public static final class Models.CompoundModel extends Object implements ReorderableTreeModel, ExtendedNodeModel, CheckNodeModel, DnDNodeModel, NodeActionsProvider, TableHTMLModel, TreeExpansionModel, TableRendererModel, TablePropertyEditorsModel
Modifier and Type | Method and Description |
---|---|
void |
addModelListener(ModelListener l)
Registers given listener.
|
Executor |
asynchronous(AsynchronousModelFilter.CALL asynchCall,
Object node) |
boolean |
canCopy(Object node)
Test whether this node permits copying.
|
boolean |
canCut(Object node)
Test whether this node permits cutting.
|
boolean |
canEditCell(Object node,
String columnID)
Test whether this renderer can edit the given cell.
|
boolean |
canRename(Object node)
Test whether this node permits renaming.
|
boolean |
canRenderCell(Object node,
String columnID)
Test whether this renderer can render the given cell.
|
boolean |
canReorder(Object parent)
Provide if this model implementation can reorder children nodes.
|
Transferable |
clipboardCopy(Object node)
Called when a node is to be copied to the clipboard.
|
Transferable |
clipboardCut(Object node)
Called when a node is to be cut to the clipboard.
|
Transferable |
drag(Object node)
Initiate a drag operation.
|
Action[] |
getActions(Object node)
Returns set of actions for given node.
|
int |
getAllowedDragActions()
Action constants from
DnDConstants . |
int |
getAllowedDropActions(Transferable t)
Action constants from
DnDConstants . |
TableCellEditor |
getCellEditor(Object node,
String columnID)
Get the editor of the given cell
|
TableCellRenderer |
getCellRenderer(Object node,
String columnID)
Get the renderer of the given cell
|
Object[] |
getChildren(Object parent,
int from,
int to)
Returns children for given parent on given indexes.
|
int |
getChildrenCount(Object node)
Returns number of children for given node.
|
ColumnModel[] |
getColumns()
Returns sorted array of
ColumnModel s. |
String |
getDisplayName(Object node)
Returns display name for given node.
|
PasteType |
getDropType(Object node,
Transferable t,
int action,
int index)
Determines if there is a paste operation that can be performed
on provided transferable when drop is done.
|
String |
getHelpId()
Get a help ID for this model.
|
String |
getHTMLValueAt(Object node,
String columnID)
Get the HTML value.
|
String |
getIconBase(Object node)
Returns icon for given node.
|
String |
getIconBaseWithExtension(Object node)
Returns icon resource with extension for given node.
|
PasteType[] |
getPasteTypes(Object node,
Transferable t)
Determine which paste operations are allowed when a given transferable is in the clipboard.
|
PropertyEditor |
getPropertyEditor(Object node,
String columnID)
Get the property editor for the given table cell.
|
Object |
getRoot()
Returns the root node of the tree or null, if the tree is empty.
|
String |
getShortDescription(Object node)
Returns tool tip for given node.
|
Object |
getValueAt(Object node,
String columnID)
Returns value to be displayed in column
columnID
and row identified by node . |
boolean |
hasHTMLValueAt(Object node,
String columnID)
Test if the model has a HTML value.
|
boolean |
isCheckable(Object node)
Tell the renderer to display the check-box.
|
boolean |
isCheckEnabled(Object node)
Provide the enabled state of the check-box.
|
boolean |
isExpanded(Object node)
Defines default state (collapsed, expanded) of given node.
|
boolean |
isLeaf(Object node)
Returns true if node is leaf.
|
boolean |
isReadOnly(Object node,
String columnID)
Returns true if value displayed in column
columnID
and row node is read only. |
Boolean |
isSelected(Object node)
Provide the selected state of the check-box.
|
void |
nodeCollapsed(Object node)
Called when given node is collapsed.
|
void |
nodeExpanded(Object node)
Called when given node is expanded.
|
void |
performDefaultAction(Object node)
Performs default action for given node.
|
void |
removeModelListener(ModelListener l)
Unregisters given listener.
|
void |
reorder(Object parent,
int[] perm)
Reorder children nodes with a given permutation.
|
void |
setName(Object node,
String name)
Sets a new name for given node.
|
void |
setSelected(Object node,
Boolean selected)
Called by the renderer when the check-box gets selected/unselected
|
void |
setValueAt(Object node,
String columnID,
Object value)
Changes a value displayed in column
columnID
and row node . |
String |
toString() |
public String getHelpId()
null
.public Object getRoot()
public Object[] getChildren(Object parent, int from, int to) throws UnknownTypeException
getChildren
in interface TreeModel
parent
- a parent of returned nodesfrom
- a start indexto
- a end indexUnknownTypeException
- if this TreeModel implementation is not
able to resolve children for given node typeTreeModel.getChildrenCount(java.lang.Object)
public int getChildrenCount(Object node) throws UnknownTypeException
getChildrenCount
in interface TreeModel
node
- the parent nodeUnknownTypeException
- if this TreeModel implementation is not
able to resolve children for given node typeTreeModel.getChildren(java.lang.Object, int, int)
public boolean isLeaf(Object node) throws UnknownTypeException
isLeaf
in interface TreeModel
UnknownTypeException
- if this TreeModel implementation is not
able to resolve children for given node typepublic boolean canReorder(Object parent) throws UnknownTypeException
ReorderableTreeModel
canReorder
in interface ReorderableTreeModel
parent
- The parent node of children that are test for reordertrue
if this model can handle reordering of children,
false
otherwiseUnknownTypeException
- if this model implementation is not
able to decide the reorder capability for given node typepublic void reorder(Object parent, int[] perm) throws UnknownTypeException
ReorderableTreeModel
reorder
in interface ReorderableTreeModel
parent
- The parent node of children that are being reorderedperm
- permutation with the length of current child nodes. The permutation
lists the new positions of the original nodes, that is, for nodes
[A,B,C,D]
and permutation [0,3,1,2]
, the final
order would be [A,C,D,B]
.UnknownTypeException
- if this model implementation is not
able to perform the reorder for given node typepublic String getDisplayName(Object node) throws UnknownTypeException
getDisplayName
in interface NodeModel
UnknownTypeException
- if this NodeModel implementation is not
able to resolve display name for given node typepublic String getShortDescription(Object node) throws UnknownTypeException
getShortDescription
in interface NodeModel
UnknownTypeException
- if this NodeModel implementation is not
able to resolve tool tip for given node typepublic String getIconBase(Object node) throws UnknownTypeException
getIconBase
in interface NodeModel
UnknownTypeException
- if this NodeModel implementation is not
able to resolve icon for given node typepublic void performDefaultAction(Object node) throws UnknownTypeException
performDefaultAction
in interface NodeActionsProvider
UnknownTypeException
- if this NodeActionsProvider implementation
is not able to resolve actions for given node typepublic Action[] getActions(Object node) throws UnknownTypeException
getActions
in interface NodeActionsProvider
UnknownTypeException
- if this NodeActionsProvider implementation
is not able to resolve actions for given node typepublic ColumnModel[] getColumns()
ColumnModel
s.public Object getValueAt(Object node, String columnID) throws UnknownTypeException
TableModel
columnID
and row identified by node
. Column ID is defined in by
ColumnModel.getID()
, and rows are defined by values returned from
TreeModel.getChildren(java.lang.Object, int, int)
.getValueAt
in interface TableModel
node
- a object returned from
TreeModel.getChildren(java.lang.Object, int, int)
for this rowcolumnID
- a id of column defined by ColumnModel.getID()
UnknownTypeException
- if there is no TableModel defined for given
parameter typepublic boolean isReadOnly(Object node, String columnID) throws UnknownTypeException
TableModel
columnID
and row node
is read only. Column ID is defined in by
ColumnModel.getID()
, and rows are defined by values returned from
TreeModel.getChildren(java.lang.Object, int, int)
.isReadOnly
in interface TableModel
node
- a object returned from TreeModel.getChildren(java.lang.Object, int, int)
for this rowcolumnID
- a id of column defined by ColumnModel.getID()
UnknownTypeException
- if there is no TableModel defined for given
parameter typepublic void setValueAt(Object node, String columnID, Object value) throws UnknownTypeException
TableModel
columnID
and row node
. Column ID is defined in by
ColumnModel.getID()
, and rows are defined by values returned from
TreeModel.getChildren(java.lang.Object, int, int)
.setValueAt
in interface TableModel
node
- a object returned from TreeModel.getChildren(java.lang.Object, int, int)
for this rowcolumnID
- a id of column defined by ColumnModel.getID()
value
- a new value of variable on given positionUnknownTypeException
- if there is no TableModel defined for given
parameter typepublic boolean isExpanded(Object node) throws UnknownTypeException
isExpanded
in interface TreeExpansionModel
node
- a nodeUnknownTypeException
public void nodeExpanded(Object node)
nodeExpanded
in interface TreeExpansionModel
node
- a expanded nodepublic void nodeCollapsed(Object node)
nodeCollapsed
in interface TreeExpansionModel
node
- a collapsed nodepublic void addModelListener(ModelListener l)
addModelListener
in interface NodeModel
addModelListener
in interface TableModel
addModelListener
in interface TableRendererModel
addModelListener
in interface TreeModel
l
- the listener to addpublic void removeModelListener(ModelListener l)
removeModelListener
in interface NodeModel
removeModelListener
in interface TableModel
removeModelListener
in interface TableRendererModel
removeModelListener
in interface TreeModel
l
- the listener to removepublic boolean canRename(Object node) throws UnknownTypeException
ExtendedNodeModel
canRename
in interface ExtendedNodeModel
true
if soUnknownTypeException
public boolean canCopy(Object node) throws UnknownTypeException
ExtendedNodeModel
canCopy
in interface ExtendedNodeModel
true
if soUnknownTypeException
public boolean canCut(Object node) throws UnknownTypeException
ExtendedNodeModel
canCut
in interface ExtendedNodeModel
true
if soUnknownTypeException
public Transferable clipboardCopy(Object node) throws IOException, UnknownTypeException
ExtendedNodeModel
clipboardCopy
in interface ExtendedNodeModel
node
- The node objectIOException
- when the copy cannot be performedUnknownTypeException
public Transferable clipboardCut(Object node) throws IOException, UnknownTypeException
ExtendedNodeModel
clipboardCut
in interface ExtendedNodeModel
node
- The node objectIOException
- when the cut cannot be performedUnknownTypeException
public int getAllowedDragActions()
DnDNodeModel
DnDConstants
.
No actions are allowed by default.getAllowedDragActions
in interface DnDNodeModel
public int getAllowedDropActions(Transferable t)
DnDNodeModel
DnDConstants
.
No actions are allowed by default.getAllowedDropActions
in interface DnDNodeModel
t
- The transferable for which the allowed drop actions are requested,
or null
to get actions for the creation of DropTarget for the view.public Transferable drag(Object node) throws IOException, UnknownTypeException
DnDNodeModel
drag
in interface DnDNodeModel
node
- The node to dragIOException
- when the drag cannot be performedUnknownTypeException
- if this model implementation is not
able to perform drag for given node typepublic PasteType[] getPasteTypes(Object node, Transferable t) throws UnknownTypeException
ExtendedNodeModel
getPasteTypes
in interface ExtendedNodeModel
node
- The node objectt
- the transferable in the clipboardUnknownTypeException
public PasteType getDropType(Object node, Transferable t, int action, int index) throws UnknownTypeException
DnDNodeModel
getDropType
in interface DnDNodeModel
node
- The node where to dropt
- the transferable to dropaction
- the Drag and Drop action from DnDConstants
index
- index between children the drop occured at or -1 if not specifiedUnknownTypeException
- if this model implementation is not
able to perform drop for given node typepublic void setName(Object node, String name) throws UnknownTypeException
ExtendedNodeModel
setName
in interface ExtendedNodeModel
node
- The object to set the new name to.name
- The new name for the given nodeUnknownTypeException
public String getIconBaseWithExtension(Object node) throws UnknownTypeException
ExtendedNodeModel
NodeModel.getIconBase(java.lang.Object)
getIconBaseWithExtension
in interface ExtendedNodeModel
node
- The node objectUnknownTypeException
- if this NodeModel implementation is not
able to resolve icon for given node typepublic boolean isCheckable(Object node) throws UnknownTypeException
CheckNodeModel
isCheckable
in interface CheckNodeModel
node
- the tree node objecttrue
if the check-box should be displayed, false
otherwise.UnknownTypeException
public boolean isCheckEnabled(Object node) throws UnknownTypeException
CheckNodeModel
isCheckEnabled
in interface CheckNodeModel
node
- the tree node objecttrue
if the check-box should be enabled, false
otherwise.UnknownTypeException
public Boolean isSelected(Object node) throws UnknownTypeException
CheckNodeModel
isSelected
in interface CheckNodeModel
node
- the tree node objecttrue
if the check-box should be selected,
false
if it should be unselected and
null
if the state is unknown.UnknownTypeException
public void setSelected(Object node, Boolean selected) throws UnknownTypeException
CheckNodeModel
setSelected
in interface CheckNodeModel
node
- the tree node objectselected
- true
if the check-box was selected,
false
if the check-box was unselected.UnknownTypeException
public Executor asynchronous(AsynchronousModelFilter.CALL asynchCall, Object node) throws UnknownTypeException
UnknownTypeException
public boolean canRenderCell(Object node, String columnID) throws UnknownTypeException
TableRendererModel
canRenderCell
in interface TableRendererModel
node
- Tree node representing the rowcolumnID
- The column nametrue
if the implementation can render the given cell, false
otherwiseUnknownTypeException
- If the implementation can not decide whether to render the given cell.public TableCellRenderer getCellRenderer(Object node, String columnID) throws UnknownTypeException
TableRendererModel
getCellRenderer
in interface TableRendererModel
node
- Tree node representing the rowcolumnID
- The column nameUnknownTypeException
- If the implementation can not render the given cell.public boolean canEditCell(Object node, String columnID) throws UnknownTypeException
TableRendererModel
canEditCell
in interface TableRendererModel
node
- Tree node representing the rowcolumnID
- The column nametrue
if the implementation can edit the given cell, false
otherwiseUnknownTypeException
- If the implementation can not decide whether to edit the given cell.public TableCellEditor getCellEditor(Object node, String columnID) throws UnknownTypeException
TableRendererModel
getCellEditor
in interface TableRendererModel
node
- Tree node representing the rowcolumnID
- The column nameUnknownTypeException
- If the implementation can not edit the given cell.public boolean hasHTMLValueAt(Object node, String columnID) throws UnknownTypeException
TableHTMLModel
false
,
HTML value is is taken from the String value, if it contains some.
If this is not desired, return true here and null from
TableHTMLModel.getHTMLValueAt(java.lang.Object, java.lang.String)
.hasHTMLValueAt
in interface TableHTMLModel
node
- an object returned from TreeModel.getChildren(java.lang.Object, int, int)
for this rowcolumnID
- an id of column defined by ColumnModel.getID()
true
if there is some HTML value to be returned
from TableHTMLModel.getHTMLValueAt(java.lang.Object, java.lang.String)
,
false
otherwise.
When false
is returned,
TableHTMLModel.getHTMLValueAt(java.lang.Object, java.lang.String)
is not called.UnknownTypeException
- if there is nothing to be provided for the given
parameter typepublic String getHTMLValueAt(Object node, String columnID) throws UnknownTypeException
TableHTMLModel
getHTMLValueAt
in interface TableHTMLModel
node
- an object returned from TreeModel.getChildren(java.lang.Object, int, int)
for this rowcolumnID
- an id of column defined by ColumnModel.getID()
null
when no HTML value is provided.UnknownTypeException
- if there is nothing to be provided for the given
parameter typeTableHTMLModel.hasHTMLValueAt(java.lang.Object, java.lang.String)
public PropertyEditor getPropertyEditor(Object node, String columnID) throws UnknownTypeException
TablePropertyEditorsModel
getPropertyEditor
in interface TablePropertyEditorsModel
node
- an object returned from TreeModel.getChildren(java.lang.Object, int, int)
for this rowcolumnID
- an id of column defined by ColumnModel.getID()
null
to use the column default one.UnknownTypeException
- if there is nothing to be provided for the given
parameter type