From 7b31e571e21c71b4b44f95c2d997e873d8f72e50 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 24 Sep 2010 12:48:04 +0000 Subject: [PATCH] minor fix: visualized plugins z-order was not correctly loaded --- tools/cooja/java/se/sics/cooja/GUI.java | 36 ++++++++++++++++--------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index 9a4ceb548..61e2d8f32 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/GUI.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: GUI.java,v 1.170 2010/06/11 09:10:52 fros4943 Exp $ + * $Id: GUI.java,v 1.171 2010/09/24 12:48:04 fros4943 Exp $ */ package se.sics.cooja; @@ -3608,7 +3608,6 @@ public class GUI extends Observable { startedPlugin.getGUI().setSize(size); } else if (pluginSubElement.getName().equals("z")) { int zOrder = Integer.parseInt(pluginSubElement.getText()); - // Save z order as temporary client property startedPlugin.getGUI().putClientProperty("zorder", zOrder); } else if (pluginSubElement.getName().equals("location_x")) { location.x = Integer.parseInt(pluginSubElement.getText()); @@ -3632,17 +3631,6 @@ public class GUI extends Observable { } } - // For all visualized plugins, check if they have a zorder property - try { - for (JInternalFrame plugin : getDesktopPane().getAllFrames()) { - if (plugin.getClientProperty("zorder") != null) { - getDesktopPane().setComponentZOrder(plugin, - ((Integer) plugin.getClientProperty("zorder")).intValue()); - plugin.putClientProperty("zorder", null); - } - } - } catch (Exception e) { } - showPlugin(startedPlugin); return true; } @@ -3651,6 +3639,28 @@ public class GUI extends Observable { } } + /* Z order visualized plugins */ + try { + for (int z=0; z < getDesktopPane().getAllFrames().length; z++) { + for (JInternalFrame plugin : getDesktopPane().getAllFrames()) { + if (plugin.getClientProperty("zorder") == null) { + continue; + } + int zOrder = ((Integer) plugin.getClientProperty("zorder")).intValue(); + if (zOrder != z) { + continue; + } + getDesktopPane().setComponentZOrder(plugin, zOrder); + if (z == 0) { + plugin.setSelected(true); + } + plugin.putClientProperty("zorder", null); + break; + } + getDesktopPane().repaint(); + } + } catch (Exception e) { } + return true; }