From 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 00:42:34 +0200 Subject: More code cleanup: Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class --- source/com/c2kernel/gui/tabs/EntityTabPane.java | 49 ++++++++++++++++--------- 1 file changed, 32 insertions(+), 17 deletions(-) mode change 100755 => 100644 source/com/c2kernel/gui/tabs/EntityTabPane.java (limited to 'source/com/c2kernel/gui/tabs/EntityTabPane.java') diff --git a/source/com/c2kernel/gui/tabs/EntityTabPane.java b/source/com/c2kernel/gui/tabs/EntityTabPane.java old mode 100755 new mode 100644 index f6fae14..5a374dd --- a/source/com/c2kernel/gui/tabs/EntityTabPane.java +++ b/source/com/c2kernel/gui/tabs/EntityTabPane.java @@ -4,12 +4,23 @@ * Created on March 22, 2001, 11:39 AM */ package com.c2kernel.gui.tabs; -import java.awt.*; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; -import javax.swing.*; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.SwingConstants; import com.c2kernel.entity.proxy.EntityProxyObserver; import com.c2kernel.gui.EntityDetails; @@ -93,10 +104,11 @@ public class EntityTabPane extends JPanel implements Runnable { refreshButton.setToolTipText(Language.translate("Refresh")); refreshButton.setMargin(new Insets(0, 0, 0, 0)); refreshButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - setCursor(new Cursor(Cursor.WAIT_CURSOR)); + @Override + public void actionPerformed(ActionEvent e) { + setCursor(new Cursor(Cursor.WAIT_CURSOR)); reload(); - setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); String defaultStartTab = MainFrame.getPref("DefaultStartTab", "Properties"); @@ -108,7 +120,8 @@ public class EntityTabPane extends JPanel implements Runnable { defaultStart.setSelected(tabName.equals(defaultStartTab)); defaultStart.setActionCommand(tabName); defaultStart.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { if (((JToggleButton)e.getSource()).isSelected()) MainFrame.setPref("DefaultStartTab", e.getActionCommand()); } @@ -122,11 +135,12 @@ public class EntityTabPane extends JPanel implements Runnable { this.add(titleBox); } public void initForEntity(NodeEntity sourceEntity) { - this.sourceEntity = sourceEntity; + this.sourceEntity = sourceEntity; Thread loader = new Thread(this); loader.start(); } - public void run() { + @Override + public void run() { Thread.currentThread().setName("Default Entity Pane Builder"); getGridBagConstraints(); c.gridx = 0; @@ -145,23 +159,24 @@ public class EntityTabPane extends JPanel implements Runnable { } public void runCommand(String command) { } - + public void destroy() { - if (sourceEntity != null && this instanceof EntityProxyObserver) { - sourceEntity.getEntity().unsubscribe((EntityProxyObserver)this); + if (sourceEntity != null && this instanceof EntityProxyObserver) { + sourceEntity.getEntity().unsubscribe((EntityProxyObserver)this); } parent = null; } - - protected void finalize() throws Throwable { + + @Override + protected void finalize() throws Throwable { Logger.msg(7, "Reaping "+getClass().getName()); } - + static public OutcomeHandler getOutcomeHandler(String schema, int version) { String ohClassName = Gateway.getProperty("OutcomeHandler."+schema+"."+version); try { if (ohClassName != null && ohClassName.length() > 0) { - Class ohClass = Class.forName(ohClassName); + Class ohClass = Class.forName(ohClassName); return (OutcomeHandler) ohClass.newInstance(); } } catch (Exception ex) { @@ -170,7 +185,7 @@ public class EntityTabPane extends JPanel implements Runnable { ohClassName = Gateway.getProperty("OutcomeHandler.*"); try { if (ohClassName != null && ohClassName.length() > 0) { - Class ohClass = Class.forName(ohClassName); + Class ohClass = Class.forName(ohClassName); return (OutcomeHandler) ohClass.newInstance(); } } catch (Exception ex) { @@ -178,5 +193,5 @@ public class EntityTabPane extends JPanel implements Runnable { Logger.error(ex); } return new OutcomePanel(); - } + } } -- cgit v1.2.3