JIDE 3.5.15

com.jidesoft.grid
Class TableColumnChooserDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by com.jidesoft.dialog.StandardDialog
                          extended by com.jidesoft.grid.TableColumnChooserDialog
All Implemented Interfaces:
ButtonNames, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
AggregateTableColumnChooserDialog

public class TableColumnChooserDialog
extends StandardDialog

TableColumnChooserDialog is a dialog to allow user to select the columns to be displayed in a JTable using a CheckBoxList.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.dialog.StandardDialog
StandardDialog.DefaultStandardDialogPane
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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
protected  String[] _descriptions
           
protected  DualList _dualList
           
protected  int[] _fixedColumns
           
protected  boolean[] _hidableColumns
           
protected  List<Integer> _hiddenColumns
           
protected  JLabel _label
           
protected  CheckBoxList _list
           
protected  JTable _table
           
protected  CheckBoxTree _tree
           
 
Fields inherited from class com.jidesoft.dialog.StandardDialog
_propertyChangeListener, _standardDialogPane, RESULT_AFFIRMED, RESULT_CANCELLED
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.jidesoft.dialog.ButtonNames
APPLY, BACK, BROWSE, CANCEL, CLEAR, CLOSE, DETAILS, EDIT, EXIT, FIND, FIND_NEXT, FINISH, FORWARD, HELP, NEW, NEXT, NO, OK, OPEN, PRINT, REPLACE, RESET, RETRY, RUN, SAVE, SAVE_AS, STOP, YES
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TableColumnChooserDialog(Dialog owner, String title, JTable table)
           
TableColumnChooserDialog(Frame owner, String title, JTable table)
           
 
Method Summary
 JComponent createBannerPanel()
          Subclasses should implement this method to create the banner panel.
 ButtonPanel createButtonPanel()
          Subclasses should implement this method to create the button panel.
 JComponent createContentPanel()
          Subclasses should implement this method to create the content panel.
 String[] getDescriptions()
          Gets the descriptions of the table columns.
 int[] getFixedColumns()
          Gets the fixed columns.
 boolean[] getHidableColumns()
          Gets the columns that can be hidden.
 List<Integer> getHiddenColumns()
          Gets the hidden columns.
protected  String getName(int index)
           
protected  Action getOkAction()
          Gets the OK Action for the OK button.
protected  String getResourceString(String key)
          Gets the localized string from resource bundle.
 int[] getSelectedColumns()
          Gets the selected column indices.
protected  boolean isColumnVisible(int index)
           
 void setDescriptions(String[] descriptions)
          Sets the descriptions of the table columns.
 void setFixedColumns(int[] fixedColumns)
          Sets the fixed columns.
 void setHidableColumns(boolean[] hidableColumns)
          Sets the columns that can be hidden.
 void setHiddenColumns(int[] hiddenColumns)
          Sets the hidden columns.
protected  void showOrHideColumns(int[] selectedModelIndices)
           
 
Methods inherited from class com.jidesoft.dialog.StandardDialog
createOKCancelButtonPanel, createStandardDialogPane, getBannerPanel, getButtonPanel, getContentPanel, getDefaultAction, getDefaultCancelAction, getDialogResult, getInitFocusedComponent, getStandardDialogPane, initComponents, initialize, pack, setDefaultAction, setDefaultCancelAction, setDialogResult, setInitFocusedComponent, show
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, 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, transferFocusBackward, 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, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, isOpaque, 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, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_table

protected JTable _table

_list

protected CheckBoxList _list

_tree

protected CheckBoxTree _tree

_dualList

protected DualList _dualList

_hidableColumns

protected boolean[] _hidableColumns

_descriptions

protected String[] _descriptions

_fixedColumns

protected int[] _fixedColumns

_hiddenColumns

protected List<Integer> _hiddenColumns

_label

protected JLabel _label
Constructor Detail

TableColumnChooserDialog

public TableColumnChooserDialog(Dialog owner,
                                String title,
                                JTable table)
                         throws HeadlessException
Throws:
HeadlessException

TableColumnChooserDialog

public TableColumnChooserDialog(Frame owner,
                                String title,
                                JTable table)
                         throws HeadlessException
Throws:
HeadlessException
Method Detail

createBannerPanel

public JComponent createBannerPanel()
Description copied from class: StandardDialog
Subclasses should implement this method to create the banner panel. By default banner panel will appear on top of the dialog unless you override initComponent() method. Banner panel is really used to balance the layout of dialog to make the dialog looking good. However it can be used to show some help text. It is highly recommended to use our BannerPanel

If subclass doesn't want to have a banner panel, just return null.

Specified by:
createBannerPanel in class StandardDialog
Returns:
the banner panel.

createContentPanel

public JComponent createContentPanel()
Description copied from class: StandardDialog
Subclasses should implement this method to create the content panel. This is the main panel of the dialog which will be added to the center of the dialog. Subclass should never return null.

Specified by:
createContentPanel in class StandardDialog
Returns:
the content panel.

getResourceString

protected String getResourceString(String key)
Gets the localized string from resource bundle. Subclass can override it to provide its own string. Available keys are defined in grid.properties that begin with "TableColumnChooserDialog.".

Parameters:
key - the resource string key
Returns:
the localized string.

createButtonPanel

public ButtonPanel createButtonPanel()
Description copied from class: StandardDialog
Subclasses should implement this method to create the button panel. 90% of dialogs have buttons. It is highly recommended to use our ButtonPanel.

Specified by:
createButtonPanel in class StandardDialog
Returns:
the button panel.
See Also:
ButtonPanel

getOkAction

protected Action getOkAction()
Gets the OK Action for the OK button.

Returns:
the OK action.
Since:
3.4.5

getSelectedColumns

public int[] getSelectedColumns()
Gets the selected column indices. Those columns will be displayed. All other will be hidden.

Returns:
the selected column indices.

getHidableColumns

public boolean[] getHidableColumns()
Gets the columns that can be hidden. It is a boolean array. If the boolean element is true, the corresponding column can not be hidden.

Returns:
the boolean array. If the corresponding boolean is true, column can not be hidden.

setHidableColumns

public void setHidableColumns(boolean[] hidableColumns)
Sets the columns that can be hidden. This is a boolean array. If column 0 can not be hidden, put false as the first element in the array. Otherwise put true. The length of the array can be more or less than the table model's getColumnCount(). If it's less, the rest of the columns will assume to be hidable. If it's more, the extra value in the hidableColumns array will be ignored. Please note, the order of the columns is based on the order in TableModel, not TableColumnModel.

For example, if you want the second and fourth column to be not hidable and the rest to be hidable, the array should be created like new boolean[] { true, false, true, false }.

Parameters:
hidableColumns - the hidable column array

getFixedColumns

public int[] getFixedColumns()
Gets the fixed columns. The fixed columns cannot be hidden.

Returns:
the fixed columns.

setFixedColumns

public void setFixedColumns(int[] fixedColumns)
Sets the fixed columns.

Parameters:
fixedColumns - the fixed columns.

getHiddenColumns

public List<Integer> getHiddenColumns()
Gets the hidden columns. The hidden columns are not visible in the dialog.

Returns:
the hidden columns.

setHiddenColumns

public void setHiddenColumns(int[] hiddenColumns)
Sets the hidden columns.

Parameters:
hiddenColumns - the hidden columns.

getDescriptions

public String[] getDescriptions()
Gets the descriptions of the table columns.

Returns:
the descriptions of the table columns.

setDescriptions

public void setDescriptions(String[] descriptions)
Sets the descriptions of the table columns. The description will be displayed next to the column name in the list. This is a String array. The length of the array can be more or less than the table model's getColumnCount(). If it's less, the rest of the columns will assume to be have no description. If it's more, the extra value in the descriptions array will be ignored. Please note, the order of the columns is based on the order in TableModel, not TableColumnModel.*

For example, if you want to set description to the second and fourth column and the rest has no description, the array should be created like new String[] { null, "description for the 2nd column", null, "description for the 4th column" }.

Parameters:
descriptions - the descriptions of the table columns.

getName

protected String getName(int index)

isColumnVisible

protected boolean isColumnVisible(int index)

showOrHideColumns

protected void showOrHideColumns(int[] selectedModelIndices)

JIDE 3.5.15