Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.treetable
Class GroupingPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.sciapp.treetable.GroupingPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class GroupingPanel
extends JPanel

This component represents a panel through which users can dynamically control the structure of a TreeTable. GroupingPanel uses a box layout in order to layout a number of comboboxes, whose items are populated with the columns of a table. By selecting a column in the combo box, the appropriate DefaultTreeTableComparator is created and added to the associated DynamicTreeTableModel. A combobox will be added to the panel, provided that the maximum number of boxes has not been reached and that "no group" is selected.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ArrayList comboBoxes
          the array list of comboboxes.
static String DEFAULT_NO_GROUP
          the default string to show if no grouping is desired.
protected  int max_groups
          the current maximum number of groups defined.
protected  DynamicTreeTableModel model
          the TreeTableModel that is used to add/remove DefaultTreeTableComparators.
protected  String noGroupString
          the current string to show if no grouping is desired.
static int UNLIMITED_GROUPS
          the integer that corresponds to an unlimited number of tree groups.
static int X_AXIS
          the integer that corresponds to an X_AXIS box layout.
static int Y_AXIS
          the integer that corresponds to a Y_AXIS box layout.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GroupingPanel(DynamicTreeTableModel model)
          Constructs a GroupingPanel object with model as the associated TreeTableModel, horizontal layout and "" as the string to show if no grouping is desired.
GroupingPanel(DynamicTreeTableModel model, int axis)
          Constructs a GroupingPanel object with model as the associated TreeTableModel, axis as the axis of the box layout and "" as the string to show if no grouping is desired.
GroupingPanel(DynamicTreeTableModel model, int axis, String noGroupString)
          Constructs a GroupingPanel object with model as the associated TreeTableModel, axis as the axis of the box layout and noGroupString as the string to show if no grouping is desired.
 
Method Summary
protected  JComboBox createFieldGroup()
          Creates and returns a JComboBox that will be used to define the grouping comparators.
 int getMaximumGroups()
          Returns the maximum number of combo boxes that are visible.
 DynamicTreeTableModel getModel()
          Returns the TreeTableModel that is used to add/remove DefaultTreeTableComparators.
 Component getSeparator()
          Returns a component to be used as a separator between adjacent comboboxes.
protected  void select(JComboBox box)
          Performs the necessary actions when the selection of a combobox changes.
 void setMaximumGroups(int max_groups)
          Sets the maximum number of combo boxes that are visible.
 void setModel(DynamicTreeTableModel newModel)
          Sets the TreeTableModel that is used to add/remove DefaultTreeTableComparators.
 void syncWithModel()
          Synchronizes the grouping panel with the DynamicTreeTableModel.
 void updateUI()
          Resets the UI property with a value from the current look and feel.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

protected DynamicTreeTableModel model
the TreeTableModel that is used to add/remove DefaultTreeTableComparators.


noGroupString

protected String noGroupString
the current string to show if no grouping is desired.


comboBoxes

protected ArrayList comboBoxes
the array list of comboboxes.


max_groups

protected int max_groups
the current maximum number of groups defined.


X_AXIS

public static final int X_AXIS
the integer that corresponds to an X_AXIS box layout.

See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
the integer that corresponds to a Y_AXIS box layout.

See Also:
Constant Field Values

UNLIMITED_GROUPS

public static final int UNLIMITED_GROUPS
the integer that corresponds to an unlimited number of tree groups.

See Also:
Constant Field Values

DEFAULT_NO_GROUP

public static final String DEFAULT_NO_GROUP
the default string to show if no grouping is desired.

Constructor Detail

GroupingPanel

public GroupingPanel(DynamicTreeTableModel model)
Constructs a GroupingPanel object with model as the associated TreeTableModel, horizontal layout and "" as the string to show if no grouping is desired.


GroupingPanel

public GroupingPanel(DynamicTreeTableModel model,
                     int axis)
Constructs a GroupingPanel object with model as the associated TreeTableModel, axis as the axis of the box layout and "" as the string to show if no grouping is desired. Use GroupingPanel.X_AXIS for a horizontal layout or GroupingPanel.Y_AXIS for a vertical one.


GroupingPanel

public GroupingPanel(DynamicTreeTableModel model,
                     int axis,
                     String noGroupString)
Constructs a GroupingPanel object with model as the associated TreeTableModel, axis as the axis of the box layout and noGroupString as the string to show if no grouping is desired.

Method Detail

createFieldGroup

protected JComboBox createFieldGroup()
Creates and returns a JComboBox that will be used to define the grouping comparators. The box's items are populated with the columns of the TreeTableModel.

Returns:
the combobox that was created

getMaximumGroups

public int getMaximumGroups()
Returns the maximum number of combo boxes that are visible.

Returns:
the maximum number of groups

getModel

public DynamicTreeTableModel getModel()
Returns the TreeTableModel that is used to add/remove DefaultTreeTableComparators.

Returns:
the associated TreeTableModel

getSeparator

public Component getSeparator()
Returns a component to be used as a separator between adjacent comboboxes.

Returns:
a separator component

select

protected void select(JComboBox box)
Performs the necessary actions when the selection of a combobox changes.

Parameters:
box - the combobox that was selected

setMaximumGroups

public void setMaximumGroups(int max_groups)
Sets the maximum number of combo boxes that are visible.

Parameters:
max_groups - the maximum number of groups

setModel

public void setModel(DynamicTreeTableModel newModel)
Sets the TreeTableModel that is used to add/remove DefaultTreeTableComparators.

Parameters:
newModel - the new treetable model to assign.

syncWithModel

public void syncWithModel()
Synchronizes the grouping panel with the DynamicTreeTableModel.


updateUI

public void updateUI()
Resets the UI property with a value from the current look and feel.

Overrides:
updateUI in class JPanel
See Also:
JComponent.updateUI()

Copyright © 2005 Scientific Applications. All Rights Reserved.