org.openpermis.editor.policy.gui.checklist
Class CheckList<T>

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by org.openpermis.editor.policy.gui.checklist.CheckList<T>
Type Parameters:
T - type of the items in the check list.
All Implemented Interfaces:
ComponentListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, AncestorListener, CellEditorListener, ListSelectionListener, TableColumnModelListener, TableModelListener, Scrollable

public class CheckList<T>
extends JTable
implements AncestorListener, ComponentListener

Editor for two observable lists.

See Also:
Serialized Form
Since:
0.1.0

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.PrintMode
 
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
private  TableCellRenderer customCellRenderer
          The item renderer for this checklist.
private  Action doubleClickAction
          The action to trigger on a double click.
private static int FIRST_ROW_SPACING
          Additional spacing for the first row.
private static int MIN_COLUMN_WIDTH
          Minimum column width for empty columns.
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
CheckList()
          Creates a new unbound check list.
CheckList(org.jdesktop.observablecollections.ObservableList<T> pool, org.jdesktop.observablecollections.ObservableList<T> selection)
          Creates a new checklist for the specified pool and selection list.
 
Method Summary
private  void addModelListeners()
          Adds listeners to the model that should be removed if the list disappears.
 void ancestorAdded(AncestorEvent event)
           
 void ancestorMoved(AncestorEvent event)
           
 void ancestorRemoved(AncestorEvent event)
           
 void bind(org.jdesktop.observablecollections.ObservableList<T> pool, org.jdesktop.observablecollections.ObservableList<T> selection)
          Binds the check list to the specified pool and selection list.
 void componentHidden(ComponentEvent e)
           
 void componentMoved(ComponentEvent e)
           
 void componentResized(ComponentEvent e)
           
 void componentShown(ComponentEvent e)
           
protected  void configureEnclosingScrollPane()
          Disables the header view of this table.
 void doLayout()
           
 boolean editCellAt(int row, int column, EventObject e)
           
 T getActivePart()
           
 TableCellRenderer getCellRenderer(int row, int column)
           
private  int getColumnWidth(int column)
          Calculates the maximum width of the specified column.
 CheckListModel<T> getModel()
           
private  int getViewportWidth()
          Returns the view of the enclosing viewport or the width of this table.
private  void layoutColumns()
          Modifies the column widths according to the data in the table.
private  void removeModelListeners()
          Removes listeners that should only be active while the list is visible.
 void scrollRectToVisible(Rectangle rect)
           
 void setDoubleClickAction(Action action)
          Sets the action to be executed if a double click is performed on a non-check column.
 void setItemRenderer(TableCellRenderer itemRenderer)
          Sets the renderer to be used for check list items.
 void setModel(TableModel dataModel)
           
 void setVisibleRowCount(int rows)
          Sets the number of visible rows that the list shows by preference.
private  void toggle(int row)
          Toggles the selection state of the specified row.
protected  void unconfigureEnclosingScrollPane()
           
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, 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, hide, imageUpdate, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Constant Field Value:
-4074036755955844894L
Since:
0.1.0

FIRST_ROW_SPACING

private static final int FIRST_ROW_SPACING
Additional spacing for the first row.

Constant Field Value:
8
Since:
0.1.0

MIN_COLUMN_WIDTH

private static final int MIN_COLUMN_WIDTH
Minimum column width for empty columns.

Constant Field Value:
16
Since:
0.1.0

doubleClickAction

private Action doubleClickAction
The action to trigger on a double click.

Since:
0.1.0

customCellRenderer

private TableCellRenderer customCellRenderer
The item renderer for this checklist.

Since:
0.1.0
Constructor Detail

CheckList

public CheckList()
Creates a new unbound check list.

See Also:
bind(ObservableList, ObservableList)
Since:
0.1.0

CheckList

public CheckList(org.jdesktop.observablecollections.ObservableList<T> pool,
                 org.jdesktop.observablecollections.ObservableList<T> selection)
Creates a new checklist for the specified pool and selection list.

Parameters:
pool - the available list items shown.
selection - the list of selected items from the pool.
Since:
0.1.0
Method Detail

setItemRenderer

public void setItemRenderer(TableCellRenderer itemRenderer)
Sets the renderer to be used for check list items.

Parameters:
itemRenderer - the item renderer.
Since:
0.1.0

setDoubleClickAction

public void setDoubleClickAction(Action action)
Sets the action to be executed if a double click is performed on a non-check column.

Parameters:
action - the action to be executed.
Since:
0.1.0

bind

public void bind(org.jdesktop.observablecollections.ObservableList<T> pool,
                 org.jdesktop.observablecollections.ObservableList<T> selection)
Binds the check list to the specified pool and selection list.

Parameters:
pool - the available list items shown.
selection - the list of selected items from the pool.
Since:
0.1.0

setVisibleRowCount

public void setVisibleRowCount(int rows)
Sets the number of visible rows that the list shows by preference.

Parameters:
rows - the number of rows requested.
Since:
0.1.0

addModelListeners

private void addModelListeners()
Adds listeners to the model that should be removed if the list disappears.

Since:
0.1.0

removeModelListeners

private void removeModelListeners()
Removes listeners that should only be active while the list is visible.

Since:
0.1.0

getColumnWidth

private int getColumnWidth(int column)
Calculates the maximum width of the specified column.

Parameters:
column - the column for which to determine the maximum width.
Returns:
the width requested.
Since:
0.1.0

getViewportWidth

private int getViewportWidth()
Returns the view of the enclosing viewport or the width of this table.

Returns:
the width currently showing.
Since:
0.1.0

layoutColumns

private void layoutColumns()
Modifies the column widths according to the data in the table.

Since:
0.1.0

getActivePart

public T getActivePart()
Since:
0.1.0

toggle

private void toggle(int row)
Toggles the selection state of the specified row.

Toggling occurs at the end of all actions that are currently on the dispatch queue.

Parameters:
row - the row to toggle.
Since:
0.3.0

setModel

public void setModel(TableModel dataModel)
Overrides:
setModel in class JTable
Since:
0.1.0

getModel

public CheckListModel<T> getModel()
Overrides:
getModel in class JTable
Since:
0.1.0

getCellRenderer

public TableCellRenderer getCellRenderer(int row,
                                         int column)
Overrides:
getCellRenderer in class JTable
Since:
0.1.0

doLayout

public void doLayout()
Overrides:
doLayout in class JTable
Since:
0.1.0

editCellAt

public boolean editCellAt(int row,
                          int column,
                          EventObject e)
Overrides:
editCellAt in class JTable
Since:
0.1.0

configureEnclosingScrollPane

protected void configureEnclosingScrollPane()
Disables the header view of this table.

Overrides:
configureEnclosingScrollPane in class JTable
Since:
0.1.0

unconfigureEnclosingScrollPane

protected void unconfigureEnclosingScrollPane()
Overrides:
unconfigureEnclosingScrollPane in class JTable
Since:
0.1.0

scrollRectToVisible

public void scrollRectToVisible(Rectangle rect)
Overrides:
scrollRectToVisible in class JComponent
Since:
0.1.0

ancestorAdded

public void ancestorAdded(AncestorEvent event)
Specified by:
ancestorAdded in interface AncestorListener
Since:
0.1.0

ancestorMoved

public void ancestorMoved(AncestorEvent event)
Specified by:
ancestorMoved in interface AncestorListener
Since:
0.1.0

ancestorRemoved

public void ancestorRemoved(AncestorEvent event)
Specified by:
ancestorRemoved in interface AncestorListener
Since:
0.1.0

componentHidden

public void componentHidden(ComponentEvent e)
Specified by:
componentHidden in interface ComponentListener
Since:
0.1.0

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener
Since:
0.1.0

componentResized

public void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener
Since:
0.1.0

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener
Since:
0.1.0


PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:15:22
Copyright (c) 2002-2007 Ergon Informatik AG