| Interface | Description |
|---|---|
| AsynchronousModelFilter |
Change threading of implemented models.
|
| CheckNodeModel |
The extension of
NodeModel that can display check-boxes next to the
node display name. |
| CheckNodeModelFilter |
A model filter for
CheckNodeModel. |
| DnDNodeModel |
Extension of
NodeModel with support for Drag and Drop of nodes. |
| DnDNodeModelFilter |
Extension of
NodeModelFilter with support for Drag and Drop of nodes. |
| ExtendedNodeModel |
Provides extension to
NodeModel with cut/copy/paste and rename
functionality, and also allowing to set icons with extension. |
| ExtendedNodeModelFilter |
Provides extension to
NodeModelFilter,
filters content of some existing ExtendedNodeModel. |
| Model |
Marker interface for all models.
|
| ModelListener |
Notifies about changes in view model.
|
| Models.ActionPerformer |
Support interface for
Models.createAction(String,Models.ActionPerformer,int) method. |
| NodeActionsProvider |
Provides actions and default action for some type of objects.
|
| NodeActionsProviderFilter |
Filters actions provided by some original
NodeActionsProvider. |
| NodeModel |
Provides display name, icon and tool tip value for some type of objects.
|
| NodeModelFilter |
Filters content of some existing
NodeModel. |
| ReorderableTreeModel |
Data model for tree that supports reordering
of child nodes.
|
| ReorderableTreeModelFilter |
Filters an original tree data model that supports reordering
of child nodes.
|
| TableHTMLModel |
Use this to separate value and the HTML value.
|
| TableHTMLModelFilter |
Use this to separate value and the HTML value.
|
| TableModel |
Adds support for columns to basic
TreeModel. |
| TableModelFilter |
Allows to filter content of some existing
TableModel. |
| TablePropertyEditorsModel |
Use this to provide different property editors for different table cells.
|
| TablePropertyEditorsModelFilter |
Use this to provide different property editors for different table cells.
|
| TableRendererModel |
Model that provides custom cell renderer and cell editor for table cells.
|
| TableRendererModelFilter |
Model filter that can override custom cell renderer and cell editor for table cells.
|
| TreeExpansionModel |
This model controlls expansion, collapsion of nodes in tree view, and
defindes default expand state for all node in it.
|
| TreeExpansionModelFilter |
This model filter controlls expansion, collapsion of nodes in tree view, and
defindes default expand state for all node in it.
|
| TreeModel |
Defines data model for tree.
|
| TreeModelFilter |
Filters content of some original tree of nodes (represented by
TreeModel). |
| Class | Description |
|---|---|
| ColumnModel |
Defines model for one table view column.
|
| ModelEvent |
Encapsulates information describing changes to a model, and
used to notify model listeners of the change.
|
| ModelEvent.NodeChanged |
Used to notify that one node has been changed (icon, displayName and
children).
|
| ModelEvent.SelectionChanged |
Event to change a selection in the tree table view.
|
| ModelEvent.TableValueChanged |
Used to notify that one cell in table has been changed.
|
| ModelEvent.TreeChanged |
Used to notify that whole content of tree has been changed.
|
| Models |
Contains various utility methods for various models.
|
| Models.CompoundModel |
This model encapsulates all currently supported models.
|
| Models.TreeFeatures |
Tree expansion control.
|
| Enum | Description |
|---|---|
| AsynchronousModelFilter.CALL |
This enumeration identifies method(s) of view models for which
threading information is provided by
AsynchronousModelFilter.asynchronous(java.util.concurrent.Executor, org.netbeans.spi.viewmodel.AsynchronousModelFilter.CALL, java.lang.Object) method. |
| Exception | Description |
|---|---|
| UnknownTypeException |
Used by various data models if data model is asked to resolve node
of unknown type.
|
public class TreeModelImpl implements TreeModel {

public Object getRoot () {
return ROOT;
}
public Object[] getChildren (Object parent, int from, int to) {
if (parent == ROOT)
return File.listRoots ();
return ((File) parent).listFiles ();
}
public boolean isLeaf (Object node) {
if (node == ROOT)
return false;
return ((File) node).isFile ();
}
}
And create a TreeView for this model:
JComponent treeView = Models.createView (
Models.createCompoundModel (
Arrays.asList (new Model[] {
new TreeModelImpl (), // TreeModel
new ArrayList () // list of ColumnModel s
})
)
);
public class NodeModelImpl implements NodeModel {
public String getDisplayName (Object node) {
if (node == ROOT) return "Name";
String name = ((File) node).getName ();
if (name.length () < 1) return ((File) node).getAbsolutePath ();
return name;
}
public String getIconBase (Object node) {
if (node == ROOT) return "folder";
if (((File) node).isDirectory ()) return "folder";
return "file";
}
public String getShortDescription (Object node) {
if (node == ROOT) return "Name";
return ((File) node).getAbsolutePath ();
}
}
public class NodeActionsProviderImpl implements NodeActionsProvider {
public Action[] getActions (final Object node) {
return new Action [] {
new AbstractAction ("Open") {
public void actionPerformed (ActionEvent e) {
performDefaultAction (node);
}
},
new AbstractAction ("Delete") {
public void actionPerformed (ActionEvent e) {
((File) node).delete ();
}
}
};
}
public void performDefaultAction (Object node) {
try {
JFrame f = new JFrame ("View");
f.getContentPane ().add (new JEditorPane (((File) node).toURL ()));
f.pack ();
f.show ();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class TableModelImpl implements TableModel {
public Object getValueAt (Object node, String columnID) {
try {
if (node == ROOT) return null;
if (columnID.equals ("sizeID")) {
if (((File) node).isDirectory ()) return "<dir>";
return "" + new FileInputStream ((File) node).getChannel ().size ();
}
} catch (Exception e) {
e.printStackTrace ();
}
return "";
}
public boolean isReadOnly (Object node, String columnID) {
return true;
}
public void setValueAt (Object node, String columnID, Object value) {
}
}
And initialization of columns looks like:ArrayList columns = new ArrayList ();
columns.add (new ColumnModel () {
public String getID () { return "sizeID"; }
public String getDisplayName () { return "size"; }
public Class getType () { return String.class; }
});
JComponent treeTableView = Models.createView (
Models.createCompoundModel (
Arrays.asList (new Model[] {
new TreeModelImpl (), // TreeModel
new NodeModelImpl (), // NodeModel
new TableModelImpl (), // TableModel
new NodeActionsProviderImpl (), // NodeActionsProvider
columns // list of ColumnModel s
})
)
);
Built on May 16 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.