|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JList com.jidesoft.list.GroupList
public class GroupList
GroupList
is JList that supports the grouping of items. Each group row has a special cell renderer which
is different from the regular cell renderer. You can decide through an interface called
GroupableListModel
to decide which rows are included under which group.
setGroupCellRenderer(javax.swing.ListCellRenderer)
.
Typically, user doesn't want to select the group rows. But if they do want, you can call setGroupCellSelectable(boolean)
and set it true.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JList |
---|
JList.AccessibleJList, JList.DropLocation |
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 | |
---|---|
protected boolean |
_groupCellSelectable
Holds value of property headersSelectable. |
static int |
HORIZONTAL
Indicates the default layout: one row for each group. |
Fields inherited from class javax.swing.JList |
---|
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP |
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 | |
---|---|
GroupList()
Constructs a GroupList with an empty model. |
|
GroupList(GroupableListModel dataModel)
Constructs a GroupList that displays the elements in the specified, non-null
GroupableListModel . |
|
GroupList(GroupListModel dataModel)
Constructs a GroupList that displays the elements in the specified, non-null
GroupListModel . |
|
GroupList(List<?> listData)
Constructs a GroupList that displays the elements in the specified List . |
|
GroupList(ListModel dataModel)
Constructs a GroupList that displays the elements in the specified, non-null
ListModel . |
|
GroupList(Map<Object,?> map)
Creates a GroupList. |
|
GroupList(Object[] listData)
Constructs a GroupList that displays the elements in the specified array. |
Method Summary | |
---|---|
protected static GroupableListModel |
createModel(Map<Object,?> map)
Returns a GroupableListModel wrapping the specified object. |
String |
getActualUIClassID()
|
int |
getColumnCount(int rowIndex)
Returns the amount of cells in the specified row. |
int[] |
getGroupCellIndices()
Gets the group rows indices. |
ListCellRenderer |
getGroupCellRenderer()
Returns the object that renders the list headers. |
int |
getLayoutOrientation()
Returns the layout orientation property for the list: JList.VERTICAL if the layout is a single column of
cells, JList.VERTICAL_WRAP if the layout is "newspaper style" with the content flowing vertically then
horizontally, or JList.HORIZONTAL_WRAP if the layout is "newspaper style" with the content flowing
horizontally then vertically. |
GroupListModel |
getModel()
Returns the data model that holds the list of items displayed by the GroupList component. |
int |
getPreferredColumnCount()
Returns the preferred number of columns. |
int |
getRowCount()
Returns the number of rows. |
String |
getToolTipText(MouseEvent event)
Overrides the method in JList to provide tooltips for group rows through the group cell renderer. |
boolean |
isGroupCellSelectable()
Returns true if the group rows are selectable, false otherwise. |
void |
setGroupCellRenderer(ListCellRenderer cellRenderer)
Sets the cell renderer for the group cells |
void |
setGroupCellSelectable(boolean groupCellSelectable)
Set a new value which represents whether group rows are selectable for this GroupList . |
void |
setLayoutOrientation(int layoutOrientation)
Override the method in JList to support a new orientation called HORIZONTAL . |
void |
setModel(ListModel model)
Overrides to wrap the model into GroupableListModel if the model itself is not GroupableListModel. |
void |
setPreferredColumnCount(int preferredColumnCount)
Sets the preferred number of columns in the list that can be displayed without a scrollbar, as determined by the nearest JViewport ancestor, if any. |
void |
updateUI()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int HORIZONTAL
setLayoutOrientation(int)
,
Constant Field Valuesprotected boolean _groupCellSelectable
Constructor Detail |
---|
public GroupList()
GroupList
with an empty model.
public GroupList(ListModel dataModel)
GroupList
that displays the elements in the specified, non-null
ListModel
. All GroupList
constructors delegate to this one.
dataModel
- the data model for this list
IllegalArgumentException
- if dataModel
is null
public GroupList(Object[] listData)
GroupList
that displays the elements in the specified array. This constructor just
delegates to the ListModel
constructor.
listData
- the array of Objects to be loaded into the data modelpublic GroupList(List<?> listData)
GroupList
that displays the elements in the specified List
. This
constructor just delegates to the ListModel
constructor.
listData
- the List
to be loaded into the data modelpublic GroupList(GroupListModel dataModel)
GroupList
that displays the elements in the specified, non-null
GroupListModel
. All GroupList
constructors delegate to this one.
dataModel
- the data model for this list
IllegalArgumentException
- if dataModel
is null
public GroupList(GroupableListModel dataModel)
GroupList
that displays the elements in the specified, non-null
GroupableListModel
. All GroupList
constructors delegate to this one.
dataModel
- the data model for this list
IllegalArgumentException
- if dataModel
is null
public GroupList(Map<Object,?> map)
map
- a map from the group object to the elements belong to this group. The elements can be any Collection
type or an array.Method Detail |
---|
public String getActualUIClassID()
public void updateUI()
updateUI
in class JList
protected static GroupableListModel createModel(Map<Object,?> map)
GroupableListModel
wrapping the specified object. If the object is:Object
s, Map
, or List
map
- the Object
used as the foundation for the GroupableListModel
GroupableListModel
wrapping the specified objectpublic void setModel(ListModel model)
setModel
in class JList
model
- the ListModel
that provides the list of items for display
IllegalArgumentException
- if model
is null
getModel()
public GroupListModel getModel()
GroupList
component.
getModel
in class JList
GroupListModel
that provides the displayed list of itemssetModel(javax.swing.ListModel)
public boolean isGroupCellSelectable()
public void setGroupCellSelectable(boolean groupCellSelectable)
GroupList
.
groupCellSelectable
- New value of property headersSelectable.public int getPreferredColumnCount()
setPreferredColumnCount(int)
public void setPreferredColumnCount(int preferredColumnCount)
JViewport
ancestor, if any. The value of this property only affects the value of the
JList
's preferredScrollableViewportSize
.
The default value of this property is 8.
preferredColumnCount
- an integer specifying the preferred number of visible columnspublic int getRowCount()
public int getColumnCount(int rowIndex)
rowIndex
- int
public ListCellRenderer getGroupCellRenderer()
ListCellRenderer
which renders the list headers.setGroupCellRenderer(ListCellRenderer)
,
JList.getCellRenderer()
public void setGroupCellRenderer(ListCellRenderer cellRenderer)
cellRenderer
- the ListCellRenderer
that paints group cellsgetGroupCellRenderer()
,
JList.setCellRenderer(ListCellRenderer)
public void setLayoutOrientation(int layoutOrientation)
HORIZONTAL
. HORIZONTAL
is
almost the same as JList.HORIZONTAL_WRAP
except it will not wrap. It probably doesn't make too much sense in
the normal JList. But in GroupList, it makes sense as it means all items under the same group will not wrap
horizontally.
setLayoutOrientation
in class JList
layoutOrientation
- new layoutOrientation.public int getLayoutOrientation()
JList.VERTICAL
if the layout is a single column of
cells, JList.VERTICAL_WRAP
if the layout is "newspaper style" with the content flowing vertically then
horizontally, or JList.HORIZONTAL_WRAP
if the layout is "newspaper style" with the content flowing
horizontally then vertically. GroupList also added one more layout orientation called HORIZONTAL
. It
basically arrange all cell under the same group into one row.
getLayoutOrientation
in class JList
layoutOrientation
propertysetLayoutOrientation(int)
public int[] getGroupCellIndices()
public String getToolTipText(MouseEvent event)
getToolTipText
in class JList
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |