diff options
author | Bernard Normier <bernard@zeroc.com> | 2005-08-02 15:39:34 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2005-08-02 15:39:34 +0000 |
commit | ca26b6792a02d7ffeffd172a0744566b78cf4602 (patch) | |
tree | 3a72423e563996d3788ee77d0f3bc055795d2e16 /java/src/IceGrid/TreeNode/CommonBaseI.java | |
parent | LocalExceptions -> LocalException (diff) | |
download | ice-ca26b6792a02d7ffeffd172a0744566b78cf4602.tar.bz2 ice-ca26b6792a02d7ffeffd172a0744566b78cf4602.tar.xz ice-ca26b6792a02d7ffeffd172a0744566b78cf4602.zip |
Fixed build failure
Diffstat (limited to 'java/src/IceGrid/TreeNode/CommonBaseI.java')
-rwxr-xr-x | java/src/IceGrid/TreeNode/CommonBaseI.java | 140 |
1 files changed, 37 insertions, 103 deletions
diff --git a/java/src/IceGrid/TreeNode/CommonBaseI.java b/java/src/IceGrid/TreeNode/CommonBaseI.java index 3f2122e57f4..a069781581a 100755 --- a/java/src/IceGrid/TreeNode/CommonBaseI.java +++ b/java/src/IceGrid/TreeNode/CommonBaseI.java @@ -25,12 +25,6 @@ import IceGrid.Model; abstract class CommonBaseI implements CommonBase
{
- static class ViewData
- {
- public TreePath path;
- public CommonBase parent;
- }
-
public String toString()
{
return _id;
@@ -41,63 +35,35 @@ abstract class CommonBaseI implements CommonBase return _id;
}
- public void addParent(CommonBase parent)
+ public void setParent(CommonBase parent)
{
- //
- // Check if this parent has any view; there is no point in remembering
- // a parent that does not belong to a view: getParent etc is used
- // only to create event to fire using the view's TreeModel.
- //
- assert(parent != null);
-
- for(int i = 0; i < TreeModelI.VIEW_COUNT; i++)
- {
- TreePath parentPath = parent.getPath(i);
- if(parentPath != null)
+ _parent = parent;
+ if(_parent == null)
+ {
+ _path = null;
+ }
+ else
+ {
+ TreePath parentPath = _parent.getPath();
+ if(parentPath == null)
{
- addParent(parent, parentPath, i);
+ _path = null;
}
- }
- }
-
- public void addParent(CommonBase parent, TreePath parentPath, int view)
- {
- assert(parent != null);
- assert(parentPath != null);
- assert(_parents[view] == null);
- assert(_paths[view] == null);
-
- _parents[view] = parent;
- _paths[view] = parentPath.pathByAddingChild(this);
- }
-
- public void removeParent(CommonBase parent)
- {
- assert(parent != null);
-
- for(int i = 0; i < TreeModelI.VIEW_COUNT; i++)
- {
- if(_parents[i] == parent)
+ else
{
- removeParent(i);
+ _path = parentPath.pathByAddingChild(this);
}
}
}
- public void removeParent(int view)
+ public TreePath getPath()
{
- _paths[view] = null;
- _parents[view] = null;
- }
-
- public TreePath getPath(int view)
- {
- return _paths[view];
+ return _path;
}
- public CommonBase getParent(int view)
+ public CommonBase getParent()
{
- return _parents[view];
+ return _parent;
}
@@ -139,14 +105,14 @@ abstract class CommonBaseI implements CommonBase }
//
- // Fires a nodesChanged event with this node for this specific view
+ // Fires a nodesChanged event with this node
//
- void fireNodeChangedEvent(Object source, int view)
+ void fireNodeChangedEvent(Object source)
{
//
- // Bug if I am not in this view
+ // Bug if I am not attached to the root
//
- assert(_paths[view] != null);
+ assert _path != null;
int[] childIndices = new int[1];
Object[] children = new Object[1];
@@ -154,7 +120,7 @@ abstract class CommonBaseI implements CommonBase TreeModelEvent event;
- if(_parents[view] == null)
+ if(_parent == null)
{
//
// I am root
@@ -165,47 +131,18 @@ abstract class CommonBaseI implements CommonBase }
else
{
- childIndices[0] = _parents[view].getIndex(this);
- event = new TreeModelEvent(source, _parents[view].getPath(view), childIndices, children);
+ childIndices[0] = _parent.getIndex(this);
+ event = new TreeModelEvent(source, _parent.getPath(), childIndices, children);
}
- _model.getTreeModel(view).fireNodesChangedEvent(event);
- }
-
- //
- // Fires a nodesChanged event with this node for all my views (usually just one)
- //
- void fireNodeChangedEvent(Object source)
- {
- for(int i = 0; i < TreeModelI.VIEW_COUNT; ++i)
- {
- if(_paths[i] != null)
- {
- fireNodeChangedEvent(source, i);
- }
- }
- }
-
-
- void fireStructureChangedEvent(Object source, int view)
- {
- //
- // Bug if I am not in this view
- //
- assert(_paths[view] != null);
-
- TreeModelEvent event = new TreeModelEvent(source, _paths[view]);
- _model.getTreeModel(view).fireStructureChangedEvent(event);
+ _model.getTreeModel().fireNodesChangedEvent(event);
}
void fireStructureChangedEvent(Object source)
{
- for(int i = 0; i < TreeModelI.VIEW_COUNT; ++i)
- {
- if(_paths[i] != null)
- {
- fireStructureChangedEvent(source, i);
- }
- }
+ assert _path != null;
+
+ TreeModelEvent event = new TreeModelEvent(source, _path);
+ _model.getTreeModel().fireStructureChangedEvent(event);
}
static String templateLabel(String templateName, java.util.Collection col)
@@ -230,14 +167,14 @@ abstract class CommonBaseI implements CommonBase return result;
}
- protected CommonBaseI(String id, Model model, int rootForView)
+ protected CommonBaseI(String id, Model model, boolean root)
{
_id = id;
_model = model;
- if(rootForView >= 0)
+ if(root)
{
- _paths[rootForView] = new TreePath(this);
+ _path = new TreePath(this);
}
}
@@ -246,12 +183,9 @@ abstract class CommonBaseI implements CommonBase return _model;
}
-
- //
- // view to Path/Parent arrays
- //
- protected TreePath[] _paths = new TreePath[TreeModelI.VIEW_COUNT];
- protected CommonBase[] _parents = new CommonBase[TreeModelI.VIEW_COUNT];
+
+ protected TreePath _path;
+ protected CommonBase _parent;
//
// Id (application name, server instance name etc)
@@ -261,10 +195,10 @@ abstract class CommonBaseI implements CommonBase //
// The Model
//
- protected IceGrid.Model _model;
+ protected Model _model;
//
// The default panel
//
- protected JPanel _panel;
+ static protected JPanel _panel;
}
|