Documentation of 'org.jdesktop.swingx.table.ColumnControlButton' Java class
ColumnControlButton
org.jdesktop.swingx.table

Class ColumnControlButton

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants


    public class ColumnControlButton
    extends javax.swing.JButton
    A component to allow interactive customization of JXTable's columns. It's main purpose is to allow toggling of table columns' visibility. Additionally, arbitrary configuration actions can be exposed.

    This component is installed in the JXTable's trailing corner, if enabled:

    
     table.setColumnControlVisible(true);
     
    From the perspective of a JXTable, the component's behaviour is opaque. Typically, the button's action is to popup a component for user interaction.

    This class is responsible for handling/providing/updating the lists of actions and to keep each Action's state in synch with Table-/Column state. The visible behaviour of the popup is delegated to a ColumnControlPopup.

    Default support for adding table (configuration or other) Actions is informal, driven by convention:

    • the JXTable's actionMap is scanned for candidate actions, the default marker is a key of type String which starts with ColumnControlButton.COLUMN_CONTROL_MARKER
    • the actions are sorted by that key and then handed over to the ColumnControlPopup for binding and addition of appropriate menu items
    • the addition as such is control by additionalActionsVisible property, its default value is true
    See Also:
    TableColumnExt, TableColumnModelExt, JXTable.setColumnControl(javax.swing.JComponent), Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      class  ColumnControlButton.ColumnVisibilityAction
      A specialized Action which takes care of keeping in synch with TableColumn state.
      class  ColumnControlButton.DefaultColumnControlPopup
      A default implementation of ColumnControlPopup.
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COLUMN_CONTROL_BUTTON_ICON_KEY
      the key for looking up the control's icon in the UIManager.
      static java.lang.String COLUMN_CONTROL_BUTTON_MARGIN_KEY
      the key for looking up the control's margin in the UIManager.
      static java.lang.String COLUMN_CONTROL_MARKER
      Marker to auto-recognize actions which should be added to the popup.
      • Fields inherited from class javax.swing.AbstractButton

        BORDER_PAINTED_CHANGED_PROPERTY, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface javax.swing.SwingConstants

        BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void applyComponentOrientation(java.awt.ComponentOrientation o) 
      boolean getAdditionalActionsVisible()
      Returns the actionsVisible property which controls whether or not additional table Actions should be included into the popup.
      void setActionGrouper(ColumnControlPopup.ActionGrouper grouper)
      Sets the grouper to use for grouping the additional actions.
      void setAdditionalActionsVisible(boolean additionalActionsVisible)
      Sets the additonalActionsVisible property.
      void togglePopup()
      Toggles the popup component's visibility.
      void updateUI() 
      • Methods inherited from class javax.swing.JButton

        getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, removeNotify, setDefaultCapable
      • Methods inherited from class javax.swing.AbstractButton

        addActionListener, addChangeListener, addItemListener, doClick, doClick, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, 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, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • COLUMN_CONTROL_MARKER

        public static final java.lang.String COLUMN_CONTROL_MARKER
        Marker to auto-recognize actions which should be added to the popup.
        See Also:
        Constant Field Values
      • COLUMN_CONTROL_BUTTON_ICON_KEY

        public static final java.lang.String COLUMN_CONTROL_BUTTON_ICON_KEY
        the key for looking up the control's icon in the UIManager. Typically, it's LAF dependent.
        See Also:
        Constant Field Values
      • COLUMN_CONTROL_BUTTON_MARGIN_KEY

        public static final java.lang.String COLUMN_CONTROL_BUTTON_MARGIN_KEY
        the key for looking up the control's margin in the UIManager. Typically, it's LAF dependent.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ColumnControlButton

        public ColumnControlButton(JXTable table)
        Creates a column control button for the table. Uses the default icon as provided by the addon.
        Parameters:
        table - the JXTable controlled by this component
      • ColumnControlButton

        public ColumnControlButton(JXTable table,
                                   javax.swing.Icon icon)
        Creates a column control button for the table. The button uses the given icon and has no text.
        Parameters:
        table - the JXTable controlled by this component
        icon - the Icon to show
    • Method Detail

      • updateUI

        public void updateUI()
        Overrides:
        updateUI in class javax.swing.JButton
      • togglePopup

        public void togglePopup()
        Toggles the popup component's visibility. This method is called by this control's default action.

        Here: delegates to getControlPopup().

      • getAdditionalActionsVisible

        public boolean getAdditionalActionsVisible()
        Returns the actionsVisible property which controls whether or not additional table Actions should be included into the popup.
        Returns:
        a boolean indicating whether or not additional table Actions are visible
      • setAdditionalActionsVisible

        public void setAdditionalActionsVisible(boolean additionalActionsVisible)
        Sets the additonalActionsVisible property. It controls whether or not additional table actions should be included into the popup.

        The default value is true.

        Parameters:
        additionalActionsVisible - the additionalActionsVisible to set
      • setActionGrouper

        public void setActionGrouper(ColumnControlPopup.ActionGrouper grouper)
        Sets the grouper to use for grouping the additional actions. Maybe null to have no additional grouping. Has no effect if the ColumnControlPopup doesn't implement Groupable. The default ColumnControlPopup supports Groupable, but is instantiated without a Grouper.
        Parameters:
        grouper -
      • applyComponentOrientation

        public void applyComponentOrientation(java.awt.ComponentOrientation o)
        Overrides:
        applyComponentOrientation in class java.awt.Container

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.