Author: kono
Date: 2011-11-21 18:56:22 -0800 (Mon, 21 Nov 2011)
New Revision: 27548
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetBuilder.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMainPanel.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/propertyeditor/CyComboBoxPropertyEditor.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
Log:
fixes #459 Still have some timing issue in Vizmap it should be fixed.
Sometimes, services are not registered before GUI initialization.
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
2011-11-22 01:01:40 UTC (rev 27547)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
2011-11-22 02:56:22 UTC (rev 27548)
@@ -135,11 +135,13 @@
}
mappingHeader.setDisplayName("Mapping Type");
-
+System.out.println("** Setting mapping type prop: " +
visualMapping.getVisualProperty().getDisplayName());
+System.out.println("** Setting mapping factory: " + factory);
+System.out.println("** Setting mapping: " + visualMapping);
// Set mapping type as string.
mappingHeader.setValue(factory);
mappingHeader.setInternalValue(visualMapping);
-
+
// Set parent-child relationship
mappingHeader.setParentProperty(topProperty);
topProperty.addSubProperty(mappingHeader);
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetBuilder.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetBuilder.java
2011-11-22 01:01:40 UTC (rev 27547)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetBuilder.java
2011-11-22 02:56:22 UTC (rev 27548)
@@ -3,6 +3,7 @@
import java.awt.Color;
import java.awt.Font;
import java.beans.PropertyEditor;
+import java.nio.channels.Selector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -23,10 +24,12 @@
import org.cytoscape.view.model.VisualProperty;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
import org.cytoscape.view.vizmap.VisualMappingFunction;
+import org.cytoscape.view.vizmap.VisualMappingFunctionFactory;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.view.vizmap.VisualStyle;
import org.cytoscape.view.vizmap.gui.DefaultViewPanel;
import org.cytoscape.view.vizmap.gui.editor.EditorManager;
+import
org.cytoscape.view.vizmap.gui.internal.editor.propertyeditor.CyComboBoxPropertyEditor;
import org.cytoscape.view.vizmap.gui.internal.event.CellType;
import org.cytoscape.view.vizmap.gui.internal.theme.ColorManager;
import org.cytoscape.view.vizmap.gui.internal.util.VizMapperUtil;
@@ -67,7 +70,7 @@
private final VizMapperUtil util;
private final VisualMappingManager vmm;
-
+
/*
* Keeps Properties in the browser.
*/
@@ -119,28 +122,22 @@
* Set Tooltiptext for the table.
*/
propertySheetPanel.setTable(new VizMapPropertySheetTable());
- propertySheetPanel
- .getTable()
- .getColumnModel()
- .addColumnModelListener(
- new
VizMapPropertySheetTableColumnModelListener(this));
+ propertySheetPanel.getTable().getColumnModel()
+ .addColumnModelListener(new
VizMapPropertySheetTableColumnModelListener(this));
/*
* By default, show category.
*/
propertySheetPanel.setMode(PropertySheetPanel.VIEW_AS_CATEGORIES);
- // TODO: fix context menu
-
//propertySheetPanel.getTable().setComponentPopupMenu(menuMgr.getContextMenu());
// TODO: fix listener
propertySheetPanel.getTable().addMouseListener(
- new
VizMapPropertySheetMouseAdapter(this.menuMgr, this, propertySheetPanel,
- style, editorManager));
+ new
VizMapPropertySheetMouseAdapter(this.menuMgr, this, propertySheetPanel, style,
editorManager));
- PropertySheetTable table = propertySheetPanel.getTable();
+ final PropertySheetTable table = propertySheetPanel.getTable();
- table.setRowHeight(25);
+ table.setRowHeight(27);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setCategoryBackground(new Color(10, 10, 50, 20));
table.setCategoryForeground(Color.black);
@@ -161,69 +158,6 @@
filledBoxRenderer = new DefaultTableCellRenderer();
filledBoxRenderer.setBackground(Color.white);
filledBoxRenderer.setForeground(Color.blue);
-
- // TODO: fix icon list
- // VisualPropertyIcon newIcon;
- //
- // List<Icon> iconList = new ArrayList<Icon>();
- // final List<NodeShape> nodeShapes = new
ArrayList<NodeShape>();
- //
- // for (Object key : nodeShapeIcons.keySet()) {
- // NodeShape shape = (NodeShape) key;
- //
- // if (shape.isSupported()) {
- // iconList.add(nodeShapeIcons.get(key));
- // nodeShapes.add(shape);
- // }
- // }
- //
- // Icon[] iconArray = new Icon[iconList.size()];
- // String[] shapeNames = new String[iconList.size()];
- //
- // for (int i = 0; i < iconArray.length; i++) {
- // newIcon = ((NodeIcon) iconList.get(i)).clone();
- // newIcon.setIconHeight(16);
- // newIcon.setIconWidth(16);
- // iconArray[i] = newIcon;
- // shapeNames[i] = nodeShapes.get(i).getShapeName();
- // }
- //
- // // shapeCellEditor.setAvailableValues(nodeShapes.toArray());
- // // shapeCellEditor.setAvailableIcons(iconArray);
- // iconList.clear();
- // iconList.addAll(arrowShapeIcons.values());
- // iconArray = new Icon[iconList.size()];
- //
- // String[] arrowNames = new String[iconList.size()];
- // Set arrowShapes = arrowShapeIcons.keySet();
- //
- // for (int i = 0; i < iconArray.length; i++) {
- // newIcon = ((ArrowIcon) iconList.get(i));
- // newIcon.setIconHeight(16);
- // newIcon.setIconWidth(40);
- // newIcon.setBottomPadding(-9);
- // iconArray[i] = newIcon;
- // arrowNames[i] = newIcon.getName();
- // }
- //
- // // arrowCellEditor.setAvailableValues(arrowShapes.toArray());
- // // arrowCellEditor.setAvailableIcons(iconArray);
- // iconList = new ArrayList();
- // iconList.addAll(lineTypeIcons.values());
- // iconArray = new Icon[iconList.size()];
- // shapeNames = new String[iconList.size()];
- //
- // Set lineTypes = lineTypeIcons.keySet();
- //
- // for (int i = 0; i < iconArray.length; i++) {
- // newIcon = (VisualPropertyIcon) (iconList.get(i));
- // newIcon.setIconHeight(16);
- // newIcon.setIconWidth(16);
- // iconArray[i] = newIcon;
- // shapeNames[i] = newIcon.getName();
- // }
- // lineCellEditor.setAvailableValues(lineTypes.toArray());
- // lineCellEditor.setAvailableIcons(iconArray);
}
private List<Property> getPropertyListFromVisualStyle(final VisualStyle
style) {
@@ -276,21 +210,33 @@
for (VisualMappingFunction<?, ?> mapping : mappings) {
final VisualProperty<?> targetVP =
mapping.getVisualProperty();
- logger.debug("!!!!!!Checking VP: " +
targetVP.getDisplayName() + " for " + categoryName);
// execute the following only if category matches.
if (vpSet.contains(targetVP) == false)
continue;
logger.debug("This is a leaf VP: " +
targetVP.getDisplayName());
+ CyComboBoxPropertyEditor mappingSelector =
(CyComboBoxPropertyEditor)
editorManager.getDefaultComboBoxEditor("mappingTypeEditor");
+ Set<Object> factories =
mappingSelector.getAvailableValues();
+ System.out.println("# Factory Size = = " +
factories.size());
+
+ VisualMappingFunctionFactory vmfFactory = null;
+ for(Object f: factories) {
+ VisualMappingFunctionFactory factory =
(VisualMappingFunctionFactory) f;
+ Class<?> type =
factory.getMappingFunctionType();
+ if(type.isAssignableFrom(mapping.getClass())) {
+ vmfFactory = factory;
+ break;
+ }
+ }
+
final VizMapperProperty<?, String, ?>
calculatorTypeProp = vizMapPropertyBuilder
- .buildProperty(mapping, categoryName,
propertySheetPanel, null);
+ .buildProperty(mapping, categoryName,
propertySheetPanel, vmfFactory);
logger.debug("Built new PROP: " +
calculatorTypeProp.getDisplayName());
- PropertyEditor editor = ((PropertyEditorRegistry)
propertySheetPanel
- .getTable().getEditorFactory())
+ PropertyEditor editor = ((PropertyEditorRegistry)
propertySheetPanel.getTable().getEditorFactory())
.getEditor(calculatorTypeProp);
@@ -299,7 +245,6 @@
&&
(calculatorTypeProp.getCategory().equals(
"Unused Properties") ==
false)) {
- logger.debug("***** Testing category: " +
categoryName);
((PropertyEditorRegistry)
this.propertySheetPanel
.getTable().getEditorFactory())
.registerEditor(calculatorTypeProp, editorManager
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMainPanel.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMainPanel.java
2011-11-22 01:01:40 UTC (rev 27547)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMainPanel.java
2011-11-22 02:56:22 UTC (rev 27548)
@@ -194,7 +194,7 @@
protected void switchVS(final VisualStyle style, boolean forceUpdate) {
- logger.debug("######## Switching VS start: " +
style.getTitle());
+ logger.debug("Switching VS start: " + style.getTitle());
// If new VS name is the same, ignore.
if (!forceUpdate &&
style.equals(manager.getCurrentVisualStyle()))
@@ -203,7 +203,6 @@
// Close editor windows
editorWindowManager.closeAllEditorWindows();
- logger.debug("######## Need to create new prop sheet: " +
style.getTitle());
vizMapPropertySheetBuilder.setPropertyTable(style);
updateAttributeList();
@@ -219,7 +218,6 @@
currentView.updateView();
}
});
-
}
/*
@@ -467,6 +465,7 @@
return;
}
+ // Style already exists
if(vsComboBoxModel.getIndexOf(newStyle) != -1) {
logger.info(newStyle.getTitle() + " is already in the
combobox.");
switchVS(newStyle, true);
@@ -489,7 +488,7 @@
logger.info("New Visual Style registered to combo box: " +
newStyle.getTitle());
// TODO: switch only if it is necessary
- //switchVS(newStyle, true);
+ switchVS(newStyle, true);
}
@Override
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/propertyeditor/CyComboBoxPropertyEditor.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/propertyeditor/CyComboBoxPropertyEditor.java
2011-11-22 01:01:40 UTC (rev 27547)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/propertyeditor/CyComboBoxPropertyEditor.java
2011-11-22 02:56:22 UTC (rev 27548)
@@ -20,9 +20,13 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
+import java.awt.ItemSelectable;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
+import java.util.HashSet;
+import java.util.Set;
+import javax.management.modelmbean.ModelMBean;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
@@ -76,18 +80,11 @@
public void popupMenuWillBecomeInvisible(PopupMenuEvent
e) {
try {
- if ((combo.getSelectedItem() == null)
- &&
(combo.getItemCount() != 0)) {
+ if ((combo.getSelectedItem() == null)
&& (combo.getItemCount() != 0)) {
combo.setSelectedIndex(0);
-
CyComboBoxPropertyEditor.this.firePropertyChange(
- oldValue,
combo.getItemAt(0));
+
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue, combo.getItemAt(0));
} else
-
CyComboBoxPropertyEditor.this.firePropertyChange(
- oldValue,
combo.getSelectedItem());
-
- System.out
- .println("!!!!!!!!Event
fired from Combobox Editor: "
- +
combo.getSelectedItem());
+
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
combo.getSelectedItem());
} catch (Exception ex) {
ex.printStackTrace();
}
@@ -96,11 +93,11 @@
public void popupMenuWillBecomeVisible(PopupMenuEvent
e) {
}
});
+
combo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER)
-
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
-
combo.getSelectedItem());
+
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
combo.getSelectedItem());
}
});
combo.setSelectedIndex(-1);
@@ -159,6 +156,15 @@
((JComboBox) editor).setSelectedIndex(0);
}
}
+
+ public Set<Object> getAvailableValues() {
+ final int itemCount = ((JComboBox) editor).getModel().getSize();
+ final Set<Object> items = new HashSet<Object>();
+
+ for(int i=0; i<itemCount; i++)
+ items.add(((JComboBox)
editor).getModel().getElementAt(i));
+ return items;
+ }
/**
* DOCUMENT ME!
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
2011-11-22 01:01:40 UTC (rev 27547)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
2011-11-22 02:56:22 UTC (rev 27548)
@@ -125,7 +125,7 @@
@Override
public void processEvent(PropertyChangeEvent e) {
- logger.debug("$$$$$$$$ Got Property Sheet event: " + e);
+ System.out.println("$$$$$$$$ Got Property Sheet event: " + e);
final Object newVal = e.getNewValue();
final Object oldVal = e.getOldValue();
@@ -194,8 +194,8 @@
// 2. Switch mapping type
if (prop.getCellType().equals(CellType.MAPPING_TYPE)) {
- logger.debug("Mapping type changed from: " +
e.getOldValue());
- logger.debug("Mapping type new = " + e.getNewValue());
+ System.out.println("Mapping type changed from: " +
e.getOldValue());
+ System.out.println("Mapping type new = " +
e.getNewValue());
if (e.getNewValue() == e.getOldValue())
return;
@@ -211,8 +211,7 @@
logger.debug("New Type = " + type.getDisplayName());
logger.debug("New Attr Name = " + controllingAttrName);
- switchMappingType(prop, type,
- (VisualMappingFunctionFactory)
e.getNewValue(),
+ switchMappingType(prop, type,
(VisualMappingFunctionFactory) e.getNewValue(),
controllingAttrName.toString());
} else if (prop.getParentProperty() != null) {
// Discrete Cell editor. Create new map entry and
register it.
@@ -236,228 +235,6 @@
applicationManager.getCurrentNetworkView().updateView();
}
}
-
- // if (e.getNewValue() == null)
- // return;
- //
- // /*
- // * If invalid data type, ignore.
- // */
- // final Object parentValue =
prop.getParentProperty().getValue();
- //
- // if (parentValue != null) {
- // ctrAttrName = parentValue.toString();
- //
- // CyTable attr =
- //
tableMgr.getTableMap().(type.getObjectType(),applicationManager.getCurrentNetwork()).get(
- // CyNetwork.DEFAULT_ATTRS);
- //
- // final Class<?> dataClass = attr.getColumnTypeMap().get(
- // ctrAttrName);
- //
- // if (e.getNewValue().equals("Continuous Mapper")
- // && ((dataClass != Integer.class) && (dataClass !=
Double.class))) {
- // JOptionPane.showMessageDialog(vizMapperMainPanel,
- // "Continuous Mapper can be used with Numbers only.",
- // "Incompatible Mapping Type!",
- // JOptionPane.INFORMATION_MESSAGE);
- //
- // return;
- // }
- // } else {
- // return;
- // }
- //
- // if (e.getNewValue().toString().endsWith("Mapper") == false)
- // return;
- //
- // switchMapping(prop, e.getNewValue().toString(), prop
- // .getParentProperty().getValue());
- //
- // /*
- // * restore expanded props.
- // */
- // vizMapPropertySheetBuilder.expandLastSelectedItem(type
- // .getDisplayName());
- // vizMapPropertySheetBuilder.updateTableView();
- //
- // return;
- // }
- //
- // /*
- // * Extract calculator
- // */
- // VisualMappingFunction<?, ?> mapping = vmm.getVisualStyle(
- // applicationManager.getCurrentNetworkView())
- // .getVisualMappingFunction(type);
- //
- // /*
- // * Controlling Attribute has been changed.
- // */
- // if (ctrAttrName != null) {
- // /*
- // * Ignore if not compatible.
- // */
- // final CyTable attrForTest =
- //
tableMgr.getTableMap(type.getObjectType(),applicationManager.getCurrentNetwork()).get(CyNetwork.DEFAULT_ATTRS);
- //
- // final Class<?> dataType = attrForTest.getColumnTypeMap().get(
- // ctrAttrName);
- //
- // // This part is for Continuous Mapping.
- // if (mapping instanceof ContinuousMapping) {
- // if ((dataType == Double.class) || (dataType ==
Integer.class)) {
- // // Do nothing
- // } else {
- // JOptionPane
- // .showMessageDialog(
- // vizMapperMainPanel,
- // "Continuous Mapper can be used with Numbers only.\nPlease
select numerical attributes.",
- // "Incompatible Mapping Type!",
- // JOptionPane.INFORMATION_MESSAGE);
- //
- // return;
- // }
- // }
- //
- // // If same, do nothing.
- // if (ctrAttrName.equals(mapping.getMappingAttributeName()))
- // return;
- //
- // // Buffer current discrete mapping
- // if (mapping instanceof DiscreteMapping) {
- // final String curMappingName = mapping.toString() + "-"
- // + mapping.getMappingAttributeName();
- // final String newMappingName = mapping.toString() + "-"
- // + ctrAttrName;
- // final Map saved = discMapBuffer.get(newMappingName);
- //
- // if (saved == null) {
- // discMapBuffer.put(curMappingName,
- // ((DiscreteMapping) mapping).getAll());
- // mapping.(ctrAttrName);
- // } else if (saved != null) {
- // // Mapping exists
- // discMapBuffer.put(curMappingName,
- // ((DiscreteMapping) mapping).getAll());
- // mapping.setControllingAttributeName(ctrAttrName);
- // ((DiscreteMapping) mapping).putAll(saved);
- // }
- // } else {
- // mapping.setControllingAttributeName(ctrAttrName);
- // }
- //
- // propertySheetPanel.removeProperty(typeRootProp);
- //
- // final VizMapperProperty<?> newRootProp = new
VizMapperProperty<>();
- // final VisualStyle targetVS =
- //
vmm.getVisualStyle(applicationManager.getCurrentNetworkView());
- //
- //
vizMapPropertySheetBuilder.getPropertyBuilder().buildProperty(
- // targetVS.getVisualMappingFunction(type), newRootProp,
- // type.getObjectType(),
- // propertySheetPanel);
- //
- //
- // vizMapPropertySheetBuilder.removeProperty(typeRootProp);
- //
- // if (vizMapPropertySheetBuilder.getPropertyMap().get(
- // targetVS) != null)
- // vizMapPropertySheetBuilder.getPropertyMap().get(
- // targetVS).add(newRootProp);
- //
- // typeRootProp = null;
- //
- //
vizMapPropertySheetBuilder.expandLastSelectedItem(type.getIdString());
- // vizMapPropertySheetBuilder.updateTableView();
- //
- // // Finally, update graph view and focus.
- // //
vmm.setNetworkView(applicationManager.getCurrentNetworkView());
- // //
Cytoscape.redrawGraph(applicationManager.getCurrentNetworkView());
- // return;
- // }
- //
- // // Return if not a Discrete Mapping.
- // if (mapping instanceof ContinuousMapping
- // || mapping instanceof PassthroughMappingCalculator)
- // return;
- //
- // Object key = null;
- //
- // if ((type.getType() == Number.class)
- // || (type.getType() == String.class)) {
- // key = e.getOldValue();
- //
- // // TODO WTF?
- // // if (type.getDataType() == Number.class) {
- // // numberCellEditor = new CyDoublePropertyEditor(this);
- // // numberCellEditor.addPropertyChangeListener(this);
- // // editorReg.registerEditor(prop, numberCellEditor);
- // // }
- // } else {
- // key = ((Item)
propertySheetPanel.getTable().getValueAt(selected, 0))
- // .getProperty().getDisplayName();
- // }
- //
- // /*
- // * Need to convert this string to proper data types.
- // */
- // final CyTable attr =
- //
tableMgr.getTableMap(type.getObjectType(),applicationManager.getCurrentNetwork()).get(CyNetwork.DEFAULT_ATTRS);
- // ctrAttrName = mapping.getMappingAttributeName();
- //
- // // Byte attrType = attr.getType(ctrAttrName);
- // Class<?> attrType = attr.getColumnTypeMap().get(ctrAttrName);
- //
- // if (attrType == Boolean.class)
- // key = Boolean.valueOf((String) key);
- // else if (attrType == Integer.class)
- // key = Integer.valueOf((String) key);
- // else if (attrType == Double.class)
- // key = Double.valueOf((String) key);
- //
- // Object newValue = e.getNewValue();
- //
- // if (type.getType() == Number.class) {
- // if ((((Number) newValue).doubleValue() == 0)
- // || (newValue instanceof Number
- // && type.toString().endsWith("OPACITY") && (((Number)
newValue)
- // .doubleValue() > 255))) {
- // int shownPropCount = table.getRowCount();
- // Property p = null;
- // Object val = null;
- //
- // for (int i = 0; i < shownPropCount; i++) {
- // p = ((Item) table.getValueAt(i, 0)).getProperty();
- //
- // if (p != null) {
- // val = p.getDisplayName();
- //
- // if ((val != null) && val.equals(key.toString())) {
- // p.setValue(((DiscreteMapping) mapping)
- // .getMapValue(key));
- //
- // return;
- // }
- // }
- // }
- //
- // return;
- // }
- // }
- //
- // ((DiscreteMapping) mapping).putMapValue(key, newValue);
- //
- // /*
- // * Update table and current network view.
- // */
- // vizMapPropertySheetBuilder.updateTableView();
- //
- // propertySheetPanel.repaint();
- //
- // //
vmm.setNetworkView(applicationManager.getCurrentNetworkView());
- // //
Cytoscape.redrawGraph(applicationManager.getCurrentNetworkView());
- //}
private <K, V> void switchControllingAttr(
final VisualMappingFunctionFactory factory,
@@ -530,24 +307,6 @@
logger.debug("Changed to new Map from "
+ mapping.getMappingColumnName() + " to
"
+ newMapping.getMappingColumnName());
- // final String curMappingName = mapping.toString() +
"-" +
- // mapping.getMappingAttributeName();
- // final String newMappingName = mapping.toString() +
"-" +
- // ctrAttrName;
- // final Map saved = discMapBuffer.get(newMappingName);
- //
- // if (saved == null) {
- // factory.createVisualMappingFunction(ctrAttrName,
mapping., vp);
- // discMapBuffer.put(curMappingName, ((DiscreteMapping)
- // mapping).getAll());
- // mapping.(ctrAttrName);
- // } else if (saved != null) {
- // // Mapping exists
- // discMapBuffer.put(curMappingName,
- // ((DiscreteMapping) mapping).getAll());
- // mapping.setControllingAttributeName(ctrAttrName);
- // ((DiscreteMapping) mapping).putAll(saved);
- // }
}
// Remove old property
@@ -619,6 +378,7 @@
logger.debug("New VisualMappingFunction Created: Controlling
attr = "
+
style.getVisualMappingFunction(vp).getMappingColumnName());
+
// First, remove current property
Property parent = prop.getParentProperty();
propertySheetPanel.removeProperty(parent);
@@ -642,207 +402,4 @@
currentStyle.apply(applicationManager.getCurrentNetworkView());
applicationManager.getCurrentNetworkView().updateView();
}
-
- // private <K, V> VisualMappingFunction<K, V> getNewMappingFunction(
- // final VisualProperty<V> type, final String newMappingName,
- // final String newCalcName) {
- //
- // System.out.println("Mapper = " + newMappingName);
- //
- // Class mapperClass = catalog.getMapping(newMappingName);
- //
- // if (mapperClass == null) {
- // return null;
- // }
- //
- // // create the selected mapper
- // Class[] conTypes = { Object.class, byte.class };
- // Constructor mapperCon;
- //
- // try {
- // mapperCon = mapperClass.getConstructor(conTypes);
- // } catch (NoSuchMethodException exc) {
- // // Should not happen...
- // System.err.println("Invalid mapper " + mapperClass.getName());
- //
- // return null;
- // }
- //
- // final Object defaultObj = type.getDefault(vmm.getVisualStyle());
- //
- // System.out.println("defobj = " + defaultObj.getClass() + ", Type = "
- // + type.getName());
- //
- // final Object[] invokeArgs = { defaultObj };
- // VisualMappingFunction mapper = null;
- //
- // try {
- // mapper = (VisualMappingFunction) mapperCon.newInstance(invokeArgs);
- // } catch (Exception exc) {
- // System.err.println("Error creating mapping");
- //
- // return null;
- // }
- //
- // return new BasicCalculator(newCalcName, mapper, type);
- // return;
- // }
-
- // /**
- // * Switching between mapppings. Each calcs has 3 mappings. The first
one
- // * (getMapping(0)) is the current mapping used by calculator.
- // *
- // */
- // private void switchMapping(VizMapperProperty<?> prop, String
newMapName,
- // Object attrName) {
- // if (attrName == null)
- // return;
- // }
-
- // final VisualProperty<?> type = (VisualProperty)
((VizMapperProperty<?>)
- // prop
- // .getParentProperty()).getHiddenObject();
- //
- // final VisualStyle style =
- // vmm.getVisualStyle(applicationManager.getCurrentNetworkView());
- //
- // final String newCalcName = vmm.getVisualStyle().getName() + "-"
- // + type.getName() + "-" + newMapName;
- //
- // // Extract target calculator
- // Calculator newCalc = vmm.getCalculatorCatalog().getCalculator(type,
- // newCalcName);
- //
- // Calculator oldCalc = null;
- //
- // if (type.getObjectType().equals(VisualProperty.NODE))
- // oldCalc = vmm.getVisualStyle().getNodeAppearanceCalculator()
- // .getCalculator(type);
- // else
- // oldCalc = vmm.getVisualStyle().getEdgeAppearanceCalculator()
- // .getCalculator(type);
- //
- // /*
- // * If not exist, create new one.
- // */
- // if (newCalc == null) {
- // newCalc = getNewCalculator(type, newMapName, newCalcName);
- // newCalc.getMapping(0)
- // .setControllingAttributeName((String) attrName);
- // vmm.getCalculatorCatalog().addCalculator(newCalc);
- // }
- //
- // newCalc.getMapping(0).setControllingAttributeName((String) attrName);
- //
- // if (type.getObjectType().equals(VisualProperty.NODE)) {
- // vmm.getVisualStyle().getNodeAppearanceCalculator().setCalculator(
- // newCalc);
- // } else
- // vmm.getVisualStyle().getEdgeAppearanceCalculator().setCalculator(
- // newCalc);
- //
- // /*
- // * If old calc is not standard name, rename it.
- // */
- // if (oldCalc != null) {
- // final String oldMappingTypeName;
- //
- // if (oldCalc.getMapping(0) instanceof DiscreteMapping)
- // oldMappingTypeName = "Discrete Mapper";
- // else if (oldCalc.getMapping(0) instanceof ContinuousMapping)
- // oldMappingTypeName = "Continuous Mapper";
- // else if (oldCalc.getMapping(0) instanceof
PassthroughMappingCalculator)
- // oldMappingTypeName = "Passthrough Mapper";
- // else
- // oldMappingTypeName = null;
- //
- // final String oldCalcName = type.getName() + "-"
- // + oldMappingTypeName;
- //
- // if (vmm.getCalculatorCatalog().getCalculator(type, oldCalcName) ==
null)
- // {
- // final Calculator newC = getNewCalculator(type,
- // oldMappingTypeName, oldCalcName);
- // newC.getMapping(0).setControllingAttributeName(
- // (String) attrName);
- // vmm.getCalculatorCatalog().addCalculator(newC);
- // }
- // }
- //
- // Property parent = prop.getParentProperty();
- // propertySheetPanel.removeProperty(parent);
- //
- // final VizMapperProperty newRootProp = new VizMapperProperty();
- //
- // if (type.getObjectType().equals(VisualProperty.NODE))
- // vizMapPropertySheetBuilder.getPropertyBuilder().buildProperty(
- // vmm.getVisualStyle().getNodeAppearanceCalculator()
- // .getCalculator(type), newRootProp,
- // AbstractVizMapperPanel.NODE_VISUAL_MAPPING,
- // propertySheetPanel);
- // else
- // vizMapPropertySheetBuilder.getPropertyBuilder().buildProperty(
- // vmm.getVisualStyle().getEdgeAppearanceCalculator()
- // .getCalculator(type), newRootProp,
- // AbstractVizMapperPanel.EDGE_VISUAL_MAPPING,
- // propertySheetPanel);
- //
- // vizMapPropertySheetBuilder.expandLastSelectedItem(type.getName());
- //
- // vizMapPropertySheetBuilder.removeProperty(parent);
- //
- // if (vizMapPropertySheetBuilder.getPropertyMap().get(
- // vmm.getVisualStyle().getName()) != null) {
- // vizMapPropertySheetBuilder.getPropertyMap().get(
- // vmm.getVisualStyle().getName()).add(newRootProp);
- // }
- //
- // // vmm.getNetworkView().redrawGraph(false, true);
- // // Cytoscape.redrawGraph(applicationManager.getCurrentNetworkView());
- // parent = null;
- // }
- //
- // private <K, V> VisualMappingFunction<K, V>
getNewMappingFunction(final
- // VisualProperty<V> type,
- // final String newMappingName, final String newCalcName) {
- //
- // System.out.println("Mapper = " + newMappingName);
- //
- // Class mapperClass = catalog.getMapping(newMappingName);
- //
- // if (mapperClass == null) {
- // return null;
- // }
- //
- // // create the selected mapper
- // Class[] conTypes = { Object.class, byte.class };
- // Constructor mapperCon;
- //
- // try {
- // mapperCon = mapperClass.getConstructor(conTypes);
- // } catch (NoSuchMethodException exc) {
- // // Should not happen...
- // System.err.println("Invalid mapper " + mapperClass.getName());
- //
- // return null;
- // }
- //
- // final Object defaultObj = type.getDefault(vmm.getVisualStyle());
- //
- // System.out.println("defobj = " + defaultObj.getClass() + ", Type = "
- // + type.getName());
- //
- // final Object[] invokeArgs = { defaultObj };
- // VisualMappingFunction mapper = null;
- //
- // try {
- // mapper = (VisualMappingFunction) mapperCon.newInstance(invokeArgs);
- // } catch (Exception exc) {
- // System.err.println("Error creating mapping");
- //
- // return null;
- // }
- //
- // return new BasicCalculator(newCalcName, mapper, type);
- // }
}
--
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.