[MOBY-guts] biomoby commit
Martin Senger
senger at pub.open-bio.org
Sat Oct 22 01:38:04 UTC 2005
senger
Fri Oct 21 21:38:04 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv3384/src/main/org/biomoby/service/dashboard
Modified Files:
CommonTree.java Dashboard.java DashboardProperties.java
DataTypesTree.java JProgressBarWithCancel.java
PropertyChannel.java RegistryModel.java RegistryPanel.java
Added Files:
CommonBoard.java DataTypesBoard.java
Log Message:
moby-live/Java/src/main/org/biomoby/service/dashboard CommonBoard.java,NONE,1.1 DataTypesBoard.java,NONE,1.1 CommonTree.java,1.3,1.4 Dashboard.java,1.4,1.5 DashboardProperties.java,1.3,1.4 DataTypesTree.java,1.1,1.2 JProgressBarWithCancel.java,1.1,1.2 PropertyChannel.java,1.2,1.3 RegistryModel.java,1.4,1.5 RegistryPanel.java,1.9,1.10
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.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/CommonTree.java 2005/10/12 11:17:59 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java 2005/10/22 01:38:04 1.4
@@ -67,11 +67,14 @@
// protected PropertyChangeSupport support;
// protected boolean expanded = true; // the status of the application list
+ protected String rootNode;
+
/*********************************************************************
* Constructor
********************************************************************/
public CommonTree (String rootNode) {
super (new DefaultTreeModel (new DefaultMutableTreeNode (new CommonNode (rootNode))));
+ this.rootNode = rootNode;
// create an almost empty tree, only with a root node that
// contains just a String holding the name of the root node;
@@ -135,6 +138,11 @@
setFont (new Font ("Dialog", Font.PLAIN, 10));
}
+ // root node
+ if (row == 0) {
+ setText (rootNode);
+ }
+
// TBD: whale icon?
// if (leaf)
// ((JLabel)c).setIcon (icons [COMPUTER]);
@@ -159,6 +167,13 @@
/*********************************************************************
+ * Get data from a registry model and update the tree. Will be
+ * overwritten by subclass.
+ ********************************************************************/
+ public void update (int howSorted) {
+ }
+
+ /*********************************************************************
* Called when a tree node is selected. Does nothing here
********************************************************************/
protected void selected (DefaultMutableTreeNode node) {
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.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/Dashboard.java 2005/09/24 17:51:51 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java 2005/10/22 01:38:04 1.5
@@ -26,6 +26,7 @@
import java.awt.GridBagLayout;
import java.awt.Font;
+import java.awt.Dimension;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
@@ -125,7 +126,7 @@
public void show() {
JFrame frame = SwingUtils.createMainFrame (getComponent (propertyChannel),
getName());
- SwingUtils.showMainFrame (frame, dashboard.getPreferredSize());
+ SwingUtils.showMainFrame (frame, dashboard.getPreferredSize());
}
/**************************************************************************
@@ -226,7 +227,7 @@
/**************************************************************************
*
**************************************************************************/
- DashboardHeader getHeader() {
+ protected DashboardHeader getHeader() {
DashboardHeader h = new DashboardHeader (dashboardProperties);
if (panels.length > 0)
h.setPanelTitle (panels[0].getTitle());
@@ -259,7 +260,7 @@
* Return a component representing status bar (usually placed at
* the bottom of a dashboard).
**************************************************************************/
- StatusBar getStatusBar() {
+ protected StatusBar getStatusBar() {
return new StatusBar ("Status: Work in progress");
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.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/DashboardProperties.java 2005/09/24 17:51:51 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2005/10/22 01:38:04 1.4
@@ -37,6 +37,7 @@
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";
/** A filename containing Java properties that configure the
dashboard. */
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.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/DataTypesTree.java 2005/10/12 11:17:59 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java 2005/10/22 01:38:04 1.2
@@ -17,6 +17,7 @@
import org.tulsoft.shared.UUtils;
import javax.swing.JMenuItem;
import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JProgressBar;
import javax.swing.AbstractAction;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
@@ -118,8 +119,9 @@
/*********************************************************************
* Get data from a registry model and update the tree.
********************************************************************/
- void update (int howSorted) {
+ public void update (int howSorted) {
setEnabledPopup (false);
+
updateException = null;
final int sorted = howSorted;
final SwingWorker worker = new SwingWorker() {
@@ -144,11 +146,13 @@
onUpdateDataTreeByAuth (dataTypes);
else
onUpdateDataTree (dataTypes);
- setEnabledPopup (true);
- if (sorted == SORTED_BY_AUTHORITY)
- deprecatedBox.setEnabled (false);
- else
- deprecatedBox.setEnabled (true);
+ if (dataTypes.length > 0) {
+ setEnabledPopup (true);
+ if (sorted == SORTED_BY_AUTHORITY)
+ deprecatedBox.setEnabled (false);
+ else
+ deprecatedBox.setEnabled (true);
+ }
}
}
};
@@ -321,7 +325,6 @@
worker.start();
}
-
/*********************************************************************
*
* A tree node representing a child element of a Moby data type.
@@ -353,4 +356,7 @@
}
}
+
+
+
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/JProgressBarWithCancel.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/JProgressBarWithCancel.java 2005/10/12 11:17:59 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/JProgressBarWithCancel.java 2005/10/22 01:38:04 1.2
@@ -29,6 +29,7 @@
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Dimension;
+import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -72,14 +73,16 @@
progressBar.setValue (0);
progressBar.setStringPainted (true);
- cancelButton = new JButton();
+ Icon cancelIcon = SwingUtils.createIcon ("images/smallCancel.gif", this);
+ cancelButton = new JButton (cancelIcon);
cancelButton.setFocusPainted (false);
+ cancelButton.setMargin (new Insets (0,0,0,0));
+ cancelButton.setContentAreaFilled (false);
cancelButton.setToolTipText ("Cancel the process");
// put it together ( TBD: should depend on progressBar.getOrientation() )
- SwingUtils.addComponent (this, progressBar, 0, 0, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.WEST, 1.0, 0.0);
+ SwingUtils.addComponent (this, progressBar, 0, 0, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, 1.0, 0.0);
SwingUtils.addComponent (this, cancelButton, 1, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST, 0.0, 0.0);
-
}
/*********************************************************************
@@ -96,4 +99,11 @@
return cancelButton;
}
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void addActionListener (ActionListener l) {
+ getButton().addActionListener (l);
+ }
+
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PropertyChannel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PropertyChannel.java 2005/10/12 11:17:59 1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PropertyChannel.java 2005/10/22 01:38:04 1.3
@@ -8,6 +8,8 @@
package org.biomoby.service.dashboard;
+import org.tulsoft.shared.UUtils;
+
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeSupport;
@@ -86,6 +88,17 @@
}
/*********************************************************************
+ *
+ ********************************************************************/
+ public boolean getBoolean (Object key, boolean defaultValue) {
+ Object value = get (key);
+ if (value == null) return defaultValue;
+ if (value instanceof Boolean)
+ return ((Boolean)value).booleanValue();
+ return UUtils.is (value.toString());
+ }
+
+ /*********************************************************************
* Property change stuff
********************************************************************/
protected PropertyChangeSupport support;
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.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/RegistryModel.java 2005/10/12 11:17:59 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java 2005/10/22 01:38:04 1.5
@@ -13,6 +13,10 @@
import org.biomoby.shared.CentralAll;
import org.biomoby.client.CentralDigestCachedImpl;
+import org.biomoby.shared.event.Notifier;
+import org.biomoby.shared.event.NotificationEvent;
+import org.biomoby.shared.event.NotificationListener;
+
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeSupport;
@@ -32,9 +36,11 @@
*/
public class RegistryModel
- extends AbstractModel {
+ extends AbstractModel
+ implements Notifier {
CentralAll worker;
+ boolean useCache = true;
Hashtable dataTypesTable;
/*********************************************************************
@@ -73,7 +79,7 @@
public MobyDataType[] getDataTypesByNames()
throws MobyException {
initWorker();
-
+ fireEvent (DATA_TYPES_RESET, "", null);
MobyDataType[] dataTypes = worker.getDataTypes();
java.util.Arrays.sort (dataTypes);
return dataTypes;
@@ -84,8 +90,8 @@
********************************************************************/
public MobyDataType[] getDataTypesByAuthority()
throws MobyException {
-
initWorker();
+ fireEvent (DATA_TYPES_RESET, "", null);
MobyDataType[] dataTypes = worker.getDataTypes();
java.util.Arrays.sort
(dataTypes,
@@ -157,9 +163,9 @@
String registryURL = propertyChannel.getString (DP_REGISTRY_ENDPOINT);
String registryNS = propertyChannel.getString (DP_REGISTRY_NAMESPACE);
String cacheDir = propertyChannel.getString (DP_CACHE_DIR);
- // String cacheDir = "/home/senger/jMoby/myCache";
- // cacheDir = null;
-
+ useCache = propertyChannel.getBoolean (DP_USE_CACHE, true);
+ if (! useCache)
+ cacheDir = null;
worker = new CentralDigestCachedImpl (registryURL,
registryNS,
cacheDir);
@@ -167,15 +173,110 @@
String maybeNewRegistryURL = propertyChannel.getString (DP_REGISTRY_ENDPOINT);
String maybeNewRegistryNS = propertyChannel.getString (DP_REGISTRY_NAMESPACE);
String maybeNewCacheDir = propertyChannel.getString (DP_CACHE_DIR);
- if ( maybeNewRegistryURL.equals (worker.getRegistryEndpoint()) &&
+ boolean maybeUseCache = propertyChannel.getBoolean (DP_USE_CACHE, true);
+ if ( (maybeUseCache == useCache) &&
+ maybeNewRegistryURL.equals (worker.getRegistryEndpoint()) &&
maybeNewRegistryNS.equals (worker.getRegistryNamespace()) &&
maybeNewCacheDir.equals (getCacheDir()) )
return;
+ useCache = maybeUseCache;
+ if (! useCache)
+ maybeNewCacheDir = null;
+ NotificationListener[] nls = ((Notifier)worker).getNotificationListeners();
+ ((Notifier)worker).removeNotificationListeners (nls);
worker = new CentralDigestCachedImpl (maybeNewRegistryURL,
maybeNewRegistryNS,
maybeNewCacheDir);
+ ((Notifier)worker).addNotificationListeners (nls);
+ }
+ }
+
+ /*************************************************************************
+ *
+ * Methods implementing Notifier interface.
+ *
+ *************************************************************************/
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public synchronized void addNotificationListener (NotificationListener l) {
+ try {
+ initWorker();
+ ((Notifier)worker).addNotificationListener (l);
+ } catch (MobyException e) {
+ // TBD with proper logging
+ System.err.println ("ERROR: " + e);
+ }
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void addNotificationListeners (NotificationListener[] l) {
+ try {
+ initWorker();
+ ((Notifier)worker).addNotificationListeners (l);
+ } catch (MobyException e) {
+ // TBD with proper logging
+ System.err.println ("ERROR: " + e);
}
}
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public synchronized void removeNotificationListener (NotificationListener l) {
+ try {
+ initWorker();
+ ((Notifier)worker).removeNotificationListener (l);
+ } catch (MobyException e) {
+ // TBD with proper logging
+ System.err.println ("ERROR: " + e);
+ }
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void removeNotificationListeners (NotificationListener[] l) {
+ try {
+ initWorker();
+ ((Notifier)worker).removeNotificationListeners (l);
+ } catch (MobyException e) {
+ // TBD with proper logging
+ System.err.println ("ERROR: " + e);
+ }
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public NotificationListener[] getNotificationListeners() {
+ try {
+ initWorker();
+ return ((Notifier)worker).getNotificationListeners();
+ } catch (MobyException e) {
+ // TBD with proper logging
+ System.err.println ("ERROR: " + e);
+ return new NotificationListener[] {};
+ }
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void callback (int signal) {
+ if (worker != null)
+ ((Notifier)worker).callback (signal);
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void fireEvent (int type, Object message, Object details) {
+ if (worker != null)
+ ((Notifier)worker).fireEvent (type, message, details);
+ }
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/10/12 11:17:59 1.9
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/10/22 01:38:04 1.10
@@ -129,13 +129,17 @@
// ontology trees
ServicesTree servicesTree = new ServicesTree();
- DataTypesTree dataTypesTree = new DataTypesTree (registryModel, console);
- dataTypesTree.update (CommonTree.SORTED_BY_NAME);
+
+ DataTypesBoard dataTypesBoard = new DataTypesBoard (registryModel,
+ console,
+ support);
+ dataTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
+
NamespacesTree namespacesTree = new NamespacesTree();
JSplitPane split1 = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
servicesTree.scrollable(),
- dataTypesTree.scrollable());
+ dataTypesBoard);
split1.setResizeWeight (0.5);
split1.setContinuousLayout (true);
split1.setOneTouchExpandable (true);
@@ -200,6 +204,7 @@
cacheDir.setEnabled (enabled);
labelCacheDir.setEnabled (enabled);
setPrefValue (USE_CACHE, enabled);
+ propertyChannel.put (DP_USE_CACHE, new Boolean (enabled).toString());
}
/**************************************************************************
@@ -252,6 +257,8 @@
onUseCache (e.getStateChange() == ItemEvent.SELECTED);
}
});
+ propertyChannel.put (DP_USE_CACHE, new Boolean (usingCache).toString());
+
labelCacheDir = new JLabel("Cache directory");
cacheDir = createFileSelector ("Select directory for/with local cache",
"Select",
More information about the MOBY-guts
mailing list