[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Fri Dec 14 23:18:54 UTC 2007
gordonp
Fri Dec 14 18:18:54 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv24934/src/main/ca/ucalgary/seahawk/gui
Modified Files:
MobyServicesGUI.java
Log Message:
Got rid of unchecked type operations
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyServicesGUI.java,1.12,1.13
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java 2007/12/07 20:31:41 1.12
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java 2007/12/14 23:18:54 1.13
@@ -26,7 +26,7 @@
* Implementation of the actually popup menu that lists services available, and invokes them.
*/
-public class MobyServicesGUI implements ActionListener, Comparator, PopupMenuListener{
+public class MobyServicesGUI implements ActionListener, Comparator<MobyService>, PopupMenuListener{
public final static int MAX_ID_LEN = 30;
public final static String SERVICE_SUBMENU_NAME = "seahawkPopupSubMenuName";
@@ -54,10 +54,12 @@
MobyDataSecondaryInstance[] secondaryInputInstances = null;
MobyPrimaryData[] primaryInput = null;
int maxDataDesc = 22;
- private HashMap<JMenu, JMenu> service2submenu; //tracks nested submenus to root submenus of choices popup
- private HashMap submenu2msIndex;
- private HashMap submenu2waitItem;
- private HashMap specificHandlers; // for storing callbacks to other than the default response handler
+ // tracks nested submenus to root submenus of choices popup
+ private Map<JMenu, JMenu> service2submenu;
+ private Map<JComponent,Integer> submenu2msIndex;
+ private Map<JMenu,JMenuItem> submenu2waitItem;
+ // for storing callbacks to other than the default response handler
+ private Map<Integer,WeakReference<MobyRequestEventHandler>> specificHandlers;
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(MobyServicesGUI.class);
MobyContentClipboard clip = null;
@@ -69,10 +71,10 @@
waitItem = new JMenuItem("Building data list, please wait...");
textCollator = Collator.getInstance();
ms = new MobyDataServiceAssocInstance[0];
- submenu2msIndex = new HashMap();
- submenu2waitItem = new HashMap();
+ submenu2msIndex = new HashMap<JComponent,Integer>();
+ submenu2waitItem = new HashMap<JMenu,JMenuItem>();
service2submenu = new HashMap<JMenu,JMenu>();
- specificHandlers = new HashMap();
+ specificHandlers = new HashMap<Integer,WeakReference<MobyRequestEventHandler>>();
}
public Central getMobyCentralImpl(){
@@ -168,8 +170,8 @@
return mobyRequestEventHandler;
}
- WeakReference ref = (WeakReference) specificHandlers.get(hashCode);
- MobyRequestEventHandler handler = (MobyRequestEventHandler) ref.get();
+ WeakReference<MobyRequestEventHandler> ref = specificHandlers.get(hashCode);
+ MobyRequestEventHandler handler = ref.get();
if(handler == null){
// The handler was destroyed (e.g. MobyContentPane closed) before we got the response
logger.warn("Notice: The MOBY event handler corresponding to hash code " + hashCode +
@@ -656,7 +658,7 @@
if(handler != null && !specificHandlers.containsKey(handler)){
// Java 1.5 auto-boxes the key int to Integer
//logger.debug("Adding handler " + handler.hashCode());
- specificHandlers.put(handler.hashCode(), new WeakReference(handler));
+ specificHandlers.put(handler.hashCode(), new WeakReference<MobyRequestEventHandler>(handler));
}
}
@@ -1339,8 +1341,8 @@
}
}
- public int compare(Object o1, Object o2){
- return textCollator.compare(((MobyService) o1).getName(), ((MobyService) o2).getName());
+ public int compare(MobyService o1, MobyService o2){
+ return textCollator.compare(o1.getName(), o2.getName());
}
public boolean equals(Object obj){
More information about the MOBY-guts
mailing list