Author: kono
Date: 2011-01-13 20:02:25 -0800 (Thu, 13 Jan 2011)
New Revision: 23454
Added:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/event/
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/event/RegistoryImportedEvent.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/BioMartTaskFactory.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
Removed:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITask.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITaskFactory.java
Modified:
core3/webservice-biomart-client/trunk/pom.xml
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/rest/BiomartRestClient.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/LoadRepositoryTask.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
Basic functions are working, but still cannot display task monitor.
Modified: core3/webservice-biomart-client/trunk/pom.xml
===================================================================
--- core3/webservice-biomart-client/trunk/pom.xml 2011-01-14 04:00:56 UTC
(rev 23453)
+++ core3/webservice-biomart-client/trunk/pom.xml 2011-01-14 04:02:25 UTC
(rev 23454)
@@ -101,9 +101,14 @@
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
- <artifactId>work-api</artifactId>
- <version>3.0.0-alpha2-SNAPSHOT</version>
+ <artifactId>work-swing-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
+ <artifactId>swing-application-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
<!-- Testing -->
Added:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/event/RegistoryImportedEvent.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/event/RegistoryImportedEvent.java
(rev 0)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/event/RegistoryImportedEvent.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -0,0 +1,5 @@
+package org.cytoscape.io.webservice.biomart.event;
+
+public class RegistoryImportedEvent {
+
+}
Modified:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/rest/BiomartRestClient.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/rest/BiomartRestClient.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/rest/BiomartRestClient.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -346,7 +346,6 @@
String[] parts;
while ((s = reader.readLine()) != null) {
- System.out.println("Filter response: " + s);
parts = s.split("\\t");
if (parts.length <= 1)
@@ -358,8 +357,8 @@
|| parts.length > 6
&& parts[5].equals("id_list")) {
filters.put(parts[1], parts[0]);
- System.out.println("### Filter Entry = " +
parts[1] + " = "
- + parts[0]);
+// System.out.println("### Filter Entry = " +
parts[1] + " = "
+// + parts[0]);
}
}
@@ -415,8 +414,6 @@
parts = s.split("\\t");
attrInfo = new String[3];
- System.out.println("Attr Line: " + s);
-
if (parts.length == 0)
continue;
Added:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/BioMartTaskFactory.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/BioMartTaskFactory.java
(rev 0)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/BioMartTaskFactory.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -0,0 +1,23 @@
+package org.cytoscape.io.webservice.biomart.task;
+
+import org.cytoscape.work.Task;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.TaskIterator;
+
+public class BioMartTaskFactory implements TaskFactory{
+
+ private TaskIterator itr;
+
+ public BioMartTaskFactory(final Task firstTask) {
+ if(firstTask == null)
+ throw new NullPointerException("First task is null.");
+
+ this.itr = new TaskIterator(firstTask);
+ }
+
+ @Override
+ public TaskIterator getTaskIterator() {
+ return itr;
+ }
+
+}
Modified:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/LoadRepositoryTask.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/LoadRepositoryTask.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/LoadRepositoryTask.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -53,7 +53,7 @@
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
- taskMonitor.setProgress(0.0);
+ taskMonitor.setProgress(0.1);
taskMonitor.setStatusMessage("Loading list of available
marts...");
dsList = new ArrayList<String>();
Copied:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
(from rev 23431,
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITask.java)
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
(rev 0)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -0,0 +1,60 @@
+package org.cytoscape.io.webservice.biomart.task;
+
+import java.awt.event.ActionEvent;
+
+import org.cytoscape.application.swing.AbstractCyAction;
+import org.cytoscape.application.swing.CySwingApplication;
+import org.cytoscape.io.webservice.biomart.BiomartClient;
+import org.cytoscape.io.webservice.biomart.ui.BiomartMainDialog;
+import org.cytoscape.model.CyTableManager;
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.work.TaskManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * TODO: Add cancel function
+ */
+public class ShowBiomartGUIAction extends AbstractCyAction {
+
+ private static final long serialVersionUID = -1329132199540543764L;
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(ShowBiomartGUIAction.class);
+
+ private BiomartMainDialog dialog;
+
+ private final BiomartClient client;
+ private final TaskManager taskManager;
+ private final CyApplicationManager appManager;
+ private final CyTableManager tblManager;
+ private final CySwingApplication app;
+
+ public ShowBiomartGUIAction(final BiomartClient client,
+ final TaskManager taskManager,
+ final CyApplicationManager appManager,
+ final CyTableManager tblManager, final
CySwingApplication app) {
+ super("Import Tables from Biomart...", appManager);
+ setPreferredMenu("File.Import");
+
+ this.app = app;
+ this.client = client;
+ this.taskManager = taskManager;
+ this.appManager = appManager;
+ this.tblManager = tblManager;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ae) {
+ // Lazy instantiation. This process depends on network
connection.
+ if (dialog == null) {
+ logger.debug("BioMart Dialog initialization process
start.");
+ dialog = new BiomartMainDialog(client, taskManager,
appManager, tblManager, app);
+ logger.info("BioMart Client dialog initialized.");
+ }
+
+ dialog.setLocationRelativeTo(app.getJFrame());
+ dialog.setVisible(true);
+ }
+}
Deleted:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITask.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITask.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITask.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -1,52 +0,0 @@
-package org.cytoscape.io.webservice.biomart.task;
-
-import org.cytoscape.io.webservice.biomart.BiomartClient;
-import org.cytoscape.io.webservice.biomart.ui.BiomartMainDialog;
-import org.cytoscape.model.CyTableManager;
-import org.cytoscape.session.CyApplicationManager;
-import org.cytoscape.work.AbstractTask;
-import org.cytoscape.work.TaskManager;
-import org.cytoscape.work.TaskMonitor;
-
-/**
- *
- * TODO: Add cancel function
- */
-public class ShowBiomartGUITask extends AbstractTask {
-
- private BiomartMainDialog dialog;
-
- final BiomartClient client;
- final TaskManager taskManager;
- final CyApplicationManager appManager;
- final CyTableManager tblManager;
-
- public ShowBiomartGUITask(
- final BiomartClient client,
- final TaskManager taskManager,
- final CyApplicationManager appManager,
- final CyTableManager tblManager) {
-
- this.client = client;
- this.taskManager = taskManager;
- this.appManager = appManager;
- this.tblManager = tblManager;
- }
-
- @Override
- public void run(TaskMonitor taskMonitor) throws Exception {
-
- // Lazy instantiation. This process depends on network
connection.
- if (dialog == null) {
- taskMonitor
- .setStatusMessage("Checking available
Mart services.\n\nThis process may take a while.\nPlease wait...");
- taskMonitor.setProgress(0.0);
- dialog = new BiomartMainDialog(client, taskManager,
appManager, tblManager);
- taskMonitor.setProgress(1.0);
- }
-
- // mainDialog.setLocationRelativeTo(Cytoscape.getDesktop());
- dialog.setVisible(true);
- }
-
-}
Deleted:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITaskFactory.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITaskFactory.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUITaskFactory.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -1,33 +0,0 @@
-package org.cytoscape.io.webservice.biomart.task;
-
-import org.cytoscape.io.webservice.biomart.BiomartClient;
-import org.cytoscape.model.CyTableManager;
-import org.cytoscape.session.CyApplicationManager;
-import org.cytoscape.work.TaskFactory;
-import org.cytoscape.work.TaskIterator;
-import org.cytoscape.work.TaskManager;
-
-public final class ShowBiomartGUITaskFactory implements TaskFactory {
-
- final BiomartClient client;
- final TaskManager taskManager;
- final CyApplicationManager appManager;
- final CyTableManager tblManager;
-
- public ShowBiomartGUITaskFactory(final BiomartClient client,
- final TaskManager taskManager,
- final CyApplicationManager appManager,
- final CyTableManager tblManager) {
- this.client = client;
- this.taskManager = taskManager;
- this.appManager = appManager;
- this.tblManager = tblManager;
-
- }
-
- @Override
- public TaskIterator getTaskIterator() {
- return new TaskIterator(new ShowBiomartGUITask(client,
taskManager, appManager, tblManager));
- }
-
-}
Modified:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -367,7 +367,7 @@
}
protected void cancelButtonActionPerformed(java.awt.event.ActionEvent
evt) {
- firePropertyChange(CLOSE_EVENT, null, null);
+ // Close parent
}
private void attributeTypeComboBoxActionPerformed(
Modified:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -34,6 +34,7 @@
*/
package org.cytoscape.io.webservice.biomart.ui;
+import java.awt.Window;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.Collections;
@@ -51,6 +52,7 @@
import org.cytoscape.io.webservice.biomart.rest.Dataset;
import org.cytoscape.io.webservice.biomart.rest.Filter;
import org.cytoscape.io.webservice.biomart.rest.XMLQueryBuilder;
+import org.cytoscape.io.webservice.biomart.task.BioMartTaskFactory;
import org.cytoscape.io.webservice.biomart.task.ImportAttributeListTask;
import org.cytoscape.io.webservice.biomart.task.ImportAttributeListTaskFactory;
import org.cytoscape.io.webservice.biomart.task.ImportFilterTask;
@@ -64,7 +66,9 @@
import org.cytoscape.model.CyTable;
import org.cytoscape.model.CyTableManager;
import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.work.TaskIterator;
import org.cytoscape.work.TaskManager;
+import org.cytoscape.work.swing.GUITaskManager;
/**
*
@@ -102,6 +106,8 @@
private final TaskManager taskManager;
private final CyApplicationManager appManager;
private final CyTableManager tblManager;
+
+ private final Window parent;
/**
* Creates a new BiomartNameMappingPanel object.
@@ -112,21 +118,23 @@
* DOCUMENT ME!
* @throws Exception
*/
- public BiomartAttrMappingPanel(final BiomartClient client,
+ public BiomartAttrMappingPanel(
+ final BiomartClient client,
final TaskManager taskManager,
final CyApplicationManager appManager,
- final CyTableManager tblManager) {
+ final CyTableManager tblManager, final Window parent) {
super(LOGO, "Biomart", "Import Settings");
this.client = client;
this.taskManager = taskManager;
this.appManager = appManager;
this.tblManager = tblManager;
+ this.parent = parent;
importTaskFactory = new ImportTableTaskFactory(this.client);
- loadRepositoryTaskFactory = new LoadRepositoryTaskFactory(
- client.getClient());
+ loadRepositoryTaskFactory = new
LoadRepositoryTaskFactory(this.client.getClient());
+ // Access the MartService and get the available services.
initDataSources();
}
@@ -141,32 +149,29 @@
filterMap = new HashMap<String, Map<String, String>>();
attrNameMap = new HashMap<String, Map<String, String>>();
+ // Block the entire panel
+ this.setEnabled(false);
+
+ // Import list of repositories.
loadMartServiceList();
- loadFilter();
+
+ // Load available filters for current source.
+ //loadFilter();
}
- protected boolean isInitialized() {
- return initialized;
- }
-
private void loadMartServiceList() {
-// final LoadRepositoryTaskFactory tf = new
LoadRepositoryTaskFactory(
-// client.getClient());
- final LoadRepositoryTask firstTask = (LoadRepositoryTask)
loadRepositoryTaskFactory
- .getTaskIterator().next();
-
- loadRepositoryTaskFactory.setTask(firstTask);
- taskManager.executeAndWait(loadRepositoryTaskFactory);
- loadRepositoryTaskFactory.setTask(null);
+ final LoadRepositoryTask firstTask = new
LoadRepositoryTask(client.getClient());
+ final BioMartTaskFactory tf = new BioMartTaskFactory(firstTask);
+ ((GUITaskManager)taskManager).setParent(parent);
+ taskManager.executeAndWait(tf);
this.datasourceMap = firstTask.getDatasourceMap();
final List<String> dsList = firstTask.getSortedDataSourceList();
- System.out.println("GOT datasource list from task: " + dsList);
+ //System.out.println("GOT datasource list from task: " +
dsList);
for(String ds : dsList)
this.databaseComboBox.addItem(ds);
-
- initialized = true;
}
+
private void loadFilter() {
attributeTypeComboBox.removeAllItems();
Modified:
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
2011-01-14 04:02:25 UTC (rev 23454)
@@ -42,6 +42,7 @@
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
+import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.io.webservice.biomart.BiomartClient;
import org.cytoscape.model.CyTableManager;
import org.cytoscape.session.CyApplicationManager;
@@ -53,20 +54,26 @@
public final class BiomartMainDialog extends JDialog {
private static final long serialVersionUID = 2382157952635589843L;
-
- private static boolean initialized = true;
+ /**
+ * Basic GUI to access BioMart services.
+ *
+ * @param client
+ * @param taskManager
+ * @param appManager
+ * @param tblManager
+ */
public BiomartMainDialog(final BiomartClient client, final TaskManager
taskManager,
final CyApplicationManager appManager,
- final CyTableManager tblManager) {
+ final CyTableManager tblManager, final
CySwingApplication app) {
super();
setTitle("BioMart Web Service Client");
// Create a tabbed pane
final JTabbedPane tabs = new JTabbedPane();
-
final JPanel tunablePanel = new JPanel();
tunablePanel.setBackground(Color.white);
+
final JPanel tPanel = new JPanel();
final Dimension panelSize = new Dimension(220, 250);
tPanel.setMinimumSize(panelSize);
@@ -78,9 +85,8 @@
tunablePanel.add(tPanel);
- BiomartAttrMappingPanel panel = new
BiomartAttrMappingPanel(client,taskManager, appManager, tblManager);
+ final BiomartAttrMappingPanel panel = new
BiomartAttrMappingPanel(client,taskManager, appManager, tblManager,
app.getJFrame());
tabs.addTab("Query", panel);
- // tabs.addTab("Options", tunablePanel);
add(tabs);
Modified:
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-01-14 04:02:25 UTC (rev 23454)
@@ -5,6 +5,9 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd"
default-lazy-init="false">
+ <osgi:reference id="cySwingApplicationServiceRef"
+ interface="org.cytoscape.application.swing.CySwingApplication"
/>
+
<osgi:reference id="taskManagerServiceRef"
interface="org.cytoscape.work.swing.GUITaskManager" />
@@ -20,12 +23,7 @@
<osgi:reference id="cyTableFactoryServiceRef"
interface="org.cytoscape.model.CyTableFactory" />
- <osgi:service id="showBiomartGUITaskFactoryService"
ref="showDialogTaskFactory"
- interface="org.cytoscape.work.TaskFactory">
- <osgi:service-properties>
- <entry key="title" value="Import Attributes from
BioMart..." />
- <entry key="preferredMenu" value="File.Import" />
- </osgi:service-properties>
- </osgi:service>
+ <osgi:service id="showBiomartGUIActionService" ref="showDialogAction"
+ interface="org.cytoscape.application.swing.CyAction" />
</beans>
Modified:
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-01-14 04:00:56 UTC (rev 23453)
+++
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-01-14 04:02:25 UTC (rev 23454)
@@ -33,10 +33,11 @@
</bean>
<!-- Task to create menu item -->
- <bean id="showDialogTaskFactory"
class="org.cytoscape.io.webservice.biomart.task.ShowBiomartGUITaskFactory">
+ <bean id="showDialogAction"
class="org.cytoscape.io.webservice.biomart.task.ShowBiomartGUIAction">
<constructor-arg ref="biomartClient" />
<constructor-arg ref="taskManagerServiceRef" />
<constructor-arg ref="cyApplicationManagerServiceRef" />
<constructor-arg ref="cyTableManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
</bean>
</beans>
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.