Author: kono
Date: 2011-11-22 15:03:21 -0800 (Tue, 22 Nov 2011)
New Revision: 27563
Removed:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/DataLoadedEventHandler.java
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewMouseListener.java
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/task/ImportDefaultVizmapTask.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
Log:
Initialization timing issue had been resolved.
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
2011-11-22 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -115,7 +115,7 @@
DefaultViewEditorImpl defViewEditor = new
DefaultViewEditorImpl(defaultViewPanel,editorManager,cyApplicationManagerServiceRef,vmmServiceRef,selectedVisualStyleManager,vizMapperUtil,vpDependencyManager,cyEventHelperServiceRef);
CreateNewVisualStyleTaskFactory createNewVisualStyleTaskFactory
= new CreateNewVisualStyleTaskFactory(vizMapperUtil,
visualStyleFactoryServiceRef,vmmServiceRef);
DeleteVisualStyleTaskFactory removeVisualStyleTaskFactory = new
DeleteVisualStyleTaskFactory(vmmServiceRef,selectedVisualStyleManager);
- ImportDefaultVizmapTaskFactory importDefaultVizmapTaskFactory =
new
ImportDefaultVizmapTaskFactory(vizmapReaderManagerServiceRef,vmmServiceRef,cyApplicationConfigurationServiceRef);
+ ImportDefaultVizmapTaskFactory importDefaultVizmapTaskFactory =
new
ImportDefaultVizmapTaskFactory(vizmapReaderManagerServiceRef,vmmServiceRef,cyApplicationConfigurationServiceRef,
cyEventHelperServiceRef);
VizMapPropertySheetBuilder vizMapPropertySheetBuilder = new
VizMapPropertySheetBuilder(menuManager,cyNetworkManagerServiceRef,propertySheetPanel,editorManager,defaultViewPanel,cyTableManagerServiceRef,vizMapperUtil,vmmServiceRef);
EditorWindowManager editorWindowManager = new
EditorWindowManager(editorManager,propertySheetPanel);
VizMapperMainPanel vizMapperMainPanel = new
VizMapperMainPanel(visualStyleFactoryServiceRef,defViewEditor,iconManager,colorMgr,vmmServiceRef,menuManager,editorManager,propertySheetPanel,vizMapPropertySheetBuilder,editorWindowManager,cyApplicationManagerServiceRef,cyEventHelperServiceRef,selectedVisualStyleManager,importDefaultVizmapTaskFactory,dialogTaskManagerServiceRef);
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
2011-11-22 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -657,29 +657,9 @@
}
- // /*
- // * Draw global color icon
- // */
- // class GlobalIcon extends VisualPropertyIcon {
- // private final static long serialVersionUID = 1202339876659938L;
- //
- // public GlobalIcon(String name, Color color) {
- // super(name, color);
- // }
- //
- // public void paintIcon(Component c, Graphics g, int x, int y) {
- // Graphics2D g2d = (Graphics2D) g;
- //
- // g2d.setColor(color);
- // g2d.fillRect(5, 3, 50, 32);
- //
- // g2d.setStroke(new BasicStroke(1f));
- // g2d.setColor(Color.DARK_GRAY);
- // g2d.drawRect(5, 3, 50, 32);
- // }
- // }
-
- public Component getDefaultView(VisualStyle vs) {
+
+ @Override
+ public Component getDefaultView(final VisualStyle vs) {
mainView.updateView(vs);
return mainView;
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewMouseListener.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewMouseListener.java
2011-11-22 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewMouseListener.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -80,8 +80,8 @@
defViewEditor.showEditor(vizMapperMainPanel);
final Dimension panelSize =
vizMapperMainPanel.getDefaultViewPanel().getSize();
- final int newWidth = ((Number)(panelSize.width *
0.9)).intValue();
- final int newHeight = ((Number)(panelSize.height *
0.9)).intValue();
+ final int newWidth = ((Number)(panelSize.width *
0.8)).intValue();
+ final int newHeight = ((Number)(panelSize.height *
0.8)).intValue();
vizMapperMainPanel.updateDefaultImage(manager
.getCurrentVisualStyle(),
((DefaultViewPanel) defViewEditor
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 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -135,9 +135,6 @@
}
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);
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 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertySheetBuilder.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -218,7 +218,6 @@
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) {
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 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapperMainPanel.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -136,7 +136,7 @@
CyEventHelper eventHelper,
final SelectedVisualStyleManager manager,
final ImportDefaultVizmapTaskFactory taskFactory,
- final TaskManager tManager) {
+ final TaskManager<?, ?> tManager) {
super(vsFactory, defViewEditor, iconMgr, colorMgr, vmm, menuMgr,
editorFactory, propertySheetPanel,
vizMapPropertySheetBuilder,
@@ -145,18 +145,10 @@
// Initialize all components
this.defaultViewMouseListener = new
DefaultViewMouseListener(defViewEditor, this, manager);
+ initPanel();
+
// Load default styles
tManager.execute(taskFactory);
-
- try{
- // TODO: To remove this, we need a new event:
VizmapFileLoadedEvent
- Thread.sleep(1000); // Wait until styles are loaded
- initPanel();
- switchVS(vmm.getDefaultVisualStyle(), true);
- } catch(Exception ex) {
- logger.warn("Initialization failed!");
- switchVS(vmm.getDefaultVisualStyle(), true);
- }
}
private void initPanel() {
@@ -193,13 +185,6 @@
}
protected void switchVS(final VisualStyle style, boolean forceUpdate) {
-
- logger.debug("Switching VS start: " + style.getTitle());
-
- // If new VS name is the same, ignore.
- if (!forceUpdate &&
style.equals(manager.getCurrentVisualStyle()))
- return;
-
// Close editor windows
editorWindowManager.closeAllEditorWindows();
@@ -220,25 +205,18 @@
});
}
- /*
- * Draw default view
- */
- Image defImg = defaultImageManager.get(style);
-
- if (defImg == null) {
- // Default image is not available in the buffer. Create
a new one.
- updateDefaultImage(style, ((DefaultViewPanel)
defViewEditor.getDefaultView(style)).getRenderingEngine(),
- defaultViewImagePanel.getSize());
- defImg = defaultImageManager.get(style);
- }
-
+ final Dimension newSize = new
Dimension(mainSplitPane.getWidth(), mainSplitPane.getDividerLocation());
+ // Default image is not available in the buffer. Create a new
one.
+ updateDefaultImage(style, ((DefaultViewPanel)
defViewEditor.getDefaultView(style)).getRenderingEngine(), newSize);
+ final Image defImg = defaultImageManager.get(style);
// Set the default view to the panel.
setDefaultViewImagePanel(defImg, style);
+
+ // Set the default view to the panel.
propertySheetPanel.setSorting(true);
}
- public void refreshUI() {
-
+ void refreshUI() {
final List<VisualStyle> visualStyles = new
ArrayList<VisualStyle>(
vmm.getAllVisualStyles());
@@ -253,7 +231,6 @@
Component defPanel;
final Dimension panelSize = defaultViewImagePanel.getSize();
- CyNetworkView view;
// TODO: make sortable!
// Collections.sort(visualStyles);
@@ -262,9 +239,7 @@
logger.info("Adding VS: " + vs.getTitle());
vsComboBoxModel.addElement(vs);
defPanel = defViewEditor.getDefaultView(vs);
- RenderingEngine<CyNetwork> engine = ((DefaultViewPanel)
defPanel)
- .getRenderingEngine();
-
+ final RenderingEngine<CyNetwork> engine =
((DefaultViewPanel) defPanel).getRenderingEngine();
updateDefaultImage(vs, engine, panelSize);
}
@@ -274,8 +249,6 @@
// Sync check box and actual lock state
spcs.firePropertyChange("UPDATE_LOCK", null, true);
- // switchNodeSizeLock(lockSize.isSelected());
-
// Restore listeners
for (int i = 0; i < li.length; i++)
visualStyleComboBox.addActionListener(li[i]);
@@ -296,14 +269,7 @@
}
public void updateAttributeList() {
- // TODO: use new event listener to do this.
vizMapPropertySheetBuilder.setAttrComboBox();
- // final Set mappingTypes =
- // vmm.getCalculatorCatalog().getMappingNames();
- //
- // //
mappingTypeEditor.setAvailableValues(mappingTypes.toArray());
- // spcs.firePropertyChange("UPDATE_AVAILABLE_VAL",
"mappingTypeEditor",
- // mappingTypes.toArray());
}
/**
@@ -563,6 +529,15 @@
public void handleEvent(SelectedVisualStyleSwitchedEvent e) {
final VisualStyle newStyle = e.getNewVisualStyle();
this.visualStyleComboBox.setSelectedItem(newStyle);
+
+ switchVS(newStyle, true);
+
+// final Dimension newSize = new
Dimension(mainSplitPane.getWidth(), mainSplitPane.getDividerLocation());
+// // Default image is not available in the buffer. Create a new
one.
+// updateDefaultImage(newStyle, ((DefaultViewPanel)
defViewEditor.getDefaultView(newStyle)).getRenderingEngine(), newSize);
+// final Image defImg = defaultImageManager.get(newStyle);
+// // Set the default view to the panel.
+// setDefaultViewImagePanel(defImg, newStyle);
}
Deleted:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/DataLoadedEventHandler.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/DataLoadedEventHandler.java
2011-11-22 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/DataLoadedEventHandler.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -1,51 +0,0 @@
-/*
- Copyright (c) 2006, 2007, 2010, The Cytoscape Consortium (www.cytoscape.org)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- 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.event;
-
-
-import java.beans.PropertyChangeEvent;
-
-import org.cytoscape.view.vizmap.VisualStyle;
-
-
-public class DataLoadedEventHandler extends AbstractVizMapEventHandler {
- /**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
- */
- @Override
- public void processEvent(PropertyChangeEvent e) {
- final VisualStyle vs =
vmm.getVisualStyle(applicationManager.getCurrentNetworkView());
-
- vizMapperMainPanel.refreshUI();
- // FIXME: remove this class.
-// vizMapperMainPanel.switchVS(vs);
-// vizMapperMainPanel.setSelectedVisualStyle(vs);
- }
-}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
2011-11-22 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -5,64 +5,71 @@
import java.util.Set;
import org.cytoscape.application.CyApplicationConfiguration;
+import org.cytoscape.event.CyEventHelper;
import org.cytoscape.io.read.VizmapReader;
import org.cytoscape.io.read.VizmapReaderManager;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.view.vizmap.VisualStyle;
+import org.cytoscape.view.vizmap.gui.event.SelectedVisualStyleSwitchedEvent;
import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.TaskMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ImportDefaultVizmapTask extends AbstractTask {
-
+
private static final Logger logger =
LoggerFactory.getLogger(ImportDefaultVizmapTask.class);
private static final String PRESET_VIZMAP_FILE = "default_vizmap.xml";
private final VisualMappingManager vmm;
private final VizmapReaderManager vizmapReaderMgr;
-
+
private final File vizmapFile;
+ private final CyEventHelper eventHelper;
- public ImportDefaultVizmapTask(final VizmapReaderManager
vizmapReaderMgr, final VisualMappingManager vmm, final
CyApplicationConfiguration config) {
+ public ImportDefaultVizmapTask(final VizmapReaderManager
vizmapReaderMgr, final VisualMappingManager vmm,
+ final CyApplicationConfiguration config, final
CyEventHelper eventHelper) {
this.vizmapReaderMgr = vizmapReaderMgr;
this.vmm = vmm;
+ this.eventHelper = eventHelper;
this.vizmapFile = new File(config.getSettingLocation(),
PRESET_VIZMAP_FILE);
}
@Override
- public void run(final TaskMonitor taskMonitor) throws Exception {
+ public void run(final TaskMonitor taskMonitor) throws Exception {
final VizmapReader reader;
-
- if(vizmapFile.exists() == false) {
+
+ if (vizmapFile.exists() == false) {
// get the file from resource
final URL url =
this.getClass().getClassLoader().getResource(PRESET_VIZMAP_FILE);
reader = vizmapReaderMgr.getReader(url.toURI(),
url.getPath());
} else {
reader = vizmapReaderMgr.getReader(vizmapFile.toURI(),
vizmapFile.getName());
}
-
+
logger.debug("Default vizmap file = " + vizmapFile.getName());
if (reader == null)
throw new NullPointerException("Failed to find Default
Vizmap loader.");
- insertTasksAfterCurrentTask(reader, new
AddVisualStylesTask(reader, vmm));
+ insertTasksAfterCurrentTask(reader, new
AddVisualStylesTask(reader, vmm, eventHelper));
}
-
- private final class AddVisualStylesTask extends AbstractTask {
+ private static final class AddVisualStylesTask extends AbstractTask {
+
private final VizmapReader reader;
private final VisualMappingManager vmMgr;
+ private final CyEventHelper helper;
- public AddVisualStylesTask(VizmapReader reader,
VisualMappingManager vmMgr) {
+ public AddVisualStylesTask(VizmapReader reader,
VisualMappingManager vmMgr, final CyEventHelper eventHelper) {
this.reader = reader;
this.vmMgr = vmMgr;
+ this.helper = eventHelper;
}
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
- taskMonitor.setTitle("Loading default visual
styles...");
+ taskMonitor.setTitle("Loading preset Visual Styles...");
final Set<VisualStyle> styles =
reader.getVisualStyles();
if (styles != null) {
@@ -70,7 +77,8 @@
int total = styles.size();
for (VisualStyle vs : styles) {
- if (cancelled) break;
+ if (cancelled)
+ break;
taskMonitor.setStatusMessage(count + "
of " + total + ": " + vs.getTitle());
vmMgr.addVisualStyle(vs);
taskMonitor.setProgress(count / total);
@@ -79,15 +87,15 @@
if (cancelled) {
// remove recently added styles
- for (VisualStyle vs : styles) {
+ for (VisualStyle vs : styles)
vmMgr.removeVisualStyle(vs);
- }
taskMonitor.setProgress(1.0);
}
+
+ final VisualStyle defStyle =
vmMgr.getDefaultVisualStyle();
+ helper.fireEvent(new
SelectedVisualStyleSwitchedEvent(this, null, defStyle));
}
}
}
-
-
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
2011-11-22 22:45:34 UTC (rev 27562)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
2011-11-22 23:03:21 UTC (rev 27563)
@@ -1,6 +1,7 @@
package org.cytoscape.view.vizmap.gui.internal.task;
import org.cytoscape.application.CyApplicationConfiguration;
+import org.cytoscape.event.CyEventHelper;
import org.cytoscape.io.read.VizmapReaderManager;
import org.cytoscape.view.vizmap.VisualMappingManager;
import org.cytoscape.work.TaskFactory;
@@ -11,15 +12,19 @@
private final VizmapReaderManager vizmapReaderMgr;
private final VisualMappingManager vmm;
private final CyApplicationConfiguration config;
+
+ private final CyEventHelper eventHelper;
- public ImportDefaultVizmapTaskFactory(VizmapReaderManager
vizmapReaderMgr, VisualMappingManager vmm, final CyApplicationConfiguration
config) {
+ public ImportDefaultVizmapTaskFactory(VizmapReaderManager
vizmapReaderMgr, VisualMappingManager vmm,
+ final CyApplicationConfiguration config, final
CyEventHelper eventHelper) {
this.vizmapReaderMgr = vizmapReaderMgr;
this.vmm = vmm;
this.config = config;
+ this.eventHelper = eventHelper;
}
@Override
public TaskIterator getTaskIterator() {
- return new TaskIterator(new
ImportDefaultVizmapTask(vizmapReaderMgr, vmm, config));
+ return new TaskIterator(new
ImportDefaultVizmapTask(vizmapReaderMgr, vmm, config, eventHelper));
}
}
--
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.