Author: ruschein
Date: 2010-08-13 14:05:21 -0700 (Fri, 13 Aug 2010)
New Revision: 21385
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
Log:
We now also intercept @ProvidesGUI.
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
===================================================================
---
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
2010-08-13 19:39:30 UTC (rev 21384)
+++
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
2010-08-13 21:05:21 UTC (rev 21385)
@@ -73,16 +73,21 @@
*/
public abstract class AbstractTunableInterceptor<TH extends TunableHandler>
implements TunableInterceptor<TH> {
/**
- * Factory for Handlers
+ * Factory for Handlers
*/
protected HandlerFactory<TH> factory;
/**
- * Store the Handlers
+ * Store the Handlers
*/
protected Map<Object, LinkedHashMap<String, TH>> handlerMap;
/**
+ * Store the JPanel-returning methods
+ */
+ protected Map<Object, Method> guiProviderMap;
+
+ /**
* Creates a new AbstractTunableInterceptor object.
*
* @param tunableHandlerFactory Factory of <code>Handlers</code> = can
be <code>GUIHandlerFactory</code> to make the GUI with the
<code>Handlers</code>,
@@ -92,6 +97,7 @@
public AbstractTunableInterceptor(HandlerFactory<TH>
tunableHandlerFactory) {
this.factory = tunableHandlerFactory;
handlerMap = new HashMap<Object, LinkedHashMap<String, TH>>();
+ guiProviderMap = new HashMap<Object, Method>();
}
/**
@@ -166,6 +172,7 @@
final String rootName =
method.getName().substring(3);
setMethodsMap.put(rootName, method);
+
tunableMap.put(rootName, tunable);
if
(getMethodsMap.containsKey(rootName)) {
final Method
getter = getMethodsMap.get(rootName);
if
(!setterAndGetterTypesAreCompatible(getter, method))
@@ -189,6 +196,13 @@
System.out.println("tunable
method intercept failed: " + method);
ex.printStackTrace();
}
+ } else if
(method.isAnnotationPresent(ProvidesGUI.class)) {
+ if (method.getReturnType() !=
void.class)
+
System.err.println(method.getName() + " annotated with @ProvidesGUI must return
void!");
+ else if
(method.getParameterTypes().length != 0)
+
System.err.println(method.getName() + " annotated with @ProvidesGUI must take 0
arguments!");
+ else
+ guiProviderMap.put(obj, method);
}
}
--
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.