summaryrefslogtreecommitdiff
path: root/java/src/IceGrid/Model.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2005-06-25 16:48:42 +0000
committerBernard Normier <bernard@zeroc.com>2005-06-25 16:48:42 +0000
commit68c4c2ad068c5647bef41659bb16811374d1fedc (patch)
treefee0b1ea8e3d0f32c53172e8a7e591eba7342db6 /java/src/IceGrid/Model.java
parentAdded minimal client to CE build (diff)
downloadice-68c4c2ad068c5647bef41659bb16811374d1fedc.tar.bz2
ice-68c4c2ad068c5647bef41659bb16811374d1fedc.tar.xz
ice-68c4c2ad068c5647bef41659bb16811374d1fedc.zip
Fixed build
Diffstat (limited to 'java/src/IceGrid/Model.java')
-rwxr-xr-xjava/src/IceGrid/Model.java105
1 files changed, 79 insertions, 26 deletions
diff --git a/java/src/IceGrid/Model.java b/java/src/IceGrid/Model.java
index 9d63a515658..2bbd9f110ae 100755
--- a/java/src/IceGrid/Model.java
+++ b/java/src/IceGrid/Model.java
@@ -93,48 +93,93 @@ class Model
// -- adapters, databases (see above)
-
//
- // WARNING: The following methods are called by the Server thread pool (or client
- // thread pool for bidir connections), not by the UI thread!
+ // The following methods all run in the UI thread
//
- void registryInit(int serial, final ApplicationDescriptor[] applications, String[] nodesUp)
+
+ void registryInit(int serial, final java.util.List applications, String[] nodesUp)
{
assert(_latestSerial == -1);
_latestSerial = serial;
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- NodeViewRoot nodeViewRoot =
- (NodeViewRoot)TreeModelI.getTreeModel(TreeModelI.NODE_VIEW).getRoot();
-
- nodeViewRoot.init(applications);
-
- ApplicationViewRoot applicationViewRoot =
- (ApplicationViewRoot)TreeModelI.getTreeModel(TreeModelI.APPLICATION_VIEW).getRoot();
-
- applicationViewRoot.init(applications);
-
- }
- });
+ NodeViewRoot nodeViewRoot =
+ (NodeViewRoot)TreeModelI.getTreeModel(TreeModelI.NODE_VIEW).getRoot();
+ nodeViewRoot.init(applications);
+
+ ApplicationViewRoot applicationViewRoot =
+ (ApplicationViewRoot)TreeModelI.getTreeModel(TreeModelI.APPLICATION_VIEW).getRoot();
+ applicationViewRoot.init(applications);
}
- void applicationAdded(int serial, ApplicationDescriptor desc)
+ void applicationAdded(ApplicationDescriptor desc)
{
+ NodeViewRoot nodeViewRoot =
+ (NodeViewRoot)TreeModelI.getTreeModel(TreeModelI.NODE_VIEW).getRoot();
+ nodeViewRoot.put(desc.name, desc.nodes, true);
+
+ ApplicationViewRoot applicationViewRoot =
+ (ApplicationViewRoot)TreeModelI.getTreeModel(TreeModelI.APPLICATION_VIEW).getRoot();
+ applicationViewRoot.applicationAdded(desc);
}
- void applicationRemoved(int serial, String name)
+ void applicationRemoved(String name)
{
+ NodeViewRoot nodeViewRoot =
+ (NodeViewRoot)TreeModelI.getTreeModel(TreeModelI.NODE_VIEW).getRoot();
+ nodeViewRoot.remove(name);
+
+
+ ApplicationViewRoot applicationViewRoot =
+ (ApplicationViewRoot)TreeModelI.getTreeModel(TreeModelI.APPLICATION_VIEW).getRoot();
+ applicationViewRoot.applicationRemoved(name);
}
+ void applicationSynced(ApplicationDescriptor desc)
+ {
+ NodeViewRoot nodeViewRoot =
+ (NodeViewRoot)TreeModelI.getTreeModel(TreeModelI.NODE_VIEW).getRoot();
+ nodeViewRoot.remove(desc.name);
+ nodeViewRoot.put(desc.name, desc.nodes, true);
- //
- // Runs in UI thread
- //
- void lostSession()
+ ApplicationViewRoot applicationViewRoot =
+ (ApplicationViewRoot)TreeModelI.getTreeModel(TreeModelI.APPLICATION_VIEW).getRoot();
+
+ applicationViewRoot.applicationSynced(desc);
+ }
+
+ void applicationUpdated(ApplicationUpdateDescriptor desc)
+ {
+ NodeViewRoot nodeViewRoot =
+ (NodeViewRoot)TreeModelI.getTreeModel(TreeModelI.NODE_VIEW).getRoot();
+
+ for(int i = 0; i < desc.removeNodes.length; ++i)
+ {
+ nodeViewRoot.remove(desc.name, desc.removeNodes[i]);
+ }
+ nodeViewRoot.put(desc.name, desc.nodes, true);
+
+ ApplicationViewRoot applicationViewRoot =
+ (ApplicationViewRoot)TreeModelI.getTreeModel(TreeModelI.APPLICATION_VIEW).getRoot();
+
+ applicationViewRoot.applicationUpdated(desc);
+ }
+
+ boolean updateSerial(int serial)
+ {
+ if(serial == _latestSerial + 1)
+ {
+ _latestSerial = serial;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ void sessionLost()
{
_latestSerial = -1;
@@ -149,6 +194,9 @@ class Model
applicationViewRoot.clear();
}
+
+
+
boolean save()
{
return true;
@@ -159,6 +207,11 @@ class Model
return true;
}
+
+
+
+
+
private int _latestSerial = -1;
}