Skip navigation links

Introduction

This document lists changes made to the View Model APIs. Please ask on the nbdev@netbeans.org mailing list if you have any questions about the details of a change, or are wondering how to convert existing code to be compatible.


Index of APIs

Incompatible changes by date

Fuller descriptions of all changes can be found below (follow links).

Not all deprecations are listed here, assuming that the deprecated APIs continue to essentially work. For a full deprecation list, please consult the Javadoc.

All changes by date

Changes by version

These API specification versions may be used to indicate that a module requires a certain API feature in order to function. For example, if you see here a feature you need which is labelled 1.20, your manifest should contain in its main attributes the line:

OpenIDE-Module-Module-Dependencies: org.netbeans.spi.viewmodel/2 > 1.20

Changes by affected class

org.netbeans.spi.viewmodel.AsynchronousModelFilter

org.netbeans.spi.viewmodel.CachedChildrenTreeModel

org.netbeans.spi.viewmodel.CheckNodeModel

org.netbeans.spi.viewmodel.CheckNodeModelFilter

org.netbeans.spi.viewmodel.ColumnModel

org.netbeans.spi.viewmodel.DnDNodeModel

org.netbeans.spi.viewmodel.DnDNodeModelFilter

org.netbeans.spi.viewmodel.ExtendedNodeModel

org.netbeans.spi.viewmodel.ExtendedNodeModelFilter

org.netbeans.spi.viewmodel.ModelEvent

org.netbeans.spi.viewmodel.Models

org.netbeans.spi.viewmodel.ReorderableTreeModel

org.netbeans.spi.viewmodel.ReorderableTreeModelFilter

org.netbeans.spi.viewmodel.TableHTMLModel

org.netbeans.spi.viewmodel.TableHTMLModelFilter

org.netbeans.spi.viewmodel.TablePropertyEditorsModel

org.netbeans.spi.viewmodel.TablePropertyEditorsModelFilter

org.netbeans.spi.viewmodel.TableRendererModel

org.netbeans.spi.viewmodel.TableRendererModelFilter

org.netbeans.spi.viewmodel.TreeExpansionModel

org.netbeans.spi.viewmodel.TreeExpansionModelFilter

org.netbeans.spi.viewmodel.TreeModel


Details of all changes by API and date


View Model API

Add an abstract children caching model.

Nov 28 '14; API spec. version: 1.49; affected top-level classes: CachedChildrenTreeModel; made by: mentlicher; issues: #248775
Views that show asynchronously loaded children nodes, have problems with visible refreshes of the children tree. CachedChildrenTreeModel is introduced to allow seamless refresh of children tree.

Separate the value and HTML value and allow custom property editors.

Apr 30 '13; API spec. version: 1.42; affected top-level classes: TableHTMLModel TableHTMLModelFilter TablePropertyEditorsModel TablePropertyEditorsModelFilter ModelEvent; made by: mentlicher; issues: #228909
So far the HTML value is automatically retrieved from the value provided by the TableModel when the value is a String and contains HTML code. This is not flexible enough and therefore we separate the value and HTML value by introduction of TableHTMLModel and TableHTMLModelFilter.
In addition to that, this API change also brings a prossibility to provide custom property editor, separately for every value. Two interfaces are introduced for this purpose: TablePropertyEditorsModel and TablePropertyEditorsModelFilter.
This also implies, that Models.CompoundModel now implements TableHTMLModel and TablePropertyEditorsModel.
In order to be able to fire changes in HTML value and also in r/w state, an additional constructor of ModelEvent.TableValueChanged is added, which takes the change mask. Three change masks are defined: VALUE_MASK, HTML_VALUE_MASK and IS_READ_ONLY_MASK. To get the change mask, ModelEvent.TableValueChanged.getChange() method is added.

Custom table cell renderers and editors.

Jun 7 '10; API spec. version: 1.28; affected top-level classes: TableRendererModel TableRendererModelFilter; made by: mentlicher; issues: #186672
This API introduce TableRendererModel and TableRendererModelFilter that can be used to provide custom table cell renderers and cell editors.

Drag and Drop support.

Dec 15 '09; API spec. version: 1.25; affected top-level classes: ReorderableTreeModel ReorderableTreeModelFilter; made by: mentlicher; issues: #178301
This API introduce ReorderableTreeModel and ReorderableTreeModelFilter that can be used to alter the order of children nodes.

Drag and Drop support.

Dec 4 '09; API spec. version: 1.24; affected top-level classes: DnDNodeModel DnDNodeModelFilter; made by: mentlicher; issues: #177506
This API introduce DnDNodeModel and DnDNodeModelFilter that can be used by clients to implement Drag and Drop.

Introduction of AsynchronousModelFilter.

Sep 25 '09; API spec. version: 1.20; affected top-level classes: AsynchronousModelFilter; made by: mentlicher; issues: #172694
This API introduced AsynchronousModelFilter that can be used by clients to override the default threading of their model implementations.

Check extension to NodeModel.

Sep 1 '09; API spec. version: 1.19; affected top-level classes: ModelEvent; made by: mentlicher; issues: #171194
This API change allows to change a node selection in the tree table view. SelectionChanged event is used to select a set of nodes (rows).

Added classes:
org.netbeans.spi.viewmodel.ModelEvent.SelectionChanged,

Check extension to NodeModel.

Mar 8 '09; API spec. version: 1.17; affected top-level classes: CheckNodeModel CheckNodeModelFilter; made by: mentlicher; issues: #159545
This API change allows to display check-boxes next to the node icons in the tree column.

Added classes:
org.netbeans.spi.viewmodel.CheckNodeModel, org.netbeans.spi.viewmodel.CheckNodeModelFilter

Extension to NodeModel.

Jun 2 '08; API spec. version: 1.15; affected top-level classes: TreeExpansionModelFilter Models; made by: mentlicher; issues: #136099
This API change is necessary for the redesign of the debugger UI and to be able to better control node expansions.

Added classes:
org.netbeans.spi.viewmodel.TreeExpansionModelFilter

Changed classes:
Models.TreeFeatures - final class with a private constructor changed to an abstract class.

Added methods:
Models.createNodes(),

Added fields:
ModelEvent.EXPANSION_MASK

Extension to NodeModel.

Jun 6 '07; API spec. version: 1.12; affected top-level classes: ExtendedNodeModel ExtendedNodeModelFilter Models; made by: mentlicher; issues: #104281
Add ability to in-place rename and copy/paste functionality to nodes in debugger views. Also, the models needs to have a way to provide an icon with arbitrary extension. Therefore following methods are provided with new ExtendedNodeModel and ExtendedNodeModelFilter interfaces and are also added into CompoundModel: canRename(), canCopy(), canCut(), clipboardCopy(), clipboardCut(), getPasteTypes(), setName(), getIconBaseWithExtension().

getDisplayedMnemonic() method added to ColumnModel.

Jan 30 '06; API spec. version: 1.11; affected top-level classes: ColumnModel; made by: mentlicher; issues: #71858
In order to be able to provide mnemonics for columns in tree table views, Character ColumnModel.getDisplayedMnemonic() method was added to ColumnModel class.

CompoundModel enhanced with a possibility to set help ID.

Aug 25 '05; API spec. version: 1.7; affected top-level classes: Models; made by: mentlicher; issues: #62617
In order to have a help ID defined for the GUI component that is created from the compound model, it's necessary to be able to set that help ID on the compound model instance. Two methods are added for that purpose: CompoundModel Models.createCompoundModel (List, String) and String CompoundModel.getHelpId().

ModelEvent enhanced with more fine-grained changes

Jul 21 '05; API spec. version: 1.6; affected top-level classes: ModelEvent; made by: mentlicher; issues: #60499
NodeChanged events need to distinguish what node property has changed. Mask constant were added for display name, icon, short description and children properties. By default, mask that aggregates all these properties is used - to assure compatibility.

I need to add TreeModelEvent to ViewModelAPI.

Mar 31 '05; made by: jjancura; issues: #57273
NB4.0 version of ViewModelAPI had several event firing related issues: 1) It supported two types of changes only: i) whole tree has been changed notification ii) node and all subnodes change notification There where no support for small grained changes (one table cell change). 2) The same listener type (TreeModelListener) has been used for all model types (TreeModel, NodeModel, ...) 3) There was no TreeModelEvent, so evolving of this api was problematic. I have done folowing incompatible api change, to fix this problem: 1) TreeModelListener has been renamed to ModelListener (Because its used for other models too). 2) ModelEvent class has been added. 3) Two methods removed from TreeModelListener: public void treeNodeChanged (Object node); public void treeNodeChanged (TreeModelEvent event); and replaced by folowing method: public void modelChanged (ModelEvent event); 4) three innerclasses added to ModelEvent TreeChanged TableValueChanged NodeChanged These three innerclasses are designed to support firing of all kinds of model changes. TreeChanged - Designed to notify about chages of whole tree content / structure. This event has no parameters. TableValueChanged - Designed to notify about chages of one cell in table. Two parameters: Object row, String columnID NodeChanged - Designed to notify about chages of one node - icon and display name. One parameter: Object node.

Access to tree node expansion added.

Jan 13 '05; affected top-level classes: Models TreeExpansionModel; made by: jjancura; issues: #46167
This change has been done to cover user requirement #46167. List of changes: 1) new TreeExpansionModel introduced 2) new class Models.TreeFeatures contains tree expansion methods. During implementation of this user requirement I have discovered important problem in ViewModel API. There is no possibility to add a new model to it. List of changes fixing this problem: 1) Models.createView (...) and Models.setModelsToView (...) methods do not use fixed set of models as parameters, but they use Models.CompoundModel. 2) Models.CompoundModel is final class implementing all currently supported models. The only way how to create a new instance of it is Models.createCompoundModel (List listOfModels). It allows future additions of new models. 3) Methods Models.createCompoundTreeModel (...), Models.createCompoundNodeModel (...), Models.createCompoundTableModel (...), Models.createCompoundNodeActionsProvider (...), and field Models.EMPTY_TREE_MODEL has been removed as useless. How to update your code using these exceptions: No changes required for most of clients. You should change your code only if you are providing some new view based on ViewModel. In this case you should put all your model instances to one list, and call Models.createCompountModel (list), in place of calling create*Model* methods.

Support for synchronous and asynchronous ViewModels implementation fixed.

Jan 7 '05; made by: jjancura; issues: #53073
Support for synchronous and asynchronous ViewModels implementations is one of the major ViewModel API requirements. During fixing of #46614 (toString update should not run in AWT thread) I have realized, that current support for asynchronous ViewModels implementations is not usable. This change fixes the problem: 1) ComputingException, and NoInformationException removed - as completely useless. 2) All methods throwing these exceptions changed. 3) New ViewModel implementation supports asynchronous model only. Its fast and safe. How to update your code using these exceptions: Old code: public Object getValueAt (Object row, String columnId) throws ComputingException { if (....) throw new ComputingException (); ... } Fixed code: public Object getValueAt (Object row, String columnId) { if (....) return "Computing"; ... }

TreeModel.getChildrenCount (Object node) method added.

Jul 23 '04; affected top-level classes: TreeModel; made by: jjancura; issues: #46368
TreeModel uses indexed approach (getChildren (Object node, int from, int to). But the children count has not been accesible through the API. This was important problem.

Support for pop-up menu actions fixed.

Apr 29 '04; made by: jjancura
Support for different models in multiselection has been added.
Compatibility:

Incompatile changes (additions / removals).