Author: kono
Date: 2010-12-08 17:06:54 -0800 (Wed, 08 Dec 2010)
New Revision: 23141
Added:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/AbstractDiscreteMappingGenerator.java
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMenuManager.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowColorMappingGenerator.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowOscColorMappingGenerator.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomColorMappingGenerator.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomNumberMappingGenerator.java
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
Log:
Value generator framework is working now. Need to fix performance issue.
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMenuManager.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMenuManager.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMenuManager.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -8,15 +8,20 @@
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
import org.cytoscape.view.vizmap.gui.action.VizMapUIAction;
+import
org.cytoscape.view.vizmap.gui.internal.task.generators.GenerateValuesTaskFactory;
import org.cytoscape.view.vizmap.gui.internal.theme.IconManager;
-import org.cytoscape.work.Task;
+import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
import org.cytoscape.work.TaskFactory;
-import org.cytoscape.work.TaskIterator;
import org.cytoscape.work.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.l2fprod.common.propertysheet.PropertySheetPanel;
+import com.l2fprod.common.propertysheet.PropertySheetTable;
+
/**
* Manager for all Vizmap-local tasks (commands).
*
@@ -40,9 +45,11 @@
// Context menu
private final JPopupMenu rightClickMenu;
+
+ // Context Menu Preset items
+ private final JMenu edit;
+ private final JMenu generateValues;
- private JMenu generateValues;
-
private IconManager iconManager;
// Injected from resource file.
@@ -55,19 +62,30 @@
private JMenu modifyValues;
private final TaskManager taskManager;
+
+ private final PropertySheetPanel panel;
+ private final SelectedVisualStyleManager manager;
+ private final CyApplicationManager appManager;
- public VizMapperMenuManager(final TaskManager taskManager) {
+ public VizMapperMenuManager(final TaskManager taskManager, final
PropertySheetPanel panel, final SelectedVisualStyleManager manager, final
CyApplicationManager appManager) {
if (taskManager == null)
throw new NullPointerException("TaskManager is null.");
this.taskManager = taskManager;
+ this.appManager = appManager;
+ this.manager = manager;
+ this.panel = panel;
// Will be shown under the button next to Visual Style Name
mainMenu = new JPopupMenu();
// Context menu
rightClickMenu = new JPopupMenu();
+ this.edit = new JMenu("Edit");
+ rightClickMenu.add(edit);
+ this.generateValues = new JMenu("Mapping Value Generators");
+ this.rightClickMenu.add(generateValues);
// modifyValues = new JMenu(modifyMenuLabel);
}
@@ -101,20 +119,20 @@
* java.util.Map)
*/
public void onBind(VizMapUIAction action, Map properties) {
- if (generateValues == null && iconManager != null) {
- // for value generators.
- generateValues = new JMenu(generateMenuLabel);
-
generateValues.setIcon(iconManager.getIcon(generateIconId));
- rightClickMenu.add(generateValues);
- }
-
- final Object serviceType = properties.get("service.type");
- if (serviceType != null
- &&
serviceType.toString().equals("vizmapUI.contextMenu")) {
- rightClickMenu.add(action.getMenu());
- } else {
- mainMenu.add(action.getMenu());
- }
+// if (generateValues == null && iconManager != null) {
+// // for value generators.
+// generateValues = new JMenu(generateMenuLabel);
+//
generateValues.setIcon(iconManager.getIcon(generateIconId));
+// rightClickMenu.add(generateValues);
+// }
+//
+// final Object serviceType = properties.get("service.type");
+// if (serviceType != null
+// &&
serviceType.toString().equals("vizmapUI.contextMenu")) {
+// edit.add(action.getMenu());
+// } else {
+// mainMenu.add(action.getMenu());
+// }
}
public void onUnbind(VizMapUIAction service, Map properties) {
@@ -152,12 +170,44 @@
if(serviceType.toString().equals(MAIN_MENU))
mainMenu.add(menuItem);
else if(serviceType.toString().equals(CONTEXT_MENU))
- rightClickMenu.add(menuItem);
+ edit.add(menuItem);
}
public void removeTaskFactory(final TaskFactory taskFactory, Map
properties) {
}
+
+ public void addMappingGenerator(final DiscreteMappingGenerator<?>
generator, @SuppressWarnings("rawtypes") Map properties) {
+ final Object serviceType = properties.get(METADATA_MENU_KEY);
+ if (serviceType == null)
+ throw new NullPointerException(
+ "Service Type metadata is null. This
value is required.");
+ // This is a menu item for Main Command Button.
+ final Object title = properties.get(METADATA_TITLE_KEY);
+ if (title == null)
+ throw new NullPointerException("Title metadata is
missing.");
+
+ // Create mapping generator task factory
+ final GenerateValuesTaskFactory taskFactory = new
GenerateValuesTaskFactory(generator, panel.getTable(), manager, appManager);
+
+ // Add new menu to the pull-down
+ final JMenuItem menuItem = new JMenuItem(title.toString());
+ // menuItem.setIcon(iconManager.getIcon(iconId));
+ menuItem.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ taskManager.execute(taskFactory);
+ }
+ });
+
+ generateValues.add(menuItem);
+
+ }
+
+ public void removeMappingGenerator(final DiscreteMappingGenerator<?>
generator, @SuppressWarnings("rawtypes") Map properties) {
+ // FIXME
+ }
+
}
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTask.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -1,5 +1,122 @@
package org.cytoscape.view.vizmap.gui.internal.task.generators;
-public class GenerateValuesTask {
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.view.vizmap.VisualMappingFunction;
+import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
+import org.cytoscape.view.vizmap.gui.internal.VizMapperProperty;
+import org.cytoscape.view.vizmap.gui.internal.event.CellType;
+import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
+import org.cytoscape.view.vizmap.mappings.DiscreteMapping;
+import org.cytoscape.work.AbstractTask;
+import org.cytoscape.work.TaskMonitor;
+
+import com.l2fprod.common.propertysheet.Property;
+import com.l2fprod.common.propertysheet.PropertySheetTable;
+import com.l2fprod.common.propertysheet.PropertySheetTableModel.Item;
+
+public class GenerateValuesTask extends AbstractTask {
+
+ private final DiscreteMappingGenerator<?> generator;
+
+ private final PropertySheetTable table;
+ private final SelectedVisualStyleManager manager;
+ private final CyApplicationManager appManager;
+
+ //private final CyTableManager tableManager;
+
+ public GenerateValuesTask(final DiscreteMappingGenerator<?> generator,
+ final PropertySheetTable table,
+ final SelectedVisualStyleManager manager,
+ final CyApplicationManager appManager) {
+ this.generator = generator;
+ this.appManager = appManager;
+ this.manager = manager;
+ this.table = table;
+ //this.tableManager = tableManager;
+ }
+
+ @Override
+ public void run(TaskMonitor monitor) throws Exception {
+ System.out.println("Running task...");
+
+ int selectedRow = table.getSelectedRow();
+
+ // If not selected, do nothing.
+ if (selectedRow < 0)
+ return;
+
+ final Item value = (Item) table.getValueAt(selectedRow, 0);
+
+ if (value.isProperty()) {
+ final VizMapperProperty<?, ?, ?> prop =
(VizMapperProperty<?, ?, ?>) value
+ .getProperty();
+
+ if (prop.getCellType() ==
CellType.VISUAL_PROPERTY_TYPE) {
+ final VisualProperty<?> vp =
(VisualProperty<?>) prop.getKey();
+ System.out.println("Type of VP: " +
vp.getRange().getType());
+
+
if(vp.getRange().getType().isAssignableFrom(generator.getDataType())) {
+ System.out.println("This is compatible:
" + generator.getDataType());
+ generateMapping(prop,
prop.getValue().toString(), vp);
+
+ }
+
+
+ }
+ }
+ }
+
+ private void generateMapping(final VizMapperProperty<?, ?, ?> prop,
final String attrName, final VisualProperty<?> vp ) {
+ System.out.println("Target Attr name = " + attrName);
+
+
+ final Property[] subProps = prop.getSubProperties();
+ final VisualStyle style = manager.getCurrentVisualStyle();
+ final VisualMappingFunction<?, ?> mapping =
style.getVisualMappingFunction(vp);
+
+ if(mapping == null)
+ return;
+
+ final DiscreteMapping<Object, Object> discMapping =
(DiscreteMapping)mapping;
+
+ final Set<Object> keySet = new HashSet<Object>();
+ for(Property p: subProps) {
+ final VizMapperProperty<?, ?, ?> vmp =
(VizMapperProperty<?, ?, ?>)p;
+ if(vmp.getCellType().equals(CellType.DISCRETE)) {
+ System.out.print("Key = " + vmp.getKey());
+ System.out.print(" Key Class = " +
vmp.getKey().getClass());
+ System.out.println(" Val = " + vmp.getValue());
+ keySet.add(vmp.getKey());
+ }
+ }
+
+ Map<Object, ?> map = generator.generateMap(keySet);
+
+ discMapping.putAll(map);
+
+ final CyNetworkView networkView =
appManager.getCurrentNetworkView();
+ style.apply(networkView);
+ networkView.updateView();
+
+ for(Property p: subProps) {
+ final VizMapperProperty<?, ?, ?> vmp =
(VizMapperProperty<?, ?, ?>)p;
+ if(vmp.getCellType().equals(CellType.DISCRETE)) {
+
+ System.out.print("New Key = " + vmp.getKey());
+ System.out.print(" New Key Class = " +
vmp.getKey().getClass());
+
+
vmp.setValue(discMapping.getMapValue(vmp.getKey()));
+ System.out.println(" New Val = " +
vmp.getValue());
+ }
+ }
+
+ }
+
}
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/generators/GenerateValuesTaskFactory.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -1,5 +1,34 @@
package org.cytoscape.view.vizmap.gui.internal.task.generators;
-public class GenerateValuesTaskFactory {
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.view.vizmap.gui.SelectedVisualStyleManager;
+import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.TaskIterator;
+import com.l2fprod.common.propertysheet.PropertySheetTable;
+
+public class GenerateValuesTaskFactory implements TaskFactory {
+
+ private final DiscreteMappingGenerator<?> generator;
+ private final PropertySheetTable table;
+ private final SelectedVisualStyleManager manager;
+ private final CyApplicationManager appManager;
+
+ public GenerateValuesTaskFactory(
+ final DiscreteMappingGenerator<?> generator,
+ final PropertySheetTable table,
+ final SelectedVisualStyleManager manager,
+ final CyApplicationManager appManager) {
+ this.generator = generator;
+ this.appManager = appManager;
+ this.manager = manager;
+ this.table = table;
+ }
+
+ @Override
+ public TaskIterator getTaskIterator() {
+
+ return new TaskIterator(new GenerateValuesTask(generator,
table, manager, appManager));
+ }
}
Added:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/AbstractDiscreteMappingGenerator.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/AbstractDiscreteMappingGenerator.java
(rev 0)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/AbstractDiscreteMappingGenerator.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -0,0 +1,19 @@
+package org.cytoscape.view.vizmap.gui.internal.util.mapgenerator;
+
+import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
+
+public abstract class AbstractDiscreteMappingGenerator<V> implements
+ DiscreteMappingGenerator<V> {
+
+ private final Class<V> type;
+
+ public AbstractDiscreteMappingGenerator(final Class<V> type) {
+ this.type = type;
+ }
+
+ @Override
+ public Class<V> getDataType() {
+ return type;
+ }
+
+}
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowColorMappingGenerator.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowColorMappingGenerator.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowColorMappingGenerator.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -7,9 +7,13 @@
import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
-public class RainbowColorMappingGenerator implements
- DiscreteMappingGenerator<Color> {
+public class RainbowColorMappingGenerator extends
+ AbstractDiscreteMappingGenerator<Color> {
+ public RainbowColorMappingGenerator(final Class<Color> type) {
+ super(type);
+ }
+
public <T> Map<T, Color> generateMap(Set<T> attributeSet) {
// Error check
if(attributeSet == null || attributeSet.size() == 0)
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowOscColorMappingGenerator.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowOscColorMappingGenerator.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RainbowOscColorMappingGenerator.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -31,7 +31,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
+ */
package org.cytoscape.view.vizmap.gui.internal.util.mapgenerator;
import java.awt.Color;
@@ -39,23 +39,29 @@
import java.util.Map;
import java.util.Set;
-import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
-
-
/**
*
*/
-public class RainbowOscColorMappingGenerator implements
DiscreteMappingGenerator<Color> {
+public class RainbowOscColorMappingGenerator extends
+ AbstractDiscreteMappingGenerator<Color> {
+ public RainbowOscColorMappingGenerator(Class<Color> type) {
+ super(type);
+ }
+
/**
- * Generate discrete mapping from T to Color (Rainbow w/ oscillation
algorithm)
- *
- * @param <T> Attribute type
- * @param attributeSet Set of attribute type T
- *
- * @return Discrete mapping from T to Color
+ * Generate discrete mapping from T to Color (Rainbow w/ oscillation
+ * algorithm)
+ *
+ * @param <T>
+ * Attribute type
+ * @param attributeSet
+ * Set of attribute type T
+ *
+ * @return Discrete mapping from T to Color
*/
public <T> Map<T, Color> generateMap(Set<T> attributeSet) {
- final float increment = 1f / ((Number)
attributeSet.size()).floatValue();
+ final float increment = 1f / ((Number) attributeSet.size())
+ .floatValue();
float hue = 0;
float sat = 0;
@@ -67,10 +73,10 @@
for (T key : attributeSet) {
hue = hue + increment;
- sat = (Math.abs(((Number) Math.cos((8 * i) / (2 *
Math.PI))).floatValue()) * 0.7f)
- + 0.3f;
- br = (Math.abs(((Number) Math.sin(((i) / (2 * Math.PI))
+ (Math.PI / 2))).floatValue()) * 0.7f)
- + 0.3f;
+ sat = (Math.abs(((Number) Math.cos((8 * i) / (2 *
Math.PI)))
+ .floatValue()) * 0.7f) + 0.3f;
+ br = (Math.abs(((Number) Math.sin(((i) / (2 * Math.PI))
+ + (Math.PI / 2))).floatValue()) * 0.7f)
+ 0.3f;
valueMap.put(key, new Color(Color.HSBtoRGB(hue, sat,
br)));
i++;
}
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomColorMappingGenerator.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomColorMappingGenerator.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomColorMappingGenerator.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -31,7 +31,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
+ */
package org.cytoscape.view.vizmap.gui.internal.util.mapgenerator;
import java.awt.Color;
@@ -40,30 +40,37 @@
import java.util.Random;
import java.util.Set;
-import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
-
-
/**
* Mapping generator from any attributes to random color
*/
-public class RandomColorMappingGenerator implements
DiscreteMappingGenerator<Color> {
+public class RandomColorMappingGenerator extends
+ AbstractDiscreteMappingGenerator<Color> {
+
+ public RandomColorMappingGenerator(Class<Color> type) {
+ super(type);
+ }
+
private final int MAX_COLOR = 256 * 256 * 256;
private final long seed = System.currentTimeMillis();
private final Random rand = new Random(seed);
/**
- * From a given set of attributes, create a discrete mapping from the
attribute to random color.
- *
- * @param <T> Attribute type
- * @param attributeSet Set of attribute values
- *
- * @return map from T to Color
+ * From a given set of attributes, create a discrete mapping from the
+ * attribute to random color.
+ *
+ * @param <T>
+ * Attribute type
+ * @param attributeSet
+ * Set of attribute values
+ *
+ * @return map from T to Color
*/
public <T> Map<T, Color> generateMap(Set<T> attributeSet) {
final Map<T, Color> valueMap = new HashMap<T, Color>();
for (T key : attributeSet)
- valueMap.put(key, new Color(((Number) (rand.nextFloat()
* MAX_COLOR)).intValue()));
+ valueMap.put(key, new Color(
+ ((Number) (rand.nextFloat() *
MAX_COLOR)).intValue()));
return valueMap;
}
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomNumberMappingGenerator.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomNumberMappingGenerator.java
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/util/mapgenerator/RandomNumberMappingGenerator.java
2010-12-09 01:06:54 UTC (rev 23141)
@@ -31,7 +31,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
+ */
package org.cytoscape.view.vizmap.gui.internal.util.mapgenerator;
import java.util.HashMap;
@@ -41,19 +41,23 @@
import javax.swing.JOptionPane;
-import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
-
-
/**
*
*/
-public class RandomNumberMappingGenerator implements
DiscreteMappingGenerator<Number> {
+public class RandomNumberMappingGenerator extends
+ AbstractDiscreteMappingGenerator<Number> {
+
+ public RandomNumberMappingGenerator(Class<Number> type) {
+ super(type);
+ }
+
/**
- * Generate discrete mapping between any attribute values and numbers.
- *
- * @param attributeSet set of attribute values. ? can be anything.
- *
- * @return DOCUMENT ME!
+ * Generate discrete mapping between any attribute values and numbers.
+ *
+ * @param attributeSet
+ * set of attribute values. ? can be anything.
+ *
+ * @return DOCUMENT ME!
*/
public <T> Map<T, Number> generateMap(Set<T> attributeSet) {
// Error if attributeSet is empty or null
@@ -62,9 +66,8 @@
// Ask user to input number range
final String range = JOptionPane.showInputDialog(null,
- "Please enter
the value range (example: 30-100)",
- "Assign Random
Numbers",
-
JOptionPane.PLAIN_MESSAGE);
+ "Please enter the value range (example:
30-100)",
+ "Assign Random Numbers",
JOptionPane.PLAIN_MESSAGE);
String[] rangeVals = range.split("-");
Modified:
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
2010-12-09 01:06:54 UTC (rev 23141)
@@ -149,18 +149,24 @@
interface="org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator">
<osgi:service-properties>
<entry key="service.type" value="vizmapUI.contextMenu"
/>
+ <entry key="menu" value="context" />
+ <entry key="title" value="Rainbow" />
</osgi:service-properties>
</osgi:service>
<osgi:service id="rainbowOscGeneratorService" ref="rainbowOscGenerator"
interface="org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator">
<osgi:service-properties>
<entry key="service.type" value="vizmapUI.contextMenu"
/>
+ <entry key="menu" value="context" />
+ <entry key="title" value="Rainbow OSC" />
</osgi:service-properties>
</osgi:service>
<osgi:service id="randomColorGeneratorService"
ref="randomColorGenerator"
interface="org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator">
<osgi:service-properties>
<entry key="service.type" value="vizmapUI.contextMenu"
/>
+ <entry key="menu" value="context" />
+ <entry key="title" value="Random" />
</osgi:service-properties>
</osgi:service>
@@ -223,7 +229,13 @@
cardinality="0..N" filter="(service.type=vizmapUI.taskFactory)"
>
<osgi:listener bind-method="addTaskFactory"
unbind-method="removeTaskFactory" ref="menuManager" />
-
+ </osgi:set>
+
+ <osgi:set id="mappingGeneratorSet"
+
interface="org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator"
+ cardinality="0..N" >
+ <osgi:listener bind-method="addMappingGenerator"
+ unbind-method="removeMappingGenerator"
ref="menuManager" />
</osgi:set>
</beans>
Modified:
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
2010-12-09 01:05:08 UTC (rev 23140)
+++
core3/vizmap-gui-impl/trunk/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
2010-12-09 01:06:54 UTC (rev 23141)
@@ -101,6 +101,9 @@
<bean id="paintClass" class="java.lang.Class" factory-method="forName">
<constructor-arg value="java.awt.Paint" />
</bean>
+ <bean id="colorClass" class="java.lang.Class" factory-method="forName">
+ <constructor-arg value="java.awt.Color" />
+ </bean>
<bean id="numberClass" class="java.lang.Class" factory-method="forName">
<constructor-arg value="java.lang.Number" />
</bean>
@@ -163,6 +166,9 @@
class="org.cytoscape.view.vizmap.gui.internal.VizMapperMenuManager"
scope="singleton">
<constructor-arg ref="taskManagerServiceRef" />
+ <constructor-arg ref="propertySheetPanel" />
+ <constructor-arg ref="selectedVisualStyleManager" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
<bean name="defaultViewPanel"
@@ -239,20 +245,23 @@
<!-- Value generators: generate discrete mapping from simple
algorithms. -->
+
<bean name="rainbowGenerator"
class="org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RainbowColorMappingGenerator"
- scope="singleton" depends-on="generateValueAction" />
+ scope="singleton">
+ <constructor-arg ref="colorClass" />
+ </bean>
<bean name="rainbowOscGenerator"
class="org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RainbowOscColorMappingGenerator"
- scope="singleton" depends-on="generateValueAction" />
+ scope="singleton">
+ <constructor-arg ref="colorClass" />
+ </bean>
<bean name="randomColorGenerator"
class="org.cytoscape.view.vizmap.gui.internal.util.mapgenerator.RandomColorMappingGenerator"
- scope="singleton" depends-on="generateValueAction" />
- <bean name="generateValueAction"
-
class="org.cytoscape.view.vizmap.gui.internal.action.GenerateValueAction"
- scope="singleton" depends-on="vizMapperMainPanel">
- <constructor-arg ref="cyTableManagerServiceRef" />
+ scope="singleton">
+ <constructor-arg ref="colorClass" />
</bean>
+
<!-- For property sheet table -->
<bean id="emptyBoxRenderer"
class="javax.swing.table.DefaultTableCellRenderer" />
--
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.