diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-09-08 12:07:33 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-09-08 12:07:33 -0400 |
commit | def8933bfb6f0c8f25301e28ccd94fe05ba7d894 (patch) | |
tree | bf1001dc8152a5554ab79734b24910df31cd3c96 | |
parent | ICE-7321 - Java cross-test failure in Ice/objects (diff) | |
parent | Moved IceGridGUI to com.zeroc (diff) | |
download | ice-def8933bfb6f0c8f25301e28ccd94fe05ba7d894.tar.bz2 ice-def8933bfb6f0c8f25301e28ccd94fe05ba7d894.tar.xz ice-def8933bfb6f0c8f25301e28ccd94fe05ba7d894.zip |
Merged IceGridGUI updates from 3.6 branch
13 files changed, 162 insertions, 107 deletions
diff --git a/allTests.py b/allTests.py index 18daac556bc..f65508ec9ac 100755 --- a/allTests.py +++ b/allTests.py @@ -30,7 +30,7 @@ for d in languages: tests = [] - tests = [ (os.path.join(d, "test", x), y) for x, y in current_mod.tests ] + tests = [ (os.path.join(d, "test", os.path.normpath(x)), y) for x, y in current_mod.tests ] if len(tests) > 0: testGroups.extend(tests) diff --git a/java/gradle.properties b/java/gradle.properties index 9ccd1e1aa94..81c641892ce 100644 --- a/java/gradle.properties +++ b/java/gradle.properties @@ -44,6 +44,11 @@ icegridguiProguard = true debug = true // +// Set the versions of the Ice Builder to use for thsi build +// +iceBuilderVersion = 1.3.7 + +// // Set the location of a local Ice Builder for Gradle source directory // iceBuilderHome = diff --git a/java/gradle/ice.gradle b/java/gradle/ice.gradle index 779ce353d97..79e09b1dbc1 100644 --- a/java/gradle/ice.gradle +++ b/java/gradle/ice.gradle @@ -43,7 +43,7 @@ buildscript { } } dependencies { - classpath group: 'com.zeroc.gradle.ice-builder', name: 'slice', version: '1.3.13' + classpath group: 'com.zeroc.gradle.ice-builder', name: 'slice', version: "${iceBuilderVersion}" } } diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle index fe6fc517a29..45a609ae86f 100644 --- a/java/src/IceGridGUI/build.gradle +++ b/java/src/IceGridGUI/build.gradle @@ -171,7 +171,7 @@ if(icegridguiProguard.toBoolean()) { ant.signjar(jar: "${DESTDIR}${jarDir}/${jarName}", alias: "zeroc.com", keystore: "${keystore}", - storepass:"${storepass}") + storepass:"${keystore_password}") } } } diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java index 63a307cbe63..e40f3e90394 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java @@ -3313,11 +3313,8 @@ public class Coordinator void showMainFrame() { - if(!loadWindowPrefs()) - { - _mainFrame.setLocation(100, 100); - _mainFrame.pack(); - } + Utils.restoreWindowBounds(_mainFrame, _prefs, "Window", null); + _mainFrame.pack(); _mainFrame.setVisible(true); } @@ -3349,7 +3346,7 @@ public class Coordinator } } - storeWindowPrefs(); + Utils.storeWindowBounds(_mainFrame, _prefs.node("Window")); _sessionKeeper.logout(true); @@ -3382,44 +3379,6 @@ public class Coordinator } } - private boolean loadWindowPrefs() - { - try - { - if(!_prefs.nodeExists("Window")) - { - return false; - } - } - catch(BackingStoreException e) - { - return false; - } - - Preferences windowPrefs = _prefs.node("Window"); - int x = windowPrefs.getInt("x", 0); - int y = windowPrefs.getInt("y", 0); - int width = windowPrefs.getInt("width", 0); - int height = windowPrefs.getInt("height", 0); - _mainFrame.setBounds(new Rectangle(x, y, width, height)); - if(windowPrefs.getBoolean("maximized", false)) - { - _mainFrame.setExtendedState(Frame.MAXIMIZED_BOTH); - } - return true; - } - - private void storeWindowPrefs() - { - Preferences windowPrefs = _prefs.node("Window"); - Rectangle rect = _mainFrame.getBounds(); - windowPrefs.putInt("x", rect.x); - windowPrefs.putInt("y", rect.y); - windowPrefs.putInt("width", rect.width); - windowPrefs.putInt("height", rect.height); - windowPrefs.putBoolean("maximized", _mainFrame.getExtendedState() == Frame.MAXIMIZED_BOTH); - } - public AdminSessionPrx getSession() { return _sessionKeeper.getSession(); diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java index c344a4e35cc..b9c89771811 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java @@ -278,6 +278,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato { DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("pref,2dlu,pref:grow", "pref")); + builder.append("Samples displayed:", new JSpinner(samples)); builder.append("", new JLabel("<html><p>The number of samples displayed on a graph;" + "<br/>must be between 2 and 300." + "</p></html>")); @@ -576,16 +577,6 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato pack(); if(!loadPreferences()) { - Rectangle otherRect = _coordinator.getMainFrame().getBounds(); - Rectangle thisRect = getBounds(); - if(otherRect.width < thisRect.width || otherRect.height < thisRect.height) - { - setLocationRelativeTo(null); - } - else - { - setLocationRelativeTo(_coordinator.getMainFrame()); - } _splitPane.setDividerLocation(400); } setVisible(true); @@ -623,10 +614,10 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato return _preferences.node("GraphView").getBoolean("showInfo", true); } - public void storePreferences() + private void storePreferences() { Preferences preferences = _preferences.node("GraphView"); - Rectangle rect = getBounds(); + Utils.storeWindowBounds(this, preferences); for(int i = _columnNames.length -1; i >= 0; --i) { @@ -634,11 +625,6 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato preferences.putInt("colWidth" + Integer.toString(i), _legendTable.getColumnModel().getColumn(i).getWidth()); } - preferences.putInt("x", rect.x); - preferences.putInt("y", rect.y); - preferences.putInt("width", rect.width); - preferences.putInt("height", rect.height); - preferences.putBoolean("maximized", getExtendedState() == Frame.MAXIMIZED_BOTH); preferences.putInt("splitLocation", _splitPane.getDividerLocation()); preferences.putInt("sampleInterval", getRefreshPeriod()); @@ -646,32 +632,15 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato preferences.put("dateFormat", getDateFormat()); } - public boolean loadPreferences() + private boolean loadPreferences() { - try - { - if(!_preferences.nodeExists("GraphView")) - { - return false; - } - } - catch(BackingStoreException ex) + Preferences preferences = Utils.restoreWindowBounds(this, _preferences, "GraphView", _coordinator.getMainFrame()); + if(preferences == null) { return false; } - Preferences preferences = _preferences.node("GraphView"); - - int x = preferences.getInt("x", 0); - int y = preferences.getInt("y", 0); - int width = preferences.getInt("width", 0); - int height = preferences.getInt("height", 0); - setBounds(new Rectangle(x, y, width, height)); - if(preferences.getBoolean("maximized", false)) - { - setExtendedState(Frame.MAXIMIZED_BOTH); - } - _splitPane.setDividerLocation(_preferences.node("GraphView").getInt("splitLocation", 600)); + _splitPane.setDividerLocation(preferences.getInt("splitLocation", 600)); for(int i = _columnNames.length -1; i >= 0; --i) { int pos = _legendTable.convertColumnIndexToView(preferences.getInt("columnPos" + Integer.toString(i), i)); diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java index 1a08e655d7e..89e179c317e 100755 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java @@ -636,6 +636,8 @@ class Node extends ListTreeNode void updateServer(ServerDynamicInfo updatedInfo) { + boolean destroyed = updatedInfo.state == ServerState.Destroyed; + if(_info != null) { java.util.ListIterator<ServerDynamicInfo> p = _info.servers.listIterator(); @@ -645,12 +647,18 @@ class Node extends ListTreeNode ServerDynamicInfo sinfo = p.next(); if(sinfo.id.equals(updatedInfo.id)) { - p.set(updatedInfo); + if(destroyed) + { + p.remove(); + } + { + p.set(updatedInfo); + } found = true; break; } } - if(!found) + if(!found && !destroyed) { _info.servers.add(updatedInfo); } diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java index f99cc2144a0..cf256b676cd 100755 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java @@ -15,6 +15,8 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; +import java.util.prefs.Preferences; + import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ButtonGroup; @@ -273,6 +275,7 @@ class ShowIceLogDialog extends JDialog { _rowCount = logMessages.length + _queue.size() < _maxRows ? logMessages.length + _queue.size() : _maxRows; + final Object[][] data = new Object[_rowCount][]; int i = _rowCount - 1; @@ -456,6 +459,7 @@ class ShowIceLogDialog extends JDialog _defaultFileName = defaultFileName; _maxMessages = maxMessages; _initialMessages = initialMessages; + _preferences = Preferences.userNodeForPackage(getClass()); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() @@ -563,6 +567,7 @@ class ShowIceLogDialog extends JDialog } return tip; } + }; _table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); @@ -604,11 +609,9 @@ class ShowIceLogDialog extends JDialog getContentPane().add(scrollPane); - pack(); setResizable(true); - - setLocationRelativeTo(_parent.getRoot().getCoordinator().getMainFrame()); - + pack(); + Utils.restoreWindowBounds(this, _preferences, "IceLogDialog", _parent.getRoot().getCoordinator().getMainFrame()); _parent.getRoot().addShowIceLogDialog(_title, this); setVisible(true); @@ -647,6 +650,7 @@ class ShowIceLogDialog extends JDialog _remoteLoggerPrx = RemoteLoggerPrx.uncheckedCast( _parent.getRoot().getCoordinator().addCallback(_remoteLogger, id, "")); + final String prefix = "Attaching remote logger to " + _loggerAdmin.ice_getIdentity().name + "..."; final String errorTitle = "Failed to attach remote logger to " + _loggerAdmin.ice_getIdentity().name; _parent.getRoot().getCoordinator().getStatusBar().setText(prefix); @@ -805,6 +809,9 @@ class ShowIceLogDialog extends JDialog { _parent.getRoot().removeShowIceLogDialog(_title); } + + Utils.storeWindowBounds(this, _preferences.node("IceLogDialog")); + dispose(); } @@ -850,6 +857,8 @@ class ShowIceLogDialog extends JDialog private final DefaultTableModel _tableModel; private final JTable _table; + private final Preferences _preferences; + private static String renderDate(java.util.Date date) { return _dateFormat.format(date) + _timeFormat.format(date); @@ -870,6 +879,6 @@ class ShowIceLogDialog extends JDialog private static final java.text.DateFormat _dateFormat = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); + private static final java.text.DateFormat _timeFormat = new java.text.SimpleDateFormat(" HH:mm:ss:SSS"); } - diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java index 40e9a97ea5f..2dd612e1a29 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java @@ -13,6 +13,8 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; +import java.util.prefs.Preferences; + import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ButtonGroup; @@ -536,6 +538,7 @@ class ShowLogFileDialog extends JDialog _period = period; _factory = factory; _root = root; + _preferences = Preferences.userNodeForPackage(getClass()); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() @@ -583,10 +586,10 @@ class ShowLogFileDialog extends JDialog getContentPane().add(scrollPane); - pack(); setResizable(true); + pack(); + Utils.restoreWindowBounds(this, _preferences, "LogFileDialog", _root.getCoordinator().getMainFrame()); - setLocationRelativeTo(root.getCoordinator().getMainFrame()); play(); } @@ -711,6 +714,9 @@ class ShowLogFileDialog extends JDialog { _root.removeShowLogFileDialog(_factory.getTitle()); } + + Utils.storeWindowBounds(this, _preferences.node("LogFileDialog")); + dispose(); } @@ -737,4 +743,6 @@ class ShowLogFileDialog extends JDialog private FIFOTextArea _textArea = new FIFOTextArea(20, 45); private ReaderThread _thread; + + private final Preferences _preferences; } diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java index 609407a77c5..8ebffd3dfe1 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java @@ -31,8 +31,6 @@ public class Main extends JFrame { if(System.getProperty("os.name").startsWith("Mac OS")) // OS X L&F { - System.setProperty("apple.laf.useScreenMenuBar", "true"); - System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IceGrid Admin"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else if(System.getProperty("os.name").startsWith("Windows")) diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java index 4f0d5425b9d..13c00803902 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java @@ -19,7 +19,16 @@ public class MainProxy // Save main arguments for later usage. // _args = java.util.Arrays.copyOf(args, args.length); - + + if(System.getProperty("os.name").startsWith("Mac OS")) + { + System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IceGrid Admin"); + + // To catch Command+Q + System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS"); + } + String version = System.getProperty("java.version"); Class<?> cls = com.zeroc.IceInternal.Util.findClass("com.javafx.main.Main", null); @@ -42,7 +51,7 @@ public class MainProxy { ex.printStackTrace(); JOptionPane.showMessageDialog( - null, + null, "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'", "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE); } @@ -81,11 +90,11 @@ public class MainProxy { } } - + public static String[] args() { return _args; } - + private static String[] _args = new String[]{}; } diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java index b91cc49f677..5335c502e25 100644 --- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java @@ -11,7 +11,10 @@ package com.zeroc.IceGridGUI; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.Graphics2D; +import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; + import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -50,8 +53,8 @@ public class Utils try { BufferedImage image = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(). - getDefaultConfiguration().createCompatibleImage( - icon.getIconWidth(), icon.getIconHeight()); + getDefaultConfiguration().createCompatibleImage( + icon.getIconWidth(), icon.getIconHeight()); g = image.createGraphics(); icon.paintIcon(null, g, 0, 0); return image; @@ -66,7 +69,7 @@ public class Utils } } - public static void addEscapeListener(final JDialog dialog) + static public void addEscapeListener(final JDialog dialog) { dialog.getRootPane().registerKeyboardAction( new ActionListener() @@ -131,6 +134,93 @@ public class Utils return result; } + static public void + storeWindowBounds(java.awt.Window window, java.util.prefs.Preferences prefs) + { + Rectangle rect = window.getBounds(); + prefs.putInt("x", rect.x); + prefs.putInt("y", rect.y); + prefs.putInt("width", rect.width); + prefs.putInt("height", rect.height); + + if(window instanceof java.awt.Frame) + { + prefs.putBoolean("maximized", ((java.awt.Frame)window).getExtendedState() == java.awt.Frame.MAXIMIZED_BOTH); + } + } + + static public java.util.prefs.Preferences + restoreWindowBounds(java.awt.Window window, java.util.prefs.Preferences parent, String node, java.awt.Component parentComponent) + { + java.util.prefs.Preferences prefs = null; + + try + { + if(parent.nodeExists(node)) + { + prefs = parent.node(node); + } + } + catch(java.util.prefs.BackingStoreException ex) + { + } + + boolean locationVisible = false; + + if(prefs != null) + { + int x = prefs.getInt("x", 0); + int y = prefs.getInt("y", 0); + int width = prefs.getInt("width", 0); + int height = prefs.getInt("height", 0); + + Rectangle visibleBounds = new Rectangle(); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice screens[] = ge.getScreenDevices(); + for(GraphicsDevice s : screens) + { + visibleBounds.add(s.getDefaultConfiguration().getBounds()); + } + locationVisible = visibleBounds.contains(x, y); + + if(locationVisible) + { + window.setBounds(new Rectangle(x, y, width, height)); + if(prefs.getBoolean("maximized", false)) + { + ((java.awt.Frame)window).setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); + } + } + else + { + window.setSize(width, height); + } + } + + if(!locationVisible) + { + if(parentComponent != null) + { + java.awt.Dimension parentSize = parentComponent.getSize(); + java.awt.Dimension thisSize = window.getSize(); + if(parentSize.width < thisSize.width || parentSize.height < thisSize.height) + { + window.setLocationRelativeTo(null); + } + else + { + window.setLocationRelativeTo(parentComponent); + } + } + else + { + window.setLocation(100, 100); + } + } + + return prefs; + } + static public interface Stringifier { public String toString(Object obj); diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py index a4cdb62a57b..991e4fda22a 100755 --- a/scripts/TestUtil.py +++ b/scripts/TestUtil.py @@ -540,7 +540,7 @@ def run(tests, root = False): elif o in ("-l", "--loop"): loop = True elif o in ("-r", "-R", "--filter", '--rfilter'): - testFilter = re.compile(a) + testFilter = re.compile(re.escape(os.path.normpath(a))) if o in ("--rfilter", "-R"): filters.append((testFilter, True)) else: @@ -604,7 +604,7 @@ def run(tests, root = False): arg += " " + a if not root: - tests = [ (os.path.join(getDefaultMapping(), "test", x), y) for x, y in tests ] + tests = [ (os.path.join(getDefaultMapping(), "test", os.path.normpath(x)), y) for x, y in tests ] # Expand all the test and argument combinations. expanded = [] @@ -678,14 +678,14 @@ def run(tests, root = False): for c in crossLang: a = "--cross=%s --protocol=tcp %s" % (c, arg) for test in crossTests: - name = "%s/test/%s" % (lang, test) + name = os.path.join(lang, "test", test) expanded.append([(name, a, testConfig(name, tests))]) # Add ssl & compress for the operations test. if ((compact or mono) and c == "csharp") or (c == "js"): # Don't add the ssl tests. continue a = "--cross=%s --protocol=ssl --compress %s" % (c, arg) - expanded.append([("%s/test/Ice/operations" % lang, a, [])]) + expanded.append([(os.path.join(lang, "test", "Ice", "operations"), a, [])]) # Apply filters after expanding. if len(filters) > 0: |