com.dlsc.flexgantt.swing.selector

## Class Selector

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - java.awt.Window
      - - javax.swing.JWindow
        - - com.dlsc.flexgantt.swing.selector.Selector

- All Implemented Interfaces:
    ImageObserver, LayoutManager, MenuContainer, Serializable, Accessible, RootPaneContainer
  Direct Known Subclasses:
    ActionSelector, BookmarksSelector, ColumnChooserSelector, GranularitySelector, GridSelector, LayerSelector, OverviewSelector, PagingSelector, SimpleGranularityHorizonSelector, SpreadsheetSelector, TimeGranularityGotoSelector, TimeGranularityHorizonSelector, TimeZoneSelector

      public class Selector
      extends JWindow
      implements LayoutManager

  A selector is a window without any decorations that contains a single component and a title. The window can be animated depending on the Java version and platform used (requires Java 6 or higher). The selector is hooked to a 'parent' component and will be shown on the top, or the bottom, or to the left or to the right of this parent component.

  The animation behaviour of selectors can be controlled globally via static method calls. This way the animation can be turned off if not desired.

  Since:
    1.0
  Version:
    $Revision: 1.8 $
  Author:
    Dirk Lemmermann
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Selector.Location` An enumator used for indicating where the selector window will be shown.

    - ### Nested classes/interfaces inherited from class javax.swing.JWindow

      `JWindow.AccessibleJWindow`

    - ### Nested classes/interfaces inherited from class java.awt.Window

      `Window.AccessibleAWTWindow, Window.Type`

    - ### Nested classes/interfaces inherited from class java.awt.Container

      `Container.AccessibleAWTContainer`

    - ### Nested classes/interfaces inherited from class java.awt.Component

      `Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

  - ### Field Summary

    - ### Fields inherited from class javax.swing.JWindow

      `accessibleContext, rootPane, rootPaneCheckingEnabled`

    - ### Fields inherited from class java.awt.Component

      `BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

    - ### Fields inherited from interface java.awt.image.ImageObserver

      `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Selector(String title, JComponent parentComponent, JComponent contentComponent, Selector.Location location)` Constructs a new selector window.
    `Selector(String title, JComponent parentComponent, Selector.Location location)` Constructs a new selector window without specifying a content component.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addLayoutComponent(String name, Component comp)`
    `JLabel` | `getCloseSelectorLabel()` Returns the label used for closing the selector.
    `JComponent` | `getContentComponent()` Returns the component that is shown as the selector 'content'.
    `JPanel` | `getFooterPanel()` Returns the panel used as a footer in the bottom of the selector.
    `static int` | `getGlobalAnimationDuration()` Returns the duration used for the show / hide animation.
    `JPanel` | `getHeaderPanel()` Returns the panel that contains the title label and the close icon.
    `JComponent` | `getParentComponent()` Returns the parent component, which is the component to which the selector window gets hooked.
    `Selector.Location` | `getSelectorLocation()` Returns the location where the selector will appear (above, below, to the left, or to the right of the parent component).
    `JLabel` | `getTitleLabel()` Returns the label used for displaying the title of the selector window.
    `boolean` | `isAnimationEnabled()` Returns the flag that individually determines whether the selector will use an animation to show or hide itself.
    `boolean` | `isAutoHideEnabled()` Determines if the selector will be automatically hidden when the selector window looses its focus.
    `static boolean` | `isGlobalAnimationEnabled()` Returns the (global) flag for signalling whether all selectors will use an animation when showing up or hiding.
    `static boolean` | `isGlobalAutoHideEnabled()` Determines whether selectors will be automatically hidden when the selector windows loose their focus.
    `void` | `layoutContainer(Container parent)`
    `Dimension` | `minimumLayoutSize(Container parent)`
    `Dimension` | `preferredLayoutSize(Container parent)`
    `void` | `removeLayoutComponent(Component comp)`
    `void` | `setAnimationEnabled(boolean enabled)` Sets the flag that individually determines whether the selector will use an animation to show or hide itself.
    `void` | `setAutoHideEnabled(boolean enabled)` Specifies whether the selector will be automatically hidden when the selector window looses its focus.
    `void` | `setContentComponent(JComponent comp)` Sets the content of the selector window.
    `static void` | `setGlobalAnimationDuration(int duration)` Sets the duration used for the show / hide animation.
    `static void` | `setGlobalAnimationEnabled(boolean enabled)` Specifies whether the selector windows will use animations when showing or hiding themselves.
    `static void` | `setGlobalAutoHideEnabled(boolean enabled)` Specifies globally whether selectors will be automatically hidden when the selector windows loose their focus.
    `void` | `setVisible(boolean b)` Overrides the standard method in order to implement a nice looking animation (slide in / out) of the selector window.

    - ### Methods inherited from class javax.swing.JWindow

      `addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update, windowInit`

    - ### Methods inherited from class java.awt.Window

      `addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBackground, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setOpacity, setShape, setSize, setSize, setType, show, toBack, toFront`

    - ### Methods inherited from class java.awt.Container

      `add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree`

    - ### Methods inherited from class java.awt.Component

      `action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Selector

          public Selector(String title,
                          JComponent parentComponent,
                          JComponent contentComponent,
                          Selector.Location location)

      Constructs a new selector window.
      Parameters:
        `title` - the title of the selector window
        `parentComponent` - the parent component to which the selector gets hooked
        `contentComponent` - the content component that will be shown inside the selector
        `location` - the location where the selector window will be shown
      Since:
        1.0

    - #### Selector

          public Selector(String title,
                          JComponent parentComponent,
                          Selector.Location location)

      Constructs a new selector window without specifying a content component. Use `setContentComponent(JComponent)` to set the component before the selector gets shown for the first time.
      Parameters:
        `title` - the title of the selector window
        `parentComponent` - the parent component to which the selector gets hooked
        `location` - the location where the selector window will be shown
      Since:
        1.0

  - ### Method Detail

    - #### setAutoHideEnabled

          public void setAutoHideEnabled(boolean enabled)

      Specifies whether the selector will be automatically hidden when the selector window looses its focus.
      Parameters:
        `enabled` - if TRUE the selector window will automatically hide
      Since:
        2.0

    - #### isAutoHideEnabled

          public boolean isAutoHideEnabled()

      Determines if the selector will be automatically hidden when the selector window looses its focus.
      Returns:
        TRUE if the selector window will automatically hide
      Since:
        2.0

    - #### setContentComponent

          public void setContentComponent(JComponent comp)

      Sets the content of the selector window.
      Parameters:
        `comp` - the content component
      Since:
        1.0

    - #### getContentComponent

          public JComponent getContentComponent()

      Returns the component that is shown as the selector 'content'.
      Returns:
        the content component
      Since:
        1.0

    - #### setVisible

          public void setVisible(boolean b)

      Overrides the standard method in order to implement a nice looking animation (slide in / out) of the selector window. Several checks will be performed before actually performing the animation. The Java version used needs to be at least Java 6 or higher and animations need to be enabled (which can be controlled for each selector but also globally).
      Overrides:
        `setVisible` in class `Window`
      Since:
        1.0
      See Also:
        `setAnimationEnabled(boolean)`, `setGlobalAnimationEnabled(boolean)`

    - #### isAnimationEnabled

          public boolean isAnimationEnabled()

      Returns the flag that individually determines whether the selector will use an animation to show or hide itself.
      Returns:
        TRUE if the selector window uses an animation to show or hide itself
      Since:
        1.0

    - #### setAnimationEnabled

          public void setAnimationEnabled(boolean enabled)

      Sets the flag that individually determines whether the selector will use an animation to show or hide itself.
      Parameters:
        `enabled` - if TRUE if the selector window uses an animation to show or hide itself
      Since:
        1.0

    - #### getParentComponent

          public JComponent getParentComponent()

      Returns the parent component, which is the component to which the selector window gets hooked. The selector window will show up in a location relative to the parent component (above, below, left, right).
      Returns:
        the parent component to which the selector window is hooked
      Since:
        1.0

    - #### addLayoutComponent

          public void addLayoutComponent(String name,
                                         Component comp)

      Specified by:
        `addLayoutComponent` in interface `LayoutManager`

    - #### layoutContainer

          public void layoutContainer(Container parent)

      Specified by:
        `layoutContainer` in interface `LayoutManager`

    - #### minimumLayoutSize

          public Dimension minimumLayoutSize(Container parent)

      Specified by:
        `minimumLayoutSize` in interface `LayoutManager`

    - #### preferredLayoutSize

          public Dimension preferredLayoutSize(Container parent)

      Specified by:
        `preferredLayoutSize` in interface `LayoutManager`

    - #### removeLayoutComponent

          public void removeLayoutComponent(Component comp)

      Specified by:
        `removeLayoutComponent` in interface `LayoutManager`

    - #### getSelectorLocation

          public Selector.Location getSelectorLocation()

      Returns the location where the selector will appear (above, below, to the left, or to the right of the parent component).
      Returns:
        the (relative) location of the selector window
      Since:
        1.0

    - #### getTitleLabel

          public JLabel getTitleLabel()

      Returns the label used for displaying the title of the selector window.
      Returns:
        the title label
      Since:
        1.0

    - #### getHeaderPanel

          public JPanel getHeaderPanel()

      Returns the panel that contains the title label and the close icon.
      Returns:
        the header panel
      Since:
        1.0

    - #### isGlobalAnimationEnabled

          public static boolean isGlobalAnimationEnabled()

      Returns the (global) flag for signalling whether all selectors will use an animation when showing up or hiding.
      Returns:
        the flag that controls the selector animations globally
      Since:
        1.0

    - #### setGlobalAnimationEnabled

          public static void setGlobalAnimationEnabled(boolean enabled)

      Specifies whether the selector windows will use animations when showing or hiding themselves.
      Parameters:
        `enabled` - if TRUE all selectors will use animations
      Since:
        1.0

    - #### getGlobalAnimationDuration

          public static int getGlobalAnimationDuration()

      Returns the duration used for the show / hide animation.
      Returns:
        the duration of the animation
      Since:
        1.0

    - #### setGlobalAnimationDuration

          public static void setGlobalAnimationDuration(int duration)

      Sets the duration used for the show / hide animation.
      Parameters:
        `duration` - the duration of the show / hide animation
      Since:
        1.0

    - #### setGlobalAutoHideEnabled

          public static void setGlobalAutoHideEnabled(boolean enabled)

      Specifies globally whether selectors will be automatically hidden when the selector windows loose their focus.
      Parameters:
        `enabled` - if TRUE then all selector windows will automatically hide
      Since:
        2.0

    - #### isGlobalAutoHideEnabled

          public static boolean isGlobalAutoHideEnabled()

      Determines whether selectors will be automatically hidden when the selector windows loose their focus.
      Returns:
        TRUE if all selector windows will automatically hide
      Since:
        2.0

    - #### getFooterPanel

          public JPanel getFooterPanel()

      Returns the panel used as a footer in the bottom of the selector.
      Returns:
        the footer panel
      Since:
        1.0

    - #### getCloseSelectorLabel

          public JLabel getCloseSelectorLabel()

      Returns the label used for closing the selector.
      Returns:
        the close label
      Since:
        1.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.