[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Sat Oct 22 14:35:46 UTC 2005


senger
Sat Oct 22 10:35:46 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv6406/src/main/org/biomoby/service/dashboard

Modified Files:
	AbstractPanel.java CommonConsole.java ConsolePanel.java 
	DashboardProperties.java RegistryPanel.java 
Added Files:
	BuildDataTypeTree.java RegistrationPanel.java 
Log Message:


moby-live/Java/src/main/org/biomoby/service/dashboard BuildDataTypeTree.java,NONE,1.1 RegistrationPanel.java,NONE,1.1 AbstractPanel.java,1.7,1.8 CommonConsole.java,1.1,1.2 ConsolePanel.java,1.4,1.5 DashboardProperties.java,1.4,1.5 RegistryPanel.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java	2005/10/12 11:17:59	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java	2005/10/22 14:35:46	1.8
@@ -48,6 +48,8 @@
 import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;
 import java.awt.event.ItemListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
 
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
@@ -90,6 +92,7 @@
     protected JComponent pComponent;
     protected static Icon confirmIcon;
     protected static Icon warningIcon;
+    protected static Icon clearIcon;
 
     // re-use "style" components
     protected static final Insets BREATH_TOP = new Insets (10,0,0,0);
@@ -322,10 +325,84 @@
 	    };
     }
 
+    /*********************************************************************
+     * 
+     ********************************************************************/
+    protected JPanel createCustomTextArea (String title,
+					   String initValue,
+					   String preferenceKey,
+					   String eventName) {
+	JPanel p = new JPanel (new GridBagLayout());
+
+	// main label
+   	JLabel label = new JLabel (title);
+
+	// text area
+	final JTextArea area = new JTextArea();
+	area.setEditable (true);
+	if (initValue == null)
+	    area.setText (preferenceKey == null ? "" : getPrefValue (preferenceKey, ""));
+	else
+	    area.setText (initValue);
+	area.setCaretPosition (0);
+
+	if (eventName != null) {
+	    final String eName = eventName;
+	    if (preferenceKey == null) {
+		area.addFocusListener (new FocusListener() {
+			public void focusGained (FocusEvent e) {}
+			public void focusLost (FocusEvent e) {
+			    String contents =  ((JTextArea)e.getSource()).getText();
+			    propertyChannel.put (eName, contents);
+			}
+		    });
+	    } else {
+		final String pKey = preferenceKey;
+		area.addFocusListener (new FocusListener() {
+			public void focusGained (FocusEvent e) {}
+			public void focusLost (FocusEvent e) {
+			    String contents =  ((JTextArea)e.getSource()).getText();
+			    propertyChannel.put (eName, contents);
+			    setPrefValue (pKey, contents);
+			}
+		    });
+	    }
+	    // propagate also the initial value (unless it is empty)
+	    String text = area.getText();
+	    if (UUtils.notEmpty (text))
+		propertyChannel.put (eventName, text);
+	}
+
+	// reset/clear button
+	if (clearIcon == null)
+	    clearIcon = SwingUtils.createIcon ("images/smallClear.gif", this);
+	JButton clearButton = new JButton (clearIcon);
+        clearButton.setFocusPainted (false);
+        clearButton.setMargin (new Insets (0,0,0,0));
+        clearButton.setContentAreaFilled (false);
+        clearButton.setToolTipText ("Clear text area");
+	clearButton.addActionListener (new ActionListener() {
+		public void actionPerformed (ActionEvent e) {
+		    area.setText ("");
+		}
+	    });
+
+	// put it together
+ 	SwingUtils.addComponent (p, label,                  0, 0, 1, 1, NONE, NWEST, 0.0, 0.0);
+ 	SwingUtils.addComponent (p, clearButton,            1, 0, 1, 1, NONE, NEAST, 0.0, 0.0);
+ 	SwingUtils.addComponent (p, new JScrollPane (area), 0, 1, 2, 1, BOTH, NWEST, 1.0, 1.0);
+	return p;
+    }
 
     /*********************************************************************
      * 
      ********************************************************************/
+    protected String getPrefValue (String key,
+				   String defaultValue) {
+	Preferences node = PrefsUtils.getNode (this.getClass());
+	return node.get (key, defaultValue);
+    }
+
     protected boolean getPrefValue (String key,
 				    boolean defaultValue) {
 	Preferences node = PrefsUtils.getNode (this.getClass());
@@ -336,6 +413,12 @@
      * 
      ********************************************************************/
     protected void setPrefValue (String key,
+				 String value) {
+	Preferences node = PrefsUtils.getNode (this.getClass());
+	node.put (key, value);
+    }
+
+    protected void setPrefValue (String key,
 				 boolean value) {
 	Preferences node = PrefsUtils.getNode (this.getClass());
 	node.putBoolean (key, value);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonConsole.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonConsole.java	2005/09/24 17:51:51	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonConsole.java	2005/10/22 14:35:46	1.2
@@ -15,6 +15,7 @@
 import javax.swing.JTextArea;
 import javax.swing.JCheckBox;
 import javax.swing.JPanel;
+import javax.swing.Icon;
 
 import java.awt.Font;
 import java.awt.GridBagLayout;
@@ -40,6 +41,7 @@
     JTextArea textArea;
     JCheckBox appendModeBox;
     boolean appendMode = true;
+    static Icon clearIcon;
 
     /*********************************************************************
      * Constructor.
@@ -64,6 +66,10 @@
 		 }
 	     });
 
+	if (clearIcon == null)
+	    clearIcon = SwingUtils.createIcon ("images/smallClear.gif", this);
+	cleanButton.setIcon (clearIcon);
+
 	appendModeBox = AbstractPanel.createCheckBox
 	    ("append mode", appendMode, KeyEvent.VK_A,
 	     new ItemListener() {

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ConsolePanel.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ConsolePanel.java	2005/09/24 17:51:51	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ConsolePanel.java	2005/10/22 14:35:46	1.5
@@ -115,4 +115,13 @@
 	return "Debugging Console";
     }
 
+    /**************************************************************************
+     *
+     **************************************************************************/
+    public Icon getIcon() {
+	if (panelIcon == null)
+  	    panelIcon = SwingUtils.createIcon ("images/console.gif", this);
+	return panelIcon;
+    }
+
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java	2005/10/22 01:38:04	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java	2005/10/22 14:35:46	1.5
@@ -34,11 +34,18 @@
     static final String DP_DATATYPE_NAME = "dp-datatype-name";
 
     // names of properties used in property channel storage
+    static final String DP_REGISTRY_MODEL = "dp-registry-model";
+
     static final String DP_REGISTRY_ENDPOINT = "dp-registry-endpoint";
     static final String DP_REGISTRY_NAMESPACE = "dp-registry-namespace";
     static final String DP_CACHE_DIR = "dp-cache-dir";
     static final String DP_USE_CACHE = "dp-use-cache";
 
+    static final String DP_REG_DT_NAME = "dp-reg-dt-name";
+    static final String DP_REG_DT_AUTH = "dp-reg-dt-auth";
+    static final String DP_REG_DT_EMAIL = "dp-reg-dt-email";
+    static final String DP_REG_DT_DESC = "dp-reg-dt-desc";
+
     /** A filename containing Java properties that configure the
 	dashboard. */
     static final String DASHBOARD_PROPERTIES_FILE = "dashboard.properties";

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java	2005/10/22 01:38:04	1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java	2005/10/22 14:35:46	1.11
@@ -1,6 +1,6 @@
 // RegistryPanel.java
 //
-//    Created: September 2005
+// Created: September 2005
 //
 // This file is a component of the BioMoby project.
 // Copyright Martin Senger (martin.senger at gmail.com).
@@ -61,8 +61,6 @@
  * what Biomoby registry to work with, and what cache directory to
  * use. <p>
  *
- * WORK IN PROGRESS. <p>
- *
  * @author <A HREF="mailto:martin.senger at gmail.com">Martin Senger</A>
  * @version $Id$
  */
@@ -87,22 +85,17 @@
      * propertyChange()
      ********************************************************************/
     public void propertyChange (PropertyChangeEvent e) {
-        String prop = e.getPropertyName();
-        String newVal = (String)e.getNewValue();
-        if (newVal == null) return;   // no interest in non-defined  new values
-        if (prop == null) return;     // no interest in non-specific changes
-// 	else if (prop.equalsIgnoreCase (PROP_MODE))          setMode (checkAndGetOperMode (newVal));
-//         else if (prop.equalsIgnoreCase (PROP_BEAN_VISIBLE))  setBeanVisible (BBConfig.getBoolFromString (newVal));
-//         else if (prop.equalsIgnoreCase (PROP_LISTEN_TO))     setListenTo (newVal);
-//         else if (prop.equalsIgnoreCase (PROP_DATA_IDENTITY)) setDataIdentity (newVal);
+//         String prop = e.getPropertyName();
+//         String newVal = (String)e.getNewValue();
+//         if (newVal == null) return;   // no interest in non-defined  new values
+//         if (prop == null) return;     // no interest in non-specific changes
     }
 
     /*********************************************************************
-     * Default constructor
+     * Default constructor.
      ********************************************************************/
     public RegistryPanel() {
 	super();
- 	registryModel = new RegistryModel (support);
     }
 
     /**************************************************************************
@@ -110,7 +103,15 @@
      **************************************************************************/
     public JComponent getComponent (PropertyChannel propertyChannel) {
  	setPropertyChannel (propertyChannel);
-	registryModel.setPropertyChannel (propertyChannel);
+	synchronized (propertyChannel) {
+	    if (propertyChannel.containsKey (DP_REGISTRY_MODEL)) {
+		registryModel = (RegistryModel)propertyChannel.get (DP_REGISTRY_MODEL);
+	    } else {
+		registryModel = new RegistryModel (support);
+		propertyChannel.put (DP_REGISTRY_MODEL, registryModel);
+	    }
+	    registryModel.setPropertyChannel (propertyChannel);
+	}
 
 	if (pComponent != null)
 	    return pComponent;
@@ -339,7 +340,7 @@
      **************************************************************************/
     public Icon getIcon() {
 	if (panelIcon == null)
-	    panelIcon = SwingUtils.createIcon ("images/registry.gif", this);
+  	    panelIcon = SwingUtils.createIcon ("images/registry.gif", this);
 	return panelIcon;
     }
 




More information about the MOBY-guts mailing list