diff options
Diffstat (limited to 'java/src')
-rwxr-xr-x | java/src/IceGrid/AdminGUI.java | 25 | ||||
-rwxr-xr-x | java/src/IceGrid/Model.java | 144 | ||||
-rwxr-xr-x | java/src/IceGrid/SessionKeeper.java | 4 | ||||
-rwxr-xr-x | java/src/IceGrid/StatusBar.java | 1 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/Application.java | 8 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/ApplicationEditor.java | 4 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/CommonBase.java | 8 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/CommonBaseI.java | 4 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/Root.java | 1 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/Server.java | 8 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/ServerSubEditor.java | 4 |
11 files changed, 106 insertions, 105 deletions
diff --git a/java/src/IceGrid/AdminGUI.java b/java/src/IceGrid/AdminGUI.java index 258e42fc8fc..df6240238ba 100755 --- a/java/src/IceGrid/AdminGUI.java +++ b/java/src/IceGrid/AdminGUI.java @@ -8,9 +8,12 @@ // **********************************************************************
package IceGrid;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
@@ -32,10 +35,20 @@ public class AdminGUI extends JFrame StatusBarI()
{
super(new BorderLayout());
- setBorder(new EmptyBorder(0, 10, 10, 10));
+ setBorder(new EmptyBorder(0, 10, 5, 10));
+
+ _connected = Utils.getIcon("/icons/active.png");
+ _disconnected = Utils.getIcon("/icons/destroyed.png");
+
+ _connectedLabel = new JLabel(_disconnected);
_text = new JLabel("Starting up");
_text.setHorizontalAlignment(SwingConstants.LEFT);
- add(_text, BorderLayout.LINE_START);
+
+ JPanel leftPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ leftPanel.add(_connectedLabel);
+ leftPanel.add(_text);
+
+ add(leftPanel, BorderLayout.LINE_START);
JLabel copyright = new JLabel("Copyright \u00A9 2005 ZeroC, Inc.");
copyright.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -47,6 +60,14 @@ public class AdminGUI extends JFrame _text.setText(text);
}
+ public void setConnected(boolean connected)
+ {
+ _connectedLabel.setIcon(connected ? _connected : _disconnected);
+ }
+
+ JLabel _connectedLabel;
+ Icon _connected;
+ Icon _disconnected;
JLabel _text;
}
diff --git a/java/src/IceGrid/Model.java b/java/src/IceGrid/Model.java index b26244f1cc9..ac0c8c22c1e 100755 --- a/java/src/IceGrid/Model.java +++ b/java/src/IceGrid/Model.java @@ -199,7 +199,7 @@ public class Model _appMenu = new JMenu("Application");
_appMenu.setEnabled(false);
toolsMenu.add(_appMenu);
- _appMenu.add(_actions[CommonBase.APPLICATION_REFRESH_INSTALLATION]);
+ _appMenu.add(_actions[CommonBase.APPLICATION_INSTALL_DISTRIBUTION]);
//
// Node sub-menu
@@ -221,7 +221,7 @@ public class Model _serverMenu.add(_actions[CommonBase.ENABLE]);
_serverMenu.add(_actions[CommonBase.DISABLE]);
_serverMenu.addSeparator();
- _serverMenu.add(_actions[CommonBase.SERVER_REFRESH_INSTALLATION]);
+ _serverMenu.add(_actions[CommonBase.SERVER_INSTALL_DISTRIBUTION]);
//
// Service sub-menu
@@ -308,9 +308,8 @@ public class Model if(proceedWithUpdate(serial))
{
_root.applicationAdded(desc);
- _statusBar.setText("Connected; application '"
- + desc.name + "' added (" + serial + ")");
-
+ _statusBar.setText(
+ "Last update: new application '" + desc.name + "'");
checkWriteSerial();
}
}
@@ -320,8 +319,8 @@ public class Model if(proceedWithUpdate(serial))
{
_root.applicationRemoved(name);
- _statusBar.setText("Connected; application '"
- + name + "' removed (" + serial + ")");
+ _statusBar.setText(
+ "Last update: application '" + name + "' was removed");
checkWriteSerial();
}
}
@@ -337,8 +336,7 @@ public class Model path = currentNode.getPath();
}
_root.applicationUpdated(desc);
- _statusBar.setText("Connected; application '"
- + desc.name + "' updated (" + serial + ")");
+ _statusBar.setText("Last update: application '" + desc.name + "' was updated");
checkWriteSerial();
restore(path);
}
@@ -368,20 +366,11 @@ public class Model else
{
_sessionKeeper.sessionLost(
- "Received message from registry out of order");
+ "Received message from IceGrid Registry out of order");
return false;
}
}
- private void checkWriteSerial()
- {
- if(_writeSerial != -1 && _writeSerial == _latestSerial)
- {
- updateInProgress();
- }
- }
-
-
public CommonBase getSelectedNode()
{
return (CommonBase)_tree.getLastSelectedPathComponent();
@@ -447,15 +436,18 @@ public class Model }
}
+
+
public boolean canUpdate()
{
- if(_writeSerial == _latestSerial)
+ if(isUpdateInProgress())
{
return true;
}
try
{
+ _mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
_writeSerial = _sessionKeeper.getSession().startUpdate();
}
catch(AccessDeniedException e)
@@ -464,7 +456,12 @@ public class Model accessDenied(e);
return false;
}
-
+ finally
+ {
+ _mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ showActions();
+
if(_writeSerial > _latestSerial)
{
//
@@ -473,19 +470,42 @@ public class Model JOptionPane.showMessageDialog(
_mainFrame,
"Your view was not up-to-date;"
- + " you now have exclusive write-access to the registry, however your previous changes were lost.",
+ + " you now have exclusive write-access to the IceGrid Registry, however your previous changes were lost.",
"Concurrent update",
JOptionPane.WARNING_MESSAGE);
- _mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ //
+ // TODO: wait for my view to be up to date
+ //
return false;
}
else
{
- updateInProgress();
+ setUpdateInProgress();
return true;
}
}
+ public boolean isUpdateInProgress()
+ {
+ return _writeSerial >= _latestSerial;
+ }
+
+
+ private void checkWriteSerial()
+ {
+ if(_writeSerial != -1 && _writeSerial == _latestSerial)
+ {
+ setUpdateInProgress();
+ }
+ }
+ private void setUpdateInProgress()
+ {
+ _statusBar.setText("Update in progress");
+ _save.setEnabled(true);
+ _discard.setEnabled(true);
+ }
+
private void accessDenied(AccessDeniedException e)
{
JOptionPane.showMessageDialog(
@@ -612,9 +632,10 @@ public class Model _writeSerial = -1;
_save.setEnabled(false);
_discard.setEnabled(false);
+ showActions();
+
_statusBar.setText("Saving complete");
return true;
-
}
finally
{
@@ -643,15 +664,6 @@ public class Model }
- private void updateInProgress()
- {
- _statusBar.setText("Update in progress");
- _mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- _save.setEnabled(true);
- _discard.setEnabled(true);
- }
-
-
//
// From the Node observer:
//
@@ -904,7 +916,7 @@ public class Model _save.setEnabled(false);
_save.putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke("ctrl S"));
- _save.putValue(Action.SHORT_DESCRIPTION, "Save to IceGrid registry");
+ _save.putValue(Action.SHORT_DESCRIPTION, "Save to IceGrid Registry");
_discard = new AbstractAction("Discard all updates...",
Utils.getIcon("/icons/undo_edit.gif"))
@@ -915,7 +927,7 @@ public class Model }
};
_discard.setEnabled(false);
- _save.putValue(Action.SHORT_DESCRIPTION, "Discard all updates");
+ _discard.putValue(Action.SHORT_DESCRIPTION, "Discard all updates");
_exit = new AbstractAction("Exit")
{
@@ -1139,20 +1151,20 @@ public class Model _actionsTarget.shutdownNode();
}
};
- _actions[CommonBase.APPLICATION_REFRESH_INSTALLATION] =
- new AbstractAction("Refresh installation")
+ _actions[CommonBase.APPLICATION_INSTALL_DISTRIBUTION] =
+ new AbstractAction("Install or refresh distribution")
{
public void actionPerformed(ActionEvent e)
{
- _actionsTarget.applicationRefreshInstallation();
+ _actionsTarget.applicationInstallDistribution();
}
};
- _actions[CommonBase.SERVER_REFRESH_INSTALLATION] =
- new AbstractAction("Refresh installation")
+ _actions[CommonBase.SERVER_INSTALL_DISTRIBUTION] =
+ new AbstractAction("Install or refresh distribution")
{
public void actionPerformed(ActionEvent e)
{
- _actionsTarget.serverRefreshInstallation();
+ _actionsTarget.serverInstallDistribution();
}
};
}
@@ -1223,50 +1235,6 @@ public class Model }
}
-
- /*
- void deleteCurrentNode()
- {
- CommonBase currentNode = (CommonBase)_tree.getLastSelectedPathComponent();
- if(currentNode != null)
- {
- CommonBase parent = currentNode.getParent();
- CommonBase toSelect = null;
- if(parent != null)
- {
- int index = parent.getIndex(currentNode);
- toSelect = (CommonBase)parent.getChildAt(index + 1);
- if(toSelect == null)
- {
- if(index > 0)
- {
- toSelect = (CommonBase)parent.getChildAt(0);
- }
- else
- {
- toSelect = parent;
- }
- }
- }
- if(toSelect != null)
- {
- disableDisplay();
- }
- boolean destroyed = currentNode.destroy();
- if(toSelect != null)
- {
- enableDisplay();
- if(destroyed)
- {
- toSelect = findNewNode(toSelect.getPath());
- _tree.setSelectionPath(toSelect.getPath());
- }
- }
- }
- }
- */
-
-
public void setClipboard(Object copy)
{
_clipboard = copy;
@@ -1402,7 +1370,7 @@ public class Model availableActions[CommonBase.NEW_TEMPLATE_SERVICE]);
_appMenu.setEnabled(
- availableActions[CommonBase.APPLICATION_REFRESH_INSTALLATION]);
+ availableActions[CommonBase.APPLICATION_INSTALL_DISTRIBUTION]);
_nodeMenu.setEnabled(
availableActions[CommonBase.SHUTDOWN_NODE]);
@@ -1412,7 +1380,7 @@ public class Model availableActions[CommonBase.STOP] ||
availableActions[CommonBase.ENABLE] ||
availableActions[CommonBase.DISABLE] ||
- availableActions[CommonBase.SERVER_REFRESH_INSTALLATION]);
+ availableActions[CommonBase.SERVER_INSTALL_DISTRIBUTION]);
_serviceMenu.setEnabled(
availableActions[CommonBase.MOVE_UP] ||
diff --git a/java/src/IceGrid/SessionKeeper.java b/java/src/IceGrid/SessionKeeper.java index 620e70aaf8c..867c82abc98 100755 --- a/java/src/IceGrid/SessionKeeper.java +++ b/java/src/IceGrid/SessionKeeper.java @@ -340,7 +340,7 @@ class SessionKeeper }
}
- _model.getStatusBar().setText("Connected");
+ _model.getStatusBar().setConnected(true);
//
// Start thread
@@ -431,7 +431,7 @@ class SessionKeeper }
_session = null;
- _model.getStatusBar().setText("Not connected");
+ _model.getStatusBar().setConnected(false);
}
}
diff --git a/java/src/IceGrid/StatusBar.java b/java/src/IceGrid/StatusBar.java index 659622e6cfa..ad7e940bb3e 100755 --- a/java/src/IceGrid/StatusBar.java +++ b/java/src/IceGrid/StatusBar.java @@ -11,4 +11,5 @@ package IceGrid; public interface StatusBar
{
void setText(String text);
+ void setConnected(boolean connected);
}
diff --git a/java/src/IceGrid/TreeNode/Application.java b/java/src/IceGrid/TreeNode/Application.java index acf638e18ee..935d530cbf5 100755 --- a/java/src/IceGrid/TreeNode/Application.java +++ b/java/src/IceGrid/TreeNode/Application.java @@ -56,7 +56,11 @@ public class Application extends EditableParent {
actions[PASTE] = descriptor instanceof ApplicationDescriptor;
}
- actions[APPLICATION_REFRESH_INSTALLATION] = true;
+ if(!_model.isUpdateInProgress())
+ {
+ actions[APPLICATION_INSTALL_DISTRIBUTION] =
+ !_descriptor.distrib.icepatch.equals("");
+ }
return actions;
}
public JPopupMenu getPopupMenu()
@@ -64,7 +68,7 @@ public class Application extends EditableParent if(_popup == null)
{
_popup = new PopupMenu(_model);
- _popup.add(_model.getActions()[APPLICATION_REFRESH_INSTALLATION]);
+ _popup.add(_model.getActions()[APPLICATION_INSTALL_DISTRIBUTION]);
}
return _popup;
}
diff --git a/java/src/IceGrid/TreeNode/ApplicationEditor.java b/java/src/IceGrid/TreeNode/ApplicationEditor.java index d331ba896ed..555eb526916 100755 --- a/java/src/IceGrid/TreeNode/ApplicationEditor.java +++ b/java/src/IceGrid/TreeNode/ApplicationEditor.java @@ -206,7 +206,7 @@ class ApplicationEditor extends Editor builder.append(_variablesButton);
builder.nextLine();
- builder.appendSeparator("Installation");
+ builder.appendSeparator("Distribution");
builder.append("IcePatch2 Proxy");
builder.append(_distrib, 3);
builder.nextLine();
@@ -294,7 +294,7 @@ class ApplicationEditor extends Editor return "None selected";
}
};
- static private final String DEFAULT_DISTRIB = "${application}.Icepatch2";
+ static private final String DEFAULT_DISTRIB = "${application}.IcePatch2";
private JTextField _name = new JTextField(20);
private JTextArea _description = new JTextArea(3, 20);
diff --git a/java/src/IceGrid/TreeNode/CommonBase.java b/java/src/IceGrid/TreeNode/CommonBase.java index 9c197915028..1e9b96c246d 100755 --- a/java/src/IceGrid/TreeNode/CommonBase.java +++ b/java/src/IceGrid/TreeNode/CommonBase.java @@ -139,8 +139,8 @@ public interface CommonBase extends TreeCellRenderer static final int SHUTDOWN_NODE = 22;
- static final int APPLICATION_REFRESH_INSTALLATION = 23;
- static final int SERVER_REFRESH_INSTALLATION = 24;
+ static final int APPLICATION_INSTALL_DISTRIBUTION = 23;
+ static final int SERVER_INSTALL_DISTRIBUTION = 24;
static public final int ACTION_COUNT = 25;
@@ -174,8 +174,8 @@ public interface CommonBase extends TreeCellRenderer void shutdownNode();
- void applicationRefreshInstallation();
- void serverRefreshInstallation();
+ void applicationInstallDistribution();
+ void serverInstallDistribution();
JPopupMenu getPopupMenu();
}
diff --git a/java/src/IceGrid/TreeNode/CommonBaseI.java b/java/src/IceGrid/TreeNode/CommonBaseI.java index de902256c64..34ffc5c066d 100755 --- a/java/src/IceGrid/TreeNode/CommonBaseI.java +++ b/java/src/IceGrid/TreeNode/CommonBaseI.java @@ -272,11 +272,11 @@ abstract class CommonBaseI implements CommonBase {
assert false;
}
- public void applicationRefreshInstallation()
+ public void applicationInstallDistribution()
{
assert false;
}
- public void serverRefreshInstallation()
+ public void serverInstallDistribution()
{
assert false;
}
diff --git a/java/src/IceGrid/TreeNode/Root.java b/java/src/IceGrid/TreeNode/Root.java index bffaeb7f413..f342f67f31e 100755 --- a/java/src/IceGrid/TreeNode/Root.java +++ b/java/src/IceGrid/TreeNode/Root.java @@ -412,6 +412,7 @@ public class Root extends Parent {
Application app = new Application(true, ad, _model);
addChild(app, true);
+ expandChildren();
}
catch(UpdateFailedException e)
{
diff --git a/java/src/IceGrid/TreeNode/Server.java b/java/src/IceGrid/TreeNode/Server.java index 9381f08bcc1..170ed37b260 100755 --- a/java/src/IceGrid/TreeNode/Server.java +++ b/java/src/IceGrid/TreeNode/Server.java @@ -163,6 +163,12 @@ class Server extends EditableParent actions[ENABLE] = !_enabled;
actions[DISABLE] = _enabled;
+ if(!_model.isUpdateInProgress())
+ {
+ actions[SERVER_INSTALL_DISTRIBUTION] =
+ !_serverDescriptor.distrib.icepatch.equals("");
+ }
+
return actions;
}
public JPopupMenu getPopupMenu()
@@ -176,7 +182,7 @@ class Server extends EditableParent _popup.add(_model.getActions()[ENABLE]);
_popup.add(_model.getActions()[DISABLE]);
_popup.addSeparator();
- _popup.add(_model.getActions()[SERVER_REFRESH_INSTALLATION]);
+ _popup.add(_model.getActions()[SERVER_INSTALL_DISTRIBUTION]);
}
return _popup;
}
diff --git a/java/src/IceGrid/TreeNode/ServerSubEditor.java b/java/src/IceGrid/TreeNode/ServerSubEditor.java index 65945f6ba6a..a0153e7545b 100755 --- a/java/src/IceGrid/TreeNode/ServerSubEditor.java +++ b/java/src/IceGrid/TreeNode/ServerSubEditor.java @@ -158,7 +158,7 @@ class ServerSubEditor extends CommunicatorSubEditor builder.append("Deactivation Timeout");
builder.append(_deactivationTimeout, 3);
builder.nextLine();
- builder.appendSeparator("Installation");
+ builder.appendSeparator("Distribution");
builder.append("IcePatch2 Proxy");
builder.append(_distrib, 3);
builder.nextLine();
@@ -373,7 +373,7 @@ class ServerSubEditor extends CommunicatorSubEditor }
};
- static private final String DEFAULT_DISTRIB = "${application}.Icepatch2";
+ static private final String DEFAULT_DISTRIB = "${application}.IcePatch2";
private JTextField _id = new JTextField(20);
private JTextField _exe = new JTextField(20);
|