com.sciapp.tree
Class GroupingPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.sciapp.tree.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 TreeTableModel.
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
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 TreeTableModel |
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. |
Constructor Summary |
GroupingPanel(TreeTableModel 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(TreeTableModel 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(TreeTableModel 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. |
TreeTableModel |
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(TreeTableModel newModel)
Sets the TreeTableModel that is used to add/remove DefaultTreeTableComparators. |
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 |
model
protected TreeTableModel 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.
- See Also:
- Constant Field Values
GroupingPanel
public GroupingPanel(TreeTableModel 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(TreeTableModel 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(TreeTableModel 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.
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 TreeTableModel 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(TreeTableModel newModel)
- Sets the TreeTableModel that is used to add/remove DefaultTreeTableComparators.
- Parameters:
newModel
- the new treetable model to assign.