Author: kono
Date: 2011-06-09 14:05:57 -0700 (Thu, 09 Jun 2011)
New Revision: 25695
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
Log:
Code had been re-formated because it was broken. NO FUNCTIONAL CHANGES.
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
2011-06-09 18:51:14 UTC (rev 25694)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
2011-06-09 21:05:57 UTC (rev 25695)
@@ -75,300 +75,300 @@
*/
public class EditorManagerImpl implements EditorManager {
- private static final Logger logger =
LoggerFactory.getLogger(EditorManagerImpl.class);
+ private static final Logger logger =
LoggerFactory.getLogger(EditorManagerImpl.class);
- private final Map<Class<?>, VisualPropertyEditor<?>> editors;
+ private final Map<Class<?>, VisualPropertyEditor<?>> editors;
- private final Map<String, PropertyEditor> comboBoxEditors;
+ private final Map<String, PropertyEditor> comboBoxEditors;
- private final Map<Class<?>, ListEditor> attrComboBoxEditors;
+ private final Map<Class<?>, ListEditor> attrComboBoxEditors;
- private final Map<Class<?>, ValueEditor<?>> valueEditors;
+ private final Map<Class<?>, ValueEditor<?>> valueEditors;
- private final PropertyEditor mappingTypeEditor;
+ private final PropertyEditor mappingTypeEditor;
- private final CyApplicationManager appManager;
+ private final CyApplicationManager appManager;
- private final CyTableManager tableManager;
- private final SelectedVisualStyleManager selectedManager;
- private final VisualMappingManager vmm;
+ private final CyTableManager tableManager;
+ private final SelectedVisualStyleManager selectedManager;
+ private final VisualMappingManager vmm;
- /**
- * Creates a new EditorFactory object.
- */
- public EditorManagerImpl(final CyApplicationManager appManager, final
AttributeSetManager attrManager,
- final VisualMappingManager vmm, final CyTableManager tableManager,
- final SelectedVisualStyleManager selectedManager) {
+ /**
+ * Creates a new EditorFactory object.
+ */
+ public EditorManagerImpl(final CyApplicationManager appManager, final
AttributeSetManager attrManager,
+ final VisualMappingManager vmm, final CyTableManager
tableManager,
+ final SelectedVisualStyleManager selectedManager) {
- this.appManager = appManager;
- this.tableManager = tableManager;
- this.vmm = vmm;
- this.selectedManager = selectedManager;
+ this.appManager = appManager;
+ this.tableManager = tableManager;
+ this.vmm = vmm;
+ this.selectedManager = selectedManager;
- editors = new HashMap<Class<?>, VisualPropertyEditor<?>>();
+ editors = new HashMap<Class<?>, VisualPropertyEditor<?>>();
- comboBoxEditors = new HashMap<String, PropertyEditor>();
- attrComboBoxEditors = new HashMap<Class<?>, ListEditor>();
+ comboBoxEditors = new HashMap<String, PropertyEditor>();
+ attrComboBoxEditors = new HashMap<Class<?>, ListEditor>();
- final AttributeComboBoxPropertyEditor nodeAttrEditor = new
AttributeComboBoxPropertyEditor(CyNode.class,
- attrManager, appManager);
- final AttributeComboBoxPropertyEditor edgeAttrEditor = new
AttributeComboBoxPropertyEditor(CyEdge.class,
- attrManager, appManager);
- final AttributeComboBoxPropertyEditor networkAttrEditor = new
AttributeComboBoxPropertyEditor(CyNetwork.class,
- attrManager, appManager);
- attrComboBoxEditors.put(nodeAttrEditor.getTargetObjectType(),
nodeAttrEditor);
- attrComboBoxEditors.put(edgeAttrEditor.getTargetObjectType(),
edgeAttrEditor);
- attrComboBoxEditors.put(networkAttrEditor.getTargetObjectType(),
networkAttrEditor);
+ final AttributeComboBoxPropertyEditor nodeAttrEditor = new
AttributeComboBoxPropertyEditor(CyNode.class,
+ attrManager, appManager);
+ final AttributeComboBoxPropertyEditor edgeAttrEditor = new
AttributeComboBoxPropertyEditor(CyEdge.class,
+ attrManager, appManager);
+ final AttributeComboBoxPropertyEditor networkAttrEditor = new
AttributeComboBoxPropertyEditor(CyNetwork.class,
+ attrManager, appManager);
+ attrComboBoxEditors.put(nodeAttrEditor.getTargetObjectType(),
nodeAttrEditor);
+ attrComboBoxEditors.put(edgeAttrEditor.getTargetObjectType(),
edgeAttrEditor);
+
attrComboBoxEditors.put(networkAttrEditor.getTargetObjectType(),
networkAttrEditor);
- valueEditors = new HashMap<Class<?>, ValueEditor<?>>();
+ valueEditors = new HashMap<Class<?>, ValueEditor<?>>();
- // Create mapping type editor
- this.mappingTypeEditor = getDefaultComboBoxEditor("mappingTypeEditor");
+ // Create mapping type editor
+ this.mappingTypeEditor =
getDefaultComboBoxEditor("mappingTypeEditor");
- Set<VisualLexicon> lexSet = vmm.getAllVisualLexicon();
+ Set<VisualLexicon> lexSet = vmm.getAllVisualLexicon();
- for (final VisualLexicon lex : lexSet) {
- this.buildDiscreteEditors(lex);
+ for (final VisualLexicon lex : lexSet) {
+ this.buildDiscreteEditors(lex);
+ }
}
- }
- public AttributeComboBoxPropertyEditor getNodeEditor() {
- return (AttributeComboBoxPropertyEditor)
attrComboBoxEditors.get(CyNode.class);
- }
+ public AttributeComboBoxPropertyEditor getNodeEditor() {
+ return (AttributeComboBoxPropertyEditor)
attrComboBoxEditors.get(CyNode.class);
+ }
- public AttributeComboBoxPropertyEditor getEdgeEditor() {
- return (AttributeComboBoxPropertyEditor)
attrComboBoxEditors.get(CyEdge.class);
- }
+ public AttributeComboBoxPropertyEditor getEdgeEditor() {
+ return (AttributeComboBoxPropertyEditor)
attrComboBoxEditors.get(CyEdge.class);
+ }
- public AttributeComboBoxPropertyEditor getNetworkEditor() {
- return (AttributeComboBoxPropertyEditor)
attrComboBoxEditors.get(CyNetwork.class);
- }
+ public AttributeComboBoxPropertyEditor getNetworkEditor() {
+ return (AttributeComboBoxPropertyEditor)
attrComboBoxEditors.get(CyNetwork.class);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * addEditorDisplayer(org .cytoscape.vizmap.gui.editors.EditorDisplayer,
- * java.util.Map)
- */
- public void addValueEditor(ValueEditor<?> ve,
@SuppressWarnings("rawtypes") Map properties) {
- logger.debug("Got Value Editor " + ve.toString() + ", this is for " +
ve.getType() + "\n\n\n");
- this.valueEditors.put(ve.getType(), ve);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * addEditorDisplayer(org .cytoscape.vizmap.gui.editors.EditorDisplayer,
+ * java.util.Map)
+ */
+ public void addValueEditor(ValueEditor<?> ve,
@SuppressWarnings("rawtypes") Map properties) {
+ logger.debug("Got Value Editor " + ve.toString() + ", this is
for " + ve.getType() + "\n\n\n");
+ this.valueEditors.put(ve.getType(), ve);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * removeEditorDisplayer(
- * org.cytoscape.application.swing.vizmap.gui.editors.EditorDisplayer,
- * java.util.Map)
- */
- public void removeValueEditor(ValueEditor<?> valueEditor,
@SuppressWarnings("rawtypes") Map properties) {
- logger.debug("************* Removing Value Editor ****************");
- valueEditors.remove(valueEditor.getType());
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * removeEditorDisplayer(
+ * org.cytoscape.application.swing.vizmap.gui.editors.EditorDisplayer,
+ * java.util.Map)
+ */
+ public void removeValueEditor(ValueEditor<?> valueEditor,
@SuppressWarnings("rawtypes") Map properties) {
+ logger.debug("************* Removing Value Editor
****************");
+ valueEditors.remove(valueEditor.getType());
+ }
- public void addVisualPropertyEditor(VisualPropertyEditor<?> ve,
@SuppressWarnings("rawtypes") Map properties) {
- logger.debug("### Got VP Editor " + ve.toString() + ", this is for " +
ve.getType());
- this.editors.put(ve.getType(), ve);
- }
+ public void addVisualPropertyEditor(VisualPropertyEditor<?> ve,
@SuppressWarnings("rawtypes") Map properties) {
+ logger.debug("### Got VP Editor " + ve.toString() + ", this is
for " + ve.getType());
+ this.editors.put(ve.getType(), ve);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * removeEditorDisplayer(
- * org.cytoscape.application.swing.vizmap.gui.editors.EditorDisplayer,
- * java.util.Map)
- */
- public void removeVisualPropertyEditor(VisualPropertyEditor<?> vpEditor,
- @SuppressWarnings("rawtypes") Map properties) {
- logger.debug("************* Removing VP Editor ****************");
- editors.remove(vpEditor.getType());
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * removeEditorDisplayer(
+ * org.cytoscape.application.swing.vizmap.gui.editors.EditorDisplayer,
+ * java.util.Map)
+ */
+ public void removeVisualPropertyEditor(VisualPropertyEditor<?> vpEditor,
+ @SuppressWarnings("rawtypes") Map properties) {
+ logger.debug("************* Removing VP Editor
****************");
+ editors.remove(vpEditor.getType());
+ }
- // private <T> VisualPropertyEditor<T> findEditor(VisualProperty<T> type) {
- // final Class<T> dataType = type.getType();
- //
- // for (VisualPropertyEditor<?> disp : displayers)
- // if ((dataType == disp.getVisualProperty().getType()))
- // return disp;
- //
- // throw new NullPointerException("no editor displayer found for: "
- // + type.toString());
- // }
+ // private <T> VisualPropertyEditor<T> findEditor(VisualProperty<T>
type) {
+ // final Class<T> dataType = type.getType();
+ //
+ // for (VisualPropertyEditor<?> disp : displayers)
+ // if ((dataType == disp.getVisualProperty().getType()))
+ // return disp;
+ //
+ // throw new NullPointerException("no editor displayer found for: "
+ // + type.toString());
+ // }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * showDiscreteEditor(java .awt.Component,
- * org.cytoscape.application.swing.viewmodel.VisualProperty)
- */
- @SuppressWarnings("unchecked")
- public <V> V showVisualPropertyValueEditor(Component parentComponent,
VisualProperty<V> type, V initialValue)
- throws Exception {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * showDiscreteEditor(java .awt.Component,
+ * org.cytoscape.application.swing.viewmodel.VisualProperty)
+ */
+ @SuppressWarnings("unchecked")
+ public <V> V showVisualPropertyValueEditor(Component parentComponent,
VisualProperty<V> type, V initialValue)
+ throws Exception {
- final ValueEditor<V> editor = (ValueEditor<V>)
valueEditors.get(type.getRange().getType());
+ final ValueEditor<V> editor = (ValueEditor<V>)
valueEditors.get(type.getRange().getType());
- if (editor == null)
- throw new IllegalStateException("No value editor for " +
type.getDisplayName() + " is available.");
+ if (editor == null)
+ throw new IllegalStateException("No value editor for "
+ type.getDisplayName() + " is available.");
- return editor.showEditor(null, initialValue);
- }
+ return editor.showEditor(null, initialValue);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * showContinuousEditor(java .awt.Component,
- * org.cytoscape.application.swing.viewmodel.VisualProperty)
- */
- public <V> void showContinuousEditor(Component parentComponent,
VisualProperty<V> type) throws Exception {
- final VisualPropertyEditor<?> editor =
editors.get(type.getRange().getType());
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * showContinuousEditor(java .awt.Component,
+ * org.cytoscape.application.swing.viewmodel.VisualProperty)
+ */
+ public <V> void showContinuousEditor(Component parentComponent,
VisualProperty<V> type) throws Exception {
+ final VisualPropertyEditor<?> editor =
editors.get(type.getRange().getType());
- // TODO: design dialog state mamagement
- //
- //
- // Component mappingEditor = editor.getContinuousMappingEditor();
- //
- // JDialog editorDialog = new JDialog();
- // editorDialog.setModal(true);
- // editorDialog.setLocationRelativeTo(parentComponent);
+ // TODO: design dialog state mamagement
+ //
+ //
+ // Component mappingEditor =
editor.getContinuousMappingEditor();
+ //
+ // JDialog editorDialog = new JDialog();
+ // editorDialog.setModal(true);
+ // editorDialog.setLocationRelativeTo(parentComponent);
- }
+ }
- @SuppressWarnings("unchecked")
- public <V> VisualPropertyEditor<V> getVisualPropertyEditor(final
VisualProperty<V> vp) {
- return (VisualPropertyEditor<V>) editors.get(vp.getRange().getType());
- }
+ @SuppressWarnings("unchecked")
+ public <V> VisualPropertyEditor<V> getVisualPropertyEditor(final
VisualProperty<V> vp) {
+ return (VisualPropertyEditor<V>)
editors.get(vp.getRange().getType());
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * getCellEditors()
- */
- @Override
- public List<PropertyEditor> getCellEditors() {
- List<PropertyEditor> ret = new ArrayList<PropertyEditor>();
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * getCellEditors()
+ */
+ @Override
+ public List<PropertyEditor> getCellEditors() {
+ List<PropertyEditor> ret = new ArrayList<PropertyEditor>();
- for (Class<?> type : editors.keySet())
- ret.add(editors.get(type).getPropertyEditor());
+ for (Class<?> type : editors.keySet())
+ ret.add(editors.get(type).getPropertyEditor());
- return ret;
- }
+ return ret;
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * getContinuousCellEditor
- * (org.cytoscape.application.swing.viewmodel.VisualProperty)
- */
- public PropertyEditor getContinuousCellEditor(VisualProperty type) {
- return null;
- // return findEditor(type,
- // EditorDisplayer.MappingType.VisualPropertyEditor)
- // .getVisualPropertyEditor();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * getContinuousCellEditor
+ * (org.cytoscape.application.swing.viewmodel.VisualProperty)
+ */
+ public PropertyEditor getContinuousCellEditor(VisualProperty type) {
+ return null;
+ // return findEditor(type,
+ // EditorDisplayer.MappingType.VisualPropertyEditor)
+ // .getVisualPropertyEditor();
+ }
- /*
- * (non-Javadoc)
- *
- * @see
- *
- * org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * getContinuousCellRenderer
- * (org.cytoscape.application.swing.viewmodel.VisualProperty, int, int)
- */
- public TableCellRenderer getContinuousCellRenderer(VisualProperty type,
int w, int h) {
- return null;
- // return findEditor(type,
- // EditorDisplayer.MappingType.VisualPropertyEditor)
- // .getCellRenderer(type, w, h);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ *
+ * org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * getContinuousCellRenderer
+ * (org.cytoscape.application.swing.viewmodel.VisualProperty, int, int)
+ */
+ public TableCellRenderer getContinuousCellRenderer(VisualProperty type,
int w, int h) {
+ return null;
+ // return findEditor(type,
+ // EditorDisplayer.MappingType.VisualPropertyEditor)
+ // .getCellRenderer(type, w, h);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
- * getDefaultComboBoxEditor (java.lang.String)
- */
- public PropertyEditor getDefaultComboBoxEditor(String editorName) {
- PropertyEditor editor = comboBoxEditors.get(editorName);
- if (editor == null) {
- editor = new CyComboBoxPropertyEditor();
- comboBoxEditors.put(editorName, editor);
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cytoscape.application.swing.vizmap.gui.editors.EditorFactory#
+ * getDefaultComboBoxEditor (java.lang.String)
+ */
+ public PropertyEditor getDefaultComboBoxEditor(String editorName) {
+ PropertyEditor editor = comboBoxEditors.get(editorName);
+ if (editor == null) {
+ editor = new CyComboBoxPropertyEditor();
+ comboBoxEditors.put(editorName, editor);
+ }
+ return editor;
}
- return editor;
- }
- public <V> ValueEditor<V> getValueEditor(Class<V> dataType) {
- return (ValueEditor<V>) this.valueEditors.get(dataType);
- }
+ public <V> ValueEditor<V> getValueEditor(Class<V> dataType) {
+ return (ValueEditor<V>) this.valueEditors.get(dataType);
+ }
- /**
- * Editor name is NODE, EDGE, or NETWORK.
- */
- @Override
- public PropertyEditor getDataTableComboBoxEditor(final Class<? extends
CyTableEntry> targetObjectType) {
+ /**
+ * Editor name is NODE, EDGE, or NETWORK.
+ */
+ @Override
+ public PropertyEditor getDataTableComboBoxEditor(final Class<? extends
CyTableEntry> targetObjectType) {
- final ListEditor editor = attrComboBoxEditors.get(targetObjectType);
+ final ListEditor editor =
attrComboBoxEditors.get(targetObjectType);
- if (editor == null)
- throw new IllegalArgumentException("No such list editor: " +
targetObjectType);
+ if (editor == null)
+ throw new IllegalArgumentException("No such list
editor: " + targetObjectType);
- return (PropertyEditor) editor;
- }
+ return (PropertyEditor) editor;
+ }
- @Override
- public Collection<PropertyEditor> getAttributeSelectors() {
- final Collection<PropertyEditor> selectors = new
HashSet<PropertyEditor>();
- for (ListEditor selector : attrComboBoxEditors.values())
- selectors.add((PropertyEditor) selector);
- return selectors;
- }
+ @Override
+ public Collection<PropertyEditor> getAttributeSelectors() {
+ final Collection<PropertyEditor> selectors = new
HashSet<PropertyEditor>();
+ for (ListEditor selector : attrComboBoxEditors.values())
+ selectors.add((PropertyEditor) selector);
+ return selectors;
+ }
- @Override
- public PropertyEditor getMappingFunctionSelector() {
- return mappingTypeEditor;
- }
+ @Override
+ public PropertyEditor getMappingFunctionSelector() {
+ return mappingTypeEditor;
+ }
- private void buildDiscreteEditors(final VisualLexicon lexicon) {
+ private void buildDiscreteEditors(final VisualLexicon lexicon) {
- logger.debug("\n\n\nNew Engine Factory: Adding discrete value
editors------------------------");
+ logger.debug("\n\n\nNew Engine Factory: Adding discrete value
editors------------------------");
- Set<VisualProperty<?>> vps = lexicon.getAllVisualProperties();
- for (final VisualProperty<?> vp : vps) {
- Range<?> range = vp.getRange();
+ Set<VisualProperty<?>> vps = lexicon.getAllVisualProperties();
+ for (final VisualProperty<?> vp : vps) {
+ Range<?> range = vp.getRange();
- if (range instanceof DiscreteRange<?>) {
+ if (range instanceof DiscreteRange<?>) {
- // Visual Property Editor.
- logger.debug("Got new Discrete. Creating new VP editor: " +
vp.getDisplayName());
- final Set<?> values = ((DiscreteRange<?>) range).values();
- VisualPropertyEditor<?> vpEditor = new
DiscreteValuePropertyEditor(range.getType(), values,
- tableManager, appManager, selectedManager, this, vmm);
- this.addVisualPropertyEditor(vpEditor, null);
+ // Visual Property Editor.
+ logger.debug("Got new Discrete. Creating new
VP editor: " + vp.getDisplayName());
+ final Set<?> values = ((DiscreteRange<?>)
range).values();
+ VisualPropertyEditor<?> vpEditor = new
DiscreteValuePropertyEditor(range.getType(), values,
+ tableManager, appManager,
selectedManager, this, vmm);
+ this.addVisualPropertyEditor(vpEditor, null);
- if (this.getValueEditor(range.getType()) == null) {
- ValueEditor<?> valEditor = new
DiscreteValueEditor(appManager, range.getType(),
- (DiscreteRange) range, vp);
- this.addValueEditor(valEditor, null);
+ if (this.getValueEditor(range.getType()) ==
null) {
+ ValueEditor<?> valEditor = new
DiscreteValueEditor(appManager, range.getType(),
+ (DiscreteRange) range,
vp);
+ this.addValueEditor(valEditor, null);
+ }
+ }
}
- }
}
- }
- public void addRenderingEngineFactory(RenderingEngineFactory<?> factory,
Map props) {
+ public void addRenderingEngineFactory(RenderingEngineFactory<?>
factory, Map props) {
- final VisualLexicon lexicon = factory.getVisualLexicon();
- buildDiscreteEditors(lexicon);
- }
+ final VisualLexicon lexicon = factory.getVisualLexicon();
+ buildDiscreteEditors(lexicon);
+ }
- public void removeRenderingEngineFactory(RenderingEngineFactory<?>
factory, Map props) {
- // TODO: clean up state when rendering engines are removed.
- }
+ public void removeRenderingEngineFactory(RenderingEngineFactory<?>
factory, Map props) {
+ // TODO: clean up state when rendering engines are removed.
+ }
}
--
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.