|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
org.openpermis.editor.policy.gui.checklist.CheckList<T>
T
- type of the items in the check list.public class CheckList<T>
GUI component that provides a list with checkboxes on the left side.
The checklist is in fact a typed editor for two observable lists, the first being the list of all choices and the second containing the checked items.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
JTable.AccessibleJTable, JTable.DropLocation, 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
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 | |
---|---|
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)
Called if the size of the enclosing viewport changes. |
void |
componentShown(ComponentEvent e)
|
protected void |
configureEnclosingScrollPane()
Disables the header view of this table. |
void |
doLayout()
Overrides the default layout strategy to automatically adjust column widths. |
boolean |
editCellAt(int row,
int column,
EventObject e)
|
T |
getActivePart()
|
TableCellRenderer |
getCellRenderer(int row,
int column)
|
protected int |
getColumnWidth(int column)
Calculates the maximum width of the specified column. |
protected JScrollPane |
getEnclosingScrollPane()
Returns the enclosing scroll pane or null if there is none. |
protected JViewport |
getEnclosingViewport()
Returns the enclosing viewport or null if there is none. |
CheckListModel<T> |
getModel()
|
protected int |
getViewportWidth()
Returns the view of the enclosing viewport or the width of this table. |
protected void |
layoutColumns()
Modifies the column widths according to the data in the table. |
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. |
protected void |
setEnclosingHorizontalScrollBarEnabled(boolean enabled)
Configures the horizontal scroll bar policy of the enclosing scroll pane (if any). |
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. |
void |
unbind()
Removes the current check list binding and sets and empty model. |
protected void |
unconfigureEnclosingScrollPane()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CheckList()
bind(ObservableList, ObservableList)
public CheckList(org.jdesktop.observablecollections.ObservableList<T> pool, org.jdesktop.observablecollections.ObservableList<T> selection)
pool
- the available list items shown.selection
- the list of selected items from the pool.Method Detail |
---|
public void setItemRenderer(TableCellRenderer itemRenderer)
itemRenderer
- the item renderer.public void setDoubleClickAction(Action action)
action
- the action to be executed.public void bind(org.jdesktop.observablecollections.ObservableList<T> pool, org.jdesktop.observablecollections.ObservableList<T> selection)
pool
- the available list items shown.selection
- the list of selected items from the pool.public void unbind()
public void setVisibleRowCount(int rows)
rows
- the number of rows requested.protected int getColumnWidth(int column)
column
- the column for which to determine the maximum width.
protected JScrollPane getEnclosingScrollPane()
null
if there is none.
null
if there is none.protected JViewport getEnclosingViewport()
null
if there is none.
null
if there is none.protected int getViewportWidth()
protected void setEnclosingHorizontalScrollBarEnabled(boolean enabled)
We have to manage the scroll bar policy on our own, the
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
policy will not work since we
are adjusting our size on-the-fly according to the viewport width to simulate a list.
enabled
- true
to show the scroll bar, false
to hide it.protected void layoutColumns()
Adjusts all columns to their preferred with (i.e. the width of the largest item contained) and optionally stretches the last column to fill the remaining slack space (to simulate the looks of a list).
The horizontal scroll bar of the enclosing scroll pane is configured according to the total width of all columns calculated. It is either completely disabled (if not required) or constantly enabled (if total width is heigher than viewport width).
setEnclosingHorizontalScrollBarEnabled(boolean)
public T getActivePart()
public void setModel(TableModel dataModel)
setModel
in class JTable
public CheckListModel<T> getModel()
getModel
in class JTable
public TableCellRenderer getCellRenderer(int row, int column)
getCellRenderer
in class JTable
public void doLayout()
doLayout
in class JTable
layoutColumns()
public boolean editCellAt(int row, int column, EventObject e)
editCellAt
in class JTable
protected void configureEnclosingScrollPane()
configureEnclosingScrollPane
in class JTable
protected void unconfigureEnclosingScrollPane()
unconfigureEnclosingScrollPane
in class JTable
public void scrollRectToVisible(Rectangle rect)
scrollRectToVisible
in class JComponent
public void ancestorAdded(AncestorEvent event)
ancestorAdded
in interface AncestorListener
public void ancestorMoved(AncestorEvent event)
ancestorMoved
in interface AncestorListener
public void ancestorRemoved(AncestorEvent event)
ancestorRemoved
in interface AncestorListener
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentResized(ComponentEvent e)
We will adjust our column sizes to match the viewport size and show/hide the
scroll bar of the enclosing scroll pane as needed here
.
componentResized
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG