diff options
Diffstat (limited to 'java/src')
-rwxr-xr-x | java/src/IceGrid/BareBonesBrowserLaunch.java | 54 | ||||
-rwxr-xr-x | java/src/IceGrid/Model.java | 69 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/AdapterEditor.java | 2 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/Editor.java | 102 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/ReplicaGroupEditor.java | 1 | ||||
-rwxr-xr-x | java/src/IceGrid/TreeNode/Server.java | 8 |
6 files changed, 125 insertions, 111 deletions
diff --git a/java/src/IceGrid/BareBonesBrowserLaunch.java b/java/src/IceGrid/BareBonesBrowserLaunch.java new file mode 100755 index 00000000000..223fb3fd74b --- /dev/null +++ b/java/src/IceGrid/BareBonesBrowserLaunch.java @@ -0,0 +1,54 @@ +//
+// From http://www.centerkey.com/java/browser
+//
+
+////////////////////////////////////////////////////////
+// Bare Bones Browser Launch //
+// Version 1.1 //
+// July 8, 2005 //
+// Supports: Mac OS X, GNU/Linux, Unix, Windows XP //
+// Example Usage: //
+// String url = "http://www.centerkey.com/"; //
+// BareBonesBrowserLaunch.openURL(url); //
+// Public Domain Software -- Free to Use as You Like //
+////////////////////////////////////////////////////////
+
+package IceGrid;
+
+import java.lang.reflect.Method;
+import javax.swing.JOptionPane;
+
+public class BareBonesBrowserLaunch {
+
+ private static final String errMsg = "Error attempting to launch web browser";
+
+ public static void openURL(String url) {
+ String osName = System.getProperty("os.name");
+ try {
+ if (osName.startsWith("Mac OS")) {
+ Class macUtils = Class.forName("com.apple.mrj.MRJFileUtils");
+ Method openURL = macUtils.getDeclaredMethod("openURL",
+ new Class[] {String.class});
+ openURL.invoke(null, new Object[] {url});
+ }
+ else if (osName.startsWith("Windows"))
+ Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
+ else { //assume Unix or Linux
+ String[] browsers = {
+ "firefox", "opera", "konqueror", "mozilla", "netscape" };
+ String browser = null;
+ for (int count = 0; count < browsers.length && browser == null; count++)
+ if (Runtime.getRuntime().exec(
+ new String[] {"which", browsers[count]}).waitFor() == 0)
+ browser = browsers[count];
+ if (browser == null)
+ throw new Exception("Could not find web browser.");
+ else
+ Runtime.getRuntime().exec(new String[] {browser, url});
+ }
+ }
+ catch (Exception e) {
+ JOptionPane.showMessageDialog(null, errMsg + ":\n" + e.getLocalizedMessage());
+ }
+ }
+}
diff --git a/java/src/IceGrid/Model.java b/java/src/IceGrid/Model.java index e53e6f6e164..860e8cacd31 100755 --- a/java/src/IceGrid/Model.java +++ b/java/src/IceGrid/Model.java @@ -324,7 +324,7 @@ public class Model add(_substituteTool);
}
}
-
+
//
// All Model's methods run in the UI thread
//
@@ -1109,6 +1109,8 @@ public class Model _root = new Root(this);
_treeModel = new TreeModelI(_root);
+ _licenseDialog = new LicenseDialog(_mainFrame);
+
_shutdownHook = new Thread("Shutdown hook")
{
public void run()
@@ -1228,6 +1230,8 @@ public class Model {
public void actionPerformed(ActionEvent e)
{
+ System.err.println("Action fired");
+
helpContents();
}
};
@@ -1236,7 +1240,7 @@ public class Model {
public void actionPerformed(ActionEvent e)
{
- copying();
+ _licenseDialog.show("TOP");
}
};
@@ -1244,7 +1248,7 @@ public class Model {
public void actionPerformed(ActionEvent e)
{
- warranty();
+ _licenseDialog.show("WARRANTY");
}
};
@@ -1793,59 +1797,8 @@ public class Model private void helpContents()
{
- /*
- if(_helpWindow == null)
- {
- _helpWindow = new HelpWindow();
- }
- _helpWindow.showWindow(_mainFrame);
- */
- }
-
- private void copying()
- {
- try
- {
- JEditorPane pane = new JEditorPane(
- Utils.class.getResource("/license.txt"));
- pane.setEditable(false);
-
- Dimension prefSize = new Dimension(500, 450);
- pane.setPreferredSize(prefSize);
-
- JOptionPane.showMessageDialog(
- _mainFrame,
- new JScrollPane(pane),
- "Copying Conditions - IceGrid Admin",
- JOptionPane.INFORMATION_MESSAGE);
- }
- catch(java.io.IOException e)
- {
- System.err.println("Cannot find license.txt");
- }
- }
-
- private void warranty()
- {
- try
- {
- JEditorPane pane = new JEditorPane(
- Utils.class.getResource("/warranty.txt"));
- pane.setEditable(false);
-
- Dimension prefSize = new Dimension(500, 350);
- pane.setPreferredSize(prefSize);
-
- JOptionPane.showMessageDialog(
- _mainFrame,
- new JScrollPane(pane),
- "Warranty - IceGrid Admin",
- JOptionPane.INFORMATION_MESSAGE);
- }
- catch(java.io.IOException e)
- {
- System.err.println("Cannot find warranty.txt");
- }
+ BareBonesBrowserLaunch.openURL(
+ "http://www.zeroc.com/help/IceGridAdmin/");
}
private void about()
@@ -1861,8 +1814,6 @@ public class Model JOptionPane.INFORMATION_MESSAGE);
}
-
-
public void setClipboard(Object copy)
{
_clipboard = copy;
@@ -2070,6 +2021,8 @@ public class Model private Object _clipboard;
+ private LicenseDialog _licenseDialog;
+
//
// back/forward navigation
//
diff --git a/java/src/IceGrid/TreeNode/AdapterEditor.java b/java/src/IceGrid/TreeNode/AdapterEditor.java index a348a5895c2..55bffae2a6c 100755 --- a/java/src/IceGrid/TreeNode/AdapterEditor.java +++ b/java/src/IceGrid/TreeNode/AdapterEditor.java @@ -174,7 +174,7 @@ class AdapterEditor extends ListElementEditor JTextField idTextField = (JTextField) _id.getEditor().getEditorComponent(); - idTextField.getDocument().addDocumentListener(_updateListener); + idTextField.getDocument().addDocumentListener(_updateListener); JTextField replicaGroupIdTextField = (JTextField) _replicaGroupId.getEditor().getEditorComponent(); diff --git a/java/src/IceGrid/TreeNode/Editor.java b/java/src/IceGrid/TreeNode/Editor.java index af9ea9a3286..6467e4dcfb1 100755 --- a/java/src/IceGrid/TreeNode/Editor.java +++ b/java/src/IceGrid/TreeNode/Editor.java @@ -43,18 +43,18 @@ public class Editor {
public JComponent getProperties()
{
- if(_propertiesPanel == null)
+ if(_propertiesPanel == null && _hasProperties)
{
- buildPanels();
+ buildPropertiesPanel();
}
return _propertiesPanel;
}
public JComponent getCurrentStatus(Ice.StringHolder title)
{
- if(_currentStatusPanel == null)
+ if(_currentStatusPanel == null && _hasCurrentStatus)
{
- buildPanels();
+ buildCurrentStatusPanel();
}
return _currentStatusPanel;
}
@@ -78,61 +78,61 @@ public class Editor assert false;
}
- private void buildPanels()
+ private void buildCurrentStatusPanel()
{
- if(_hasCurrentStatus)
- {
- 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());
- appendCurrentStatus(builder);
+ assert _hasCurrentStatus;
- JScrollPane scrollPane =
- new JScrollPane(builder.getPanel(),
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
- JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-
- scrollPane.setBorder(Borders.DIALOG_BORDER);
+ FormLayout layout = new FormLayout(
+ "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
- _currentStatusPanel = new JPanel(new BorderLayout());
- _currentStatusPanel.add(scrollPane, BorderLayout.CENTER);
- _currentStatusPanel.setBorder(Borders.EMPTY_BORDER);
- }
+ DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+ builder.setBorder(Borders.DLU2_BORDER);
+ builder.setRowGroupingEnabled(true);
+ builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
+ appendCurrentStatus(builder);
- if(_hasProperties)
- {
- FormLayout layout = new FormLayout(
- "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
+ JScrollPane scrollPane =
+ new JScrollPane(builder.getPanel(),
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
+ scrollPane.setBorder(Borders.DIALOG_BORDER);
+
+ _currentStatusPanel = new JPanel(new BorderLayout());
+ _currentStatusPanel.add(scrollPane, BorderLayout.CENTER);
+ _currentStatusPanel.setBorder(Borders.EMPTY_BORDER);
+ }
+
+ private void buildPropertiesPanel()
+ {
+ assert _hasProperties;
- DefaultFormBuilder builder = new DefaultFormBuilder(layout);
- builder.setBorder(Borders.DLU2_BORDER);
- builder.setRowGroupingEnabled(true);
- builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
-
- appendProperties(builder);
-
- JScrollPane scrollPane =
- new JScrollPane(builder.getPanel(),
- JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
- JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-
- scrollPane.setBorder(Borders.DIALOG_BORDER);
+ FormLayout layout = new FormLayout(
+ "right:pref, 3dlu, fill:pref:grow, 3dlu, pref", "");
- _propertiesPanel = new JPanel(new BorderLayout());
- _propertiesPanel.add(scrollPane, BorderLayout.CENTER);
- _propertiesPanel.setBorder(Borders.EMPTY_BORDER);
+ DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+ builder.setBorder(Borders.DLU2_BORDER);
+ builder.setRowGroupingEnabled(true);
+ builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
- JComponent buttonBar =
- ButtonBarFactory.buildRightAlignedBar(_applyButton,
- _discardButton);
- buttonBar.setBorder(Borders.DIALOG_BORDER);
- _propertiesPanel.add(buttonBar, BorderLayout.SOUTH);
+ 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);
+ _propertiesPanel.add(buttonBar, BorderLayout.SOUTH);
}
//
diff --git a/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java b/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java index 8be880cf088..cf7c6a7b4e0 100755 --- a/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java +++ b/java/src/IceGrid/TreeNode/ReplicaGroupEditor.java @@ -365,6 +365,7 @@ class ReplicaGroupEditor extends Editor _loadBalancing.setEnabled(true); _loadBalancing.setEditable(true); + if(descriptor.loadBalancing == null) { _loadBalancing.setSelectedItem(RETURN_ALL); diff --git a/java/src/IceGrid/TreeNode/Server.java b/java/src/IceGrid/TreeNode/Server.java index f6bfe511eb1..53baa236ac5 100755 --- a/java/src/IceGrid/TreeNode/Server.java +++ b/java/src/IceGrid/TreeNode/Server.java @@ -130,9 +130,15 @@ class Server extends EditableParent java.util.LinkedList adapterList = new java.util.LinkedList();
adapterList.add(serviceManager);
+ PropertyDescriptor pd =
+ new PropertyDescriptor("IceBox.ServiceManager.Endpoints",
+ "tcp -h 127.0.0.1");
+ java.util.LinkedList properties = new java.util.LinkedList();
+ properties.add(pd);
+
return new IceBoxDescriptor(
adapterList,
- new java.util.LinkedList(),
+ properties,
new java.util.LinkedList(),
"",
"NewIceBox",
|