[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Thu Nov 10 14:32:43 UTC 2005


senger
Thu Nov 10 09:32:42 EST 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv4952/src/main/org/biomoby/service/dashboard

Modified Files:
	BuildDataTypeTree.java CommonDataTable.java CommonTree.java 
	Dashboard.java DashboardProperties.java NOTES 
	RegistrationDataTypeSubPanel.java 
	RegistrationNamespaceSubPanel.java RegistrationPanel.java 
	RegistrationServiceSubPanel.java 
	RegistrationServiceTypeSubPanel.java ServicesBoard.java 
	ServicesTree.java 
Log Message:


moby-live/Java/src/main/org/biomoby/service/dashboard BuildDataTypeTree.java,1.5,1.6 CommonDataTable.java,1.3,1.4 CommonTree.java,1.15,1.16 Dashboard.java,1.14,1.15 DashboardProperties.java,1.14,1.15 NOTES,1.22,1.23 RegistrationDataTypeSubPanel.java,1.5,1.6 RegistrationNamespaceSubPanel.java,1.4,1.5 RegistrationPanel.java,1.15,1.16 RegistrationServiceSubPanel.java,1.4,1.5 RegistrationServiceTypeSubPanel.java,1.6,1.7 ServicesBoard.java,1.4,1.5 ServicesTree.java,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/BuildDataTypeTree.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/BuildDataTypeTree.java	2005/11/06 16:47:11	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/BuildDataTypeTree.java	2005/11/10 14:32:42	1.6
@@ -152,20 +152,22 @@
 
 	    // make member nodes richer
 	    if (row > 1) {
-		MemberNode member = (MemberNode)((DefaultMutableTreeNode)value).getUserObject();
-		MobyRelationship rel = member.getRelationship();
-		cellBorder.setTitle (MobyRelationship.type2str (rel.getRelationshipType()));
-		dataTypeName.setText (member.getValue());
-		articleName.setText (rel.getName());
-		if (rel.getRelationshipType() == Central.iHASA)
-		    cellPanel.setBackground (new Color (255, 255, 204));
-		else
-		    cellPanel.setBackground (new Color (204, 255, 204));
-		return cellPanel;
-	    } else {
-		return super.getTreeCellRendererComponent (tree, value, selected,
-							   expanded, leaf, row, hasFocus);
+		Object aNode = ((DefaultMutableTreeNode)value).getUserObject();
+		if (aNode instanceof MemberNode) {
+		    MemberNode member = (MemberNode)aNode;
+		    MobyRelationship rel = member.getRelationship();
+		    cellBorder.setTitle (MobyRelationship.type2str (rel.getRelationshipType()));
+		    dataTypeName.setText (member.getValue());
+		    articleName.setText (rel.getName());
+		    if (rel.getRelationshipType() == Central.iHASA)
+			cellPanel.setBackground (new Color (255, 255, 204));
+		    else
+			cellPanel.setBackground (new Color (204, 255, 204));
+		    return cellPanel;
+		}
 	    }
+	    return super.getTreeCellRendererComponent (tree, value, selected,
+						       expanded, leaf, row, hasFocus);
 	}
 
     }
@@ -209,6 +211,23 @@
     }
 
     /*********************************************************************
+     *
+     ********************************************************************/
+    public void addMember (MobyRelationship child) {
+	MemberNode newNode = new MemberNode (child);
+	nameNode.add (new DefaultMutableTreeNode (newNode));
+	updateTree();
+    }
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public void removeAllChildren() {
+	nameNode.removeAllChildren();
+	updateTree();
+    }
+
+    /*********************************************************************
      * Load all menu icons.
      ********************************************************************/
     protected void loadIcons() {
@@ -358,10 +377,16 @@
      * Draw/update this tree.
      ********************************************************************/
     protected void updateTree() {
-	DefaultTreeModel tModel = (DefaultTreeModel)getModel();
-	tModel.reload();
-	propertyChannel.put (DP_REG_DT_TREE, extractFromTree());
-	expand();
+
+        SwingUtilities.invokeLater (new Runnable() {
+		public void run() {
+		    DefaultTreeModel tModel = (DefaultTreeModel)getModel();
+		    tModel.reload();
+		    propertyChannel.put (DP_REG_DT_TREE, extractFromTree());
+		    expand();
+		}
+	    });
+
     }
 
     /*********************************************************************

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonDataTable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonDataTable.java	2005/11/07 17:14:46	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonDataTable.java	2005/11/10 14:32:42	1.4
@@ -10,6 +10,7 @@
 
 import org.tulsoft.tools.gui.SwingUtils;
 
+import org.biomoby.shared.MobyData;
 import javax.swing.Icon;
 import javax.swing.JButton;
 import javax.swing.JScrollPane;
@@ -80,6 +81,13 @@
     /*********************************************************************
      *
      ********************************************************************/
+    public void setData (MobyData[] newData) {
+	tableModel.setData (newData);
+    }
+
+    /*********************************************************************
+     *
+     ********************************************************************/
     protected void createItself() {
 	loadIcons();
 
@@ -212,6 +220,22 @@
 
 	abstract public void addEmptyData();
 
+	/**************************************************************************
+	 * Used to fill the table programatically. It clear the whole
+	 * table a put given data there.
+	 **************************************************************************/
+	public void setData (MobyData[] newData) {
+	    synchronized (this) {
+		int rowCount = getRowCount();
+		int colCount = getColumnCount();
+		for (int i = 0; i < rowCount; i++)
+		    removeRow (i);
+		for (int i = 0; i < newData.length; i++)
+		    data.addElement (newData[i]);
+		fireTableDataChanged();
+	    }
+	}
+
 	public Vector getData() {
 	    return data;
 	}

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java	2005/11/10 08:54:31	1.15
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java	2005/11/10 14:32:42	1.16
@@ -72,6 +72,8 @@
     protected String lastSearchText = "";
     protected int lastSorted = SORTED_BY_NAME;
 
+    protected PropertyChannel propertyChannel;
+
     // shared icons
     static protected Icon searchIcon;
     static protected Icon menuSearchIcon, menuSearchIconDis;
@@ -123,6 +125,13 @@
 	loadIcons();
     }
 
+    /**************************************************************************
+     * Keep shared storage of properties updated in various panels.
+     **************************************************************************/
+    public void setPropertyChannel (PropertyChannel propertyChannel) {
+	this.propertyChannel = propertyChannel;
+    }
+
     /*********************************************************************
      *
      ********************************************************************/
@@ -450,6 +459,7 @@
      ********************************************************************/
     protected void highlightAndJumpTo (HashSet toBeHighlighted) {
 
+	setSelectionPath (null);
 	CommonTreeCellRenderer r = (CommonTreeCellRenderer)getCellRenderer();
 	r.setToBeHighlighted (toBeHighlighted);
 	collapse ();

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java	2005/11/10 08:54:31	1.14
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java	2005/11/10 14:32:42	1.15
@@ -60,8 +60,8 @@
     protected JTabbedPane tabbedPane;
     protected Color bgcolor;
     protected DashboardPanel[] panels;
-    protected PropertyChannel propertyChannel;
     protected static Properties dashboardProperties;
+    protected PropertyChannel propertyChannel;
 
     static {
 	try {

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java	2005/11/10 08:54:31	1.14
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java	2005/11/10 14:32:42	1.15
@@ -20,7 +20,6 @@
 public interface DashboardProperties {
 
     // names of properties used in property change events
-    static final String DP_LOG_MSG = "log-msg";
     static final String DP_STATUS_MSG = "status-msg";
     static final String DP_SERVICE_NAME = "dp-service-name";
     static final String DP_DATATYPE_NAME = "dp-datatype-name";
@@ -37,21 +36,18 @@
     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";
-    static final String DP_REG_DT_COPY_BY_SELECT = "dp-reg-dt-cbs";  // type: Boolean
     static final String DP_REG_DT_TREE = "dp-reg-dt-tree";   // type: MobyDataType
 
     static final String DP_REG_NS_NAME = "dp-reg-ns-name";
     static final String DP_REG_NS_AUTH = "dp-reg-ns-auth";
     static final String DP_REG_NS_EMAIL = "dp-reg-ns-email";
     static final String DP_REG_NS_DESC = "dp-reg-ns-desc";
-    static final String DP_REG_NS_COPY_BY_SELECT = "dp-reg-ns-cbs";  // type: Boolean
 
     static final String DP_REG_ST_NAME = "dp-reg-st-name";
     static final String DP_REG_ST_AUTH = "dp-reg-st-auth";
     static final String DP_REG_ST_EMAIL = "dp-reg-st-email";
     static final String DP_REG_ST_DESC = "dp-reg-st-desc";
     static final String DP_REG_ST_ISA = "dp-reg-st-isa";
-    static final String DP_REG_ST_COPY_BY_SELECT = "dp-reg-st-cbs";  // type: Boolean
 
     static final String DP_REG_S_NAME = "dp-reg-s-name";
     static final String DP_REG_S_AUTH = "dp-reg-s-auth";
@@ -67,6 +63,8 @@
 
     static final String DP_REG_VERBOSE = "dp-reg-verbose";
 
+    static final String DP_S_SELECTED = "dp-s-selected";  // type: MobyService
+
     /** 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/NOTES,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES	2005/11/10 08:54:31	1.22
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES	2005/11/10 14:32:42	1.23
@@ -1,3 +1,6 @@
+* FWK005 parse may not be called while parsing.
+  - probably when too many network request together
+---
 * More testing:
   - interrupting loading
   - different order of panels
@@ -11,6 +14,8 @@
   NullPointerException reported in a dialog window - difficult to
   reproduce it... but it is somewhere there :-(
 
+* BUG: the BuildDataTree does not paint itself always well
+
 * WARN: How would an authority with characters 'http://' cope as a
   cache name? Can it happen?
 
@@ -138,3 +143,5 @@
   * SwingUtils can be simplified (closeOnExit etc.)
   - JFileChooserWithHistory - its method getSelectedFile() should reflect also
     what is entered in the text field; also it can have getText()?
+  - colors in JComboBox:
+http://forum.java.sun.com/thread.jspa?threadID=670356&messageID=3920606

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java	2005/11/10 08:54:31	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java	2005/11/10 14:32:42	1.6
@@ -11,6 +11,7 @@
 import org.biomoby.shared.Central;
 import org.biomoby.shared.MobyException;
 import org.biomoby.shared.MobyDataType;
+import org.biomoby.shared.MobyRelationship;
 import org.biomoby.shared.parser.MobyTags;
 import org.biomoby.service.generator.DataTypesGenerator;
 
@@ -110,19 +111,17 @@
 
 	// allow to copy selected namespace to the new one
 	boolean usingCopyBySelect = getPrefValue (COPY_BY_SELECT_DT, false);
-	JCheckBox copyBySelect =
+	copyBySelect =
 	    createCheckBox ("Copy when selected", usingCopyBySelect, KeyEvent.VK_C,
 			    new ItemListener() {
 				public void itemStateChanged (ItemEvent e) {
 				    onCopyBySelectDT (e.getStateChange() == ItemEvent.SELECTED);
 				}
 			    });
-	propertyChannel.put (DP_REG_DT_COPY_BY_SELECT,
-			     new Boolean (usingCopyBySelect).toString());
 
 	JPanel board = new JPanel (new GridBagLayout());
  	SwingUtils.addComponent (board, dataTypesBoard, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
- 	SwingUtils.addComponent (board, copyBySelect,    0, 1, 1, 1, NONE, NWEST, 0.0, 0.0);
+ 	SwingUtils.addComponent (board, copyBySelect,   0, 1, 1, 1, NONE, NWEST, 0.0, 0.0);
 
 	// a tree with a new data type
 	buildTree = new BuildDataTypeTree (propertyChannel);
@@ -159,7 +158,6 @@
      **************************************************************************/
     protected void onCopyBySelectDT (boolean enabled) {
 	setPrefValue (COPY_BY_SELECT_DT, enabled);
-	propertyChannel.put (DP_REG_DT_COPY_BY_SELECT, new Boolean (enabled).toString());
     }
 
     /**************************************************************************
@@ -215,44 +213,6 @@
 	}
     }
 
-//     /**************************************************************************
-//      *
-//      **************************************************************************/
-//     public void onRegisterFromXML (File file) {
-// 	final File xmlFile = file;
-// 	dtRegisterButton.setEnabled (false);
-// 	dtFromXMLButton.setEnabled (false);
-// 	dtException = null;
-// 	final SwingWorker worker = new SwingWorker() {
-// 		boolean oldAppendMode;
-// 		StatusBag bag;
-// 		public Object construct() {
-// 		    try {
-// 			bag = maybeEnableVerbose();
-// 			oldAppendMode = console.setAppendMode (true);
-// 			console.setText ("Registering data type from raw XML:\n" +
-// 					 "-----------------------------------\n");
-// 			console.setText (registryModel.callRegistry ("registerDataType", xmlFile));
-// 			console.setText ("\n");
-// 		    } catch (MobyException e) {
-// 			dtException = e;
-// 		    }
-// 		    return null;  // not used here
-// 		}
-
-// 		// runs on the event-dispatching thread.
-// 		public void finished() {
-// 		    if (dtException != null)
-// 			error (DATA_TYPE_PROLOGUE, dtException);
-// 		    dtRegisterButton.setEnabled (true);
-// 		    dtFromXMLButton.setEnabled (true);
-// 		    maybeDisableVerbose (bag);
-// 		    console.setAppendMode (oldAppendMode);
-// 		}
-// 	    };
-// 	worker.start(); 
-//     }
-
     /**************************************************************************
      *
      * Customized tree of data types - has different popup menus...
@@ -360,19 +320,23 @@
 			return dataType;  // not used here
 		    }
 		    
-		    // runs on the event-dispatching thread.
+		    // runs on the event-dispatching thread
 		    public void finished() {
 			if (dataType != null) {
 			    console.setText (dataType.toString());
-			    if (propertyChannel.getBoolean (DP_REG_DT_COPY_BY_SELECT, false)) {
+			    if (copyBySelect.isSelected()) {
 				dtName.setText (dataType.getName());
 				dtAuth.setText (dataType.getAuthority());
 				dtEmail.setText (dataType.getEmailContact());
 				dtDescArea.setText (dataType.getDescription());
 				buildTree.setParent (dataType.getParentName());
+				buildTree.removeAllChildren();
+				MobyRelationship[] children = dataType.getChildren();
+				for (int i = 0; i < children.length; i++)
+				    buildTree.addMember (children[i]);
 			    }
 			} else if (isAuthority) {
-			    if (propertyChannel.getBoolean (DP_REG_DT_COPY_BY_SELECT, false))
+			    if (copyBySelect.isSelected())
 				dtAuth.setText (nodeObject.getValue());
 			}
 		    }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationNamespaceSubPanel.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/RegistrationNamespaceSubPanel.java	2005/11/09 05:29:38	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationNamespaceSubPanel.java	2005/11/10 14:32:42	1.5
@@ -100,15 +100,13 @@
 
 	// allow to copy selected namespace to the new one
 	boolean usingCopyBySelect = getPrefValue (COPY_BY_SELECT_NS, false);
-	JCheckBox copyBySelect =
+	copyBySelect =
 	    createCheckBox ("Copy when selected", usingCopyBySelect, KeyEvent.VK_C,
 			    new ItemListener() {
 				public void itemStateChanged (ItemEvent e) {
 				    onCopyBySelectNS (e.getStateChange() == ItemEvent.SELECTED);
 				}
 			    });
-	propertyChannel.put (DP_REG_NS_COPY_BY_SELECT,
-			     new Boolean (usingCopyBySelect).toString());
 
 	JPanel board = new JPanel (new GridBagLayout());
  	SwingUtils.addComponent (board, namespacesBoard, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
@@ -145,7 +143,6 @@
      **************************************************************************/
     protected void onCopyBySelectNS (boolean enabled) {
 	setPrefValue (COPY_BY_SELECT_NS, enabled);
-	propertyChannel.put (DP_REG_NS_COPY_BY_SELECT, new Boolean (enabled).toString());
     }
 
     /**************************************************************************
@@ -269,14 +266,14 @@
 		    public void finished() {
 			if (namespace != null) {
 			    console.setText (namespace.toString() + "\n");
-			    if (propertyChannel.getBoolean (DP_REG_NS_COPY_BY_SELECT, false)) {
+			    if (copyBySelect.isSelected()) {
 				nsName.setText (namespace.getName());
 				nsAuth.setText (namespace.getAuthority());
 				nsEmail.setText (namespace.getEmailContact());
 				nsDescArea.setText (namespace.getDescription());
 			    }
 			} else if (isAuthority) {
-			    if (propertyChannel.getBoolean (DP_REG_NS_COPY_BY_SELECT, false))
+			    if (copyBySelect.isSelected())
 				nsAuth.setText (nodeObject.getValue());
 			}
 		    }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationPanel.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationPanel.java	2005/11/09 16:23:32	1.15
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationPanel.java	2005/11/10 14:32:42	1.16
@@ -17,6 +17,7 @@
 import javax.swing.JSplitPane;
 import javax.swing.JTabbedPane;
 import javax.swing.JComponent;
+import javax.swing.JCheckBox;
 import javax.swing.JFileChooser;
 import javax.swing.JButton;
 
@@ -53,6 +54,7 @@
     // components that are used from more methods
     protected CommonConsole console;
     protected JButton registerButton, showXMLButton, fromXMLButton;
+    protected JCheckBox copyBySelect;
 
     // shared icons
     protected static Icon menuAddISAIcon, menuAddISAIconDis;
@@ -117,7 +119,6 @@
     public JComponent getComponent (PropertyChannel propertyChannel) {
  	setPropertyChannel (propertyChannel);
 	registryModel = createRegistryModel();
-
 	if (pComponent != null)  return pComponent;
 
 	// console panel

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceSubPanel.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/RegistrationServiceSubPanel.java	2005/11/10 08:54:31	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceSubPanel.java	2005/11/10 14:32:42	1.5
@@ -33,6 +33,7 @@
 import javax.swing.JComponent;
 import javax.swing.JFileChooser;
 import javax.swing.Box;
+import javax.swing.SwingUtilities;
 import javax.swing.tree.DefaultMutableTreeNode;
 
 import java.awt.GridBagLayout;
@@ -42,7 +43,8 @@
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
-
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;
 import java.io.File;
 import java.io.IOException;
 
@@ -54,13 +56,15 @@
  */
 
 public class RegistrationServiceSubPanel
-    extends RegistrationPanel {
+    extends RegistrationPanel
+    implements PropertyChangeListener {
 
     // names of user preferences keys
     static final String USE_SIGNATURE = "use-signature";
     static final String USE_AUTHORITATIVE = "use-authoritative";
     static final String REG_S_TYPE = "reg-s-type";
     static final String REG_S_FROM_XML = "reg-service-from-xml-file";
+    static final String COPY_BY_SELECT_S = "s-copy-by-select";
 
     // components that are used from more methods
     JTextFieldWithHistory sName, sAuth, sEmail, sURL, sSigURL;
@@ -88,6 +92,7 @@
  	setPropertyChannel (propertyChannel);
 	registryModel = createRegistryModel();
 	this.console = console;
+	this.propertyChannel.addPropertyChangeListener (this);
 
 	JPanel p = new JPanel (new GridBagLayout());
 
@@ -147,6 +152,11 @@
  	SwingUtils.addComponent (serviceType, labelST, 0, 0, 1, 1, NONE, NWEST,  0.0, 0.0);
  	SwingUtils.addComponent (serviceType, sType,   1, 0, 1, 1, NONE, NWEST,  0.0, 0.0);
 
+	// copy-by-select
+	copyBySelect =
+	    createCheckBox ("Copy here when selected in browser panel",
+			    false, KeyEvent.VK_C, null);
+
 	// put together service fields
 	JPanel defs = new JPanel (new GridBagLayout());
  	SwingUtils.addComponent (defs, labelSName,       0, 0, 1, 1, NONE, NWEST,  0.0, 0.0);
@@ -175,9 +185,10 @@
 	stBoard.updateTree (CommonTree.SORTED_BY_NAME);
 
 	JPanel main = createTitledPanel ("New Service");
- 	SwingUtils.addComponent (main, defs,             0, 0, 2, 1, HORI, NWEST,  1.0, 0.0);
- 	SwingUtils.addComponent (main, sDesc,            0, 1, 1, 1, BOTH, NWEST,  1.0, 1.0, BREATH_TOP);
- 	SwingUtils.addComponent (main, stBoard,          1, 1, 1, 1, BOTH, NWEST,  1.0, 1.0, BREATH_TOP_LEFT);
+ 	SwingUtils.addComponent (main, defs,         0, 0, 2, 1, HORI, NWEST, 1.0, 0.0);
+ 	SwingUtils.addComponent (main, sDesc,        0, 1, 1, 1, BOTH, NWEST, 1.0, 1.0, BREATH_TOP);
+ 	SwingUtils.addComponent (main, stBoard,      1, 1, 1, 1, BOTH, NWEST, 1.0, 1.0, BREATH_TOP_LEFT);
+ 	SwingUtils.addComponent (main, copyBySelect, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0);
 
 	// sub-panels for input/output data
 	JTabbedPane dataPane = new JTabbedPane();
@@ -227,6 +238,49 @@
     }
 
     /**************************************************************************
+     * Here we get notified when somebody somewhere select a service. Used to
+     * update this service fields - if it is enabled by COPY_BY_SELECT field.
+     **************************************************************************/
+    public void propertyChange (PropertyChangeEvent event) {
+	if (copyBySelect == null ||
+	    ! copyBySelect.isSelected()) return;   // copy not expected/allowed
+        String prop = event.getPropertyName();
+        if (prop == null) return;     // no interest in non-specific changes
+	Object obj = event.getNewValue();
+	if (obj == null || ! (obj instanceof MobyService)) return;
+        final MobyService service = (MobyService)obj;
+
+	// finally...
+	if (DP_S_SELECTED.equals (prop)) {
+	    SwingUtilities.invokeLater (new Runnable() {
+		    public void run() {
+			onFillService (service);
+		    }
+		});
+	}
+    }
+
+    /**************************************************************************
+     *
+     **************************************************************************/
+    protected void onFillService (MobyService service) {
+	sName.setText (service.getName());
+	sAuth.setText (service.getAuthority());
+	sEmail.setText (service.getEmailContact());
+	sURL.setText (service.getURL());
+	sSigURL.setText (service.getSignatureURL());
+	sDescArea.setText (service.getDescription());
+	useAuth.setEnabled (service.isAuthoritative());
+	sType.setText (service.getType());
+	String value = service.getPathToRDF();
+	if (UUtils.notEmpty (value))
+	    localRDFFile.getTextField().setText (service.getPathToRDF());	
+	primInTable.setData (service.getPrimaryInputs());
+	primOutTable.setData (service.getPrimaryOutputs());
+ 	secTable.setData (service.getSecondaryInputs());
+    }
+
+    /**************************************************************************
      *
      **************************************************************************/
     protected void onUseRDFSignature (boolean enabled) {

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceTypeSubPanel.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceTypeSubPanel.java	2005/11/10 08:54:31	1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceTypeSubPanel.java	2005/11/10 14:32:42	1.7
@@ -107,15 +107,13 @@
 
 	// allow to copy selected service types to the new one
 	boolean usingCopyBySelect = getPrefValue (COPY_BY_SELECT_ST, false);
-	JCheckBox copyBySelect =
+	copyBySelect =
 	    createCheckBox ("Copy when selected", usingCopyBySelect, KeyEvent.VK_O,
 			    new ItemListener() {
 				public void itemStateChanged (ItemEvent e) {
 				    onCopyBySelectST (e.getStateChange() == ItemEvent.SELECTED);
 				}
 			    });
-	propertyChannel.put (DP_REG_ST_COPY_BY_SELECT,
-			     new Boolean (usingCopyBySelect).toString());
 
 	JPanel board = new JPanel (new GridBagLayout());
  	SwingUtils.addComponent (board, serviceTypesBoard, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
@@ -152,7 +150,6 @@
      **************************************************************************/
     protected void onCopyBySelectST (boolean enabled) {
 	setPrefValue (COPY_BY_SELECT_ST, enabled);
-	propertyChannel.put (DP_REG_ST_COPY_BY_SELECT, new Boolean (enabled).toString());
     }
 
     /**************************************************************************
@@ -307,7 +304,7 @@
 		    public void finished() {
 			if (serviceType != null) {
 			    console.setText (serviceType.toString() + "\n");
-			    if (propertyChannel.getBoolean (DP_REG_ST_COPY_BY_SELECT, false)) {
+			    if (copyBySelect.isSelected()) {
 				stName.setText (serviceType.getName());
 				stAuth.setText (serviceType.getAuthority());
 				stEmail.setText (serviceType.getEmailContact());
@@ -315,7 +312,7 @@
 				stISA.setText (serviceType.getParentName());
 			    }
 			} else if (isAuthority) {
-			    if (propertyChannel.getBoolean (DP_REG_ST_COPY_BY_SELECT, false))
+			    if (copyBySelect.isSelected())
 				stAuth.setText (nodeObject.getValue());
 			}
 		    }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServicesBoard.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/ServicesBoard.java	2005/11/10 08:54:31	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServicesBoard.java	2005/11/10 14:32:42	1.5
@@ -58,6 +58,7 @@
 			  CommonTree customTree) {
 	super (model, channel);
 	tree = customTree;
+	tree.setPropertyChannel (channel);
 	createItself();
  	this.model.addNotificationListener (this);
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServicesTree.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/ServicesTree.java	2005/11/07 07:03:49	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServicesTree.java	2005/11/10 14:32:42	1.5
@@ -419,8 +419,10 @@
 
 		// runs on the event-dispatching thread.
 		public void finished() {
-		    if (service != null)
+		    if (service != null) {
+			propertyChannel.fire (DashboardProperties.DP_S_SELECTED, service);
 			console.setText (service.toString());
+		    }
 		}
 	    };
 	worker.start(); 




More information about the MOBY-guts mailing list