[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Fri Apr 9 15:55:49 UTC 2010
gordonp
Fri Apr 9 11:55:48 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv1730/src/main/ca/ucalgary/seahawk/gui
Modified Files:
MobyServicesGUI.java
Log Message:
Added ability to customize top level menu items with extra text (used initially by 'previous input' feature)
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyServicesGUI.java,1.16,1.17
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java 2009/06/09 19:27:56 1.16
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java 2010/04/09 15:55:48 1.17
@@ -442,7 +442,7 @@
// Create the top level menu items for these moby objects right away
submenus = new JMenu[mobyObjects.length];
for(int i = 0; i < mobyObjects.length; i++){
- JMenu submenu = createObjectSubMenu(mobyObjects[i]);
+ JMenu submenu = createObjectSubMenu(mobyObjects[i], null);
if(submenu == null){
continue;
}
@@ -503,6 +503,7 @@
Node targetNode = null;
MobyRequestEventHandler handler = null;
MobyDataInstance mobyData = null;
+ String extraMenuText = null;
JPopupMenu popupList;
public OptionLoaderThread(Node targetNode, JPopupMenu popupList, MobyRequestEventHandler handler){
@@ -512,11 +513,12 @@
this.handler = handler;
}
- public OptionLoaderThread(MobyDataInstance mobyData, JPopupMenu popupList, MobyRequestEventHandler handler){
+ public OptionLoaderThread(MobyDataInstance mobyData, JPopupMenu popupList, MobyRequestEventHandler handler, String extraMenuText){
super();
this.mobyData = mobyData;
this.popupList = popupList;
this.handler = handler;
+ this.extraMenuText = extraMenuText;
}
public void run(){
@@ -524,7 +526,7 @@
addPopupOptions(targetNode, popupList, false, handler);
}
else if(mobyData != null){
- addPopupOptions(mobyData, popupList, false, handler);
+ addPopupOptions(mobyData, popupList, false, handler, extraMenuText);
}
else{
logger.warn("Warning: OptionLoaderThread has no data to work with");
@@ -584,6 +586,13 @@
* Find the list of available services querying MobyCentral directly with a piece of data.
*/
public void addPopupOptions(MobyDataInstance mobyData, JPopupMenu popupList, boolean asynchronous, MobyRequestEventHandler handler){
+ addPopupOptions(mobyData, popupList, asynchronous, handler, null);
+ }
+
+ /**
+ * Find the list of available services querying MobyCentral directly with a piece of data.
+ */
+ public void addPopupOptions(MobyDataInstance mobyData, JPopupMenu popupList, boolean asynchronous, MobyRequestEventHandler handler, String extraMenuText){
if(asynchronous){
//Show the user that we're doing something...
@@ -596,13 +605,13 @@
}
// Call this method synchronously in a different thread
- OptionLoaderThread lt = new OptionLoaderThread(mobyData, popupList, handler);
+ OptionLoaderThread lt = new OptionLoaderThread(mobyData, popupList, handler, extraMenuText);
lt.start();
return;
}
// Create submenu for this object
- JMenu submenu = createObjectSubMenu(mobyData);
+ JMenu submenu = createObjectSubMenu(mobyData, extraMenuText);
// Add option to copy object to clipboard. We don't need to wait until services are found.
if(submenu == null){
return;
@@ -1127,7 +1136,7 @@
return menu;
}
- public JMenu createObjectSubMenu(MobyDataInstance mdi){
+ public JMenu createObjectSubMenu(MobyDataInstance mdi, String extraMenuText){
if(!(mdi instanceof MobyPrimaryData)){
logger.warn("Ignoring non-primary data object submitted to menu creation: " + mdi);
return null;
@@ -1205,7 +1214,7 @@
}
}
desc = "Record Identifier - " + mobydesc;
- submenu = new JMenu("Services for " + datatype + ":" + id);
+ submenu = new JMenu("Services for " + (extraMenuText == null ? "" : extraMenuText+" ")+datatype + ":" + id);
assignMenuDataIndex(submenu);
}
else if("String".equals(mobyDataType.getName())){
@@ -1217,7 +1226,8 @@
sample = sample.substring(0, MAX_ID_LEN)+"...";
}
desc = "A piece of text";
- submenu = new JMenu("Services for String \"" + sample + "\"");
+ submenu = new JMenu("Services for "+(extraMenuText == null ? "" : extraMenuText+" ")+
+ "String \"" + sample + "\"");
assignMenuDataIndex(submenu);
}
// Complex object
@@ -1236,7 +1246,7 @@
else if(targetData instanceof MobyDataObjectSet){
objectLabel += " collection";
}
- submenu = new JMenu("Services for " + objectLabel);
+ submenu = new JMenu("Services for " + (extraMenuText == null ? "" : extraMenuText+" ")+objectLabel);
assignMenuDataIndex(submenu);
}
desc = "Input data: " + desc;
More information about the MOBY-guts
mailing list