summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rwxr-xr-xjava/src/IceGrid/MainPane.java92
-rwxr-xr-xjava/src/IceGrid/Model.java216
-rwxr-xr-xjava/src/IceGrid/PlasticTreeUI.java165
-rwxr-xr-xjava/src/IceGrid/SimpleInternalFrame.java12
-rwxr-xr-xjava/src/IceGrid/TreeNode/AbstractServerEditor.java90
-rwxr-xr-xjava/src/IceGrid/TreeNode/Adapter.java16
-rwxr-xr-xjava/src/IceGrid/TreeNode/AdapterEditor.java56
-rwxr-xr-xjava/src/IceGrid/TreeNode/Application.java133
-rwxr-xr-xjava/src/IceGrid/TreeNode/ApplicationEditor.java7
-rwxr-xr-xjava/src/IceGrid/TreeNode/CommonBase.java29
-rwxr-xr-xjava/src/IceGrid/TreeNode/CommonBaseI.java29
-rwxr-xr-xjava/src/IceGrid/TreeNode/CommunicatorSubEditor.java4
-rwxr-xr-xjava/src/IceGrid/TreeNode/DbEnv.java13
-rwxr-xr-xjava/src/IceGrid/TreeNode/DbEnvEditor.java5
-rwxr-xr-xjava/src/IceGrid/TreeNode/Editor.java219
-rwxr-xr-xjava/src/IceGrid/TreeNode/ListElementEditor.java5
-rwxr-xr-xjava/src/IceGrid/TreeNode/Node.java34
-rwxr-xr-xjava/src/IceGrid/TreeNode/NodeEditor.java79
-rwxr-xr-xjava/src/IceGrid/TreeNode/Nodes.java24
-rwxr-xr-xjava/src/IceGrid/TreeNode/ReplicaGroup.java17
-rwxr-xr-xjava/src/IceGrid/TreeNode/ReplicaGroupEditor.java6
-rwxr-xr-xjava/src/IceGrid/TreeNode/Root.java22
-rwxr-xr-xjava/src/IceGrid/TreeNode/Server.java94
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServerEditor.java9
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServerInstanceEditor.java11
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServerSubEditor.java10
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServerTemplate.java13
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServerTemplateEditor.java6
-rwxr-xr-xjava/src/IceGrid/TreeNode/Service.java12
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServiceEditor.java5
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServiceInstanceEditor.java7
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServiceSubEditor.java4
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServiceTemplate.java11
-rwxr-xr-xjava/src/IceGrid/TreeNode/ServiceTemplateEditor.java6
-rwxr-xr-xjava/src/IceGrid/TreeNode/TemplateEditor.java5
35 files changed, 904 insertions, 562 deletions
diff --git a/java/src/IceGrid/MainPane.java b/java/src/IceGrid/MainPane.java
index ae61cbee9d4..c2e09a2877c 100755
--- a/java/src/IceGrid/MainPane.java
+++ b/java/src/IceGrid/MainPane.java
@@ -67,7 +67,7 @@ public class MainPane extends JSplitPane
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
- Dimension d = _rightPane.getSize(null);
+ Dimension d = _model.getPropertiesFrame().getSize(null);
//
// Keep the aspect ratio and make the image fill all the space
@@ -138,7 +138,8 @@ public class MainPane extends JSplitPane
{
if(_model.displayEnabled())
{
- displayWelcomePanel();
+ _model.show(_model.getRoot());
+ // displayWelcomePanel();
}
}
else
@@ -156,11 +157,7 @@ public class MainPane extends JSplitPane
//
assert newNode.getParent() != null;
_previousNode = newNode;
- if(_model.displayEnabled())
- {
- _model.showActions(newNode);
- newNode.displayProperties();
- }
+ _model.show(newNode);
}
}
private CommonBase _previousNode;
@@ -225,83 +222,34 @@ public class MainPane extends JSplitPane
//
// Right pane
//
- _rightPane = new SimpleInternalFrame("");
-
+ JPanel rightPane = new JPanel();
+ rightPane.setLayout(new BoxLayout(rightPane, BoxLayout.Y_AXIS));
+ rightPane.setBorder(Borders.EMPTY_BORDER);
+ rightPane.add(_model.getCurrentStatusFrame());
+ rightPane.add(Box.createRigidArea(new Dimension(0, 5)));
+ rightPane.add(_model.getPropertiesFrame());
+
+ //_model.show(_model.getRoot());
+
//
// Welcome panel
//
- _welcomePanel = new WelcomePanel();
- // _welcomePanel.setBackground(Color.RED);
- displayWelcomePanel();
-
- _model.setPropertiesFrame(_rightPane);
+ //_welcomePanel = new WelcomePanel();
+ //displayWelcomePanel();
setLeftComponent(leftPane);
- setRightComponent(_rightPane);
- }
-
- //
- // Adapted from JGoodies SimpleInternalFrame
- //
- private static class ShadowBorder extends AbstractBorder
- {
- private static final Insets INSETS = new Insets(1, 1, 3, 3);
- public Insets getBorderInsets(Component c) { return INSETS; }
-
- public void paintBorder(Component c, Graphics g,
- int x, int y, int w, int h)
- {
- Color shadow = UIManager.getColor("controlShadow");
- if (shadow == null)
- {
- shadow = Color.GRAY;
- }
- Color lightShadow = new Color(shadow.getRed(),
- shadow.getGreen(),
- shadow.getBlue(),
- 170);
- Color lighterShadow = new Color(shadow.getRed(),
- shadow.getGreen(),
- shadow.getBlue(),
- 70);
- g.translate(x, y);
-
- g.setColor(shadow);
-
- int tabAdjustment = 24;
-
- // g.fillRect(0, 0, w - 3, 1);
- g.fillRect(0, 0 + tabAdjustment, 1, h - 3 - tabAdjustment);
- g.fillRect(w - 3, 1 + tabAdjustment , 1, h - 3 - tabAdjustment);
- g.fillRect(1, h - 3, w - 3, 1);
- // Shadow line 1
- g.setColor(lightShadow);
- g.fillRect(w - 3, 0 + tabAdjustment, 1, 1);
- g.fillRect(0, h - 3, 1, 1);
- g.fillRect(w - 2, 1 + tabAdjustment, 1, h - 3 - tabAdjustment);
- g.fillRect(1, h - 2, w - 3, 1);
- // Shadow line2
- g.setColor(lighterShadow);
- g.fillRect(w - 2, 0 + tabAdjustment, 1, 1);
- g.fillRect(0, h - 2, 1, 1);
- g.fillRect(w-2, h - 2, 1, 1);
- g.fillRect(w - 1, 1 + tabAdjustment, 1, h - 2 - tabAdjustment);
- g.fillRect(1, h - 1, w - 2, 1);
- g.translate(-x, -y);
- }
+ setRightComponent(rightPane);
}
private void displayWelcomePanel()
{
- _rightPane.setTitle(" ");
- _rightPane.setContent(_welcomePanel);
- _rightPane.validate();
- _rightPane.repaint();
+ SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
+ propertiesFrame.setContent(_welcomePanel);
+ propertiesFrame.validate();
+ propertiesFrame.repaint();
}
private Model _model;
- private SimpleInternalFrame _rightPane;
-
private JPanel _welcomePanel;
}
diff --git a/java/src/IceGrid/Model.java b/java/src/IceGrid/Model.java
index 71874c40952..62db008e1e3 100755
--- a/java/src/IceGrid/Model.java
+++ b/java/src/IceGrid/Model.java
@@ -13,6 +13,7 @@ import java.util.prefs.BackingStoreException;
import java.awt.BorderLayout;
import java.awt.Cursor;
+import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Rectangle;
import java.awt.Container;
@@ -27,6 +28,7 @@ import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
+import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
@@ -48,6 +50,7 @@ import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import IceGrid.TreeNode.Application;
import IceGrid.TreeNode.CommonBase;
+import IceGrid.TreeNode.Editor;
import IceGrid.TreeNode.Root;
//
@@ -186,6 +189,7 @@ public class Model
JMenu viewMenu = new JMenu("View");
viewMenu.setMnemonic(java.awt.event.KeyEvent.VK_V);
add(viewMenu);
+ viewMenu.add(_showVarsMenuItem);
viewMenu.add(_substituteMenuItem);
//
@@ -264,16 +268,11 @@ public class Model
addSeparator();
add(_actions[CommonBase.DELETE]);
addSeparator();
- add(_substituteTool );
+ add(_showVarsTool);
+ add(_substituteTool);
}
}
-
-
-
-
-
-
-
+
//
// All Model's methods run in the UI thread
//
@@ -403,13 +402,10 @@ public class Model
public void refreshDisplay()
{
- if(_displayEnabled)
+ CommonBase currentNode = getSelectedNode();
+ if(currentNode != null)
{
- CommonBase currentNode = getSelectedNode();
- if(currentNode != null)
- {
- currentNode.displayProperties();
- }
+ show(currentNode);
}
}
@@ -434,12 +430,9 @@ public class Model
{
CommonBase newNode = findNewNode(path);
_tree.setSelectionPath(newNode.getPath());
- newNode.displayProperties();
}
}
-
-
public boolean canUpdate()
{
if(isUpdateInProgress())
@@ -673,21 +666,29 @@ public class Model
void nodeUp(NodeDynamicInfo updatedInfo)
{
_root.nodeUp(updatedInfo);
+ showActions();
+ refreshCurrentStatus();
}
void nodeDown(String node)
{
_root.nodeDown(node);
+ showActions();
+ refreshCurrentStatus();
}
void updateServer(String node, ServerDynamicInfo updatedInfo)
{
_root.updateServer(node, updatedInfo);
+ showActions();
+ refreshCurrentStatus();
}
void updateAdapter(String node, AdapterDynamicInfo updatedInfo)
{
_root.updateAdapter(node, updatedInfo);
+ showActions();
+ refreshCurrentStatus();
}
@@ -791,31 +792,36 @@ public class Model
return true;
}
- public void toggleSubstitute()
+ private void showVars()
{
- _substitute = !_substitute;
+ substitute(false);
+ }
- //
- // Synchronize the other button
- //
- if(_substituteMenuItem.isSelected() != _substitute)
- {
- _substituteMenuItem.setSelected(_substitute);
- }
- if(_substituteTool.isSelected() != _substitute)
- {
- _substituteTool.setSelected(_substitute);
- }
-
- CommonBase node = (CommonBase)_tree.getLastSelectedPathComponent();
- if(node != null)
+ private void substituteVars()
+ {
+ substitute(true);
+ }
+
+ private void substitute(boolean newValue)
+ {
+ if(_substitute != newValue)
{
- node.displayProperties();
+ _substitute = newValue;
+
+ if(_substitute)
+ {
+ _substituteMenuItem.setSelected(true);
+ _substituteTool.setSelected(true);
+ }
+ else
+ {
+ _showVarsMenuItem.setSelected(true);
+ _showVarsTool.setSelected(true);
+ }
+ refreshDisplay();
}
}
-
-
public boolean substitute()
{
return _substitute;
@@ -848,14 +854,14 @@ public class Model
return _tree;
}
- public void setPropertiesFrame(SimpleInternalFrame frame)
+ public SimpleInternalFrame getPropertiesFrame()
{
- _propertiesFrame = frame;
+ return _propertiesFrame;
}
- public SimpleInternalFrame getPropertiesFrame()
+ public SimpleInternalFrame getCurrentStatusFrame()
{
- return _propertiesFrame;
+ return _currentStatusFrame;
}
public JFrame getMainFrame()
@@ -874,6 +880,17 @@ public class Model
_root = new Root(this);
_treeModel = new TreeModelI(_root);
+ //
+ // Fixed height for current status frame
+ //
+ Dimension prefSize = new Dimension(0, 160);
+ Dimension maxSize = new Dimension(Short.MAX_VALUE, 160);
+ _currentStatusFrame.setMinimumSize(prefSize);
+ _currentStatusFrame.setPreferredSize(prefSize);
+ _currentStatusFrame.setMaximumSize(maxSize);
+ _currentStatusFrame.getTitleLabel().setEnabled(false);
+ _propertiesFrame.getTitleLabel().setEnabled(false);
+
final int MENU_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
//
@@ -1085,23 +1102,53 @@ public class Model
_actions[CommonBase.DELETE].putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
_actions[CommonBase.DELETE].putValue(Action.SHORT_DESCRIPTION, "Delete");
- _actions[CommonBase.SUBSTITUTE_VARS] = new
+ _actions[CommonBase.SHOW_VARS] = new
AbstractAction("${}")
{
public void actionPerformed(ActionEvent e)
{
- _actionsTarget.substituteVars();
- putValue(Action.NAME, _substitute ? "abc" : "${}");
+ showVars();
}
};
+ _actions[CommonBase.SHOW_VARS].putValue(
+ Action.SHORT_DESCRIPTION,
+ "Show variables and parameters in the Properties pane");
+
+
+ _actions[CommonBase.SUBSTITUTE_VARS] = new
+ AbstractAction("abc")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ substituteVars();
+ }
+ };
+
_actions[CommonBase.SUBSTITUTE_VARS].putValue(
Action.SHORT_DESCRIPTION,
"Substitute variables and parameters with their values in the Properties pane");
+
+
+ _showVarsMenuItem = new
+ JCheckBoxMenuItem(_actions[CommonBase.SHOW_VARS]);
+ _showVarsTool = new
+ JToggleButton(_actions[CommonBase.SHOW_VARS]);
+
_substituteMenuItem = new
JCheckBoxMenuItem(_actions[CommonBase.SUBSTITUTE_VARS]);
_substituteTool = new
JToggleButton(_actions[CommonBase.SUBSTITUTE_VARS]);
-
+
+ ButtonGroup group = new ButtonGroup();
+ group.add(_showVarsMenuItem);
+ group.add(_substituteMenuItem);
+ group = new ButtonGroup();
+ group.add(_showVarsTool);
+ group.add(_substituteTool);
+
+ _showVarsMenuItem.setSelected(true);
+ _showVarsTool.setSelected(true);
+
_actions[CommonBase.MOVE_UP] = new AbstractAction("Move up")
{
public void actionPerformed(ActionEvent e)
@@ -1157,7 +1204,7 @@ public class Model
}
};
_actions[CommonBase.APPLICATION_INSTALL_DISTRIBUTION] =
- new AbstractAction("Install or refresh distribution")
+ new AbstractAction("Patch")
{
public void actionPerformed(ActionEvent e)
{
@@ -1165,7 +1212,7 @@ public class Model
}
};
_actions[CommonBase.SERVER_INSTALL_DISTRIBUTION] =
- new AbstractAction("Install or refresh distribution")
+ new AbstractAction("Patch")
{
public void actionPerformed(ActionEvent e)
{
@@ -1174,6 +1221,71 @@ public class Model
};
}
+ void show(CommonBase node)
+ {
+ if(_displayEnabled)
+ {
+ showActions(node);
+
+ _currentEditor = node.getEditor();
+
+ Ice.StringHolder title = new Ice.StringHolder();
+ Component currentStatus = _currentEditor.getCurrentStatus(title);
+ if(title.value == null)
+ {
+ title.value = "Current status";
+ }
+ _currentStatusFrame.setTitle(title.value);
+
+ if(currentStatus == null)
+ {
+ _currentStatusFrame.setToolBar(null);
+ Component oldContent = _currentStatusFrame.getContent();
+ if(oldContent != null)
+ {
+ _currentStatusFrame.remove(oldContent);
+ }
+ _currentStatusFrame.getTitleLabel().setEnabled(false);
+ }
+ else
+ {
+ _currentStatusFrame.setToolBar(
+ _currentEditor.getCurrentStatusToolBar());
+ _currentStatusFrame.setContent(currentStatus);
+ _currentStatusFrame.getTitleLabel().setEnabled(true);
+ }
+ _currentStatusFrame.validate();
+ _currentStatusFrame.repaint();
+
+ Component currentProperties = _currentEditor.getProperties();
+
+ if(currentProperties == null)
+ {
+ Component oldContent = _propertiesFrame.getContent();
+ if(oldContent != null)
+ {
+ _propertiesFrame.remove(oldContent);
+ }
+ _propertiesFrame.getTitleLabel().setEnabled(false);
+ }
+ else
+ {
+ _propertiesFrame.setContent(currentProperties);
+ _propertiesFrame.getTitleLabel().setEnabled(true);
+ }
+ _propertiesFrame.validate();
+ _propertiesFrame.repaint();
+ }
+ }
+
+ void refreshCurrentStatus()
+ {
+ if(_currentEditor != null)
+ {
+ _currentEditor.refreshCurrentStatus();
+ }
+ }
+
//
// New application action
//
@@ -1422,11 +1534,16 @@ public class Model
private boolean _displayEnabled = true;
- private SimpleInternalFrame _propertiesFrame;
-
+ private SimpleInternalFrame _currentStatusFrame
+ = new SimpleInternalFrame("Current status");
+ private SimpleInternalFrame _propertiesFrame
+ = new SimpleInternalFrame("Properties");
+
private JFrame _mainFrame;
private SessionKeeper _sessionKeeper;
+ private Editor _currentEditor;
+
private Object _clipboard;
//
@@ -1441,8 +1558,11 @@ public class Model
private Action _about;
private Action[] _actions;
+
+ private JToggleButton _showVarsTool;
private JToggleButton _substituteTool;
private JCheckBoxMenuItem _substituteMenuItem;
+ private JCheckBoxMenuItem _showVarsMenuItem;
private CommonBase _actionsTarget;
diff --git a/java/src/IceGrid/PlasticTreeUI.java b/java/src/IceGrid/PlasticTreeUI.java
deleted file mode 100755
index 7752ac0e3ef..00000000000
--- a/java/src/IceGrid/PlasticTreeUI.java
+++ /dev/null
@@ -1,165 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-package IceGrid;
-//
-// This is JGoodies PlasticTreeUI modified to work-around bug 4833524
-// (the MacOS CTRL+click bug):
-// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4833524
-//
-
-/*
- * Copyright (c) 2001-2005 JGoodies Karsten Lentzsch. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * o Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * o Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * o Neither the name of JGoodies Karsten Lentzsch nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// package com.jgoodies.looks.plastic;
-
-import java.awt.Component;
-import java.awt.Graphics;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.Icon;
-import javax.swing.JComponent;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicTreeUI;
-
-import com.jgoodies.looks.Options;
-
-/**
- * The JGoodies Plastic Look&amp;Feel implementation of <code>TreeUI</code>.
- * It provides two line styles: angled dashed lines, or no lines at all.
- * By default, lines are drawn.
- * <p>
- * You can change the line style by setting a client property.
- * The property key and values are a subset of the values used
- * by the Metal L&amp;F tree. To hide lines use one of the following:
- * <pre>
- * JTree tree1 = new JTree();
- * tree1.putClientProperty("JTree.lineStyle", "None");
- *
- * JTree tree2 = new JTree();
- * tree1.putClientProperty(Options.TREE_LINE_STYLE_KEY,
- * Options.TREE_LINE_STYLE_NONE_VALUE);
- * </pre>
- *
- * Although lines are shown by default, you could code:
- * <pre>
- * JTree tree1 = new JTree();
- * tree1.putClientProperty("JTree.lineStyle", "Angled");
- *
- * JTree tree2 = new JTree();
- * tree1.putClientProperty(Options.TREE_LINE_STYLE_KEY,
- * Options.TREE_LINE_STYLE_ANGLED_VALUE);
- * </pre>
- *
- * @author Karsten Lentzsch
- * @version $Revision$
- */
-
-public final class PlasticTreeUI extends BasicTreeUI {
-
- private boolean linesEnabled = true;
- private PropertyChangeListener lineStyleHandler;
-
-
- public static ComponentUI createUI(JComponent b) {
- return new PlasticTreeUI();
- }
-
- // Installation ***********************************************************
-
- public void installUI(JComponent c) {
- super.installUI(c);
- updateLineStyle(c.getClientProperty(Options.TREE_LINE_STYLE_KEY));
- lineStyleHandler = new LineStyleHandler();
- c.addPropertyChangeListener(lineStyleHandler);
- }
-
- public void uninstallUI(JComponent c) {
- c.removePropertyChangeListener(lineStyleHandler);
- super.uninstallUI(c);
- }
-
-
- // Painting ***************************************************************
-
- protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom) {
- if (linesEnabled) {
- drawDashedVerticalLine(g, x, top, bottom);
- }
- }
-
- protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right) {
- if (linesEnabled) {
- drawDashedHorizontalLine(g, y, left, right);
- }
- }
-
- // Draws the icon centered at (x,y)
- protected void drawCentered(Component c, Graphics graphics, Icon icon, int x, int y) {
- icon.paintIcon(
- c,
- graphics,
- x - icon.getIconWidth() / 2 - 1,
- y - icon.getIconHeight() / 2);
- }
-
- // Helper Code ************************************************************
-
- private void updateLineStyle(Object lineStyle) {
- linesEnabled = !Options.TREE_LINE_STYLE_NONE_VALUE.equals(lineStyle);
- }
-
- // Listens for changes of the line style property
- private class LineStyleHandler implements PropertyChangeListener {
- public void propertyChange(PropertyChangeEvent e) {
- String name = e.getPropertyName();
- Object value = e.getNewValue();
- if (name.equals(Options.TREE_LINE_STYLE_KEY)) {
- updateLineStyle(value);
- }
- }
- }
-
- //
- // Use suggested work-around for Java bug #4833524
- //
- protected boolean isToggleSelectionEvent(java.awt.event.MouseEvent event)
- {
- return (javax.swing.SwingUtilities.isLeftMouseButton(event) &&
- event.isControlDown() && !event.isPopupTrigger());
- }
-
-}
diff --git a/java/src/IceGrid/SimpleInternalFrame.java b/java/src/IceGrid/SimpleInternalFrame.java
index f5ef7cee9c3..456507c67ba 100755
--- a/java/src/IceGrid/SimpleInternalFrame.java
+++ b/java/src/IceGrid/SimpleInternalFrame.java
@@ -170,6 +170,11 @@ public class SimpleInternalFrame extends JPanel {
return titleLabel.getText();
}
+ public JLabel getTitleLabel() {
+ return titleLabel;
+ }
+
+
/**
* Sets a new title text.
@@ -285,6 +290,13 @@ public class SimpleInternalFrame extends JPanel {
gradientPanel.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 1));
headerPanel = new JPanel(new BorderLayout());
+
+ Dimension prefSize = new Dimension(0, 24);
+ Dimension maxSize = new Dimension(Short.MAX_VALUE, 24);
+ headerPanel.setMinimumSize(prefSize);
+ headerPanel.setPreferredSize(prefSize);
+ headerPanel.setMaximumSize(maxSize);
+
headerPanel.add(gradientPanel, BorderLayout.CENTER);
setToolBar(bar);
headerPanel.setBorder(new RaisedHeaderBorder());
diff --git a/java/src/IceGrid/TreeNode/AbstractServerEditor.java b/java/src/IceGrid/TreeNode/AbstractServerEditor.java
index 3345b7d4692..9c23957f166 100755
--- a/java/src/IceGrid/TreeNode/AbstractServerEditor.java
+++ b/java/src/IceGrid/TreeNode/AbstractServerEditor.java
@@ -9,10 +9,20 @@
package IceGrid.TreeNode;
import javax.swing.JOptionPane;
+import javax.swing.JTextField;
+import javax.swing.JToolBar;
+
+import com.jgoodies.looks.Options;
+import com.jgoodies.looks.HeaderStyle;
+import com.jgoodies.looks.BorderStyle;
+import com.jgoodies.looks.plastic.PlasticLookAndFeel;
+
+import com.jgoodies.forms.builder.DefaultFormBuilder;
import IceGrid.Model;
import IceGrid.ServerDescriptor;
import IceGrid.ServerInstanceDescriptor;
+import IceGrid.ServerState;
//
// Base class for ServerEditor and ServerInstanceEditor
@@ -23,6 +33,59 @@ abstract class AbstractServerEditor extends Editor
abstract protected void writeDescriptor();
abstract protected boolean isSimpleUpdate();
+ private class ToolBar extends JToolBar
+ {
+ private ToolBar()
+ {
+ putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.SINGLE);
+ putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR);
+ setFloatable(false);
+ putClientProperty("JToolBar.isRollover", Boolean.TRUE);
+
+ add(_model.getActions()[CommonBase.START]);
+ add(_model.getActions()[CommonBase.STOP]);
+ addSeparator();
+ add(_model.getActions()[CommonBase.ENABLE]);
+ add(_model.getActions()[CommonBase.DISABLE]);
+ }
+ }
+
+
+ public JToolBar getCurrentStatusToolBar()
+ {
+ if(_toolBar == null)
+ {
+ _toolBar = new ToolBar();
+ }
+ return _toolBar;
+ }
+
+ public void refreshCurrentStatus()
+ {
+ Server server = (Server)_target;
+
+ ServerState state = server.getState();
+ if(state == null)
+ {
+ _currentState.setText("Unknown");
+ _currentPid.setText("");
+ }
+ else
+ {
+ _currentState.setText(state.toString());
+ int pid = server.getPid();
+ if(pid == 0)
+ {
+ _currentPid.setText("");
+ }
+ else
+ {
+ _currentPid.setText(Integer.toString(pid));
+ }
+ }
+ }
+
+
protected void applyUpdate()
{
Server server = (Server)_target;
@@ -173,7 +236,30 @@ abstract class AbstractServerEditor extends Editor
}
}
+
+ void appendCurrentStatus(DefaultFormBuilder builder)
+ {
+ builder.append("State");
+ builder.append(_currentState, 3);
+ builder.nextLine();
+
+ builder.append("Process ID");
+ builder.append(_currentPid, 3);
+ builder.nextLine();
+ }
+
+ protected AbstractServerEditor(Model model)
+ {
+ super(true, true);
+ _model = model;
+
+ _currentState.setEditable(false);
+ _currentPid.setEditable(false);
+ }
+
+ private JTextField _currentState = new JTextField(20);
+ private JTextField _currentPid = new JTextField(20);
- protected AbstractServerEditor()
- {}
+ private JToolBar _toolBar;
+ private Model _model;
}
diff --git a/java/src/IceGrid/TreeNode/Adapter.java b/java/src/IceGrid/TreeNode/Adapter.java
index 7cf6e274204..d0200c3ec5f 100755
--- a/java/src/IceGrid/TreeNode/Adapter.java
+++ b/java/src/IceGrid/TreeNode/Adapter.java
@@ -44,6 +44,7 @@ class Adapter extends Leaf
if(_resolver != null && !_ephemeral)
{
+ actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
}
return actions;
@@ -87,21 +88,14 @@ class Adapter extends Leaf
tree, value, sel, expanded, leaf, row, hasFocus);
}
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
-
- propertiesFrame.setTitle("Properties for " + _id);
if(_editor == null)
{
_editor = new AdapterEditor(_model.getMainFrame());
}
-
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
public boolean destroy()
@@ -270,7 +264,7 @@ class Adapter extends Leaf
{
if(proxy == null)
{
- _currentEndpoints = "";
+ _currentEndpoints = null;
_toolTip = "Inactive";
}
else
@@ -285,7 +279,7 @@ class Adapter extends Leaf
{
_currentEndpoints = str.substring(index + 1);
}
- _toolTip = "Current endpoints: " + _currentEndpoints;
+ _toolTip = "Published endpoints: " + _currentEndpoints;
}
}
diff --git a/java/src/IceGrid/TreeNode/AdapterEditor.java b/java/src/IceGrid/TreeNode/AdapterEditor.java
index 84c6c423a72..de24fdbf8d2 100755
--- a/java/src/IceGrid/TreeNode/AdapterEditor.java
+++ b/java/src/IceGrid/TreeNode/AdapterEditor.java
@@ -38,8 +38,13 @@ class AdapterEditor extends ListElementEditor
{
AdapterEditor(JFrame parentFrame)
{
+ super(true);
+
_objects.setEditable(false);
+
+ _currentStatus.setEditable(false);
_currentEndpoints.setEditable(false);
+
//
// Create buttons
@@ -95,7 +100,7 @@ class AdapterEditor extends ListElementEditor
public void actionPerformed(ActionEvent e)
{
java.util.Map result = _objectsDialog.show(_objectsMap,
- _panel);
+ getProperties());
if(result != null)
{
updated();
@@ -209,7 +214,18 @@ class AdapterEditor extends ListElementEditor
&& descriptor.id.equals(getIdAsString());
}
- void append(DefaultFormBuilder builder)
+ void appendCurrentStatus(DefaultFormBuilder builder)
+ {
+ builder.append("Status" );
+ builder.append(_currentStatus, 3);
+ builder.nextLine();
+
+ builder.append("Published Endpoints" );
+ builder.append(_currentEndpoints, 3);
+ builder.nextLine();
+ }
+
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Adapter Name" );
builder.append(_name, 3);
@@ -243,18 +259,13 @@ class AdapterEditor extends ListElementEditor
builder.append("", _waitForActivation);
builder.nextLine();
- builder.appendSeparator("Endpoints");
- builder.append("Definition" );
+ builder.append("Endpoints" );
builder.append(_endpoints, 3);
builder.nextLine();
- builder.append("Published" );
+ builder.append("Published Endpoints" );
builder.append(_publishedEndpoints, 3);
builder.nextLine();
-
- builder.append("Current Value" );
- builder.append(_currentEndpoints, 3);
- builder.nextLine();
}
void postUpdate()
@@ -466,8 +477,6 @@ class AdapterEditor extends ListElementEditor
}
_publishedEndpoints.setEnabled(isEditable);
_publishedEndpoints.setEditable(isEditable);
-
- _currentEndpoints.setText(adapter.getCurrentEndpoints());
//
// Objects
@@ -481,12 +490,33 @@ class AdapterEditor extends ListElementEditor
_waitForActivation.setSelected(descriptor.waitForActivation);
_waitForActivation.setEnabled(isEditable);
-
+
+ refreshCurrentStatus();
+
_applyButton.setEnabled(adapter.isEphemeral());
_discardButton.setEnabled(adapter.isEphemeral());
detectUpdates(true);
}
+ public void refreshCurrentStatus()
+ {
+ Adapter adapter = getAdapter();
+
+ String currentEndpoints = adapter.getCurrentEndpoints();
+ boolean active = (currentEndpoints != null);
+
+ if(currentEndpoints == null)
+ {
+ _currentStatus.setText("Inactive");
+ _currentEndpoints.setText("");
+ }
+ else
+ {
+ _currentStatus.setText("Active");
+ _currentEndpoints.setText(currentEndpoints);
+ }
+ }
+
Adapter getAdapter()
{
return (Adapter)_target;
@@ -532,6 +562,8 @@ class AdapterEditor extends ListElementEditor
private JTextField _endpoints = new JTextField(20);
private JComboBox _publishedEndpoints = new JComboBox(
new Object[]{PUBLISH_ACTUAL});
+
+ private JTextField _currentStatus = new JTextField(20);
private JTextField _currentEndpoints = new JTextField(20);
private JCheckBox _registerProcess;
diff --git a/java/src/IceGrid/TreeNode/Application.java b/java/src/IceGrid/TreeNode/Application.java
index 2ea54440b91..bfc79e2b5fb 100755
--- a/java/src/IceGrid/TreeNode/Application.java
+++ b/java/src/IceGrid/TreeNode/Application.java
@@ -11,12 +11,16 @@ package IceGrid.TreeNode;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+
+import IceGrid.AMI_Admin_patchApplication;
import IceGrid.AdapterDynamicInfo;
import IceGrid.ApplicationDescriptor;
import IceGrid.ApplicationUpdateDescriptor;
import IceGrid.DistributionDescriptor;
import IceGrid.Model;
+import IceGrid.NodeInfo;
import IceGrid.ServerDynamicInfo;
import IceGrid.ServerState;
import IceGrid.SimpleInternalFrame;
@@ -66,6 +70,7 @@ public class Application extends EditableParent
if(!_ephemeral)
{
+ actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
}
@@ -139,6 +144,118 @@ public class Application extends EditableParent
{
_serviceTemplates.newTemplateService();
}
+
+ public void applicationInstallDistribution()
+ {
+ int shutdown = JOptionPane.showConfirmDialog(
+ _model.getMainFrame(),
+ "You are about to install or refresh"
+ + " the distribution of your application onto this node.\n"
+ + " Do you want shut down all servers affected by this update?",
+ "Patch Confirmation",
+ JOptionPane.YES_NO_CANCEL_OPTION);
+
+ if(shutdown == JOptionPane.CANCEL_OPTION)
+ {
+ //
+ // Recompute actions in case this comes from popup menu
+ //
+ _model.showActions(_model.getSelectedNode());
+
+ return;
+ }
+
+ final String prefix = "Patching application '" + _id + "'...";
+ _model.getStatusBar().setText(prefix);
+
+ AMI_Admin_patchApplication cb = new AMI_Admin_patchApplication()
+ {
+ //
+ // Called by another thread!
+ //
+ public void ice_response()
+ {
+ amiSuccess(prefix);
+ }
+
+ public void ice_exception(Ice.UserException e)
+ {
+ amiFailure(prefix, "Failed to patch " + _id, e);
+ }
+
+ public void ice_exception(Ice.LocalException e)
+ {
+ amiFailure(prefix, "Failed to patch " + _id, e.toString());
+ }
+ };
+
+ try
+ {
+ _model.getAdmin().patchApplication_async(cb, _id,
+ shutdown == JOptionPane.YES_OPTION);
+ }
+ catch(Ice.LocalException e)
+ {
+ failure(prefix, "Failed to patch " + _id, e.toString());
+ }
+
+ //
+ // Recompute actions in case this comes from popup menu
+ //
+ _model.showActions(_model.getSelectedNode());
+ }
+
+
+ private void amiSuccess(final String prefix)
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _model.getStatusBar().setText(prefix + "done.");
+ }
+ });
+ }
+
+ private void amiFailure(String prefix, String title, Ice.UserException e)
+ {
+ if(e instanceof IceGrid.ApplicationNotExistException)
+ {
+ amiFailure(prefix, title, "This application was not registered with the IceGrid Registry");
+ }
+ else if(e instanceof IceGrid.PatchException)
+ {
+ IceGrid.PatchException pe = (IceGrid.PatchException)e;
+ amiFailure(prefix, title, pe.reason);
+ }
+ else
+ {
+ amiFailure(prefix, title, e.toString());
+ }
+ }
+
+ private void amiFailure(final String prefix, final String title, final String message)
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ failure(prefix, title, message);
+ }
+ });
+ }
+
+ private void failure(String prefix, String title, String message)
+ {
+ _model.getStatusBar().setText(prefix + "failed!");
+
+ JOptionPane.showMessageDialog(
+ _model.getMainFrame(),
+ message,
+ title,
+ JOptionPane.ERROR_MESSAGE);
+ }
+
public ApplicationUpdateDescriptor createUpdateDescriptor()
{
@@ -237,22 +354,14 @@ public class Application extends EditableParent
return _descriptor;
}
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
-
- propertiesFrame.setTitle("Properties for " + _id);
if(_editor == null)
{
_editor = new ApplicationEditor(_model.getMainFrame());
}
-
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
-
+ return _editor;
}
public boolean isEphemeral()
@@ -540,9 +649,9 @@ public class Application extends EditableParent
return _descriptor.variables;
}
- void nodeUp(String nodeName)
+ void nodeUp(String nodeName, NodeInfo staticInfo)
{
- _nodes.nodeUp(nodeName);
+ _nodes.nodeUp(nodeName, staticInfo);
}
void nodeDown(String nodeName)
diff --git a/java/src/IceGrid/TreeNode/ApplicationEditor.java b/java/src/IceGrid/TreeNode/ApplicationEditor.java
index 010f9f78535..f3fccb16753 100755
--- a/java/src/IceGrid/TreeNode/ApplicationEditor.java
+++ b/java/src/IceGrid/TreeNode/ApplicationEditor.java
@@ -141,6 +141,7 @@ class ApplicationEditor extends Editor
ApplicationEditor(JFrame parentFrame)
{
+ super(false, true);
_name.getDocument().addDocumentListener(_updateListener);
_description.getDocument().addDocumentListener(_updateListener);
_variables.setEditable(false);
@@ -156,7 +157,7 @@ class ApplicationEditor extends Editor
public void actionPerformed(ActionEvent e)
{
java.util.TreeMap result = _variablesDialog.show(_variablesMap,
- getPanel());
+ getProperties());
if(result != null)
{
updated();
@@ -187,7 +188,7 @@ class ApplicationEditor extends Editor
public void actionPerformed(ActionEvent e)
{
java.util.LinkedList result = _distribDirsDialog.show(
- _distribDirsList, getPanel());
+ _distribDirsList, getProperties());
if(result != null)
{
updated();
@@ -200,7 +201,7 @@ class ApplicationEditor extends Editor
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Name");
builder.append(_name, 3);
diff --git a/java/src/IceGrid/TreeNode/CommonBase.java b/java/src/IceGrid/TreeNode/CommonBase.java
index 1e9b96c246d..7c9bb409faf 100755
--- a/java/src/IceGrid/TreeNode/CommonBase.java
+++ b/java/src/IceGrid/TreeNode/CommonBase.java
@@ -60,7 +60,7 @@ public interface CommonBase extends TreeCellRenderer
//
TreePath getPath();
- void displayProperties();
+ Editor getEditor();
//
// Get properties
@@ -128,21 +128,22 @@ public interface CommonBase extends TreeCellRenderer
static final int PASTE = 13;
static final int DELETE = 14;
- static final int SUBSTITUTE_VARS = 15;
+ static final int SHOW_VARS = 15;
+ static final int SUBSTITUTE_VARS = 16;
- static final int MOVE_UP = 16;
- static final int MOVE_DOWN =17;
- static final int START = 18;
- static final int STOP = 19;
- static final int ENABLE = 20;
- static final int DISABLE = 21;
+ static final int MOVE_UP = 17;
+ static final int MOVE_DOWN =18;
+ static final int START = 19;
+ static final int STOP = 20;
+ static final int ENABLE = 21;
+ static final int DISABLE = 22;
- static final int SHUTDOWN_NODE = 22;
+ static final int SHUTDOWN_NODE = 23;
- static final int APPLICATION_INSTALL_DISTRIBUTION = 23;
- static final int SERVER_INSTALL_DISTRIBUTION = 24;
+ static final int APPLICATION_INSTALL_DISTRIBUTION = 24;
+ static final int SERVER_INSTALL_DISTRIBUTION = 25;
- static public final int ACTION_COUNT = 25;
+ static public final int ACTION_COUNT = 26;
boolean[] getAvailableActions();
@@ -162,9 +163,7 @@ public interface CommonBase extends TreeCellRenderer
void copy();
void paste();
void delete();
-
- void substituteVars();
-
+
void moveUp();
void moveDown();
void start();
diff --git a/java/src/IceGrid/TreeNode/CommonBaseI.java b/java/src/IceGrid/TreeNode/CommonBaseI.java
index 34ffc5c066d..6ad65ba4137 100755
--- a/java/src/IceGrid/TreeNode/CommonBaseI.java
+++ b/java/src/IceGrid/TreeNode/CommonBaseI.java
@@ -18,10 +18,6 @@ import javax.swing.event.PopupMenuListener;
import javax.swing.event.TreeModelEvent;
import javax.swing.tree.TreePath;
-import IceGrid.SimpleInternalFrame;
-import com.jgoodies.forms.factories.Borders;
-import com.jgoodies.forms.factories.DefaultComponentFactory;
-
import IceGrid.Model;
import IceGrid.Utils;
@@ -102,22 +98,13 @@ abstract class CommonBaseI implements CommonBase
return false;
}
- public void displayProperties()
+ public Editor getEditor()
{
- if(_panel == null)
+ if(_editor == null)
{
- JLabel label = DefaultComponentFactory.getInstance().createTitle("This element has no property");
- _panel = new JPanel();
- _panel.add(label);
- _panel.setBorder(Borders.DIALOG_BORDER);
+ _editor = new Editor(false, false);
}
-
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
- propertiesFrame.setTitle("Properties");
- propertiesFrame.setContent(_panel);
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
public Component getTreeCellRendererComponent(
@@ -240,10 +227,6 @@ abstract class CommonBaseI implements CommonBase
}
}
}
- public void substituteVars()
- {
- _model.toggleSubstitute();
- }
public void moveUp()
{
assert false;
@@ -403,7 +386,7 @@ abstract class CommonBaseI implements CommonBase
protected Model _model;
//
- // The default panel
+ // The default Editor
//
- static protected JPanel _panel;
+ static private Editor _editor;
}
diff --git a/java/src/IceGrid/TreeNode/CommunicatorSubEditor.java b/java/src/IceGrid/TreeNode/CommunicatorSubEditor.java
index 4ff6dea69e7..e26603e7b3e 100755
--- a/java/src/IceGrid/TreeNode/CommunicatorSubEditor.java
+++ b/java/src/IceGrid/TreeNode/CommunicatorSubEditor.java
@@ -48,7 +48,7 @@ class CommunicatorSubEditor
{
java.util.Map result =
_propertiesDialog.show(_propertiesMap,
- _mainEditor.getPanel());
+ _mainEditor.getProperties());
if(result != null)
{
_mainEditor.updated();
@@ -64,7 +64,7 @@ class CommunicatorSubEditor
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Description");
builder.nextLine();
diff --git a/java/src/IceGrid/TreeNode/DbEnv.java b/java/src/IceGrid/TreeNode/DbEnv.java
index 736ba83dd92..30659f3014a 100755
--- a/java/src/IceGrid/TreeNode/DbEnv.java
+++ b/java/src/IceGrid/TreeNode/DbEnv.java
@@ -39,6 +39,7 @@ class DbEnv extends Leaf
if(_resolver != null && !_ephemeral)
{
+ actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
}
return actions;
@@ -57,24 +58,16 @@ class DbEnv extends Leaf
_parent.paste();
}
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
-
- propertiesFrame.setTitle("Properties for " + _id);
if(_editor == null)
{
_editor = new DbEnvEditor(_model.getMainFrame());
}
-
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
-
public Object getDescriptor()
{
return _descriptor;
diff --git a/java/src/IceGrid/TreeNode/DbEnvEditor.java b/java/src/IceGrid/TreeNode/DbEnvEditor.java
index 390d449db8c..fc3e8ad38b4 100755
--- a/java/src/IceGrid/TreeNode/DbEnvEditor.java
+++ b/java/src/IceGrid/TreeNode/DbEnvEditor.java
@@ -32,6 +32,7 @@ class DbEnvEditor extends ListElementEditor
{
DbEnvEditor(JFrame parentFrame)
{
+ super(false);
_name.getDocument().addDocumentListener(_updateListener);
_description.getDocument().addDocumentListener(_updateListener);
_dbHome.getDocument().addDocumentListener(_updateListener);
@@ -52,7 +53,7 @@ class DbEnvEditor extends ListElementEditor
{
java.util.Map result =
_propertiesDialog.show(_propertiesMap,
- getPanel());
+ getProperties());
if(result != null)
{
updated();
@@ -81,7 +82,7 @@ class DbEnvEditor extends ListElementEditor
return descriptor.name.equals(_name.getText());
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Name" );
builder.append(_name, 3);
diff --git a/java/src/IceGrid/TreeNode/Editor.java b/java/src/IceGrid/TreeNode/Editor.java
index 3817142c37e..af9ea9a3286 100755
--- a/java/src/IceGrid/TreeNode/Editor.java
+++ b/java/src/IceGrid/TreeNode/Editor.java
@@ -15,8 +15,10 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.JToolBar;
import javax.swing.tree.TreePath;
@@ -26,6 +28,7 @@ import javax.swing.event.DocumentListener;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.factories.ButtonBarFactory;
+import com.jgoodies.forms.factories.DefaultComponentFactory;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.util.LayoutStyle;
@@ -36,86 +39,49 @@ import IceGrid.Utils;
//
// Base class for all editors
//
-abstract class Editor
+public class Editor
{
- abstract void append(DefaultFormBuilder builder);
- abstract protected void applyUpdate();
+ public JComponent getProperties()
+ {
+ if(_propertiesPanel == null)
+ {
+ buildPanels();
+ }
+ return _propertiesPanel;
+ }
- //
- // Used by the sub-editor (when there is one)
- //
- Object getSubDescriptor()
+ public JComponent getCurrentStatus(Ice.StringHolder title)
{
- return null;
+ if(_currentStatusPanel == null)
+ {
+ buildPanels();
+ }
+ return _currentStatusPanel;
}
- Utils.Resolver getDetailResolver()
+ public JToolBar getCurrentStatusToolBar()
{
return null;
}
- protected Editor()
- {
- //
- // _applyButton
- //
- AbstractAction apply = new AbstractAction("Apply")
- {
- public void actionPerformed(ActionEvent e)
- {
- applyUpdate();
- }
- };
- _applyButton = new JButton(apply);
-
- //
- // _discardButton
- //
- AbstractAction discard = new AbstractAction("Discard")
- {
- public void actionPerformed(ActionEvent e)
- {
- discardUpdate();
- }
- };
- _discardButton = new JButton(discard);
+ void appendProperties(DefaultFormBuilder builder)
+ {}
- _updateListener = new DocumentListener()
- {
- public void changedUpdate(DocumentEvent e)
- {
- updated();
- }
-
- public void insertUpdate(DocumentEvent e)
- {
- updated();
- }
-
- public void removeUpdate(DocumentEvent e)
- {
- updated();
- }
- };
- }
-
- protected void setTarget(CommonBase target)
- {
- _target = target;
- }
+ void appendCurrentStatus(DefaultFormBuilder builder)
+ {}
- CommonBase getTarget()
+ public void refreshCurrentStatus()
+ {}
+
+ protected void applyUpdate()
{
- return _target;
+ assert false;
}
- JComponent getComponent()
+ private void buildPanels()
{
- if(_panel == null)
+ if(_hasCurrentStatus)
{
- //
- // Build everything using JGoodies's DefaultFormBuilder
- //
FormLayout layout = new FormLayout(
"right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
@@ -123,8 +89,7 @@ abstract class Editor
builder.setBorder(Borders.DLU2_BORDER);
builder.setRowGroupingEnabled(true);
builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
- append(builder);
+ appendCurrentStatus(builder);
JScrollPane scrollPane =
new JScrollPane(builder.getPanel(),
@@ -132,19 +97,118 @@ abstract class Editor
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(Borders.DIALOG_BORDER);
+
+ _currentStatusPanel = new JPanel(new BorderLayout());
+ _currentStatusPanel.add(scrollPane, BorderLayout.CENTER);
+ _currentStatusPanel.setBorder(Borders.EMPTY_BORDER);
+ }
+
+ if(_hasProperties)
+ {
+ FormLayout layout = new FormLayout(
+ "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
+
+ DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+ builder.setBorder(Borders.DLU2_BORDER);
+ builder.setRowGroupingEnabled(true);
+ builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
- _panel = new JPanel(new BorderLayout());
- _panel.add(scrollPane, BorderLayout.CENTER);
+ appendProperties(builder);
+
+ JScrollPane scrollPane =
+ new JScrollPane(builder.getPanel(),
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setBorder(Borders.DIALOG_BORDER);
+
+ _propertiesPanel = new JPanel(new BorderLayout());
+ _propertiesPanel.add(scrollPane, BorderLayout.CENTER);
+ _propertiesPanel.setBorder(Borders.EMPTY_BORDER);
+
JComponent buttonBar =
ButtonBarFactory.buildRightAlignedBar(_applyButton,
_discardButton);
buttonBar.setBorder(Borders.DIALOG_BORDER);
- _panel.add(buttonBar, BorderLayout.SOUTH);
+ _propertiesPanel.add(buttonBar, BorderLayout.SOUTH);
+
+ }
+ }
+
+ //
+ // Used by the sub-editor (when there is one)
+ //
+ Object getSubDescriptor()
+ {
+ return null;
+ }
+
+ Utils.Resolver getDetailResolver()
+ {
+ return null;
+ }
+
+ protected Editor(boolean hasCurrentStatus, boolean hasProperties)
+ {
+ _hasCurrentStatus = hasCurrentStatus;
+ _hasProperties = hasProperties;
+
+ if(_hasProperties)
+ {
+ //
+ // _applyButton
+ //
+ AbstractAction apply = new AbstractAction("Apply")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ applyUpdate();
+ }
+ };
+ _applyButton = new JButton(apply);
+
+ //
+ // _discardButton
+ //
+ AbstractAction discard = new AbstractAction("Discard")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ discardUpdate();
+ }
+ };
+ _discardButton = new JButton(discard);
+
+ _updateListener = new DocumentListener()
+ {
+ public void changedUpdate(DocumentEvent e)
+ {
+ updated();
+ }
+
+ public void insertUpdate(DocumentEvent e)
+ {
+ updated();
+ }
+
+ public void removeUpdate(DocumentEvent e)
+ {
+ updated();
+ }
+ };
}
- return _panel;
+ }
+
+ protected void setTarget(CommonBase target)
+ {
+ _target = target;
}
+ CommonBase getTarget()
+ {
+ return _target;
+ }
+
void updated()
{
if(_detectUpdates)
@@ -159,12 +223,6 @@ abstract class Editor
return _updateListener;
}
- JPanel getPanel()
- {
- return _panel;
- }
-
-
protected void detectUpdates(boolean val)
{
_detectUpdates = val;
@@ -227,12 +285,17 @@ abstract class Editor
return result;
}
+ private final boolean _hasCurrentStatus;
+ private final boolean _hasProperties;
+
protected JButton _applyButton;
protected JButton _discardButton;
protected DocumentListener _updateListener;
protected CommonBase _target;
- protected JPanel _panel;
-
private boolean _detectUpdates = true;
+
+ protected JPanel _currentStatusPanel;
+ protected JPanel _propertiesPanel;
+
}
diff --git a/java/src/IceGrid/TreeNode/ListElementEditor.java b/java/src/IceGrid/TreeNode/ListElementEditor.java
index 04667d39b27..f825db1d685 100755
--- a/java/src/IceGrid/TreeNode/ListElementEditor.java
+++ b/java/src/IceGrid/TreeNode/ListElementEditor.java
@@ -18,6 +18,11 @@ abstract class ListElementEditor extends Editor
abstract boolean isSimpleUpdate();
void postUpdate() {}
+ protected ListElementEditor(boolean hasCurrentStatus)
+ {
+ super(hasCurrentStatus, true);
+ }
+
//
// Update when parent is a ListParent
//
diff --git a/java/src/IceGrid/TreeNode/Node.java b/java/src/IceGrid/TreeNode/Node.java
index 664dac74cd9..cc81edcbca4 100755
--- a/java/src/IceGrid/TreeNode/Node.java
+++ b/java/src/IceGrid/TreeNode/Node.java
@@ -19,7 +19,9 @@ import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.DefaultTreeCellRenderer;
import IceGrid.NodeDescriptor;
+import IceGrid.NodeInfo;
import IceGrid.Model;
+import IceGrid.NodeInfo;
import IceGrid.NodeDynamicInfo;
import IceGrid.NodeUpdateDescriptor;
import IceGrid.ServerDynamicInfo;
@@ -74,6 +76,7 @@ class Node extends EditableParent
if(!_ephemeral)
{
+ actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
actions[NEW_SERVER] = true;
actions[NEW_SERVER_ICEBOX] = true;
@@ -183,7 +186,7 @@ class Node extends EditableParent
{
try
{
- Node cleanNode = new Node(false, _id, null, application, true);
+ Node cleanNode = new Node(false, _id, null, application, _staticInfo);
nodes.addChild(cleanNode, true);
}
catch(UpdateFailedException e)
@@ -249,22 +252,15 @@ class Node extends EditableParent
return _cellRenderer.getTreeCellRendererComponent(
tree, value, sel, expanded, leaf, row, hasFocus);
}
-
- public void displayProperties()
+
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
-
- propertiesFrame.setTitle("Properties for " + _id);
if(_editor == null)
{
_editor = new NodeEditor(_model.getMainFrame());
}
-
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
public Object getDescriptor()
@@ -522,9 +518,10 @@ class Node extends EditableParent
}
- void up()
+ void up(NodeInfo staticInfo)
{
_up = true;
+ _staticInfo = staticInfo;
fireNodeChangedEvent(this);
}
@@ -783,13 +780,14 @@ class Node extends EditableParent
}
Node(boolean brandNew, String nodeName, NodeDescriptor descriptor,
- Application application, boolean up)
+ Application application, NodeInfo staticInfo)
throws UpdateFailedException
{
super(brandNew, nodeName, application.getModel());
_ephemeral = false;
- _inRegistry = (descriptor != null);
- _up = up;
+ _inRegistry = (descriptor != null);
+ _staticInfo = staticInfo;
+ _up = staticInfo != null;
if(!_inRegistry)
{
@@ -936,6 +934,10 @@ class Node extends EditableParent
return _resolver;
}
+ NodeInfo getStaticInfo()
+ {
+ return _staticInfo;
+ }
void tryAdd(ServerInstanceDescriptor instanceDescriptor,
ServerDescriptor serverDescriptor,
@@ -1090,6 +1092,8 @@ class Node extends EditableParent
private boolean _inRegistry;
+ private NodeInfo _staticInfo;
+
static private DefaultTreeCellRenderer _cellRenderer;
static private Icon _nodeUpOpen;
static private Icon _nodeUpClosed;
diff --git a/java/src/IceGrid/TreeNode/NodeEditor.java b/java/src/IceGrid/TreeNode/NodeEditor.java
index 1c627ef20ca..236a6291a9e 100755
--- a/java/src/IceGrid/TreeNode/NodeEditor.java
+++ b/java/src/IceGrid/TreeNode/NodeEditor.java
@@ -13,7 +13,9 @@ import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
+import javax.swing.JComponent;
import javax.swing.JFrame;
+import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
@@ -24,6 +26,7 @@ import com.jgoodies.forms.layout.CellConstraints;
import IceGrid.Model;
import IceGrid.NodeDescriptor;
+import IceGrid.NodeInfo;
import IceGrid.TableDialog;
import IceGrid.Utils;
@@ -157,10 +160,17 @@ class NodeEditor extends Editor
NodeEditor(JFrame parentFrame)
{
+ super(true, true);
+
_name.getDocument().addDocumentListener(_updateListener);
_description.getDocument().addDocumentListener(_updateListener);
_variables.setEditable(false);
+ _hostname.setEditable(false);
+ _os.setEditable(false);
+ _machineType.setEditable(false);
+ _loadAverage.setEditable(false);
+
//
// Variables
//
@@ -172,7 +182,7 @@ class NodeEditor extends Editor
public void actionPerformed(ActionEvent e)
{
java.util.TreeMap result = _variablesDialog.show(_variablesMap,
- getPanel());
+ getProperties());
if(result != null)
{
updated();
@@ -186,7 +196,64 @@ class NodeEditor extends Editor
_loadFactor.getDocument().addDocumentListener(_updateListener);
}
- void append(DefaultFormBuilder builder)
+ public JComponent getCurrentStatus(Ice.StringHolder title)
+ {
+ title.value = "System information";
+ return super.getCurrentStatus(title);
+ }
+
+ public void refreshCurrentStatus()
+ {
+ Node node = (Node)_target;
+ NodeInfo info = node.getStaticInfo();
+
+ if(info == null)
+ {
+ _hostname.setText("Unknown");
+ _os.setText("Unknown");
+ _machineType.setText("Unknown");
+ _loadAverageLabel.setText("Load Average");
+ _loadAverage.setText("Unknown");
+ }
+ else
+ {
+ _hostname.setText(info.hostname);
+ _os.setText(info.os + " " + info.release + " " + info.version);
+ _machineType.setText(info.machine + " with " +
+ info.nProcessors
+ + " CPU"
+ + (info.nProcessors >= 2 ? "s" : ""));
+
+ if(info.os.toLowerCase().startsWith("windows"))
+ {
+ _loadAverageLabel.setText("CPU Usage");
+ _loadAverage.setText("92% 48% 18%");
+ }
+ else
+ {
+ _loadAverageLabel.setText("Load Average");
+ _loadAverage.setText("0.92 0.48 0.18");
+ }
+ }
+ }
+
+
+ void appendCurrentStatus(DefaultFormBuilder builder)
+ {
+ builder.append("Hostname");
+ builder.append(_hostname, 3);
+ builder.nextLine();
+ builder.append("Operating System");
+ builder.append(_os, 3);
+ builder.nextLine();
+ builder.append("Machine Type");
+ builder.append(_machineType, 3);
+ builder.append(_loadAverageLabel);
+ builder.append(_loadAverage, 3);
+ builder.nextLine();
+ }
+
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Name");
builder.append(_name, 3);
@@ -254,6 +321,8 @@ class NodeEditor extends Editor
_applyButton.setEnabled(node.isEphemeral());
_discardButton.setEnabled(node.isEphemeral());
detectUpdates(true);
+
+ refreshCurrentStatus();
}
private void setVariablesField()
@@ -285,4 +354,10 @@ class NodeEditor extends Editor
private TableDialog _variablesDialog;
private java.util.TreeMap _variablesMap;
private JTextField _loadFactor = new JTextField(20);
+
+ private JTextField _hostname = new JTextField(20);
+ private JTextField _os = new JTextField(20);
+ private JTextField _machineType = new JTextField(20);
+ private JLabel _loadAverageLabel = new JLabel();
+ private JTextField _loadAverage = new JTextField(20);
}
diff --git a/java/src/IceGrid/TreeNode/Nodes.java b/java/src/IceGrid/TreeNode/Nodes.java
index 6f0a45ffc9c..4317afd988a 100755
--- a/java/src/IceGrid/TreeNode/Nodes.java
+++ b/java/src/IceGrid/TreeNode/Nodes.java
@@ -17,6 +17,7 @@ import IceGrid.TreeModelI;
import IceGrid.Model;
import IceGrid.NodeDescriptor;
import IceGrid.NodeDynamicInfo;
+import IceGrid.NodeInfo;
import IceGrid.NodeUpdateDescriptor;
import IceGrid.ServerDynamicInfo;
import IceGrid.AdapterDynamicInfo;
@@ -89,8 +90,6 @@ public class Nodes extends EditableParent
super(false, "Nodes", application.getModel());
_descriptors = nodeMap;
- java.util.Set nodesUp = _model.getRoot().getNodesUp();
-
java.util.Iterator p = nodeMap.entrySet().iterator();
while(p.hasNext())
{
@@ -98,19 +97,21 @@ public class Nodes extends EditableParent
String nodeName = (String)entry.getKey();
NodeDescriptor nodeDescriptor = (NodeDescriptor)entry.getValue();
addChild(new Node(false, nodeName, nodeDescriptor,
- application, nodesUp.contains(nodeName)));
+ application,
+ _model.getRoot().getStaticNodeInfo(nodeName)));
}
//
// Also create a Node for each node that is up
- //
- p = nodesUp.iterator();
+ //
+ p = _model.getRoot().getNodesUp().iterator();
while(p.hasNext())
{
String nodeName = (String)p.next();
if(findChild(nodeName) == null)
{
- addChild(new Node(false, nodeName, null, application, true));
+ addChild(new Node(false, nodeName, null, application,
+ _model.getRoot().getStaticNodeInfo(nodeName)));
}
}
}
@@ -236,7 +237,7 @@ public class Nodes extends EditableParent
update.loadFactor.value,
update.description.value);
_descriptors.put(update.name, nodeDescriptor);
- node = new Node(false, update.name, nodeDescriptor, application, false);
+ node = new Node(false, update.name, nodeDescriptor, application, null);
newChildren.add(node);
}
else
@@ -248,14 +249,15 @@ public class Nodes extends EditableParent
addChildren((CommonBaseI[])newChildren.toArray(new CommonBaseI[0]));
}
- void nodeUp(String nodeName)
+ void nodeUp(String nodeName, NodeInfo staticInfo)
{
Node node = findNode(nodeName);
if(node == null)
{
try
{
- node = new Node(false, nodeName, null, getApplication(), true);
+ node = new Node(false, nodeName, null, getApplication(),
+ staticInfo);
addChild(node, true);
}
catch(UpdateFailedException e)
@@ -266,7 +268,7 @@ public class Nodes extends EditableParent
}
else
{
- node.up();
+ node.up(staticInfo);
}
}
@@ -319,7 +321,7 @@ public class Nodes extends EditableParent
{
try
{
- Node node = new Node(true, nodeName, descriptor, getApplication(), false);
+ Node node = new Node(true, nodeName, descriptor, getApplication(), null);
addChild(node, true);
}
catch(UpdateFailedException e)
diff --git a/java/src/IceGrid/TreeNode/ReplicaGroup.java b/java/src/IceGrid/TreeNode/ReplicaGroup.java
index ec4bd61fc61..30f16dd45aa 100755
--- a/java/src/IceGrid/TreeNode/ReplicaGroup.java
+++ b/java/src/IceGrid/TreeNode/ReplicaGroup.java
@@ -34,7 +34,12 @@ class ReplicaGroup extends EditableLeaf
actions[PASTE] = true;
}
actions[DELETE] = true;
- actions[SUBSTITUTE_VARS] = true;
+
+ if(!_ephemeral)
+ {
+ actions[SHOW_VARS] = true;
+ actions[SUBSTITUTE_VARS] = true;
+ }
return actions;
}
@@ -71,20 +76,14 @@ class ReplicaGroup extends EditableLeaf
return false;
}
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
-
- propertiesFrame.setTitle("Properties for " + _id);
if(_editor == null)
{
_editor = new ReplicaGroupEditor(_model.getMainFrame());
}
- propertiesFrame.setContent(_editor.getComponent());
_editor.show(this);
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
public Object getDescriptor()
diff --git a/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java b/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java
index a776f0e3023..8e4d3a90bc1 100755
--- a/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java
+++ b/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java
@@ -171,6 +171,8 @@ class ReplicaGroupEditor extends Editor
ReplicaGroupEditor(JFrame parentFrame)
{
+ super(false, true);
+
_objects.setEditable(false);
//
@@ -186,7 +188,7 @@ class ReplicaGroupEditor extends Editor
public void actionPerformed(ActionEvent e)
{
java.util.Map result = _objectsDialog.show(_objectsMap,
- _panel);
+ getProperties());
if(result != null)
{
updated();
@@ -275,7 +277,7 @@ class ReplicaGroupEditor extends Editor
return descriptor.id.equals(_id.getText());
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Replica Group ID" );
builder.append(_id, 3);
diff --git a/java/src/IceGrid/TreeNode/Root.java b/java/src/IceGrid/TreeNode/Root.java
index 3730d502ea3..99127a35267 100755
--- a/java/src/IceGrid/TreeNode/Root.java
+++ b/java/src/IceGrid/TreeNode/Root.java
@@ -15,6 +15,7 @@ import IceGrid.ApplicationDescriptor;
import IceGrid.ApplicationUpdateDescriptor;
import IceGrid.Model;
import IceGrid.NodeDynamicInfo;
+import IceGrid.NodeInfo;
import IceGrid.ServerDynamicInfo;
import IceGrid.ServerState;
import IceGrid.TreeModelI;
@@ -24,6 +25,8 @@ public class Root extends Parent
{
static class DynamicInfo
{
+ NodeInfo staticInfo;
+
//
// ServerId to ServerDynamicInfo
//
@@ -163,6 +166,8 @@ public class Root extends Parent
DynamicInfo info = new DynamicInfo();
_dynamicInfoMap.put(nodeName, info);
+ info.staticInfo = updatedInfo.info;
+
for(int i = 0; i < updatedInfo.servers.length; ++i)
{
info.serverInfoMap.put(updatedInfo.servers[i].id, updatedInfo.servers[i]);
@@ -221,7 +226,7 @@ public class Root extends Parent
while(p.hasNext())
{
Application application = (Application)p.next();
- application.nodeUp(nodeName);
+ application.nodeUp(nodeName, info.staticInfo);
}
}
@@ -259,11 +264,24 @@ public class Root extends Parent
}
}
- public java.util.Set getNodesUp()
+ java.util.Set getNodesUp()
{
return _dynamicInfoMap.keySet();
}
+ NodeInfo getStaticNodeInfo(String nodeName)
+ {
+ DynamicInfo info = (DynamicInfo)_dynamicInfoMap.get(nodeName);
+ if(info == null)
+ {
+ return null;
+ }
+ else
+ {
+ return info.staticInfo;
+ }
+ }
+
ServerState registerServer(String nodeName, Server server,
Ice.IntHolder pid, Ice.BooleanHolder enabled)
{
diff --git a/java/src/IceGrid/TreeNode/Server.java b/java/src/IceGrid/TreeNode/Server.java
index 9866b7fd740..c8e453d4463 100755
--- a/java/src/IceGrid/TreeNode/Server.java
+++ b/java/src/IceGrid/TreeNode/Server.java
@@ -162,7 +162,11 @@ class Server extends EditableParent
}
actions[DELETE] = true;
- actions[SUBSTITUTE_VARS] = !_ephemeral;
+ if(!_ephemeral)
+ {
+ actions[SHOW_VARS] = true;
+ actions[SUBSTITUTE_VARS] = true;
+ }
if(_instanceDescriptor == null)
{
@@ -337,6 +341,67 @@ class Server extends EditableParent
{
enableServer(false);
}
+
+ public void serverInstallDistribution()
+ {
+ int shutdown = JOptionPane.showConfirmDialog(
+ _model.getMainFrame(),
+ "You are about to install or refresh your"
+ + " server distribution and your application distribution onto this node.\n"
+ + " Do you want shut down all servers affected by this update?",
+ "Patch Confirmation",
+ JOptionPane.YES_NO_CANCEL_OPTION);
+
+ if(shutdown == JOptionPane.CANCEL_OPTION)
+ {
+ //
+ // Recompute actions in case this comes from popup menu
+ //
+ _model.showActions(_model.getSelectedNode());
+
+ return;
+ }
+
+ final String prefix = "Patching server '" + _id + "'...";
+ _model.getStatusBar().setText(prefix);
+
+ AMI_Admin_patchServer cb = new AMI_Admin_patchServer()
+ {
+ //
+ // Called by another thread!
+ //
+ public void ice_response()
+ {
+ amiSuccess(prefix);
+ }
+
+ public void ice_exception(Ice.UserException e)
+ {
+ amiFailure(prefix, "Failed to patch " + _id, e);
+ }
+
+ public void ice_exception(Ice.LocalException e)
+ {
+ amiFailure(prefix, "Failed to patch " + _id, e.toString());
+ }
+ };
+
+ try
+ {
+ _model.getAdmin().patchServer_async(cb, _id,
+ shutdown == JOptionPane.YES_OPTION);
+ }
+ catch(Ice.LocalException e)
+ {
+ failure(prefix, "Failed to patch " + _id, e.toString());
+ }
+
+ //
+ // Recompute actions in case this comes from popup menu
+ //
+ _model.showActions(_model.getSelectedNode());
+ }
+
private void amiSuccess(final String prefix)
{
@@ -365,6 +430,11 @@ class Server extends EditableParent
IceGrid.ServerStartException ste = (IceGrid.ServerStartException)e;
amiFailure(prefix, title, ste.reason);
}
+ else if(e instanceof IceGrid.PatchException)
+ {
+ IceGrid.PatchException pe = (IceGrid.PatchException)e;
+ amiFailure(prefix, title, pe.reason);
+ }
else
{
amiFailure(prefix, title, e.toString());
@@ -440,11 +510,8 @@ class Server extends EditableParent
}
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
- propertiesFrame.setTitle("Properties for " + _id);
-
//
// Pick the appropriate editor
//
@@ -453,23 +520,21 @@ class Server extends EditableParent
{
if(_serverEditor == null)
{
- _serverEditor = new ServerEditor(_model.getMainFrame());
+ _serverEditor = new ServerEditor(_model, _model.getMainFrame());
}
_serverEditor.show(this);
- propertiesFrame.setContent(_serverEditor.getComponent());
+ return _serverEditor;
}
else
{
if(_serverInstanceEditor == null)
{
- _serverInstanceEditor = new ServerInstanceEditor(_model.getMainFrame());
+ _serverInstanceEditor = new ServerInstanceEditor(
+ _model, _model.getMainFrame());
}
_serverInstanceEditor.show(this);
- propertiesFrame.setContent(_serverInstanceEditor.getComponent());
+ return _serverInstanceEditor;
}
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
}
@@ -775,6 +840,11 @@ class Server extends EditableParent
{
return _state;
}
+
+ int getPid()
+ {
+ return _pid;
+ }
ServerInstanceDescriptor getInstanceDescriptor()
{
diff --git a/java/src/IceGrid/TreeNode/ServerEditor.java b/java/src/IceGrid/TreeNode/ServerEditor.java
index deb7e42e46b..f1bdbaef9eb 100755
--- a/java/src/IceGrid/TreeNode/ServerEditor.java
+++ b/java/src/IceGrid/TreeNode/ServerEditor.java
@@ -28,8 +28,9 @@ class ServerEditor extends AbstractServerEditor
return _subEditor.isSimpleUpdate();
}
- ServerEditor(JFrame parentFrame)
+ ServerEditor(Model model, JFrame parentFrame)
{
+ super(model);
_subEditor = new ServerSubEditor(this, parentFrame);
}
@@ -49,9 +50,9 @@ class ServerEditor extends AbstractServerEditor
}
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
- _subEditor.append(builder);
+ _subEditor.appendProperties(builder);
}
@@ -70,6 +71,8 @@ class ServerEditor extends AbstractServerEditor
_applyButton.setEnabled(server.isEphemeral());
_discardButton.setEnabled(server.isEphemeral());
detectUpdates(true);
+
+ refreshCurrentStatus();
}
private ServerSubEditor _subEditor;
diff --git a/java/src/IceGrid/TreeNode/ServerInstanceEditor.java b/java/src/IceGrid/TreeNode/ServerInstanceEditor.java
index c451339ae22..addfb91496f 100755
--- a/java/src/IceGrid/TreeNode/ServerInstanceEditor.java
+++ b/java/src/IceGrid/TreeNode/ServerInstanceEditor.java
@@ -47,8 +47,9 @@ class ServerInstanceEditor extends AbstractServerEditor
return false;
}
- ServerInstanceEditor(JFrame parentFrame)
+ ServerInstanceEditor(Model model, JFrame parentFrame)
{
+ super(model);
_subEditor = new ServerSubEditor(this, parentFrame);
_parameterValues.setEditable(false);
@@ -83,7 +84,7 @@ class ServerInstanceEditor extends AbstractServerEditor
public void actionPerformed(ActionEvent e)
{
if(_parametersDialog.show(_parameterList, _parameterValuesMap,
- _panel))
+ getProperties()))
{
updated();
setParameterValuesField();
@@ -119,7 +120,7 @@ class ServerInstanceEditor extends AbstractServerEditor
}
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Template", _template);
builder.append(_templateButton);
@@ -132,7 +133,7 @@ class ServerInstanceEditor extends AbstractServerEditor
builder.appendSeparator();
builder.nextLine();
- _subEditor.append(builder);
+ _subEditor.appendProperties(builder);
}
Object getSubDescriptor()
@@ -211,6 +212,8 @@ class ServerInstanceEditor extends AbstractServerEditor
_applyButton.setEnabled(server.isEphemeral());
_discardButton.setEnabled(server.isEphemeral());
detectUpdates(true);
+
+ refreshCurrentStatus();
}
void setParameterValuesField()
diff --git a/java/src/IceGrid/TreeNode/ServerSubEditor.java b/java/src/IceGrid/TreeNode/ServerSubEditor.java
index c11524a03c9..4bd2349ed0f 100755
--- a/java/src/IceGrid/TreeNode/ServerSubEditor.java
+++ b/java/src/IceGrid/TreeNode/ServerSubEditor.java
@@ -61,7 +61,7 @@ class ServerSubEditor extends CommunicatorSubEditor
public void actionPerformed(ActionEvent e)
{
java.util.Map result = _envDialog.show(
- _envMap, _mainEditor.getPanel());
+ _envMap, _mainEditor.getProperties());
if(result != null)
{
_mainEditor.updated();
@@ -79,7 +79,7 @@ class ServerSubEditor extends CommunicatorSubEditor
public void actionPerformed(ActionEvent e)
{
java.util.LinkedList result = _optionDialog.show(
- _optionList, _mainEditor.getPanel());
+ _optionList, _mainEditor.getProperties());
if(result != null)
{
_mainEditor.updated();
@@ -106,7 +106,7 @@ class ServerSubEditor extends CommunicatorSubEditor
public void actionPerformed(ActionEvent e)
{
java.util.LinkedList result = _distribDirsDialog.show(
- _distribDirsList, _mainEditor.getPanel());
+ _distribDirsList, _mainEditor.getProperties());
if(result != null)
{
_mainEditor.updated();
@@ -124,7 +124,7 @@ class ServerSubEditor extends CommunicatorSubEditor
_mainEditor.getSubDescriptor();
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Server ID");
builder.append(_id, 3);
@@ -133,7 +133,7 @@ class ServerSubEditor extends CommunicatorSubEditor
//
// Add Communicator fields
//
- super.append(builder);
+ super.appendProperties(builder);
builder.appendSeparator("Activation");
diff --git a/java/src/IceGrid/TreeNode/ServerTemplate.java b/java/src/IceGrid/TreeNode/ServerTemplate.java
index f2b547491ad..9c05c7faf25 100755
--- a/java/src/IceGrid/TreeNode/ServerTemplate.java
+++ b/java/src/IceGrid/TreeNode/ServerTemplate.java
@@ -117,23 +117,16 @@ class ServerTemplate extends EditableParent
return _popup;
}
-
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
- propertiesFrame.setTitle("Properties for " + _id);
-
if(_editor == null)
{
_editor = new ServerTemplateEditor(_model.getMainFrame());
}
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
-
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
-
+
public boolean destroy()
{
ServerTemplates serverTemplates = (ServerTemplates)_parent;
diff --git a/java/src/IceGrid/TreeNode/ServerTemplateEditor.java b/java/src/IceGrid/TreeNode/ServerTemplateEditor.java
index ca4898ad88c..2ee59a630d1 100755
--- a/java/src/IceGrid/TreeNode/ServerTemplateEditor.java
+++ b/java/src/IceGrid/TreeNode/ServerTemplateEditor.java
@@ -31,12 +31,12 @@ class ServerTemplateEditor extends TemplateEditor
return super.isSimpleUpdate() && _subEditor.isSimpleUpdate();
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
- super.append(builder);
+ super.appendProperties(builder);
builder.appendSeparator();
builder.nextLine();
- _subEditor.append(builder);
+ _subEditor.appendProperties(builder);
}
void show(ServerTemplate t)
diff --git a/java/src/IceGrid/TreeNode/Service.java b/java/src/IceGrid/TreeNode/Service.java
index f85aa8820e1..c84c2f22f01 100755
--- a/java/src/IceGrid/TreeNode/Service.java
+++ b/java/src/IceGrid/TreeNode/Service.java
@@ -74,6 +74,7 @@ class Service extends Parent
if(_resolver != null && !_ephemeral)
{
+ actions[SHOW_VARS] = true;
actions[SUBSTITUTE_VARS] = true;
}
@@ -169,11 +170,8 @@ class Service extends Parent
((ListParent)_parent).destroyChild(this);
}
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
- propertiesFrame.setTitle("Properties for " + _id);
-
if(_instanceDescriptor.template.length() > 0)
{
if(_instanceEditor == null)
@@ -181,7 +179,7 @@ class Service extends Parent
_instanceEditor = new ServiceInstanceEditor(_model.getMainFrame());
}
_instanceEditor.show(this);
- propertiesFrame.setContent(_instanceEditor.getComponent());
+ return _instanceEditor;
}
else
{
@@ -190,10 +188,8 @@ class Service extends Parent
_editor = new ServiceEditor(_model.getMainFrame());
}
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
+ return _editor;
}
- propertiesFrame.validate();
- propertiesFrame.repaint();
}
public String toString()
diff --git a/java/src/IceGrid/TreeNode/ServiceEditor.java b/java/src/IceGrid/TreeNode/ServiceEditor.java
index a5bf22dcffa..9996524a4da 100755
--- a/java/src/IceGrid/TreeNode/ServiceEditor.java
+++ b/java/src/IceGrid/TreeNode/ServiceEditor.java
@@ -20,6 +20,7 @@ class ServiceEditor extends ListElementEditor
{
ServiceEditor(JFrame parentFrame)
{
+ super(false);
_subEditor = new ServiceSubEditor(this, parentFrame);
}
@@ -39,9 +40,9 @@ class ServiceEditor extends ListElementEditor
}
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
- _subEditor.append(builder);
+ _subEditor.appendProperties(builder);
}
void writeDescriptor()
diff --git a/java/src/IceGrid/TreeNode/ServiceInstanceEditor.java b/java/src/IceGrid/TreeNode/ServiceInstanceEditor.java
index 536d77fddcf..cc81bd4ff17 100755
--- a/java/src/IceGrid/TreeNode/ServiceInstanceEditor.java
+++ b/java/src/IceGrid/TreeNode/ServiceInstanceEditor.java
@@ -32,6 +32,7 @@ class ServiceInstanceEditor extends ListElementEditor
{
ServiceInstanceEditor(JFrame parentFrame)
{
+ super(false);
_subEditor = new ServiceSubEditor(this, parentFrame);
_parameterValues.setEditable(false);
@@ -66,7 +67,7 @@ class ServiceInstanceEditor extends ListElementEditor
public void actionPerformed(ActionEvent e)
{
if(_parametersDialog.show(_parameterList, _parameterValuesMap,
- _panel))
+ getProperties()))
{
updated();
setParameterValuesField();
@@ -113,7 +114,7 @@ class ServiceInstanceEditor extends ListElementEditor
return false;
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Template", _template);
builder.append(_templateButton);
@@ -126,7 +127,7 @@ class ServiceInstanceEditor extends ListElementEditor
builder.appendSeparator();
builder.nextLine();
- _subEditor.append(builder);
+ _subEditor.appendProperties(builder);
}
Object getSubDescriptor()
diff --git a/java/src/IceGrid/TreeNode/ServiceSubEditor.java b/java/src/IceGrid/TreeNode/ServiceSubEditor.java
index e3fa5cddc9b..7d24e36eedd 100755
--- a/java/src/IceGrid/TreeNode/ServiceSubEditor.java
+++ b/java/src/IceGrid/TreeNode/ServiceSubEditor.java
@@ -39,7 +39,7 @@ class ServiceSubEditor extends CommunicatorSubEditor
_mainEditor.getSubDescriptor();
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Service Name");
builder.append(_name, 3);
@@ -48,7 +48,7 @@ class ServiceSubEditor extends CommunicatorSubEditor
//
// Add Communicator fields
//
- super.append(builder);
+ super.appendProperties(builder);
builder.append("Entry");
builder.append(_entry, 3);
diff --git a/java/src/IceGrid/TreeNode/ServiceTemplate.java b/java/src/IceGrid/TreeNode/ServiceTemplate.java
index 98a891938cc..4d798d8c149 100755
--- a/java/src/IceGrid/TreeNode/ServiceTemplate.java
+++ b/java/src/IceGrid/TreeNode/ServiceTemplate.java
@@ -83,23 +83,16 @@ class ServiceTemplate extends EditableParent
return _popup;
}
-
- public void displayProperties()
+ public Editor getEditor()
{
- SimpleInternalFrame propertiesFrame = _model.getPropertiesFrame();
- propertiesFrame.setTitle("Properties for " + _id);
-
if(_editor == null)
{
_editor = new ServiceTemplateEditor(_model.getMainFrame());
}
_editor.show(this);
- propertiesFrame.setContent(_editor.getComponent());
- propertiesFrame.validate();
- propertiesFrame.repaint();
+ return _editor;
}
-
ServiceTemplate(boolean brandNew, String name,
TemplateDescriptor descriptor, Model model)
throws UpdateFailedException
diff --git a/java/src/IceGrid/TreeNode/ServiceTemplateEditor.java b/java/src/IceGrid/TreeNode/ServiceTemplateEditor.java
index 3ec834de351..8d02c760b5d 100755
--- a/java/src/IceGrid/TreeNode/ServiceTemplateEditor.java
+++ b/java/src/IceGrid/TreeNode/ServiceTemplateEditor.java
@@ -31,12 +31,12 @@ class ServiceTemplateEditor extends TemplateEditor
return super.isSimpleUpdate() && _subEditor.isSimpleUpdate();
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
- super.append(builder);
+ super.appendProperties(builder);
builder.appendSeparator();
builder.nextLine();
- _subEditor.append(builder);
+ _subEditor.appendProperties(builder);
}
void show(ServiceTemplate t)
diff --git a/java/src/IceGrid/TreeNode/TemplateEditor.java b/java/src/IceGrid/TreeNode/TemplateEditor.java
index c0a15d0fb48..5f43ac014c5 100755
--- a/java/src/IceGrid/TreeNode/TemplateEditor.java
+++ b/java/src/IceGrid/TreeNode/TemplateEditor.java
@@ -28,6 +28,7 @@ class TemplateEditor extends Editor
{
TemplateEditor(JFrame parentFrame)
{
+ super(false, true);
_template.getDocument().addDocumentListener(_updateListener);
_parameters.setEditable(false);
@@ -43,7 +44,7 @@ class TemplateEditor extends Editor
public void actionPerformed(ActionEvent e)
{
if(_parametersDialog.show(_parameterList, _parameterValuesMap,
- _panel))
+ getProperties()))
{
updated();
setParametersField();
@@ -81,7 +82,7 @@ class TemplateEditor extends Editor
&& descriptor.parameterDefaults.equals(_parameterValuesMap);
}
- void append(DefaultFormBuilder builder)
+ void appendProperties(DefaultFormBuilder builder)
{
builder.append("Template ID");
builder.append(_template, 3);