public class ToggleDialog extends JPanel implements ShowHideButtonListener, Helpful, AWTEventListener, Destroyable, Preferences.PreferenceChangedListener
Modifier and Type | Class and Description |
---|---|
static class |
ToggleDialog.ButtonHidingType
The button-hiding strategy in toggler dialogs.
|
private class |
ToggleDialog.DetachedDialog
The dialog class used to display toggle dialogs in a detached window.
|
protected class |
ToggleDialog.TitleBar
The title bar displayed in docked mode
|
class |
ToggleDialog.ToggleDialogAction
The action to toggle the visibility state of this toggle dialog.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
private JRadioButtonMenuItem |
alwaysHidden |
private JRadioButtonMenuItem |
alwaysShown |
protected JToggleButton |
button |
private List<Action> |
buttonActions |
protected ToggleDialog.ButtonHidingType |
buttonHiding
Indicates whether dynamic button hiding is active or not.
|
private JPanel |
buttonsPanel |
protected JDialog |
detachedDialog
the JDialog displaying the toggle dialog as undocked dialog
|
protected DialogsPanel |
dialogsPanel
DialogsPanel that manages all ToggleDialogs
|
private JRadioButtonMenuItem |
dynamic |
protected boolean |
isCollapsed
If isShowing and isDocked are true, indicates whether the dialog is
currently minimized or not.
|
protected boolean |
isDocked
If isShowing is true, indicates whether the dialog is docked or not, e.
|
protected boolean |
isShowing
Indicates whether the dialog is showing or not.
|
protected String |
name |
protected Class<? extends PreferenceSetting> |
preferenceClass
The linked preferences class (optional).
|
protected String |
preferencePrefix |
private int |
preferredHeight
the preferred height if the toggle dialog is expanded
|
private ParametrizedEnumProperty<ToggleDialog.ButtonHidingType> |
PROP_BUTTON_HIDING |
static BooleanProperty |
PROP_DYNAMIC_BUTTONS
Property to enable dynamic buttons globally.
|
protected ToggleDialog.TitleBar |
titleBar |
protected ToggleDialog.ToggleDialogAction |
toggleAction
The action to toggle this dialog
|
protected JCheckBoxMenuItem |
windowMenuItem
holds the menu entry in the windows menu.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ToggleDialog(String name,
String iconName,
String tooltip,
Shortcut shortcut,
int preferredHeight)
Constructor
|
ToggleDialog(String name,
String iconName,
String tooltip,
Shortcut shortcut,
int preferredHeight,
boolean defShow)
Constructor
|
ToggleDialog(String name,
String iconName,
String tooltip,
Shortcut shortcut,
int preferredHeight,
boolean defShow,
Class<? extends PreferenceSetting> prefClass)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
buttonHidden() |
void |
buttonShown() |
void |
closeDetachedDialog()
Closes the detached dialog if this toggle dialog is currently displayed
in a detached dialog.
|
void |
collapse()
Collapses the toggle dialog to the title bar only
|
protected Component |
createLayout(Component data,
boolean scroll,
Collection<SideButton> buttons) |
protected Component |
createLayout(Component data,
boolean scroll,
Collection<SideButton> firstButtons,
Collection<SideButton>... nextButtons) |
void |
destroy()
Called when the object has been destroyed.
|
private void |
destroyComponents(Component component,
boolean destroyItself) |
protected void |
detach()
Display the dialog in a detached window.
|
protected void |
dock()
Displays the toggle dialog in the toggle dialog view on the right
of the main map window.
|
protected boolean |
dockWhenClosingDetachedDlg() |
private void |
dynamicButtonsPropertyChanged() |
void |
eventDispatched(AWTEvent event) |
protected void |
expand()
Expands the toggle dialog
|
JToggleButton |
getButton() |
protected Dimension |
getDefaultDetachedSize()
Default size of the detached dialog.
|
protected Rectangle |
getDetachedGeometry(Rectangle last)
Change the Geometry of the detached dialog to better fit the content.
|
String |
getName()
Replies the name of this toggle dialog
|
String |
getPreferencePrefix()
Replies the prefix for the preference settings of this dialog.
|
int |
getPreferredHeight()
Returns the preferred height of this dialog.
|
AbstractAction |
getToggleAction()
Replies the action to toggle the visible state of this toggle dialog
|
String |
helpTopic() |
void |
hideDialog()
Hides the dialog
|
void |
hideNotify()
Called when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...).
|
boolean |
isDialogInCollapsedView()
Determines if this dialog is docked and collapsed.
|
boolean |
isDialogInDefaultView()
Determines if this dialog is docked and expanded.
|
boolean |
isDialogShowing()
Determines if this dialog is showing either as docked or as detached dialog.
|
void |
preferenceChanged(Preferences.PreferenceChangeEvent e) |
private void |
refreshHidingButtons() |
void |
setButton(JToggleButton button) |
protected void |
setContentVisible(boolean visible)
Sets the visibility of all components in this toggle dialog, except the title bar
|
void |
setDialogsPanel(DialogsPanel dialogsPanel)
Sets the dialogsPanel managing all toggle dialogs.
|
protected void |
setIsButtonHiding(ToggleDialog.ButtonHidingType val) |
protected void |
setIsCollapsed(boolean val) |
protected void |
setIsDocked(boolean val) |
protected void |
setIsShowing(boolean val) |
void |
setTitle(String title)
Sets the title.
|
void |
showDialog()
Shows the dialog
|
void |
showNotify()
Called when toggle dialog is shown (after it was created or expanded).
|
protected void |
stateChanged()
primitive stateChangedListener for subclasses
|
protected void |
toggleButtonHook()
Do something when the toggleButton is pressed.
|
String |
toString() |
void |
unfurlDialog()
Changes the state of the dialog such that the user can see the content.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final BooleanProperty PROP_DYNAMIC_BUTTONS
private final ParametrizedEnumProperty<ToggleDialog.ButtonHidingType> PROP_BUTTON_HIDING
protected final ToggleDialog.ToggleDialogAction toggleAction
protected String preferencePrefix
protected DialogsPanel dialogsPanel
protected ToggleDialog.TitleBar titleBar
protected boolean isShowing
protected boolean isDocked
protected boolean isCollapsed
protected ToggleDialog.ButtonHidingType buttonHiding
private int preferredHeight
protected JDialog detachedDialog
protected JToggleButton button
private JPanel buttonsPanel
private List<Action> buttonActions
protected JCheckBoxMenuItem windowMenuItem
private final JRadioButtonMenuItem alwaysShown
private final JRadioButtonMenuItem dynamic
private final JRadioButtonMenuItem alwaysHidden
protected Class<? extends PreferenceSetting> preferenceClass
public ToggleDialog(String name, String iconName, String tooltip, Shortcut shortcut, int preferredHeight)
name
- the name of the dialogiconName
- the name of the icon to be displayedtooltip
- the tool tipshortcut
- the shortcutpreferredHeight
- the preferred height for the dialogpublic ToggleDialog(String name, String iconName, String tooltip, Shortcut shortcut, int preferredHeight, boolean defShow)
name
- the name of the dialogiconName
- the name of the icon to be displayedtooltip
- the tool tipshortcut
- the shortcutpreferredHeight
- the preferred height for the dialogdefShow
- if the dialog should be shown by default, if there is no preferencepublic ToggleDialog(String name, String iconName, String tooltip, Shortcut shortcut, int preferredHeight, boolean defShow, Class<? extends PreferenceSetting> prefClass)
name
- the name of the dialogiconName
- the name of the icon to be displayedtooltip
- the tool tipshortcut
- the shortcutpreferredHeight
- the preferred height for the dialogdefShow
- if the dialog should be shown by default, if there is no preferenceprefClass
- the preferences settings class, or null if not applicablepublic void showDialog()
public void unfurlDialog()
public void buttonHidden()
buttonHidden
in interface ShowHideButtonListener
public void buttonShown()
buttonShown
in interface ShowHideButtonListener
public void hideDialog()
protected void dock()
protected void detach()
public void collapse()
protected void expand()
protected void setContentVisible(boolean visible)
visible
- true, if the components should be visible; false otherwisepublic void destroy()
Destroyable
destroy
in interface Destroyable
private void destroyComponents(Component component, boolean destroyItself)
public void closeDetachedDialog()
public void showNotify()
public void hideNotify()
public AbstractAction getToggleAction()
public String getPreferencePrefix()
public void setDialogsPanel(DialogsPanel dialogsPanel)
dialogsPanel
- The panel managing all toggle dialogsprotected void setIsShowing(boolean val)
protected void setIsDocked(boolean val)
protected void setIsCollapsed(boolean val)
protected void setIsButtonHiding(ToggleDialog.ButtonHidingType val)
public int getPreferredHeight()
public boolean isDialogShowing()
true
if this dialog is showing either as docked or as detached dialogpublic boolean isDialogInDefaultView()
true
if this dialog is docked and expandedpublic boolean isDialogInCollapsedView()
true
if this dialog is docked and collapsedpublic void setButton(JToggleButton button)
public JToggleButton getButton()
protected Rectangle getDetachedGeometry(Rectangle last)
protected Dimension getDefaultDetachedSize()
protected void toggleButtonHook()
protected boolean dockWhenClosingDetachedDlg()
protected void stateChanged()
protected Component createLayout(Component data, boolean scroll, Collection<SideButton> buttons)
@SafeVarargs protected final Component createLayout(Component data, boolean scroll, Collection<SideButton> firstButtons, Collection<SideButton>... nextButtons)
public void eventDispatched(AWTEvent event)
eventDispatched
in interface AWTEventListener
public void preferenceChanged(Preferences.PreferenceChangeEvent e)
preferenceChanged
in interface Preferences.PreferenceChangedListener
private void dynamicButtonsPropertyChanged()
private void refreshHidingButtons()