Author: kono
Date: 2012-01-19 17:26:36 -0800 (Thu, 19 Jan 2012)
New Revision: 28064
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/VizMapPropertySheetMouseAdapter.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTable.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTableColumnModelListener.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/AbstractContinuousMappingEditor.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
Log:
fixes #580 Icons for continuous mappings will be rendered correctly.
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
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -55,6 +55,7 @@
import org.cytoscape.view.vizmap.VisualMappingFunctionFactory;
import org.cytoscape.view.vizmap.gui.editor.EditorManager;
import org.cytoscape.view.vizmap.gui.editor.VisualPropertyEditor;
+import
org.cytoscape.view.vizmap.gui.internal.editor.mappingeditor.AbstractContinuousMappingEditor;
import org.cytoscape.view.vizmap.gui.internal.event.CellType;
import org.cytoscape.view.vizmap.mappings.ContinuousMapping;
import org.cytoscape.view.vizmap.mappings.DiscreteMapping;
@@ -205,8 +206,7 @@
// FIXME
setDiscreteProps(vp, visualMapping, attrSet, vpEditor,
topProperty, propertySheetPanel);
- } else if (visualMapping instanceof ContinuousMapping &&
(attrName != null)) {
-
+ } else if (visualMapping instanceof ContinuousMapping &&
(attrName != null)) {
final VizMapperProperty<String, VisualMappingFunction,
VisualMappingFunction<K, V>> graphicalView =
new VizMapperProperty<String,
VisualMappingFunction, VisualMappingFunction<K, V>>(
CellType.CONTINUOUS,
visualMapping.getVisualProperty().getDisplayName()+ "_" +
AbstractVizMapperPanel.GRAPHICAL_MAP_VIEW, visualMapping.getClass());
@@ -231,9 +231,13 @@
if (continuousCellEditor == null)
throw new NullPointerException("Continuous
Mapping cell editor is null.");
- else
+ else {
+ continuousCellEditor.setValue(visualMapping);
cellEditorFactory.registerEditor(graphicalView,
continuousCellEditor);
-
+ table.repaint();
+ }
+
+
} else if (visualMapping instanceof PassthroughMapping &&
(attrName != null)) {
String id;
Object value;
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
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetBuilder.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -52,24 +52,19 @@
private static final Logger logger =
LoggerFactory.getLogger(VizMapPropertySheetBuilder.class);
+ private static final int ROW_HEIGHT = 30;
+ private static final int ROW_HEIGHT_MAPPING_CELL = 90;
+ private static final Color CATEGORY_BACKGROUND_COLOR = new Color(10,
10, 50, 20);
private PropertySheetPanel propertySheetPanel;
private DefaultTableCellRenderer emptyBoxRenderer;
private DefaultTableCellRenderer filledBoxRenderer;
- private VizMapPropertyBuilder vizMapPropertyBuilder;
-
- private EditorManager editorManager;
-
- private ColorManager colorMgr;
-
+ private final VizMapPropertyBuilder vizMapPropertyBuilder;
+ private final EditorManager editorManager;
private final VizMapperMenuManager menuMgr;
-
- private CyNetworkManager cyNetworkManager;
-
private final VizMapperUtil util;
-
private final VisualMappingManager vmm;
/*
@@ -84,7 +79,6 @@
DefaultViewPanel defViewPanel, CyTableManager tableMgr,
final VizMapperUtil util, final VisualMappingManager vmm) {
this.menuMgr = menuMgr;
- this.cyNetworkManager = cyNetworkManager;
this.propertySheetPanel = propertySheetPanel;
this.util = util;
this.vmm = vmm;
@@ -138,16 +132,13 @@
final PropertySheetTable table = propertySheetPanel.getTable();
- table.setRowHeight(27);
+ table.setRowHeight(ROW_HEIGHT);
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- table.setCategoryBackground(new Color(10, 10, 50, 20));
+ table.setCategoryBackground(CATEGORY_BACKGROUND_COLOR);
table.setCategoryForeground(Color.black);
table.setSelectionBackground(Color.white);
table.setSelectionForeground(Color.blue);
- /*
- * Set editors
- */
// FIXME
emptyBoxRenderer = new DefaultTableCellRenderer();
emptyBoxRenderer.setHorizontalTextPosition(SwingConstants.CENTER);
@@ -259,9 +250,6 @@
private void setUnused(List<Property> propList, VisualStyle style) {
buildList(style);
- // TODO: Sort the unused list.
- // Collections.sort(getUnusedVisualPropType());
-
for (VisualProperty<?> type : getUnusedVisualPropType()) {
VizMapperProperty<VisualProperty<?>, String, ?> prop =
new VizMapperProperty<VisualProperty<?>, String, Object>(CellType.UNUSED, type,
String.class);
prop.setCategory(AbstractVizMapperPanel.CATEGORY_UNUSED);
@@ -316,23 +304,19 @@
// Number of rows shown now.
int rowCount = table.getRowCount();
-
for (int i = 0; i < rowCount; i++) {
-
- final VizMapperProperty<?, ?, ?> shownProp =
(VizMapperProperty<?, ?, ?>) ((Item) table.getValueAt(i, 0)).getProperty();
- if(shownProp == null)
+
+ final VizMapperProperty<?, ?, ?> shownProp =
(VizMapperProperty<?, ?, ?>) ((Item) table.getValueAt(i, 0))
+ .getProperty();
+ if (shownProp == null)
continue;
- if(shownProp.getCellType().equals(CellType.CONTINUOUS))
{
- table.setRowHeight(i, 80);
+ if
(shownProp.getCellType().equals(CellType.CONTINUOUS)) {
+ table.setRowHeight(i, ROW_HEIGHT_MAPPING_CELL);
} else if ((shownProp.getCategory() != null)
- && shownProp.getCategory().equals(
-
AbstractVizMapperPanel.CATEGORY_UNUSED)) {
+ &&
shownProp.getCategory().equals(AbstractVizMapperPanel.CATEGORY_UNUSED)) {
- // FIXME
- //
empRenderer.setForeground(colorMgr.getColor("UNUSED_COLOR"));
- ((PropertyRendererRegistry)
this.propertySheetPanel.getTable()
-
.getRendererFactory()).registerRenderer(shownProp,
- empRenderer);
+ ((PropertyRendererRegistry)
this.propertySheetPanel.getTable().getRendererFactory()).registerRenderer(
+ shownProp, empRenderer);
}
}
propertySheetPanel.repaint();
@@ -375,10 +359,6 @@
}
-
- /*
- * Remove an entry in the browser.
- */
public void removeProperty(final Property prop, final VisualStyle
style) {
final List<Property> props = propertyMap.get(style);
@@ -403,7 +383,7 @@
return this.vizMapPropertyBuilder;
}
- public List<VisualProperty<?>> getUnusedVisualPropType() {
+ List<VisualProperty<?>> getUnusedVisualPropType() {
return unusedVisualPropType;
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetMouseAdapter.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetMouseAdapter.java
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetMouseAdapter.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -126,9 +126,7 @@
vizMapPropertySheetBuilder.updateTableView();
if(SwingUtilities.isRightMouseButton(e)) {
-
this.handleContextMenuEvent(e);
-
} else if (SwingUtilities.isLeftMouseButton(e) && (0 <=
selected)) {
final Item item = (Item)
propertySheetPanel.getTable().getValueAt(selected, 0);
final VizMapperProperty<?, ?, ?> curProp =
(VizMapperProperty<?, ?, ?>) item.getProperty();
@@ -201,27 +199,6 @@
logger.debug("==========Target Mapping = " +
selectedMapping);
logger.debug("==========Target Key = " +
curProp.getDisplayName());
logger.debug("==========Target Val = " +
curProp.getValue());
-
- // TODO: move this function editor manager.
-// if (selectedMapping instanceof
ContinuousMapping) {
-// /*
-// * Need to check other windows.
-// */
-// if
(editorWindowManager.containsKey(type)) {
-// // This means editor is already
on display.
-//
editorWindowManager.get(type).requestFocus();
-//
-// return;
-// } else {
-// try {
-// ((JDialog)
editorFactory.showContinuousEditor(
-//
propertySheetPanel, type))
-//
.addPropertyChangeListener(propertySheetPanel);
-// } catch (Exception e1) {
-// e1.printStackTrace();
-// }
-// }
-// }
}
}
}
@@ -235,33 +212,4 @@
public void handleEvent(SelectedVisualStyleSwitchedEvent e) {
this.selectedStyle = e.getNewVisualStyle();
}
-
-// @Override
-// public void mousePressed(MouseEvent e) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// @Override
-// public void mouseReleased(MouseEvent e) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// @Override
-// public void mouseEntered(MouseEvent e) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// @Override
-// public void mouseExited(MouseEvent e) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// @Override
-// public void propertyChange(PropertyChangeEvent evt) {
-// logger.debug("Mouse Listener Got PC: " + evt.getSource());
-// }
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTable.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTable.java
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTable.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -9,7 +9,7 @@
import com.l2fprod.common.propertysheet.PropertySheetTableModel.Item;
public final class VizMapPropertySheetTable extends PropertySheetTable {
-
+
private final static long serialVersionUID = 1213748836812161L;
public String getToolTipText(MouseEvent me) {
@@ -23,32 +23,26 @@
final Color fontColor;
- if ((prop != null) && (prop.getValue() != null)
- && (prop.getValue().getClass() == Color.class))
+ if ((prop != null) && (prop.getValue() != null) &&
(prop.getValue().getClass() == Color.class))
fontColor = (Color) prop.getValue();
else
fontColor = Color.DARK_GRAY;
final String colorString =
Integer.toHexString(fontColor.getRGB());
-
if (prop == null)
return null;
if
(prop.getDisplayName().equals(AbstractVizMapperPanel.GRAPHICAL_MAP_VIEW))
return "Click to edit this mapping...";
- if ((prop.getDisplayName() == "Controlling Attribute")
- || (prop.getDisplayName() == "Mapping Type"))
- return "<html><Body BgColor=\"white\"><font
Size=\"4\" Color=\"#"
- + colorString.substring(2, 8) +
"\"><strong>"
- + prop.getDisplayName() + " = " +
prop.getValue()
- + "</font></strong></body></html>";
- else if ((prop.getSubProperties() == null)
- || (prop.getSubProperties().length == 0))
- return "<html><Body BgColor=\"white\"><font
Size=\"4\" Color=\"#"
- + colorString.substring(2, 8) +
"\"><strong>"
- + prop.getDisplayName() +
"</font></strong></body></html>";
+ if ((prop.getDisplayName() == "Controlling Attribute")
|| (prop.getDisplayName() == "Mapping Type"))
+ return "<html><Body BgColor=\"white\"><font
Size=\"4\" Color=\"#" + colorString.substring(2, 8)
+ + "\"><strong>" +
prop.getDisplayName() + " = " + prop.getValue()
+ +
"</font></strong></body></html>";
+ else if ((prop.getSubProperties() == null) ||
(prop.getSubProperties().length == 0))
+ return "<html><Body BgColor=\"white\"><font
Size=\"4\" Color=\"#" + colorString.substring(2, 8)
+ + "\"><strong>" +
prop.getDisplayName() + "</font></strong></body></html>";
return null;
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTableColumnModelListener.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTableColumnModelListener.java
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetTableColumnModelListener.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -14,8 +14,8 @@
this.vizMapPropertySheetBuilder = vizMapPropertySheetBuilder;
}
- public void columnAdded(TableColumnModelEvent arg0) {
- // TODO Auto-generated method stub
+ public void columnAdded(TableColumnModelEvent e) {
+ vizMapPropertySheetBuilder.updateTableView();
}
public void columnMarginChanged(ChangeEvent e) {
@@ -23,14 +23,11 @@
}
public void columnMoved(TableColumnModelEvent e) {
- // TODO Auto-generated method stub
}
public void columnRemoved(TableColumnModelEvent e) {
- // TODO Auto-generated method stub
}
public void columnSelectionChanged(ListSelectionEvent e) {
- // TODO Auto-generated method stub
}
}
\ No newline at end of file
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/AbstractContinuousMappingEditor.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/AbstractContinuousMappingEditor.java
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/AbstractContinuousMappingEditor.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -23,7 +23,7 @@
public abstract class AbstractContinuousMappingEditor<K extends Number, V>
extends AbstractPropertyEditor {
- private static final Dimension DEF_SIZE = new Dimension(500, 400);
+ private static final Dimension DEF_SIZE = new Dimension(550, 400);
private static final Dimension MIN_SIZE = new Dimension(300, 350);
protected ContinuousMapping<K, V> mapping;
@@ -39,6 +39,7 @@
private final JLabel iconLabel;
private boolean isEditorDialogActive;
+ private JDialog currentDialog;
public AbstractContinuousMappingEditor(final CyNetworkTableManager
manager, final CyApplicationManager appManager,
final SelectedVisualStyleManager selectedManager, final
EditorManager editorManager, final VisualMappingManager vmm) {
@@ -61,8 +62,12 @@
public void mouseClicked(MouseEvent ev) {
// Open only one editor at a time.
- if(isEditorDialogActive)
+ if(isEditorDialogActive) {
+ // Bring it to the front
+ if(currentDialog != null)
+ currentDialog.toFront();
return;
+ }
final JDialog editorDialog = new JDialog();
initComponents(editorDialog);
@@ -82,6 +87,7 @@
editorDialog.setAlwaysOnTop(true);
editorDialog.setVisible(true);
isEditorDialogActive = true;
+ currentDialog = editorDialog;
}
private void initComponents(final JDialog dialog) {
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
2012-01-20 01:16:10 UTC (rev 28063)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
2012-01-20 01:26:36 UTC (rev 28064)
@@ -210,12 +210,11 @@
switchMappingType(prop, type,
(VisualMappingFunctionFactory) e.getNewValue(),
controllingAttrName.toString());
} else if (prop.getParentProperty() != null) {
- // Discrete Cell editor. Create new map entry and
register it.
+ // Discrete Cell editor. Create new map entry and
register it.
logger.debug("Cell edit event: name = " +
prop.getName());
logger.debug("Cell edit event: old val = " +
prop.getValue());
logger.debug("Cell edit event: new val = " + newVal);
- logger.debug("Cell edit event: associated mapping = "
- + prop.getInternalValue());
+ logger.debug("Cell edit event: associated mapping = " +
prop.getInternalValue());
final VisualMappingFunction<?, ?> mapping =
(VisualMappingFunction<?, ?>) prop.getInternalValue();
@@ -329,18 +328,12 @@
}
- private void switchMappingType(final VizMapperProperty<?, ?, ?> prop,
- final VisualProperty<?> vp,
- final VisualMappingFunctionFactory factory,
- final String controllingAttrName) {
+ private void switchMappingType(final VizMapperProperty<?, ?, ?> prop,
final VisualProperty<?> vp,
+ final VisualMappingFunctionFactory factory, final
String controllingAttrName) {
// This is the currently selected Visual Style.
final VisualStyle style = manager.getCurrentVisualStyle();
- logger.debug("Mapping combo box clicked: " + style.getTitle());
- logger.debug("Mapping Category: " + prop.getCategory());
-
-
final VisualProperty<Visualizable> startVP =
util.getCategory((Class<? extends CyTableEntry>) vp.getTargetDataType());
final VisualMappingFunction<?, ?> currentMapping =
style.getVisualMappingFunction(vp);
@@ -351,33 +344,29 @@
logger.debug("!! Current Mapping type: " + currentMapping);
if(currentMapping == null || currentMapping.getClass() !=
factory.getMappingFunctionType()) {
- // Mapping does not exist.
+ // Mapping does not exist. Need to create new one.
final AttributeSet attrSet =
attrManager.getAttributeSet(applicationManager.getCurrentNetwork(), (Class<?
extends CyTableEntry>) vp.getTargetDataType());
final Class<?> attributeDataType =
attrSet.getAttrMap().get(controllingAttrName);
newMapping =
factory.createVisualMappingFunction(controllingAttrName, attributeDataType,
null,vp);
style.addVisualMappingFunction(newMapping);
- } else {
+ } else
newMapping = currentMapping;
- }
logger.debug("New VisualMappingFunction Created: Mapping Type =
"
+
style.getVisualMappingFunction(vp).toString());
logger.debug("New VisualMappingFunction Created: Controlling
attr = "
+
style.getVisualMappingFunction(vp).getMappingColumnName());
-
// First, remove current property
Property parent = prop.getParentProperty();
propertySheetPanel.removeProperty(parent);
final VizMapperProperty<?, ?, VisualMappingFunctionFactory>
newRootProp;
-
- newRootProp = vizMapPropertySheetBuilder.getPropertyBuilder()
- .buildProperty(newMapping,
startVP.getDisplayName(),
- propertySheetPanel, factory);
-
+ newRootProp =
vizMapPropertySheetBuilder.getPropertyBuilder().buildProperty(newMapping,
+ startVP.getDisplayName(), propertySheetPanel,
factory);
+
vizMapPropertySheetBuilder.expandLastSelectedItem(vp.getDisplayName());
vizMapPropertySheetBuilder.removeProperty(parent, style);
@@ -385,9 +374,10 @@
propList.add(newRootProp);
parent = null;
-
final VisualStyle currentStyle =
manager.getCurrentVisualStyle();
currentStyle.apply(applicationManager.getCurrentNetworkView());
applicationManager.getCurrentNetworkView().updateView();
+
+ vizMapPropertySheetBuilder.updateTableView();
}
}
--
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.