Merge lp:~eduramiba/gephi/linkfluence-features into lp:~gephi.team/gephi/0.8

Proposed by Eduardo Ramos
Status: Merged
Merged at revision: 2087
Proposed branch: lp:~eduramiba/gephi/linkfluence-features
Merge into: lp:~gephi.team/gephi/0.8
Diff against target: 5353 lines (+3283/-1259)
73 files modified
DataLaboratoryAPI/nbproject/genfiles.properties (+2/-2)
DataLaboratoryAPI/nbproject/project.xml (+8/-0)
DataLaboratoryAPI/src/org/gephi/datalab/api/AttributeColumnsController.java (+21/-0)
DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle.properties (+2/-0)
DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_es.properties (+3/-0)
DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_fr.properties (+3/-0)
DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_ru.properties (+1/-0)
DataLaboratoryAPI/src/org/gephi/datalab/api/DataLaboratoryHelper.java (+409/-0)
DataLaboratoryAPI/src/org/gephi/datalab/impl/AttributeColumnsControllerImpl.java (+16/-0)
DataLaboratoryAPI/src/org/gephi/datalab/impl/GraphElementsControllerImpl.java (+38/-6)
DataLaboratoryAPI/src/org/gephi/datalab/spi/Manipulator.java (+3/-3)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnAndValueChooser.java (+65/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnsChooser.java (+1/-1)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/Bundle.properties (+2/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/ClearEdgesData.java (+1/-1)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/CopyEdgeDataToOtherEdges.java (+1/-1)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdges.java (+119/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdgesBuilder.java (+37/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/Bundle.properties (+2/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/ClearNodesData.java (+1/-1)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/CopyNodeDataToOtherNodes.java (+1/-1)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodes.java (+119/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodesBuilder.java (+38/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/Bundle.properties (+3/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.form (+102/-0)
DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.java (+218/-0)
DesktopBranding/src/org/gephi/branding/desktop/multilingual/LanguageAction.java (+3/-3)
DesktopDataLaboratory/nbproject/genfiles.properties (+2/-2)
DesktopDataLaboratory/nbproject/project.xml (+0/-8)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/DataTableTopComponent.java (+11/-8)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/EdgeDataTable.java (+4/-4)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/NodeDataTable.java (+4/-4)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/general/actions/MergeColumnsUI.java (+3/-3)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle.properties (+0/-2)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_es.properties (+0/-4)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_fr.properties (+0/-4)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/DataLaboratoryHelper.java (+0/-350)
DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/PopupMenuUtils.java (+3/-2)
VisualizationAPI/nbproject/genfiles.properties (+2/-2)
VisualizationAPI/nbproject/project.xml (+1/-0)
VisualizationAPI/src/org/gephi/visualization/spi/GraphContextMenuItem.java (+125/-0)
VisualizationModule/nbproject/genfiles.properties (+2/-2)
VisualizationModule/nbproject/project.xml (+8/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle.properties (+0/-14)
VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_es.properties (+0/-32)
VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_fr.properties (+0/-32)
VisualizationModule/src/org/gephi/visualization/apiimpl/GraphContextMenu.java (+114/-178)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle.properties (+21/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_es.properties (+32/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_fr.properties (+32/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Contract.java (+126/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspace.java (+93/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspaceSubItem.java (+149/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyToWorkspace.java (+31/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Delete.java (+93/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Expand.java (+124/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Free.java (+91/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Group.java (+85/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/LastColumnOpenedURL.java (+33/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/MoveToWorkspace.java (+31/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURL.java (+93/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLLastItem.java (+119/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLSubItem.java (+152/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/SelectInDataLaboratory.java (+86/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Settle.java (+91/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/TagNodes.java (+86/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Ungroup.java (+91/-0)
VisualizationModule/src/org/gephi/visualization/apiimpl/es.po (+0/-57)
VisualizationModule/src/org/gephi/visualization/apiimpl/fr.po (+0/-57)
VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-api.pot (+0/-37)
VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-apiimpl.pot (+0/-55)
VisualizationModule/src/org/gephi/visualization/bridge/DHNSEventBridge.java (+59/-381)
VisualizationModule/src/org/gephi/visualization/component/GraphTopComponent.java (+67/-2)
To merge this branch: bzr merge lp:~eduramiba/gephi/linkfluence-features
Reviewer Review Type Date Requested Status
Mathieu Bastian Approve
Review via email: mp+48162@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mathieu Bastian (mathieu.bastian) wrote :

Great Job Eduardo, that are great useful features and nice API improvements.

Some comments:
- As we plan to do a last 0.7 update very soon, to include the bugfixes, I reverted the LanguageAction change, as new languages will be in 0.8 only
- The OpenURL contect menu item should rather be in a plugin. Please remove it from the trunk and create a plugin branch.

review: Approve
Revision history for this message
Mathieu Bastian (mathieu.bastian) wrote :

The Tag menu item should also be part of a plugin I guess

Revision history for this message
Eduardo Ramos (eduramiba) wrote :

Hi,
Right, I enabled language selection to try it and forgot to disable it.
Then, it will be necessary to delete translated bundles for an 0.7 update
before 0.8 (which will have languages), since they were merged to trunk
recently.
Also I still have to update some translations before 0.8.

When I finish my exams next tuesday I will do that, add/change other
linkfluence plugin features like "copy column of selected nodes to
clipboard" and review the API documentation.

Open URL, tagging, and the clipboard thing could be an extra utils plugin I
guess, yes.

Also, the SPI for context menu actions is very similar to nodes/edges
manipulators of data laboratory (I added support for declaring shortcut keys
and submenues, which could be useful for data lab nodes/edges manipulators).
So, with small changes if necessary, some node actions can appear in graph
view and data lab, and I thought I will add the move/copy to workspace
feature to data laboratory once it has support for the submenues.

Thanks,
Eduardo

2011/2/4 Mathieu Bastian <email address hidden>

> Review: Approve
> Great Job Eduardo, that are great useful features and nice API
> improvements.
>
> Some comments:
> - As we plan to do a last 0.7 update very soon, to include the bugfixes, I
> reverted the LanguageAction change, as new languages will be in 0.8 only
> - The OpenURL contect menu item should rather be in a plugin. Please remove
> it from the trunk and create a plugin branch.
> --
>
> https://code.launchpad.net/~eduramiba/gephi/linkfluence-features/+merge/48162<https://code.launchpad.net/%7Eeduramiba/gephi/linkfluence-features/+merge/48162>
> You are the owner of lp:~eduramiba/gephi/linkfluence-features.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DataLaboratoryAPI/nbproject/genfiles.properties'
2--- DataLaboratoryAPI/nbproject/genfiles.properties 2010-09-16 21:39:28 +0000
3+++ DataLaboratoryAPI/nbproject/genfiles.properties 2011-02-01 14:23:14 +0000
4@@ -1,8 +1,8 @@
5-build.xml.data.CRC32=08e66a2b
6+build.xml.data.CRC32=cde22f7d
7 build.xml.script.CRC32=f4b00cc3
8 build.xml.stylesheet.CRC32=a56c6a5b@1.42.2
9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
11-nbproject/build-impl.xml.data.CRC32=08e66a2b
12+nbproject/build-impl.xml.data.CRC32=cde22f7d
13 nbproject/build-impl.xml.script.CRC32=eea9549d
14 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2
15
16=== modified file 'DataLaboratoryAPI/nbproject/project.xml'
17--- DataLaboratoryAPI/nbproject/project.xml 2010-09-16 21:39:28 +0000
18+++ DataLaboratoryAPI/nbproject/project.xml 2011-02-01 14:23:14 +0000
19@@ -47,6 +47,14 @@
20 </run-dependency>
21 </dependency>
22 <dependency>
23+ <code-name-base>org.openide.dialogs</code-name-base>
24+ <build-prerequisite/>
25+ <compile-dependency/>
26+ <run-dependency>
27+ <specification-version>7.15.1</specification-version>
28+ </run-dependency>
29+ </dependency>
30+ <dependency>
31 <code-name-base>org.openide.util</code-name-base>
32 <build-prerequisite/>
33 <compile-dependency/>
34
35=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/api/AttributeColumnsController.java'
36--- DataLaboratoryAPI/src/org/gephi/datalab/api/AttributeColumnsController.java 2010-10-12 12:56:30 +0000
37+++ DataLaboratoryAPI/src/org/gephi/datalab/api/AttributeColumnsController.java 2011-02-01 14:23:14 +0000
38@@ -31,6 +31,7 @@
39 import org.gephi.graph.api.Attributes;
40 import org.gephi.graph.api.Edge;
41 import org.gephi.graph.api.Node;
42+import org.openide.util.Lookup;
43
44 /**
45 * <p>This interface defines part of the Data Laboratory API basic actions.</p>
46@@ -109,6 +110,26 @@
47 void fillColumnWithValue(AttributeTable table, AttributeColumn column, String value);
48
49 /**
50+ * <p>Fills the data values of a given column of the indicated nodes with a value as a String,
51+ * parsing it for the <code>AttributeType</code> of the column. If it is not possible to parse,
52+ * the value will be set to null.</p>
53+ * @param nodes Nodes to fill
54+ * @param column Column to fill
55+ * @param value String representation of the value for the column for each node
56+ */
57+ void fillNodesColumnWithValue(Node[] nodes, AttributeColumn column, String value);
58+
59+ /**
60+ * <p>Fills the data values of a given column of the indicated edges with a value as a String,
61+ * parsing it for the <code>AttributeType</code> of the column. If it is not possible to parse,
62+ * the value will be set to null.</p>
63+ * @param edges Edges to fill
64+ * @param column Column to fill
65+ * @param value String representation of the value for the column for each edge
66+ */
67+ void fillEdgesColumnWithValue(Edge[] edges, AttributeColumn column, String value);
68+
69+ /**
70 * <p>Clears all rows data for a given column of a table (nodes table or edges table)</p>
71 * @param table Table to clear column data
72 * @param column Column to clear data
73
74=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle.properties'
75--- DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle.properties 2010-09-07 09:00:13 +0000
76+++ DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle.properties 2011-02-01 14:23:14 +0000
77@@ -3,3 +3,5 @@
78 API/SPI for interacting with the Data Laboratory and extending it.
79 OpenIDE-Module-Name=Data Laboratory API
80 OpenIDE-Module-Short-Description=API/SPI for interacting with the Data Laboratory and extending it
81+DataLaboratoryHelper.ui.okButton.text=Ok
82+SettingsPanel.title={0}
83
84=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_es.properties'
85--- DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_es.properties 2010-12-30 12:17:31 +0000
86+++ DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_es.properties 2011-02-01 14:23:14 +0000
87@@ -8,3 +8,6 @@
88 OpenIDE-Module-Long-Description=API/SPI para interactuar con el Laboratorio de Datos y extenderlo.
89
90 OpenIDE-Module-Short-Description=API/SPI para interactuar con el Laboratorio de Datos y extenderlo.
91+
92+DataLaboratoryHelper.ui.okButton.text=Ok
93+SettingsPanel.title={0}
94\ No newline at end of file
95
96=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_fr.properties'
97--- DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_fr.properties 2010-12-30 12:17:31 +0000
98+++ DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_fr.properties 2011-02-01 14:23:14 +0000
99@@ -8,3 +8,6 @@
100 OpenIDE-Module-Long-Description=API/SPI pour interagir avec le Data Laboratory et l'\u00e9tendre
101
102 OpenIDE-Module-Short-Description=API/SPI pour interagir avec le Data Laboratory et l'\u00e9tendre
103+
104+DataLaboratoryHelper.ui.okButton.text=Ok
105+SettingsPanel.title={0}
106\ No newline at end of file
107
108=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_ru.properties'
109--- DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_ru.properties 2010-12-30 12:17:31 +0000
110+++ DataLaboratoryAPI/src/org/gephi/datalab/api/Bundle_ru.properties 2011-02-01 14:23:14 +0000
111@@ -8,3 +8,4 @@
112 OpenIDE-Module-Long-Description=API/SPI \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u0438\u0435\u0439 \u0414\u0430\u043d\u043d\u044b\u0445
113
114 OpenIDE-Module-Short-Description=API/SPI \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u0438\u0435\u0439 \u0414\u0430\u043d\u043d\u044b\u0445
115+SettingsPanel.title={0}
116\ No newline at end of file
117
118=== added file 'DataLaboratoryAPI/src/org/gephi/datalab/api/DataLaboratoryHelper.java'
119--- DataLaboratoryAPI/src/org/gephi/datalab/api/DataLaboratoryHelper.java 1970-01-01 00:00:00 +0000
120+++ DataLaboratoryAPI/src/org/gephi/datalab/api/DataLaboratoryHelper.java 2011-02-01 14:23:14 +0000
121@@ -0,0 +1,409 @@
122+/*
123+Copyright 2008-2010 Gephi
124+Authors : Eduardo Ramos <eduramiba@gmail.com>
125+Website : http://www.gephi.org
126+
127+This file is part of Gephi.
128+
129+Gephi is free software: you can redistribute it and/or modify
130+it under the terms of the GNU Affero General Public License as
131+published by the Free Software Foundation, either version 3 of the
132+License, or (at your option) any later version.
133+
134+Gephi is distributed in the hope that it will be useful,
135+but WITHOUT ANY WARRANTY; without even the implied warranty of
136+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
137+GNU Affero General Public License for more details.
138+
139+You should have received a copy of the GNU Affero General Public License
140+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
141+ */
142+package org.gephi.datalab.api;
143+
144+import java.awt.Dialog;
145+import java.awt.event.ActionEvent;
146+import java.awt.event.ActionListener;
147+import java.awt.event.WindowAdapter;
148+import java.awt.event.WindowEvent;
149+import java.util.ArrayList;
150+import java.util.Collections;
151+import java.util.Comparator;
152+import javax.swing.JButton;
153+import javax.swing.JComponent;
154+import javax.swing.JPanel;
155+import javax.swing.SwingUtilities;
156+import org.gephi.data.attributes.api.AttributeColumn;
157+import org.gephi.data.attributes.api.AttributeTable;
158+import org.gephi.datalab.spi.DialogControls;
159+import org.gephi.datalab.spi.Manipulator;
160+import org.gephi.datalab.spi.ManipulatorUI;
161+import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
162+import org.gephi.datalab.spi.columns.AttributeColumnsManipulatorUI;
163+import org.gephi.datalab.spi.columns.merge.AttributeColumnsMergeStrategy;
164+import org.gephi.datalab.spi.columns.merge.AttributeColumnsMergeStrategyBuilder;
165+import org.gephi.datalab.spi.values.AttributeValueManipulator;
166+import org.gephi.datalab.spi.values.AttributeValueManipulatorBuilder;
167+import org.gephi.datalab.spi.edges.EdgesManipulator;
168+import org.gephi.datalab.spi.edges.EdgesManipulatorBuilder;
169+import org.gephi.datalab.spi.general.GeneralActionsManipulator;
170+import org.gephi.datalab.spi.general.PluginGeneralActionsManipulator;
171+import org.gephi.datalab.spi.nodes.NodesManipulator;
172+import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
173+import org.openide.DialogDescriptor;
174+import org.openide.DialogDisplayer;
175+import org.openide.util.Lookup;
176+import org.openide.util.NbBundle;
177+import org.openide.util.lookup.ServiceProvider;
178+
179+/**
180+ * Helper class for simplifying the use of Data Laboratory API and SPI.
181+ */
182+@ServiceProvider(service=DataLaboratoryHelper.class)
183+public class DataLaboratoryHelper{
184+
185+ /**
186+ * <p>Prepares an array with one new instance of every NodesManipulator
187+ * that has a builder registered and returns it.</p>
188+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
189+ * @return Array of all NodesManipulator implementations
190+ */
191+ public NodesManipulator[] getNodesManipulators() {
192+ ArrayList<NodesManipulator> nodesManipulators = new ArrayList<NodesManipulator>();
193+ for (NodesManipulatorBuilder nm : Lookup.getDefault().lookupAll(NodesManipulatorBuilder.class)) {
194+ nodesManipulators.add(nm.getNodesManipulator());
195+ }
196+ sortManipulators(nodesManipulators);
197+ return nodesManipulators.toArray(new NodesManipulator[0]);
198+ }
199+
200+ /**
201+ * <p>Prepares an array with one new instance of every EdgesManipulator
202+ * that has a builder registered and returns it.</p>
203+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
204+ * @return Array of all EdgesManipulator implementations
205+ */
206+ public EdgesManipulator[] getEdgesManipulators() {
207+ ArrayList<EdgesManipulator> edgesManipulators = new ArrayList<EdgesManipulator>();
208+ for (EdgesManipulatorBuilder em : Lookup.getDefault().lookupAll(EdgesManipulatorBuilder.class)) {
209+ edgesManipulators.add(em.getEdgesManipulator());
210+ }
211+ sortManipulators(edgesManipulators);
212+ return edgesManipulators.toArray(new EdgesManipulator[0]);
213+ }
214+
215+ /**
216+ * <p>Prepares an array with one instance of every GeneralActionsManipulator that is registered.</p>
217+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
218+ * @return Array of all GeneralActionsManipulator implementations
219+ */
220+ public GeneralActionsManipulator[] getGeneralActionsManipulators() {
221+ ArrayList<GeneralActionsManipulator> generalActionsManipulators = new ArrayList<GeneralActionsManipulator>();
222+ generalActionsManipulators.addAll(Lookup.getDefault().lookupAll(GeneralActionsManipulator.class));
223+ sortManipulators(generalActionsManipulators);
224+ return generalActionsManipulators.toArray(new GeneralActionsManipulator[0]);
225+ }
226+
227+ /**
228+ * <p>Prepares an array with one instance of every PluginGeneralActionsManipulator that is registered.</p>
229+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
230+ * @return Array of all PluginGeneralActionsManipulator implementations
231+ */
232+ public PluginGeneralActionsManipulator[] getPluginGeneralActionsManipulators() {
233+ ArrayList<PluginGeneralActionsManipulator> pluginGeneralActionsManipulators = new ArrayList<PluginGeneralActionsManipulator>();
234+ pluginGeneralActionsManipulators.addAll(Lookup.getDefault().lookupAll(PluginGeneralActionsManipulator.class));
235+ sortManipulators(pluginGeneralActionsManipulators);
236+ return pluginGeneralActionsManipulators.toArray(new PluginGeneralActionsManipulator[0]);
237+ }
238+
239+ /**
240+ * <p>Prepares an array that has one instance of every AttributeColumnsManipulator implementation
241+ * that has a builder registered and returns it.</p>
242+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
243+ * @return Array of all AttributeColumnsManipulator implementations
244+ */
245+ public AttributeColumnsManipulator[] getAttributeColumnsManipulators() {
246+ ArrayList<AttributeColumnsManipulator> attributeColumnsManipulators = new ArrayList<AttributeColumnsManipulator>();
247+ attributeColumnsManipulators.addAll(Lookup.getDefault().lookupAll(AttributeColumnsManipulator.class));
248+ sortAttributeColumnsManipulators(attributeColumnsManipulators);
249+ return attributeColumnsManipulators.toArray(new AttributeColumnsManipulator[0]);
250+ }
251+
252+ /**
253+ * <p>Prepares an array with one new instance of every AttributeValueManipulator
254+ * that has a builder registered and returns it.</p>
255+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
256+ * @return Array of all AttributeValueManipulator implementations
257+ */
258+ public AttributeValueManipulator[] getAttributeValueManipulators() {
259+ ArrayList<AttributeValueManipulator> attributeValueManipulators = new ArrayList<AttributeValueManipulator>();
260+ for (AttributeValueManipulatorBuilder am : Lookup.getDefault().lookupAll(AttributeValueManipulatorBuilder.class)) {
261+ attributeValueManipulators.add(am.getAttributeValueManipulator());
262+ }
263+ sortManipulators(attributeValueManipulators);
264+ return attributeValueManipulators.toArray(new AttributeValueManipulator[0]);
265+ }
266+
267+ /**
268+ * <p>Prepares an array that has one new instance of every AttributeColumnsMergeStrategy implementation that is registered.</p>
269+ * <p>It also returns the manipulators ordered first by type and then by position.</p>
270+ * @return Array of all AttributeColumnsMergeStrategy implementations
271+ */
272+ public AttributeColumnsMergeStrategy[] getAttributeColumnsMergeStrategies() {
273+ ArrayList<AttributeColumnsMergeStrategy> strategies = new ArrayList<AttributeColumnsMergeStrategy>();
274+ for (AttributeColumnsMergeStrategyBuilder cs : Lookup.getDefault().lookupAll(AttributeColumnsMergeStrategyBuilder.class)) {
275+ strategies.add(cs.getAttributeColumnsMergeStrategy());
276+ }
277+ sortManipulators(strategies);
278+ return strategies.toArray(new AttributeColumnsMergeStrategy[0]);
279+ }
280+
281+ private void sortManipulators(ArrayList<? extends Manipulator> m) {
282+ Collections.sort(m, new Comparator<Manipulator>() {
283+
284+ public int compare(Manipulator o1, Manipulator o2) {
285+ //Order by type, position.
286+ if (o1.getType() == o2.getType()) {
287+ return o1.getPosition() - o2.getPosition();
288+ } else {
289+ return o1.getType() - o2.getType();
290+ }
291+ }
292+ });
293+ }
294+
295+ private void sortAttributeColumnsManipulators(ArrayList<? extends AttributeColumnsManipulator> m) {
296+ Collections.sort(m, new Comparator<AttributeColumnsManipulator>() {
297+
298+ public int compare(AttributeColumnsManipulator o1, AttributeColumnsManipulator o2) {
299+ //Order by type, position.
300+ if (o1.getType() == o2.getType()) {
301+ return o1.getPosition() - o2.getPosition();
302+ } else {
303+ return o1.getType() - o2.getType();
304+ }
305+ }
306+ });
307+ }
308+
309+ /**
310+ * Prepares the dialog UI of a manipulator if it has one and executes the manipulator in a separate
311+ * Thread when the dialog is accepted or directly if there is no UI.
312+ * @param m Manipulator to execute
313+ */
314+ public void executeManipulator(final Manipulator m) {
315+ if (m.canExecute()) {
316+ SwingUtilities.invokeLater(new Runnable() {
317+
318+ public void run() {
319+
320+ final ManipulatorUI ui = m.getUI();
321+ //Show a dialog for the manipulator UI if it provides one. If not, execute the manipulator directly:
322+ if (ui != null) {
323+ final JButton okButton = new JButton(NbBundle.getMessage(DataLaboratoryHelper.class, "DataLaboratoryHelper.ui.okButton.text"));
324+ DialogControls dialogControls = new DialogControlsImpl(okButton);
325+ ui.setup(m, dialogControls);
326+ JPanel settingsPanel = ui.getSettingsPanel();
327+ DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(DataLaboratoryHelper.class, "SettingsPanel.title", ui.getDisplayName()), ui.isModal(), new ActionListener() {
328+
329+ public void actionPerformed(ActionEvent e) {
330+ if (e.getSource().equals(okButton)) {
331+ ui.unSetup();
332+ executeManipulatorInOtherThread(m);
333+ } else {
334+ ui.unSetup();
335+ }
336+ }
337+ });
338+ dd.setOptions(new Object[]{okButton, DialogDescriptor.CANCEL_OPTION});
339+ dd.setClosingOptions(null);//All options close
340+ Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
341+ dialog.addWindowListener(new WindowAdapter() {
342+
343+ @Override
344+ public void windowClosing(WindowEvent e) {
345+ ui.unSetup();
346+ }
347+ });
348+ dialog.setVisible(true);
349+ } else {
350+ executeManipulatorInOtherThread(m);
351+ }
352+ }
353+ });
354+ }
355+ }
356+
357+ private void executeManipulatorInOtherThread(final Manipulator m) {
358+ new Thread() {
359+
360+ @Override
361+ public void run() {
362+ m.execute();
363+ }
364+ }.start();
365+ }
366+
367+ /**
368+ * Prepares the dialog UI of a AttributeColumnsManipulator if it has one and executes the manipulator in a separate
369+ * Thread when the dialog is accepted or directly if there is no UI.
370+ * @param m AttributeColumnsManipulator
371+ * @param table Table of the column
372+ * @param column Column to manipulate
373+ */
374+ public void executeAttributeColumnsManipulator(final AttributeColumnsManipulator m, final AttributeTable table, final AttributeColumn column) {
375+ if (m.canManipulateColumn(table, column)) {
376+ SwingUtilities.invokeLater(new Runnable() {
377+
378+ public void run() {
379+ final AttributeColumnsManipulatorUI ui = m.getUI(table, column);
380+ //Show a dialog for the manipulator UI if it provides one. If not, execute the manipulator directly:
381+ if (ui != null) {
382+ final JButton okButton = new JButton(NbBundle.getMessage(DataLaboratoryHelper.class, "DataLaboratoryHelper.ui.okButton.text"));
383+ DialogControls dialogControls = new DialogControlsImpl(okButton);
384+ ui.setup(m, table, column, dialogControls);
385+ JPanel settingsPanel = ui.getSettingsPanel();
386+ DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(DataLaboratoryHelper.class, "SettingsPanel.title", ui.getDisplayName()), ui.isModal(), new ActionListener() {
387+
388+ public void actionPerformed(ActionEvent e) {
389+ if (e.getSource().equals(okButton)) {
390+ ui.unSetup();
391+ executeAttributeColumnsManipulatorInOtherThread(m, table, column);
392+ } else {
393+ ui.unSetup();
394+ }
395+ }
396+ });
397+ dd.setOptions(new Object[]{okButton, DialogDescriptor.CANCEL_OPTION});
398+ dd.setClosingOptions(null);//All options close
399+ Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
400+ dialog.addWindowListener(new WindowAdapter() {
401+
402+ @Override
403+ public void windowClosing(WindowEvent e) {
404+ ui.unSetup();
405+ }
406+ });
407+ dialog.setVisible(true);
408+ } else {
409+ executeAttributeColumnsManipulatorInOtherThread(m, table, column);
410+ }
411+ }
412+ });
413+ }
414+ }
415+
416+ private void executeAttributeColumnsManipulatorInOtherThread(final AttributeColumnsManipulator m, final AttributeTable table, final AttributeColumn column) {
417+ new Thread() {
418+
419+ @Override
420+ public void run() {
421+ m.execute(table, column);
422+ }
423+ }.start();
424+ }
425+
426+ /**
427+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
428+ */
429+ public NodesManipulator getNodesManipulatorByName(String name){
430+ for (NodesManipulatorBuilder nm : Lookup.getDefault().lookupAll(NodesManipulatorBuilder.class)) {
431+ if(nm.getNodesManipulator().getClass().getSimpleName().equals(name)){
432+ return nm.getNodesManipulator();
433+ }
434+ }
435+ return null;
436+ }
437+
438+ /**
439+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
440+ */
441+ public EdgesManipulator getEdgesManipulatorByName(String name){
442+ for (EdgesManipulatorBuilder nm : Lookup.getDefault().lookupAll(EdgesManipulatorBuilder.class)) {
443+ if(nm.getEdgesManipulator().getClass().getSimpleName().equals(name)){
444+ return nm.getEdgesManipulator();
445+ }
446+ }
447+ return null;
448+ }
449+
450+ /**
451+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
452+ */
453+ public GeneralActionsManipulator getGeneralActionsManipulatorByName(String name) {
454+ for (GeneralActionsManipulator m : Lookup.getDefault().lookupAll(GeneralActionsManipulator.class)) {
455+ if(m.getClass().getSimpleName().equals(name)){
456+ return m;
457+ }
458+ }
459+ return null;
460+ }
461+
462+ /**
463+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
464+ */
465+ public PluginGeneralActionsManipulator getPluginGeneralActionsManipulatorByName(String name) {
466+ for (PluginGeneralActionsManipulator m : Lookup.getDefault().lookupAll(PluginGeneralActionsManipulator.class)) {
467+ if(m.getClass().getSimpleName().equals(name)){
468+ return m;
469+ }
470+ }
471+ return null;
472+ }
473+
474+ /**
475+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
476+ */
477+ public AttributeColumnsManipulator getAttributeColumnsManipulatorByName(String name) {
478+ for (AttributeColumnsManipulator m : Lookup.getDefault().lookupAll(AttributeColumnsManipulator.class)) {
479+ if(m.getClass().getSimpleName().equals(name)){
480+ return m;
481+ }
482+ }
483+ return null;
484+ }
485+
486+ /**
487+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
488+ */
489+ public AttributeValueManipulator getAttributeValueManipulatorByName(String name) {
490+ for (AttributeValueManipulatorBuilder am : Lookup.getDefault().lookupAll(AttributeValueManipulatorBuilder.class)) {
491+ if(am.getAttributeValueManipulator().getClass().getSimpleName().equals(name)){
492+ return am.getAttributeValueManipulator();
493+ }
494+ }
495+ return null;
496+ }
497+
498+ /**
499+ * Returns the AttributeColumnsMergeStrategy with that class name or null if it does not exist
500+ */
501+ public AttributeColumnsMergeStrategy getAttributeColumnsMergeStrategieByName(String name) {
502+ for (AttributeColumnsMergeStrategyBuilder cs : Lookup.getDefault().lookupAll(AttributeColumnsMergeStrategyBuilder.class)) {
503+ if(cs.getAttributeColumnsMergeStrategy().getClass().getSimpleName().equals(name)){
504+ return cs.getAttributeColumnsMergeStrategy();
505+ }
506+ }
507+ return null;
508+ }
509+
510+ class DialogControlsImpl implements DialogControls {
511+
512+ JComponent okButton;
513+
514+ public DialogControlsImpl(JComponent okButton) {
515+ this.okButton = okButton;
516+ }
517+
518+ public void setOkButtonEnabled(boolean enabled) {
519+ okButton.setEnabled(enabled);
520+ }
521+
522+ public boolean isOkButtonEnabled(){
523+ return okButton.isEnabled();
524+ }
525+ }
526+
527+ public static DataLaboratoryHelper getDefault(){
528+ return Lookup.getDefault().lookup(DataLaboratoryHelper.class);
529+ }
530+}
531
532=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/impl/AttributeColumnsControllerImpl.java'
533--- DataLaboratoryAPI/src/org/gephi/datalab/impl/AttributeColumnsControllerImpl.java 2010-10-16 16:36:58 +0000
534+++ DataLaboratoryAPI/src/org/gephi/datalab/impl/AttributeColumnsControllerImpl.java 2011-02-01 14:23:14 +0000
535@@ -142,6 +142,22 @@
536 }
537 }
538
539+ public void fillNodesColumnWithValue(Node[] nodes, AttributeColumn column, String value){
540+ if (canChangeColumnData(column)) {
541+ for (Node node: nodes) {
542+ setAttributeValue(value, node.getNodeData().getAttributes(), column);
543+ }
544+ }
545+ }
546+
547+ public void fillEdgesColumnWithValue(Edge[] edges, AttributeColumn column, String value){
548+ if (canChangeColumnData(column)) {
549+ for (Edge edge: edges) {
550+ setAttributeValue(value, edge.getEdgeData().getAttributes(), column);
551+ }
552+ }
553+ }
554+
555 public void clearColumnData(AttributeTable table, AttributeColumn column) {
556 if (canClearColumnData(column)) {
557 final int columnIndex = column.getIndex();
558
559=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/impl/GraphElementsControllerImpl.java'
560--- DataLaboratoryAPI/src/org/gephi/datalab/impl/GraphElementsControllerImpl.java 2010-10-11 12:12:06 +0000
561+++ DataLaboratoryAPI/src/org/gephi/datalab/impl/GraphElementsControllerImpl.java 2011-02-01 14:23:14 +0000
562@@ -35,6 +35,8 @@
563 import org.gephi.graph.api.Node;
564 import org.gephi.graph.api.NodeData;
565 import org.gephi.graph.api.UndirectedGraph;
566+import org.openide.DialogDisplayer;
567+import org.openide.NotifyDescriptor;
568 import org.openide.util.Lookup;
569 import org.openide.util.NbBundle;
570 import org.openide.util.lookup.ServiceProvider;
571@@ -47,8 +49,9 @@
572 */
573 @ServiceProvider(service = GraphElementsController.class)
574 public class GraphElementsControllerImpl implements GraphElementsController {
575- private static final float DEFAULT_NODE_SIZE=10f;
576- private static final float DEFAULT_EDGE_WEIGHT=1f;
577+
578+ private static final float DEFAULT_NODE_SIZE = 10f;
579+ private static final float DEFAULT_EDGE_WEIGHT = 1f;
580
581 public Node createNode(String label) {
582 Node newNode = buildNode(label);
583@@ -176,10 +179,39 @@
584
585 public boolean groupNodes(Node[] nodes) {
586 if (canGroupNodes(nodes)) {
587- HierarchicalGraph hg = getHierarchicalGraph();
588- Node group = hg.groupNodes(nodes);
589- //Set the group node label to the same used int visualization module:
590- group.getNodeData().setLabel(NbBundle.getMessage(GraphElementsControllerImpl.class, "Group.nodeCount.label", getNodeChildrenCount(hg, group)));
591+ HierarchicalGraph graph = getHierarchicalGraph();
592+ try {
593+ float centroidX = 0;
594+ float centroidY = 0;
595+ int len = 0;
596+ float sizes = 0;
597+ float r = 0;
598+ float g = 0;
599+ float b = 0;
600+ Node group = graph.groupNodes(nodes);
601+ group.getNodeData().setLabel(NbBundle.getMessage(GraphElementsControllerImpl.class, "Group.nodeCount.label", nodes.length));
602+ group.getNodeData().setSize(10f);
603+ for (Node child : nodes) {
604+ centroidX += child.getNodeData().x();
605+ centroidY += child.getNodeData().y();
606+ len++;
607+ sizes += child.getNodeData().getSize() / 10f;
608+ r += child.getNodeData().r();
609+ g += child.getNodeData().g();
610+ b += child.getNodeData().b();
611+ }
612+ centroidX /= len;
613+ centroidY /= len;
614+ group.getNodeData().setSize(sizes);
615+ group.getNodeData().setColor(r / len, g / len, b / len);
616+ group.getNodeData().setX(centroidX);
617+ group.getNodeData().setY(centroidY);
618+ } catch (Exception e) {
619+ graph.readUnlockAll();
620+ NotifyDescriptor.Message nd = new NotifyDescriptor.Message(e.getMessage());
621+ DialogDisplayer.getDefault().notifyLater(nd);
622+ return false;
623+ }
624 return true;
625 } else {
626 return false;
627
628=== modified file 'DataLaboratoryAPI/src/org/gephi/datalab/spi/Manipulator.java'
629--- DataLaboratoryAPI/src/org/gephi/datalab/spi/Manipulator.java 2010-09-07 09:00:13 +0000
630+++ DataLaboratoryAPI/src/org/gephi/datalab/spi/Manipulator.java 2011-02-01 14:23:14 +0000
631@@ -31,7 +31,7 @@
632 * <ul>
633 * <li>Execute an action</li>
634 * <li>Provide a name, description, type and order of appearance (position in group of its type)</li>
635- * <li>Indicate wether they have to be executable or not</li>
636+ * <li>Indicate wether they have to be executable (enabled in the context menu) or not</li>
637 * <li>Provide and UI or not</li>
638 * <li>Provide and icon or not</li>
639 * </ul>
640@@ -64,9 +64,9 @@
641 String getDescription();
642
643 /**
644- * Indicates if this Manipulator has to be shown.
645+ * Indicates if this Manipulator has to be executable.
646 * Implementations should evaluate the current data and conditions.
647- * @return True if it has to be shown, false otherwise
648+ * @return True if it has to be executable, false otherwise
649 */
650 boolean canExecute();
651
652
653=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnAndValueChooser.java'
654--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnAndValueChooser.java 1970-01-01 00:00:00 +0000
655+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnAndValueChooser.java 2011-02-01 14:23:14 +0000
656@@ -0,0 +1,65 @@
657+/*
658+Copyright 2008-2010 Gephi
659+Authors : Eduardo Ramos <eduramiba@gmail.com>
660+Website : http://www.gephi.org
661+
662+This file is part of Gephi.
663+
664+Gephi is free software: you can redistribute it and/or modify
665+it under the terms of the GNU Affero General Public License as
666+published by the Free Software Foundation, either version 3 of the
667+License, or (at your option) any later version.
668+
669+Gephi is distributed in the hope that it will be useful,
670+but WITHOUT ANY WARRANTY; without even the implied warranty of
671+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
672+GNU Affero General Public License for more details.
673+
674+You should have received a copy of the GNU Affero General Public License
675+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
676+ */
677+package org.gephi.datalab.plugin.manipulators;
678+
679+import org.gephi.data.attributes.api.AttributeColumn;
680+import org.gephi.data.attributes.api.AttributeTable;
681+import org.gephi.datalab.plugin.manipulators.nodes.TagNodes;
682+
683+/**
684+ * Interface in common for choosing a column to manipulate from a list and a String value.
685+ * Used to be able to mass-tag a column of nodes/edges.
686+ * @author Eduardo Ramos <eduramiba@gmail.com>
687+ * @see FillNodesColumnWithValue
688+ */
689+public interface GeneralColumnAndValueChooser{
690+
691+ /**
692+ * Provide columns to show in the UI to select one.
693+ * Normally provide all table columns that can be manipulated.
694+ * @return Columns to show in the GeneralColumnAndValueChooserUI
695+ */
696+ AttributeColumn[] getColumns();
697+
698+ /**
699+ * Provide table for auto-completion of column values
700+ * @return
701+ */
702+ AttributeTable getTable();
703+
704+ /**
705+ * The GeneralColumnAndValueChooserUI will use this method to set the column to finally manipulate, after the GeneralColumnAndValueChooserUI is closed.
706+ * @param columnsToClearData Column to manipulate
707+ */
708+ void setColumn(AttributeColumn column);
709+
710+ /**
711+ * The GeneralColumnAndValueChooserUI will use this method to set the String value to finally use, after the GeneralColumnAndValueChooserUI is closed.
712+ * @param columnsToClearData Column to manipulate
713+ */
714+ void setValue(String value);
715+
716+ /**
717+ * Provide title for the GeneralColumnAndValueChooserUI.
718+ * @return Title name
719+ */
720+ String getName();
721+}
722
723=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnsChooser.java'
724--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnsChooser.java 2010-12-28 14:28:46 +0000
725+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/GeneralColumnsChooser.java 2011-02-01 14:23:14 +0000
726@@ -40,7 +40,7 @@
727
728 /**
729 * The GeneralChooseColumnsUI will use this method to set the columns to finally manipulate, after the GeneralChooseColumnsUI is closed.
730- * @param columnsToClearData Columns to clear
731+ * @param columnsToClearData Columns to manipulate
732 */
733 void setColumns(AttributeColumn[] columnsToClearData);
734
735
736=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/Bundle.properties'
737--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/Bundle.properties 2010-12-29 15:36:47 +0000
738+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/Bundle.properties 2011-02-01 14:23:14 +0000
739@@ -12,6 +12,8 @@
740 DeleteEdgesWithNodes.name.single=Delete edge with nodes...
741 DeleteEdgesWithNodes.name.multiple=Delete all edges with nodes...
742
743+TagEdges.name.single=Tag edge...
744+TagEdges.name.multiple=Tag edges...
745 ClearEdgesData.name.single=Clear...
746 ClearEdgesData.name.multiple=Clear all...
747 ClearEdgesData.description=Clear data of the selected edges
748
749=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/ClearEdgesData.java'
750--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/ClearEdgesData.java 2010-09-07 09:00:13 +0000
751+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/ClearEdgesData.java 2011-02-01 14:23:14 +0000
752@@ -89,7 +89,7 @@
753 }
754
755 public int getPosition() {
756- return 0;
757+ return 100;
758 }
759
760 public Icon getIcon() {
761
762=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/CopyEdgeDataToOtherEdges.java'
763--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/CopyEdgeDataToOtherEdges.java 2010-12-28 14:28:46 +0000
764+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/CopyEdgeDataToOtherEdges.java 2011-02-01 14:23:14 +0000
765@@ -87,7 +87,7 @@
766 }
767
768 public int getPosition() {
769- return 100;
770+ return 200;
771 }
772
773 public Icon getIcon() {
774
775=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdges.java'
776--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdges.java 1970-01-01 00:00:00 +0000
777+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdges.java 2011-02-01 14:23:14 +0000
778@@ -0,0 +1,119 @@
779+/*
780+Copyright 2008-2010 Gephi
781+Authors : Eduardo Ramos <eduramiba@gmail.com>
782+Website : http://www.gephi.org
783+
784+This file is part of Gephi.
785+
786+Gephi is free software: you can redistribute it and/or modify
787+it under the terms of the GNU Affero General Public License as
788+published by the Free Software Foundation, either version 3 of the
789+License, or (at your option) any later version.
790+
791+Gephi is distributed in the hope that it will be useful,
792+but WITHOUT ANY WARRANTY; without even the implied warranty of
793+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
794+GNU Affero General Public License for more details.
795+
796+You should have received a copy of the GNU Affero General Public License
797+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
798+ */
799+package org.gephi.datalab.plugin.manipulators.edges;
800+
801+import java.util.ArrayList;
802+import javax.swing.Icon;
803+import org.gephi.data.attributes.api.AttributeColumn;
804+import org.gephi.data.attributes.api.AttributeController;
805+import org.gephi.data.attributes.api.AttributeTable;
806+import org.gephi.datalab.api.AttributeColumnsController;
807+import org.gephi.datalab.api.DataTablesController;
808+import org.gephi.datalab.plugin.manipulators.GeneralColumnAndValueChooser;
809+import org.gephi.datalab.plugin.manipulators.ui.GeneralColumnAndValueChooserUI;
810+import org.gephi.datalab.spi.ManipulatorUI;
811+import org.gephi.datalab.spi.edges.EdgesManipulator;
812+import org.gephi.graph.api.Edge;
813+import org.openide.util.ImageUtilities;
814+import org.openide.util.Lookup;
815+import org.openide.util.NbBundle;
816+
817+/**
818+ * Edges manipulator that fills the given column of multiple edges with a value.
819+ * @author Eduardo Ramos <eduramiba@gmail.com>
820+ */
821+public class TagEdges implements EdgesManipulator, GeneralColumnAndValueChooser {
822+
823+ private Edge[] edges;
824+ private AttributeColumn column;
825+ private AttributeTable table;
826+ private AttributeColumn[] availableColumns;
827+ private String value;
828+
829+ public void setup(Edge[] edges, Edge clickedEdge) {
830+ this.edges = edges;
831+ table = Lookup.getDefault().lookup(AttributeController.class).getModel().getEdgeTable();
832+ AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
833+ ArrayList<AttributeColumn> availableColumnsList = new ArrayList<AttributeColumn>();
834+ for (AttributeColumn c : table.getColumns()) {
835+ if (ac.canChangeColumnData(c)) {
836+ availableColumnsList.add(c);
837+ }
838+ }
839+ availableColumns = availableColumnsList.toArray(new AttributeColumn[0]);
840+ }
841+
842+ public void execute() {
843+ if (column != null) {
844+ AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
845+ ac.fillEdgesColumnWithValue(edges, column, value);
846+ Lookup.getDefault().lookup(DataTablesController.class).refreshCurrentTable();
847+ }
848+ }
849+
850+ public String getName() {
851+ if (edges.length > 1) {
852+ return NbBundle.getMessage(TagEdges.class, "TagEdges.name.multiple");
853+ } else {
854+ return NbBundle.getMessage(TagEdges.class, "TagEdges.name.single");
855+ }
856+ }
857+
858+ public String getDescription() {
859+ return "";
860+ }
861+
862+ public boolean canExecute() {
863+ return edges.length > 0;
864+ }
865+
866+ public ManipulatorUI getUI() {
867+ return new GeneralColumnAndValueChooserUI();
868+ }
869+
870+ public int getType() {
871+ return 200;
872+ }
873+
874+ public int getPosition() {
875+ return 0;
876+ }
877+
878+ public Icon getIcon() {
879+ return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/tag-label.png", true);
880+ }
881+
882+ public AttributeColumn[] getColumns() {
883+ return availableColumns;
884+ }
885+
886+ public void setColumn(AttributeColumn column) {
887+ this.column = column;
888+ }
889+
890+ public void setValue(String value) {
891+ this.value = value;
892+ }
893+
894+ public AttributeTable getTable() {
895+ return table;
896+ }
897+}
898
899=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdgesBuilder.java'
900--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdgesBuilder.java 1970-01-01 00:00:00 +0000
901+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/edges/TagEdgesBuilder.java 2011-02-01 14:23:14 +0000
902@@ -0,0 +1,37 @@
903+/*
904+Copyright 2008-2010 Gephi
905+Authors : Eduardo Ramos <eduramiba@gmail.com>
906+Website : http://www.gephi.org
907+
908+This file is part of Gephi.
909+
910+Gephi is free software: you can redistribute it and/or modify
911+it under the terms of the GNU Affero General Public License as
912+published by the Free Software Foundation, either version 3 of the
913+License, or (at your option) any later version.
914+
915+Gephi is distributed in the hope that it will be useful,
916+but WITHOUT ANY WARRANTY; without even the implied warranty of
917+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
918+GNU Affero General Public License for more details.
919+
920+You should have received a copy of the GNU Affero General Public License
921+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
922+ */
923+package org.gephi.datalab.plugin.manipulators.edges;
924+
925+import org.gephi.datalab.spi.edges.EdgesManipulator;
926+import org.gephi.datalab.spi.edges.EdgesManipulatorBuilder;
927+import org.openide.util.lookup.ServiceProvider;
928+
929+/**
930+ * Builder for TagEdges edges manipulator.
931+ * @author Eduardo Ramos <eduramiba@gmail.com>
932+ */
933+@ServiceProvider(service=EdgesManipulatorBuilder.class)
934+public class TagEdgesBuilder implements EdgesManipulatorBuilder{
935+
936+ public EdgesManipulator getEdgesManipulator() {
937+ return new TagEdges();
938+ }
939+}
940
941=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/Bundle.properties'
942--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/Bundle.properties 2010-12-29 15:36:47 +0000
943+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/Bundle.properties 2011-02-01 14:23:14 +0000
944@@ -10,6 +10,8 @@
945 DeleteNodes.name.multiple=Delete all
946 DeleteNodes.confirmation.message=Confirm nodes deletion?
947
948+TagNodes.name.multiple=Tag nodes...
949+TagNodes.name.single=Tag node...
950 ClearNodesData.name.single=Clear...
951 ClearNodesData.name.multiple=Clear all...
952 ClearNodesData.description=Clear data of the selected nodes
953
954=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/ClearNodesData.java'
955--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/ClearNodesData.java 2010-09-07 09:00:13 +0000
956+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/ClearNodesData.java 2011-02-01 14:23:14 +0000
957@@ -89,7 +89,7 @@
958 }
959
960 public int getPosition() {
961- return 0;
962+ return 100;
963 }
964
965 public Icon getIcon() {
966
967=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/CopyNodeDataToOtherNodes.java'
968--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/CopyNodeDataToOtherNodes.java 2010-12-28 14:28:46 +0000
969+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/CopyNodeDataToOtherNodes.java 2011-02-01 14:23:14 +0000
970@@ -87,7 +87,7 @@
971 }
972
973 public int getPosition() {
974- return 100;
975+ return 200;
976 }
977
978 public Icon getIcon() {
979
980=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodes.java'
981--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodes.java 1970-01-01 00:00:00 +0000
982+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodes.java 2011-02-01 14:23:14 +0000
983@@ -0,0 +1,119 @@
984+/*
985+Copyright 2008-2010 Gephi
986+Authors : Eduardo Ramos <eduramiba@gmail.com>
987+Website : http://www.gephi.org
988+
989+This file is part of Gephi.
990+
991+Gephi is free software: you can redistribute it and/or modify
992+it under the terms of the GNU Affero General Public License as
993+published by the Free Software Foundation, either version 3 of the
994+License, or (at your option) any later version.
995+
996+Gephi is distributed in the hope that it will be useful,
997+but WITHOUT ANY WARRANTY; without even the implied warranty of
998+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
999+GNU Affero General Public License for more details.
1000+
1001+You should have received a copy of the GNU Affero General Public License
1002+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
1003+ */
1004+package org.gephi.datalab.plugin.manipulators.nodes;
1005+
1006+import java.util.ArrayList;
1007+import javax.swing.Icon;
1008+import org.gephi.data.attributes.api.AttributeColumn;
1009+import org.gephi.data.attributes.api.AttributeController;
1010+import org.gephi.data.attributes.api.AttributeTable;
1011+import org.gephi.datalab.api.AttributeColumnsController;
1012+import org.gephi.datalab.api.DataTablesController;
1013+import org.gephi.datalab.plugin.manipulators.GeneralColumnAndValueChooser;
1014+import org.gephi.datalab.plugin.manipulators.ui.GeneralColumnAndValueChooserUI;
1015+import org.gephi.datalab.spi.ManipulatorUI;
1016+import org.gephi.datalab.spi.nodes.NodesManipulator;
1017+import org.gephi.graph.api.Node;
1018+import org.openide.util.ImageUtilities;
1019+import org.openide.util.Lookup;
1020+import org.openide.util.NbBundle;
1021+
1022+/**
1023+ * Nodes manipulator that fills the given column of multiple nodes with a value.
1024+ * @author Eduardo Ramos <eduramiba@gmail.com>
1025+ */
1026+public class TagNodes implements NodesManipulator, GeneralColumnAndValueChooser {
1027+
1028+ private Node[] nodes;
1029+ private AttributeColumn column;
1030+ private AttributeTable table;
1031+ private AttributeColumn[] availableColumns;
1032+ private String value;
1033+
1034+ public void setup(Node[] nodes, Node clickedNode) {
1035+ this.nodes = nodes;
1036+ table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
1037+ AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
1038+ ArrayList<AttributeColumn> availableColumnsList = new ArrayList<AttributeColumn>();
1039+ for (AttributeColumn c : table.getColumns()) {
1040+ if (ac.canChangeColumnData(c)) {
1041+ availableColumnsList.add(c);
1042+ }
1043+ }
1044+ availableColumns = availableColumnsList.toArray(new AttributeColumn[0]);
1045+ }
1046+
1047+ public void execute() {
1048+ if (column != null) {
1049+ AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class);
1050+ ac.fillNodesColumnWithValue(nodes, column, value);
1051+ Lookup.getDefault().lookup(DataTablesController.class).refreshCurrentTable();
1052+ }
1053+ }
1054+
1055+ public String getName() {
1056+ if (nodes.length > 1) {
1057+ return NbBundle.getMessage(TagNodes.class, "TagNodes.name.multiple");
1058+ } else {
1059+ return NbBundle.getMessage(TagNodes.class, "TagNodes.name.single");
1060+ }
1061+ }
1062+
1063+ public String getDescription() {
1064+ return "";
1065+ }
1066+
1067+ public boolean canExecute() {
1068+ return nodes.length > 0;
1069+ }
1070+
1071+ public ManipulatorUI getUI() {
1072+ return new GeneralColumnAndValueChooserUI();
1073+ }
1074+
1075+ public int getType() {
1076+ return 200;
1077+ }
1078+
1079+ public int getPosition() {
1080+ return 0;
1081+ }
1082+
1083+ public Icon getIcon() {
1084+ return ImageUtilities.loadImageIcon("org/gephi/datalab/plugin/manipulators/resources/tag-label.png", true);
1085+ }
1086+
1087+ public AttributeColumn[] getColumns() {
1088+ return availableColumns;
1089+ }
1090+
1091+ public void setColumn(AttributeColumn column) {
1092+ this.column = column;
1093+ }
1094+
1095+ public void setValue(String value) {
1096+ this.value = value;
1097+ }
1098+
1099+ public AttributeTable getTable() {
1100+ return table;
1101+ }
1102+}
1103
1104=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodesBuilder.java'
1105--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodesBuilder.java 1970-01-01 00:00:00 +0000
1106+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/nodes/TagNodesBuilder.java 2011-02-01 14:23:14 +0000
1107@@ -0,0 +1,38 @@
1108+/*
1109+Copyright 2008-2010 Gephi
1110+Authors : Eduardo Ramos <eduramiba@gmail.com>
1111+Website : http://www.gephi.org
1112+
1113+This file is part of Gephi.
1114+
1115+Gephi is free software: you can redistribute it and/or modify
1116+it under the terms of the GNU Affero General Public License as
1117+published by the Free Software Foundation, either version 3 of the
1118+License, or (at your option) any later version.
1119+
1120+Gephi is distributed in the hope that it will be useful,
1121+but WITHOUT ANY WARRANTY; without even the implied warranty of
1122+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1123+GNU Affero General Public License for more details.
1124+
1125+You should have received a copy of the GNU Affero General Public License
1126+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
1127+ */
1128+package org.gephi.datalab.plugin.manipulators.nodes;
1129+
1130+import org.gephi.datalab.spi.nodes.NodesManipulator;
1131+import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
1132+import org.openide.util.lookup.ServiceProvider;
1133+
1134+/**
1135+ * Builder for TagNodes nodes manipulator.
1136+ * @author Eduardo Ramos <eduramiba@gmail.com>
1137+ */
1138+@ServiceProvider(service=NodesManipulatorBuilder.class)
1139+public class TagNodesBuilder implements NodesManipulatorBuilder{
1140+
1141+ public NodesManipulator getNodesManipulator() {
1142+ return new TagNodes();
1143+ }
1144+
1145+}
1146
1147=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/resources/tag-label.png'
1148Binary files DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/resources/tag-label.png 1970-01-01 00:00:00 +0000 and DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/resources/tag-label.png 2011-02-01 14:23:14 +0000 differ
1149=== modified file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/Bundle.properties'
1150--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/Bundle.properties 2010-09-07 09:00:13 +0000
1151+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/Bundle.properties 2011-02-01 14:23:14 +0000
1152@@ -5,3 +5,6 @@
1153 GeneralNumberListStatisticsReportUI.useLinearRegression.text=Show linear regression
1154 GeneralNumberListStatisticsReportUI.configureHistogramButton.text=Configure Histogram
1155 GeneralNumberListStatisticsReportUI.divisionsLabel.text=Divisions:
1156+GeneralColumnAndValueChooserUI.columnLabel.text=Column:
1157+GeneralColumnAndValueChooserUI.valueLabel.text=Value:
1158+GeneralColumnAndValueChooserUI.autoComplete.text=Auto- complete
1159
1160=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.form'
1161--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.form 1970-01-01 00:00:00 +0000
1162+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.form 2011-02-01 14:23:14 +0000
1163@@ -0,0 +1,102 @@
1164+<?xml version="1.1" encoding="UTF-8" ?>
1165+
1166+<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
1167+ <AuxValues>
1168+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
1169+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
1170+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
1171+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
1172+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
1173+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
1174+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
1175+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
1176+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
1177+ </AuxValues>
1178+
1179+ <Layout>
1180+ <DimensionLayout dim="0">
1181+ <Group type="103" groupAlignment="0" attributes="0">
1182+ <Group type="102" alignment="0" attributes="0">
1183+ <EmptySpace min="-2" max="-2" attributes="0"/>
1184+ <Group type="103" groupAlignment="1" max="-2" attributes="0">
1185+ <Component id="valueLabel" alignment="0" max="32767" attributes="1"/>
1186+ <Component id="columnLabel" alignment="0" pref="63" max="32767" attributes="1"/>
1187+ </Group>
1188+ <EmptySpace min="-2" max="-2" attributes="0"/>
1189+ <Group type="103" groupAlignment="0" attributes="0">
1190+ <Group type="102" attributes="0">
1191+ <Component id="valueComboBox" pref="145" max="32767" attributes="0"/>
1192+ <EmptySpace min="-2" max="-2" attributes="0"/>
1193+ <Component id="autoComplete" min="-2" max="-2" attributes="0"/>
1194+ </Group>
1195+ <Component id="columnComboBox" pref="246" max="32767" attributes="0"/>
1196+ </Group>
1197+ <EmptySpace min="-2" max="-2" attributes="0"/>
1198+ </Group>
1199+ </Group>
1200+ </DimensionLayout>
1201+ <DimensionLayout dim="1">
1202+ <Group type="103" groupAlignment="0" attributes="0">
1203+ <Group type="102" alignment="0" attributes="0">
1204+ <EmptySpace max="-2" attributes="0"/>
1205+ <Group type="103" groupAlignment="3" attributes="0">
1206+ <Component id="columnLabel" alignment="3" min="-2" max="-2" attributes="0"/>
1207+ <Component id="columnComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
1208+ </Group>
1209+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
1210+ <Group type="103" groupAlignment="3" attributes="0">
1211+ <Component id="valueLabel" alignment="3" min="-2" max="-2" attributes="0"/>
1212+ <Component id="valueComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
1213+ <Component id="autoComplete" alignment="3" min="-2" max="-2" attributes="0"/>
1214+ </Group>
1215+ <EmptySpace max="32767" attributes="0"/>
1216+ </Group>
1217+ </Group>
1218+ </DimensionLayout>
1219+ </Layout>
1220+ <SubComponents>
1221+ <Component class="javax.swing.JComboBox" name="columnComboBox">
1222+ <Properties>
1223+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
1224+ <StringArray count="0"/>
1225+ </Property>
1226+ </Properties>
1227+ <Events>
1228+ <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="columnComboBoxItemStateChanged"/>
1229+ </Events>
1230+ </Component>
1231+ <Component class="javax.swing.JLabel" name="columnLabel">
1232+ <Properties>
1233+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
1234+ <ResourceString bundle="org/gephi/datalab/plugin/manipulators/ui/Bundle.properties" key="GeneralColumnAndValueChooserUI.columnLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
1235+ </Property>
1236+ </Properties>
1237+ </Component>
1238+ <Component class="javax.swing.JLabel" name="valueLabel">
1239+ <Properties>
1240+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
1241+ <ResourceString bundle="org/gephi/datalab/plugin/manipulators/ui/Bundle.properties" key="GeneralColumnAndValueChooserUI.valueLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
1242+ </Property>
1243+ </Properties>
1244+ </Component>
1245+ <Component class="javax.swing.JComboBox" name="valueComboBox">
1246+ <Properties>
1247+ <Property name="editable" type="boolean" value="true"/>
1248+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
1249+ <StringArray count="0"/>
1250+ </Property>
1251+ </Properties>
1252+ </Component>
1253+ <Component class="javax.swing.JCheckBox" name="autoComplete">
1254+ <Properties>
1255+ <Property name="selected" type="boolean" value="true"/>
1256+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
1257+ <ResourceString bundle="org/gephi/datalab/plugin/manipulators/ui/Bundle.properties" key="GeneralColumnAndValueChooserUI.autoComplete.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
1258+ </Property>
1259+ </Properties>
1260+ <Events>
1261+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="autoCompleteActionPerformed"/>
1262+ </Events>
1263+ </Component>
1264+ </SubComponents>
1265+</Form>
1266
1267=== added file 'DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.java'
1268--- DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.java 1970-01-01 00:00:00 +0000
1269+++ DataLaboratoryPlugin/src/org/gephi/datalab/plugin/manipulators/ui/GeneralColumnAndValueChooserUI.java 2011-02-01 14:23:14 +0000
1270@@ -0,0 +1,218 @@
1271+/*
1272+Copyright 2008-2010 Gephi
1273+Authors : Eduardo Ramos <eduramiba@gmail.com>
1274+Website : http://www.gephi.org
1275+
1276+This file is part of Gephi.
1277+
1278+Gephi is free software: you can redistribute it and/or modify
1279+it under the terms of the GNU Affero General Public License as
1280+published by the Free Software Foundation, either version 3 of the
1281+License, or (at your option) any later version.
1282+
1283+Gephi is distributed in the hope that it will be useful,
1284+but WITHOUT ANY WARRANTY; without even the implied warranty of
1285+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1286+GNU Affero General Public License for more details.
1287+
1288+You should have received a copy of the GNU Affero General Public License
1289+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
1290+ */
1291+package org.gephi.datalab.plugin.manipulators.ui;
1292+
1293+import java.util.ArrayList;
1294+import javax.swing.JPanel;
1295+import org.gephi.data.attributes.api.AttributeColumn;
1296+import org.gephi.data.attributes.api.AttributeTable;
1297+import org.gephi.datalab.api.AttributeColumnsController;
1298+import org.gephi.datalab.plugin.manipulators.GeneralColumnAndValueChooser;
1299+import org.gephi.datalab.spi.DialogControls;
1300+import org.gephi.datalab.spi.Manipulator;
1301+import org.gephi.datalab.spi.ManipulatorUI;
1302+import org.gephi.graph.api.Attributes;
1303+import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
1304+import org.openide.util.Lookup;
1305+import org.openide.util.NbPreferences;
1306+
1307+/**
1308+ * UI for GeneralColumnAndValueChooser
1309+ * @author Eduardo Ramos <eduramiba@gmail.com>
1310+ */
1311+public class GeneralColumnAndValueChooserUI extends javax.swing.JPanel implements ManipulatorUI {
1312+
1313+ private static final String AUTO_COMPLETE_SAVED_PREFERENCES = "GeneralColumnAndValueChooserUI_autoComplete";
1314+ private GeneralColumnAndValueChooser manipulator;
1315+ private AttributeColumn[] columns;
1316+ private AttributeTable table;
1317+ private String values[];
1318+ private static String lastChosenColumn=null;//To try to preserve last chosen column only while this program execution.
1319+
1320+ /** Creates new form GeneralColumnAndValueChooserUI */
1321+ public GeneralColumnAndValueChooserUI() {
1322+ initComponents();
1323+ }
1324+
1325+ public void setup(Manipulator m, DialogControls dialogControls) {
1326+ this.manipulator = (GeneralColumnAndValueChooser) m;
1327+ this.table = manipulator.getTable();
1328+ refreshColumns();
1329+ autoComplete.setSelected(NbPreferences.forModule(GeneralChooseColumnsAndRowUI.class).getBoolean(AUTO_COMPLETE_SAVED_PREFERENCES, false));
1330+ refreshAutoComplete();
1331+ }
1332+
1333+ public void unSetup() {
1334+ manipulator.setColumn(getChosenColumn());
1335+ manipulator.setValue(valueComboBox.getSelectedItem() != null ? valueComboBox.getSelectedItem().toString() : null);
1336+ NbPreferences.forModule(GeneralChooseColumnsAndRowUI.class).putBoolean(AUTO_COMPLETE_SAVED_PREFERENCES, autoComplete.isSelected());
1337+ lastChosenColumn=getChosenColumn().getTitle();
1338+ }
1339+
1340+ public String getDisplayName() {
1341+ return manipulator.getName();
1342+ }
1343+
1344+ public JPanel getSettingsPanel() {
1345+ return this;
1346+ }
1347+
1348+ public boolean isModal() {
1349+ return true;
1350+ }
1351+
1352+ public AttributeColumn getChosenColumn() {
1353+ if (columnComboBox.getSelectedIndex() != -1) {
1354+ return columns[columnComboBox.getSelectedIndex()];
1355+ } else {
1356+ return null;
1357+ }
1358+ }
1359+
1360+ private void refreshColumns() {
1361+ columns = manipulator.getColumns();
1362+ for (int i = 0; i < columns.length; i++) {
1363+ columnComboBox.addItem(columns[i].getTitle());
1364+ }
1365+ if(lastChosenColumn!=null&&!lastChosenColumn.isEmpty()){
1366+ columnComboBox.setSelectedItem(lastChosenColumn);
1367+ }
1368+ }
1369+ private int lastFetchedColumn = -1;
1370+
1371+ private void refreshAutoComplete() {
1372+ Object currentValue = valueComboBox.getSelectedItem();
1373+ if (autoComplete.isSelected()) {
1374+ AttributeColumn column = getChosenColumn();
1375+ if (column != null) {
1376+ if ((lastFetchedColumn != columnComboBox.getSelectedIndex()) || values == null) {
1377+ ArrayList<String> valuesList = new ArrayList<String>();
1378+ Object value;
1379+ String str;
1380+ for (Attributes row : Lookup.getDefault().lookup(AttributeColumnsController.class).getTableAttributeRows(table)) {
1381+ value = row.getValue(column.getId());
1382+ if (value != null) {
1383+ str = value.toString();
1384+ if (!valuesList.contains(str)) {
1385+ valuesList.add(str);
1386+ }
1387+ }
1388+ }
1389+
1390+ values = valuesList.toArray(new String[0]);
1391+ lastFetchedColumn = columnComboBox.getSelectedIndex();
1392+ }
1393+ valueComboBox.removeAllItems();
1394+ for (String item : values) {
1395+ valueComboBox.addItem(item);
1396+ }
1397+ AutoCompleteDecorator.decorate(valueComboBox);
1398+ }
1399+ } else {
1400+ valueComboBox.removeAllItems();
1401+ }
1402+ valueComboBox.setSelectedItem(currentValue);
1403+ }
1404+
1405+ /** This method is called from within the constructor to
1406+ * initialize the form.
1407+ * WARNING: Do NOT modify this code. The content of this method is
1408+ * always regenerated by the Form Editor.
1409+ */
1410+ @SuppressWarnings("unchecked")
1411+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
1412+ private void initComponents() {
1413+
1414+ columnComboBox = new javax.swing.JComboBox();
1415+ columnLabel = new javax.swing.JLabel();
1416+ valueLabel = new javax.swing.JLabel();
1417+ valueComboBox = new javax.swing.JComboBox();
1418+ autoComplete = new javax.swing.JCheckBox();
1419+
1420+ columnComboBox.addItemListener(new java.awt.event.ItemListener() {
1421+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
1422+ columnComboBoxItemStateChanged(evt);
1423+ }
1424+ });
1425+
1426+ columnLabel.setText(org.openide.util.NbBundle.getMessage(GeneralColumnAndValueChooserUI.class, "GeneralColumnAndValueChooserUI.columnLabel.text")); // NOI18N
1427+
1428+ valueLabel.setText(org.openide.util.NbBundle.getMessage(GeneralColumnAndValueChooserUI.class, "GeneralColumnAndValueChooserUI.valueLabel.text")); // NOI18N
1429+
1430+ valueComboBox.setEditable(true);
1431+
1432+ autoComplete.setSelected(true);
1433+ autoComplete.setText(org.openide.util.NbBundle.getMessage(GeneralColumnAndValueChooserUI.class, "GeneralColumnAndValueChooserUI.autoComplete.text")); // NOI18N
1434+ autoComplete.addActionListener(new java.awt.event.ActionListener() {
1435+ public void actionPerformed(java.awt.event.ActionEvent evt) {
1436+ autoCompleteActionPerformed(evt);
1437+ }
1438+ });
1439+
1440+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
1441+ this.setLayout(layout);
1442+ layout.setHorizontalGroup(
1443+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1444+ .addGroup(layout.createSequentialGroup()
1445+ .addContainerGap()
1446+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
1447+ .addComponent(valueLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1448+ .addComponent(columnLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE))
1449+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1450+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1451+ .addGroup(layout.createSequentialGroup()
1452+ .addComponent(valueComboBox, 0, 145, Short.MAX_VALUE)
1453+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1454+ .addComponent(autoComplete))
1455+ .addComponent(columnComboBox, 0, 246, Short.MAX_VALUE))
1456+ .addContainerGap())
1457+ );
1458+ layout.setVerticalGroup(
1459+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1460+ .addGroup(layout.createSequentialGroup()
1461+ .addContainerGap()
1462+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1463+ .addComponent(columnLabel)
1464+ .addComponent(columnComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1465+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
1466+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1467+ .addComponent(valueLabel)
1468+ .addComponent(valueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1469+ .addComponent(autoComplete))
1470+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1471+ );
1472+ }// </editor-fold>//GEN-END:initComponents
1473+
1474+ private void autoCompleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoCompleteActionPerformed
1475+ refreshAutoComplete();
1476+ }//GEN-LAST:event_autoCompleteActionPerformed
1477+
1478+ private void columnComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_columnComboBoxItemStateChanged
1479+ refreshAutoComplete();
1480+ }//GEN-LAST:event_columnComboBoxItemStateChanged
1481+ // Variables declaration - do not modify//GEN-BEGIN:variables
1482+ private javax.swing.JCheckBox autoComplete;
1483+ private javax.swing.JComboBox columnComboBox;
1484+ private javax.swing.JLabel columnLabel;
1485+ private javax.swing.JComboBox valueComboBox;
1486+ private javax.swing.JLabel valueLabel;
1487+ // End of variables declaration//GEN-END:variables
1488+}
1489
1490=== modified file 'DesktopBranding/src/org/gephi/branding/desktop/multilingual/LanguageAction.java'
1491--- DesktopBranding/src/org/gephi/branding/desktop/multilingual/LanguageAction.java 2010-12-20 00:55:12 +0000
1492+++ DesktopBranding/src/org/gephi/branding/desktop/multilingual/LanguageAction.java 2011-02-01 14:23:14 +0000
1493@@ -45,9 +45,9 @@
1494
1495 public enum Language {
1496
1497- EN_US("en", "English");
1498- //FR_FR("fr", "Français"),
1499- //ES_ES("es", "Español");
1500+ EN_US("en", "English"),
1501+ FR_FR("fr", "Français"),
1502+ ES_ES("es", "Español");
1503 private String locale;
1504 private String name;
1505
1506
1507=== modified file 'DesktopDataLaboratory/nbproject/genfiles.properties'
1508--- DesktopDataLaboratory/nbproject/genfiles.properties 2010-09-11 15:09:14 +0000
1509+++ DesktopDataLaboratory/nbproject/genfiles.properties 2011-02-01 14:23:14 +0000
1510@@ -1,8 +1,8 @@
1511-build.xml.data.CRC32=acfd7417
1512+build.xml.data.CRC32=93720211
1513 build.xml.script.CRC32=e39c7ed0
1514 build.xml.stylesheet.CRC32=a56c6a5b@1.42.2
1515 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
1516 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
1517-nbproject/build-impl.xml.data.CRC32=acfd7417
1518+nbproject/build-impl.xml.data.CRC32=93720211
1519 nbproject/build-impl.xml.script.CRC32=91e63bf0
1520 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2
1521
1522=== modified file 'DesktopDataLaboratory/nbproject/project.xml'
1523--- DesktopDataLaboratory/nbproject/project.xml 2010-09-11 15:09:14 +0000
1524+++ DesktopDataLaboratory/nbproject/project.xml 2011-02-01 14:23:14 +0000
1525@@ -23,14 +23,6 @@
1526 </run-dependency>
1527 </dependency>
1528 <dependency>
1529- <code-name-base>org.gephi.datalab.plugin</code-name-base>
1530- <build-prerequisite/>
1531- <compile-dependency/>
1532- <run-dependency>
1533- <specification-version>0.7.1</specification-version>
1534- </run-dependency>
1535- </dependency>
1536- <dependency>
1537 <code-name-base>org.gephi.dynamic.api</code-name-base>
1538 <build-prerequisite/>
1539 <compile-dependency/>
1540
1541=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/DataTableTopComponent.java'
1542--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/DataTableTopComponent.java 2010-12-28 14:28:46 +0000
1543+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/DataTableTopComponent.java 2011-02-01 14:23:14 +0000
1544@@ -54,6 +54,7 @@
1545 import org.gephi.data.attributes.api.AttributeListener;
1546 import org.gephi.data.attributes.api.AttributeModel;
1547 import org.gephi.data.attributes.api.AttributeTable;
1548+import org.gephi.datalab.api.DataLaboratoryHelper;
1549 import org.gephi.datalab.api.DataTablesController;
1550 import org.gephi.datalab.api.DataTablesEventListener;
1551 import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
1552@@ -74,7 +75,6 @@
1553 import org.gephi.desktop.datalab.general.actions.AddColumnUI;
1554 import org.gephi.desktop.datalab.general.actions.CSVExportUI;
1555 import org.gephi.desktop.datalab.general.actions.MergeColumnsUI;
1556-import org.gephi.desktop.datalab.utils.DataLaboratoryHelper;
1557 import org.gephi.ui.utils.DialogFileFilter;
1558 import org.gephi.ui.utils.UIUtils;
1559 import org.gephi.utils.TableCSVExporter;
1560@@ -298,7 +298,7 @@
1561 }
1562
1563 private synchronized void refreshAll() {
1564- if (Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace()!=null) {//Some workspace is selected
1565+ if (Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace() != null) {//Some workspace is selected
1566 refreshTable();
1567 refreshColumnManipulators();
1568 refreshGeneralActionsButtons();
1569@@ -741,7 +741,7 @@
1570 columns = edgeAvailableColumnsModel.getAvailableColumns();
1571 }
1572
1573- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1574+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1575 AttributeColumnsManipulator[] manipulators = dlh.getAttributeColumnsManipulators();
1576
1577 JCommandButtonStrip currentButtonGroup = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL);
1578@@ -802,7 +802,7 @@
1579 button.addActionListener(new ActionListener() {
1580
1581 public void actionPerformed(ActionEvent e) {
1582- new DataLaboratoryHelper().executeAttributeColumnsManipulator(acm, table, column);
1583+ DataLaboratoryHelper.getDefault().executeAttributeColumnsManipulator(acm, table, column);
1584 }
1585 });
1586 popup.addMenuButton(button);
1587@@ -924,7 +924,7 @@
1588 //Figure out the index to place the buttons, in order to put them between separator 2 and the boxGlue.
1589 int index = controlToolbar.getComponentIndex(boxGlue);
1590
1591- final DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1592+ final DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1593 JButton button;
1594 for (final GeneralActionsManipulator m : dlh.getGeneralActionsManipulators()) {
1595 button = new JButton(m.getName(), m.getIcon());
1596@@ -996,7 +996,7 @@
1597 button.addActionListener(new ActionListener() {
1598
1599 public void actionPerformed(ActionEvent e) {
1600- new DataLaboratoryHelper().executeManipulator(m);
1601+ DataLaboratoryHelper.getDefault().executeManipulator(m);
1602 }
1603 });
1604 } else {
1605@@ -1053,8 +1053,11 @@
1606 KeyEvent evt = (KeyEvent) event;
1607
1608 if (evt.getID() == KeyEvent.KEY_RELEASED && (evt.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0 && evt.getKeyCode() == KeyEvent.VK_F) {
1609- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1610- dlh.executeManipulator(dlh.getSearchReplaceManipulator());
1611+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1612+ GeneralActionsManipulator gam=dlh.getGeneralActionsManipulatorByName("SearchReplace");
1613+ if (gam!=null) {
1614+ dlh.executeManipulator(gam);
1615+ }
1616 evt.consume();
1617 }
1618 }
1619
1620=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/EdgeDataTable.java'
1621--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/EdgeDataTable.java 2010-10-14 21:06:13 +0000
1622+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/EdgeDataTable.java 2011-02-01 14:23:14 +0000
1623@@ -56,8 +56,8 @@
1624 import org.gephi.data.attributes.type.NumberList;
1625 import org.gephi.data.attributes.type.TimeInterval;
1626 import org.gephi.datalab.api.AttributeColumnsController;
1627+import org.gephi.datalab.api.DataLaboratoryHelper;
1628 import org.gephi.datalab.spi.edges.EdgesManipulator;
1629-import org.gephi.desktop.datalab.utils.DataLaboratoryHelper;
1630 import org.gephi.graph.api.Edge;
1631 import org.gephi.graph.api.HierarchicalGraph;
1632 import org.gephi.tools.api.EditWindowController;
1633@@ -182,10 +182,10 @@
1634 @Override
1635 public void keyReleased(KeyEvent e) {
1636 if (e.getKeyCode() == KeyEvent.VK_DELETE) {
1637+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1638 Edge[] selectedEdges = getEdgesFromSelectedRows();
1639 if (selectedEdges.length > 0) {
1640- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1641- EdgesManipulator del = dlh.getDeleEdgesManipulator();
1642+ EdgesManipulator del = dlh.getEdgesManipulatorByName("DeleteEdges");
1643 if (del != null) {
1644 del.setup(selectedEdges, null);
1645 if (del.canExecute()) {
1646@@ -576,7 +576,7 @@
1647 JPopupMenu contextMenu = new JPopupMenu();
1648
1649 //First add edges manipulators items:
1650- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1651+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1652 Integer lastManipulatorType = null;
1653 for (EdgesManipulator em : dlh.getEdgesManipulators()) {
1654 em.setup(selectedEdges, clickedEdge);
1655
1656=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/NodeDataTable.java'
1657--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/NodeDataTable.java 2010-12-28 14:28:46 +0000
1658+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/NodeDataTable.java 2011-02-01 14:23:14 +0000
1659@@ -58,6 +58,7 @@
1660 import org.gephi.data.attributes.type.NumberList;
1661 import org.gephi.data.attributes.type.TimeInterval;
1662 import org.gephi.datalab.api.AttributeColumnsController;
1663+import org.gephi.datalab.api.DataLaboratoryHelper;
1664 import org.gephi.dynamic.api.DynamicModel.TimeFormat;
1665 import org.gephi.graph.api.HierarchicalGraph;
1666 import org.gephi.graph.api.ImmutableTreeNode;
1667@@ -71,7 +72,6 @@
1668 import org.openide.awt.MouseUtils;
1669 import org.openide.util.Lookup;
1670 import org.gephi.datalab.spi.nodes.NodesManipulator;
1671-import org.gephi.desktop.datalab.utils.DataLaboratoryHelper;
1672 import org.gephi.graph.api.Attributes;
1673 import org.gephi.tools.api.EditWindowController;
1674 import org.gephi.desktop.datalab.utils.PopupMenuUtils;
1675@@ -148,10 +148,10 @@
1676 @Override
1677 public void keyReleased(KeyEvent e) {
1678 if (e.getKeyCode() == KeyEvent.VK_DELETE) {
1679+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1680 Node[] selectedNodes = getNodesFromSelectedRows();
1681 if (selectedNodes.length > 0) {
1682- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1683- NodesManipulator del = dlh.getDeleteNodesManipulator();
1684+ NodesManipulator del = dlh.getNodesManipulatorByName("DeleteNodes");
1685 if (del != null) {
1686 del.setup(selectedNodes, null);
1687 if (del.canExecute()) {
1688@@ -567,7 +567,7 @@
1689 JPopupMenu contextMenu = new JPopupMenu();
1690
1691 //First add nodes manipulators items:
1692- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
1693+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
1694 Integer lastManipulatorType = null;
1695 for (NodesManipulator nm : dlh.getNodesManipulators()) {
1696 nm.setup(selectedNodes, clickedNode);
1697
1698=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/general/actions/MergeColumnsUI.java'
1699--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/general/actions/MergeColumnsUI.java 2010-12-28 14:28:46 +0000
1700+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/general/actions/MergeColumnsUI.java 2011-02-01 14:23:14 +0000
1701@@ -32,8 +32,8 @@
1702 import org.gephi.data.attributes.api.AttributeColumn;
1703 import org.gephi.data.attributes.api.AttributeController;
1704 import org.gephi.data.attributes.api.AttributeTable;
1705+import org.gephi.datalab.api.DataLaboratoryHelper;
1706 import org.gephi.datalab.spi.columns.merge.AttributeColumnsMergeStrategy;
1707-import org.gephi.desktop.datalab.utils.DataLaboratoryHelper;
1708 import org.gephi.ui.components.richtooltip.RichTooltip;
1709 import org.netbeans.validation.api.Problems;
1710 import org.netbeans.validation.api.Validator;
1711@@ -153,7 +153,7 @@
1712 if (columnsToMerge.length < 1) {
1713 return;
1714 }
1715- AttributeColumnsMergeStrategy[] strategies = new DataLaboratoryHelper().getAttributeColumnsMergeStrategies();
1716+ AttributeColumnsMergeStrategy[] strategies = DataLaboratoryHelper.getDefault().getAttributeColumnsMergeStrategies();
1717 ArrayList<AttributeColumnsMergeStrategy> availableStrategiesList = new ArrayList<AttributeColumnsMergeStrategy>();
1718 for (AttributeColumnsMergeStrategy strategy : strategies) {
1719 strategy.setup(table, columnsToMerge);
1720@@ -205,7 +205,7 @@
1721 public void execute() {
1722 int index = availableStrategiesComboBox.getSelectedIndex();
1723 if (index != -1) {
1724- new DataLaboratoryHelper().executeManipulator(availableMergeStrategies[index]);
1725+ DataLaboratoryHelper.getDefault().executeManipulator(availableMergeStrategies[index]);
1726 }
1727 }
1728
1729
1730=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle.properties'
1731--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle.properties 2010-12-28 12:29:32 +0000
1732+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle.properties 2011-02-01 14:23:14 +0000
1733@@ -1,3 +1,1 @@
1734 Cell.Popup.subMenu.text=Cell
1735-SettingsPanel.title={0}
1736-DataLaboratoryHelper.ui.okButton.text=OK
1737\ No newline at end of file
1738
1739=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_es.properties'
1740--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_es.properties 2010-12-30 12:17:31 +0000
1741+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_es.properties 2011-02-01 14:23:14 +0000
1742@@ -6,7 +6,3 @@
1743 !=Project-Id-Version\: gephi\nReport-Msgid-Bugs-To\: FULL NAME <EMAIL@ADDRESS>\nPOT-Creation-Date\: 2010-04-07 13\:16+0200\nPO-Revision-Date\: 2010-12-26 20\:29+0000\nLast-Translator\: Eduardo Ramos <Unknown>\nLanguage-Team\: Spanish <es@li.org>\nMIME-Version\: 1.0\nContent-Type\: text/plain; charset\=UTF-8\nContent-Transfer-Encoding\: 8bit\nX-Launchpad-Export-Date\: 2010-12-27 04\:43+0000\nX-Generator\: Launchpad (build Unknown)\n
1744
1745 Cell.Popup.subMenu.text=Celda
1746-
1747-SettingsPanel.title={0} - Par\u00e1metros
1748-
1749-DataLaboratoryHelper.ui.okButton.text=Ok
1750
1751=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_fr.properties'
1752--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_fr.properties 2010-12-30 12:17:31 +0000
1753+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/Bundle_fr.properties 2011-02-01 14:23:14 +0000
1754@@ -6,7 +6,3 @@
1755 !=Project-Id-Version\: gephi\nReport-Msgid-Bugs-To\: FULL NAME <EMAIL@ADDRESS>\nPOT-Creation-Date\: 2010-04-07 13\:16+0200\nPO-Revision-Date\: 2010-12-25 20\:14+0000\nLast-Translator\: S\u00e9bastien Heymann <Unknown>\nLanguage-Team\: French <fr@li.org>\nMIME-Version\: 1.0\nContent-Type\: text/plain; charset\=UTF-8\nContent-Transfer-Encoding\: 8bit\nX-Launchpad-Export-Date\: 2010-12-26 04\:54+0000\nX-Generator\: Launchpad (build Unknown)\n
1756
1757 Cell.Popup.subMenu.text=Cellule
1758-
1759-SettingsPanel.title={0} - Param\u00e8tres
1760-
1761-DataLaboratoryHelper.ui.okButton.text=Ok
1762
1763=== removed file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/DataLaboratoryHelper.java'
1764--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/DataLaboratoryHelper.java 2010-09-16 21:39:28 +0000
1765+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/DataLaboratoryHelper.java 1970-01-01 00:00:00 +0000
1766@@ -1,350 +0,0 @@
1767-/*
1768-Copyright 2008-2010 Gephi
1769-Authors : Eduardo Ramos <eduramiba@gmail.com>
1770-Website : http://www.gephi.org
1771-
1772-This file is part of Gephi.
1773-
1774-Gephi is free software: you can redistribute it and/or modify
1775-it under the terms of the GNU Affero General Public License as
1776-published by the Free Software Foundation, either version 3 of the
1777-License, or (at your option) any later version.
1778-
1779-Gephi is distributed in the hope that it will be useful,
1780-but WITHOUT ANY WARRANTY; without even the implied warranty of
1781-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1782-GNU Affero General Public License for more details.
1783-
1784-You should have received a copy of the GNU Affero General Public License
1785-along with Gephi. If not, see <http://www.gnu.org/licenses/>.
1786- */
1787-package org.gephi.desktop.datalab.utils;
1788-
1789-import java.awt.Dialog;
1790-import java.awt.event.ActionEvent;
1791-import java.awt.event.ActionListener;
1792-import java.awt.event.WindowAdapter;
1793-import java.awt.event.WindowEvent;
1794-import java.util.ArrayList;
1795-import java.util.Collections;
1796-import java.util.Comparator;
1797-import javax.swing.JButton;
1798-import javax.swing.JComponent;
1799-import javax.swing.JPanel;
1800-import javax.swing.SwingUtilities;
1801-import org.gephi.data.attributes.api.AttributeColumn;
1802-import org.gephi.data.attributes.api.AttributeTable;
1803-import org.gephi.datalab.plugin.manipulators.edges.DeleteEdges;
1804-import org.gephi.datalab.plugin.manipulators.general.SearchReplace;
1805-import org.gephi.datalab.plugin.manipulators.nodes.DeleteNodes;
1806-import org.gephi.datalab.spi.DialogControls;
1807-import org.gephi.datalab.spi.Manipulator;
1808-import org.gephi.datalab.spi.ManipulatorUI;
1809-import org.gephi.datalab.spi.columns.AttributeColumnsManipulator;
1810-import org.gephi.datalab.spi.columns.AttributeColumnsManipulatorUI;
1811-import org.gephi.datalab.spi.columns.merge.AttributeColumnsMergeStrategy;
1812-import org.gephi.datalab.spi.columns.merge.AttributeColumnsMergeStrategyBuilder;
1813-import org.gephi.datalab.spi.values.AttributeValueManipulator;
1814-import org.gephi.datalab.spi.values.AttributeValueManipulatorBuilder;
1815-import org.gephi.datalab.spi.edges.EdgesManipulator;
1816-import org.gephi.datalab.spi.edges.EdgesManipulatorBuilder;
1817-import org.gephi.datalab.spi.general.GeneralActionsManipulator;
1818-import org.gephi.datalab.spi.general.PluginGeneralActionsManipulator;
1819-import org.gephi.datalab.spi.nodes.NodesManipulator;
1820-import org.gephi.datalab.spi.nodes.NodesManipulatorBuilder;
1821-import org.openide.DialogDescriptor;
1822-import org.openide.DialogDisplayer;
1823-import org.openide.util.Lookup;
1824-import org.openide.util.NbBundle;
1825-
1826-/**
1827- * Helper class for simplifying the implementation of Data Laboratory UI.
1828- * @author Eduardo Ramos <eduramiba@gmail.com>
1829- */
1830-public class DataLaboratoryHelper{
1831-
1832- /**
1833- * <p>Prepares an array with one new instance of every NodesManipulator
1834- * that has a builder registered and returns it.</p>
1835- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1836- * @return Array of all NodesManipulator implementations
1837- */
1838- public NodesManipulator[] getNodesManipulators() {
1839- ArrayList<NodesManipulator> nodesManipulators = new ArrayList<NodesManipulator>();
1840- for (NodesManipulatorBuilder nm : Lookup.getDefault().lookupAll(NodesManipulatorBuilder.class)) {
1841- nodesManipulators.add(nm.getNodesManipulator());
1842- }
1843- sortManipulators(nodesManipulators);
1844- return nodesManipulators.toArray(new NodesManipulator[0]);
1845- }
1846-
1847- /**
1848- * <p>Prepares an array with one new instance of every EdgesManipulator
1849- * that has a builder registered and returns it.</p>
1850- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1851- * @return Array of all EdgesManipulator implementations
1852- */
1853- public EdgesManipulator[] getEdgesManipulators() {
1854- ArrayList<EdgesManipulator> edgesManipulators = new ArrayList<EdgesManipulator>();
1855- for (EdgesManipulatorBuilder em : Lookup.getDefault().lookupAll(EdgesManipulatorBuilder.class)) {
1856- edgesManipulators.add(em.getEdgesManipulator());
1857- }
1858- sortManipulators(edgesManipulators);
1859- return edgesManipulators.toArray(new EdgesManipulator[0]);
1860- }
1861-
1862- /**
1863- * <p>Prepares an array with one instance of every GeneralActionsManipulator that is registered.</p>
1864- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1865- * @return Array of all GeneralActionsManipulator implementations
1866- */
1867- public GeneralActionsManipulator[] getGeneralActionsManipulators() {
1868- ArrayList<GeneralActionsManipulator> generalActionsManipulators = new ArrayList<GeneralActionsManipulator>();
1869- generalActionsManipulators.addAll(Lookup.getDefault().lookupAll(GeneralActionsManipulator.class));
1870- sortManipulators(generalActionsManipulators);
1871- return generalActionsManipulators.toArray(new GeneralActionsManipulator[0]);
1872- }
1873-
1874- /**
1875- * <p>Prepares an array with one instance of every PluginGeneralActionsManipulator that is registered.</p>
1876- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1877- * @return Array of all PluginGeneralActionsManipulator implementations
1878- */
1879- public PluginGeneralActionsManipulator[] getPluginGeneralActionsManipulators() {
1880- ArrayList<PluginGeneralActionsManipulator> pluginGeneralActionsManipulators = new ArrayList<PluginGeneralActionsManipulator>();
1881- pluginGeneralActionsManipulators.addAll(Lookup.getDefault().lookupAll(PluginGeneralActionsManipulator.class));
1882- sortManipulators(pluginGeneralActionsManipulators);
1883- return pluginGeneralActionsManipulators.toArray(new PluginGeneralActionsManipulator[0]);
1884- }
1885-
1886- /**
1887- * <p>Prepares an array that has one instance of every AttributeColumnsManipulator implementation
1888- * that has a builder registered and returns it.</p>
1889- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1890- * @return Array of all AttributeColumnsManipulator implementations
1891- */
1892- public AttributeColumnsManipulator[] getAttributeColumnsManipulators() {
1893- ArrayList<AttributeColumnsManipulator> attributeColumnsManipulators = new ArrayList<AttributeColumnsManipulator>();
1894- attributeColumnsManipulators.addAll(Lookup.getDefault().lookupAll(AttributeColumnsManipulator.class));
1895- sortAttributeColumnsManipulators(attributeColumnsManipulators);
1896- return attributeColumnsManipulators.toArray(new AttributeColumnsManipulator[0]);
1897- }
1898-
1899- /**
1900- * <p>Prepares an array with one new instance of every AttributeValueManipulator
1901- * that has a builder registered and returns it.</p>
1902- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1903- * @return Array of all AttributeValueManipulator implementations
1904- */
1905- public AttributeValueManipulator[] getAttributeValueManipulators() {
1906- ArrayList<AttributeValueManipulator> attributeValueManipulators = new ArrayList<AttributeValueManipulator>();
1907- for (AttributeValueManipulatorBuilder am : Lookup.getDefault().lookupAll(AttributeValueManipulatorBuilder.class)) {
1908- attributeValueManipulators.add(am.getAttributeValueManipulator());
1909- }
1910- sortManipulators(attributeValueManipulators);
1911- return attributeValueManipulators.toArray(new AttributeValueManipulator[0]);
1912- }
1913-
1914- /**
1915- * <p>Prepares an array that has one new instance of every AttributeColumnsMergeStrategy implementation that is registered.</p>
1916- * <p>It also returns the manipulators ordered first by type and then by position.</p>
1917- * @return Array of all AttributeColumnsMergeStrategy implementations
1918- */
1919- public AttributeColumnsMergeStrategy[] getAttributeColumnsMergeStrategies() {
1920- ArrayList<AttributeColumnsMergeStrategy> strategies = new ArrayList<AttributeColumnsMergeStrategy>();
1921- for (AttributeColumnsMergeStrategyBuilder cs : Lookup.getDefault().lookupAll(AttributeColumnsMergeStrategyBuilder.class)) {
1922- strategies.add(cs.getAttributeColumnsMergeStrategy());
1923- }
1924- sortManipulators(strategies);
1925- return strategies.toArray(new AttributeColumnsMergeStrategy[0]);
1926- }
1927-
1928- private void sortManipulators(ArrayList<? extends Manipulator> m) {
1929- Collections.sort(m, new Comparator<Manipulator>() {
1930-
1931- public int compare(Manipulator o1, Manipulator o2) {
1932- //Order by type, position.
1933- if (o1.getType() == o2.getType()) {
1934- return o1.getPosition() - o2.getPosition();
1935- } else {
1936- return o1.getType() - o2.getType();
1937- }
1938- }
1939- });
1940- }
1941-
1942- private void sortAttributeColumnsManipulators(ArrayList<? extends AttributeColumnsManipulator> m) {
1943- Collections.sort(m, new Comparator<AttributeColumnsManipulator>() {
1944-
1945- public int compare(AttributeColumnsManipulator o1, AttributeColumnsManipulator o2) {
1946- //Order by type, position.
1947- if (o1.getType() == o2.getType()) {
1948- return o1.getPosition() - o2.getPosition();
1949- } else {
1950- return o1.getType() - o2.getType();
1951- }
1952- }
1953- });
1954- }
1955-
1956- /**
1957- * Prepares the dialog UI of a manipulator if it has one and executes the manipulator in a separate
1958- * Thread when the dialog is accepted or directly if there is no UI.
1959- * @param m Manipulator to execute
1960- */
1961- public void executeManipulator(final Manipulator m) {
1962- if (m.canExecute()) {
1963- SwingUtilities.invokeLater(new Runnable() {
1964-
1965- public void run() {
1966-
1967- final ManipulatorUI ui = m.getUI();
1968- //Show a dialog for the manipulator UI if it provides one. If not, execute the manipulator directly:
1969- if (ui != null) {
1970- final JButton okButton = new JButton(NbBundle.getMessage(DataLaboratoryHelper.class, "DataLaboratoryHelper.ui.okButton.text"));
1971- DialogControls dialogControls = new DialogControlsImpl(okButton);
1972- ui.setup(m, dialogControls);
1973- JPanel settingsPanel = ui.getSettingsPanel();
1974- DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(DataLaboratoryHelper.class, "SettingsPanel.title", ui.getDisplayName()), ui.isModal(), new ActionListener() {
1975-
1976- public void actionPerformed(ActionEvent e) {
1977- if (e.getSource().equals(okButton)) {
1978- ui.unSetup();
1979- executeManipulatorInOtherThread(m);
1980- } else {
1981- ui.unSetup();
1982- }
1983- }
1984- });
1985- dd.setOptions(new Object[]{okButton, DialogDescriptor.CANCEL_OPTION});
1986- dd.setClosingOptions(null);//All options close
1987- Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
1988- dialog.addWindowListener(new WindowAdapter() {
1989-
1990- @Override
1991- public void windowClosing(WindowEvent e) {
1992- ui.unSetup();
1993- }
1994- });
1995- dialog.setVisible(true);
1996- } else {
1997- executeManipulatorInOtherThread(m);
1998- }
1999- }
2000- });
2001- }
2002- }
2003-
2004- private void executeManipulatorInOtherThread(final Manipulator m) {
2005- new Thread() {
2006-
2007- @Override
2008- public void run() {
2009- m.execute();
2010- }
2011- }.start();
2012- }
2013-
2014- /**
2015- * Prepares the dialog UI of a AttributeColumnsManipulator if it has one and executes the manipulator in a separate
2016- * Thread when the dialog is accepted or directly if there is no UI.
2017- * @param m AttributeColumnsManipulator
2018- * @param table Table of the column
2019- * @param column Column to manipulate
2020- */
2021- public void executeAttributeColumnsManipulator(final AttributeColumnsManipulator m, final AttributeTable table, final AttributeColumn column) {
2022- if (m.canManipulateColumn(table, column)) {
2023- SwingUtilities.invokeLater(new Runnable() {
2024-
2025- public void run() {
2026- final AttributeColumnsManipulatorUI ui = m.getUI(table, column);
2027- //Show a dialog for the manipulator UI if it provides one. If not, execute the manipulator directly:
2028- if (ui != null) {
2029- final JButton okButton = new JButton(NbBundle.getMessage(DataLaboratoryHelper.class, "DataLaboratoryHelper.ui.okButton.text"));
2030- DialogControls dialogControls = new DialogControlsImpl(okButton);
2031- ui.setup(m, table, column, dialogControls);
2032- JPanel settingsPanel = ui.getSettingsPanel();
2033- DialogDescriptor dd = new DialogDescriptor(settingsPanel, NbBundle.getMessage(DataLaboratoryHelper.class, "SettingsPanel.title", ui.getDisplayName()), ui.isModal(), new ActionListener() {
2034-
2035- public void actionPerformed(ActionEvent e) {
2036- if (e.getSource().equals(okButton)) {
2037- ui.unSetup();
2038- executeAttributeColumnsManipulatorInOtherThread(m, table, column);
2039- } else {
2040- ui.unSetup();
2041- }
2042- }
2043- });
2044- dd.setOptions(new Object[]{okButton, DialogDescriptor.CANCEL_OPTION});
2045- dd.setClosingOptions(null);//All options close
2046- Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
2047- dialog.addWindowListener(new WindowAdapter() {
2048-
2049- @Override
2050- public void windowClosing(WindowEvent e) {
2051- ui.unSetup();
2052- }
2053- });
2054- dialog.setVisible(true);
2055- } else {
2056- executeAttributeColumnsManipulatorInOtherThread(m, table, column);
2057- }
2058- }
2059- });
2060- }
2061- }
2062-
2063- private void executeAttributeColumnsManipulatorInOtherThread(final AttributeColumnsManipulator m, final AttributeTable table, final AttributeColumn column) {
2064- new Thread() {
2065-
2066- @Override
2067- public void run() {
2068- m.execute(table, column);
2069- }
2070- }.start();
2071- }
2072-
2073- /**
2074- * Special method for making public DeleteNodes manipulator so it can be specifically retrieved from Data Table UI.
2075- * It is used for reacting to delete key.
2076- * @return DeleteNodes new instance
2077- */
2078- public NodesManipulator getDeleteNodesManipulator() {
2079- return new DeleteNodes();
2080- }
2081-
2082- /**
2083- * Special method for making public DeleteEdges manipulator so it can be specifically retrieved from Data Table UI.
2084- * It is used for reacting to delete key.
2085- * @return DeleteEdges new instance
2086- */
2087- public EdgesManipulator getDeleEdgesManipulator() {
2088- return new DeleteEdges();
2089- }
2090-
2091- /**
2092- * Special method for making public SearchReplace manipulator so it can be specifically retrieved from Data Table UI.
2093- * It is used for reacting to Ctrl+F keys combination.
2094- * @return SearchReplace new instance
2095- */
2096- public GeneralActionsManipulator getSearchReplaceManipulator() {
2097- return new SearchReplace();
2098- }
2099-
2100- class DialogControlsImpl implements DialogControls {
2101-
2102- JComponent okButton;
2103-
2104- public DialogControlsImpl(JComponent okButton) {
2105- this.okButton = okButton;
2106- }
2107-
2108- public void setOkButtonEnabled(boolean enabled) {
2109- okButton.setEnabled(enabled);
2110- }
2111-
2112- public boolean isOkButtonEnabled(){
2113- return okButton.isEnabled();
2114- }
2115- }
2116-}
2117
2118=== modified file 'DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/PopupMenuUtils.java'
2119--- DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/PopupMenuUtils.java 2010-09-07 12:43:59 +0000
2120+++ DesktopDataLaboratory/src/org/gephi/desktop/datalab/utils/PopupMenuUtils.java 2011-02-01 14:23:14 +0000
2121@@ -26,6 +26,7 @@
2122 import javax.swing.JMenuItem;
2123 import org.gephi.data.attributes.api.AttributeColumn;
2124 import org.gephi.data.attributes.api.AttributeRow;
2125+import org.gephi.datalab.api.DataLaboratoryHelper;
2126 import org.gephi.datalab.spi.Manipulator;
2127 import org.gephi.datalab.spi.values.AttributeValueManipulator;
2128 import org.openide.util.ImageUtilities;
2129@@ -48,7 +49,7 @@
2130 menuItem.addActionListener(new ActionListener() {
2131
2132 public void actionPerformed(ActionEvent e) {
2133- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
2134+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
2135 dlh.executeManipulator(nm);
2136 }
2137 });
2138@@ -59,7 +60,7 @@
2139 }
2140
2141 public static JMenu createSubMenuFromRowColumn(AttributeRow row, AttributeColumn column) {
2142- DataLaboratoryHelper dlh = new DataLaboratoryHelper();
2143+ DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
2144 JMenu subMenu = new JMenu(NbBundle.getMessage(PopupMenuUtils.class, "Cell.Popup.subMenu.text"));
2145 subMenu.setIcon(ImageUtilities.loadImageIcon("org/gephi/desktop/datalab/resources/table-select.png", true));
2146
2147
2148=== modified file 'VisualizationAPI/nbproject/genfiles.properties'
2149--- VisualizationAPI/nbproject/genfiles.properties 2010-10-07 08:53:53 +0000
2150+++ VisualizationAPI/nbproject/genfiles.properties 2011-02-01 14:23:14 +0000
2151@@ -1,8 +1,8 @@
2152-build.xml.data.CRC32=006815d5
2153+build.xml.data.CRC32=aa440a30
2154 build.xml.script.CRC32=84b64b02
2155 build.xml.stylesheet.CRC32=a56c6a5b@1.42.2
2156 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
2157 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
2158-nbproject/build-impl.xml.data.CRC32=006815d5
2159+nbproject/build-impl.xml.data.CRC32=aa440a30
2160 nbproject/build-impl.xml.script.CRC32=1628a581
2161 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2
2162
2163=== modified file 'VisualizationAPI/nbproject/project.xml'
2164--- VisualizationAPI/nbproject/project.xml 2010-10-07 08:53:53 +0000
2165+++ VisualizationAPI/nbproject/project.xml 2011-02-01 14:23:14 +0000
2166@@ -26,6 +26,7 @@
2167 <public-packages>
2168 <package>org.gephi.visualization.api</package>
2169 <package>org.gephi.visualization.impl</package>
2170+ <package>org.gephi.visualization.spi</package>
2171 </public-packages>
2172 </data>
2173 </configuration>
2174
2175=== added directory 'VisualizationAPI/src/org/gephi/visualization/spi'
2176=== added file 'VisualizationAPI/src/org/gephi/visualization/spi/GraphContextMenuItem.java'
2177--- VisualizationAPI/src/org/gephi/visualization/spi/GraphContextMenuItem.java 1970-01-01 00:00:00 +0000
2178+++ VisualizationAPI/src/org/gephi/visualization/spi/GraphContextMenuItem.java 2011-02-01 14:23:14 +0000
2179@@ -0,0 +1,125 @@
2180+
2181+/*
2182+Copyright 2008-2010 Gephi
2183+Authors : Eduardo Ramos <eduramiba@gmail.com>
2184+Website : http://www.gephi.org
2185+
2186+This file is part of Gephi.
2187+
2188+Gephi is free software: you can redistribute it and/or modify
2189+it under the terms of the GNU Affero General Public License as
2190+published by the Free Software Foundation, either version 3 of the
2191+License, or (at your option) any later version.
2192+
2193+Gephi is distributed in the hope that it will be useful,
2194+but WITHOUT ANY WARRANTY; without even the implied warranty of
2195+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2196+GNU Affero General Public License for more details.
2197+
2198+You should have received a copy of the GNU Affero General Public License
2199+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
2200+ */
2201+package org.gephi.visualization.spi;
2202+
2203+import javax.swing.Icon;
2204+import org.gephi.graph.api.HierarchicalGraph;
2205+import org.gephi.graph.api.Node;
2206+
2207+/**
2208+ * <p>Interface from providing graph context menu items as services.</p>
2209+ * <p>All context menu items are able to:</p>
2210+ * <ul>
2211+ * <li>Execute an action</li>
2212+ * <li>Provide a name, type and order of appearance (position in group of its type)</li>
2213+ * <li>Indicate wether they have to be available (appear in the context menu) or not</li>
2214+ * <li>Indicate wether they have to be executable (enabled in the context menu) or not</li>
2215+ * <li>Provide and icon or not</li>
2216+ * </ul>
2217+ * <p>Used for different manipulators such as NodesManipulator, EdgesManipulator and GeneralActionsManipulator.</p>
2218+ * <p>The only methods that are called before setting up an item with the data are <b>getSubItems, getType and getPosition.</b>
2219+ * This way, the other methods behaviour can depend on the data that has been setup before</p>
2220+ * <p><b>getSubItems will be called before and after setup. Take care when the nodes are null!</b></p>
2221+ *
2222+ * To provide a context menu item, a class has to implement this interface and have a <code>@ServiceProvider</code> annotation
2223+ * @author Eduardo Ramos <eduramiba@gmail.com>
2224+ */
2225+public interface GraphContextMenuItem {
2226+
2227+ /**
2228+ * Prepare nodes for this item. Note that nodes could contain 0 nodes.
2229+ * @param graph Hierarchical graph
2230+ * @param nodes All selected nodes
2231+ */
2232+ void setup(HierarchicalGraph graph, Node[] nodes);
2233+
2234+ /**
2235+ * Execute this item.
2236+ * It will operate with data like nodes and edges previously setup for the type of manipulator.
2237+ */
2238+ void execute();
2239+
2240+ /**
2241+ * <p>This is optional. Return sub items for this menu item if desired.</p>
2242+ * <p>If this item should contain more items, return a new instance of each sub item.
2243+ * If not return null and implement execute for this item.</p>
2244+ * <p>In order to declare mnemonic keys for subitem(s), the implementation of this item
2245+ * must return the subitem(s) with the mnemonic even when it has not been setup with any node.
2246+ * If you don't need a mnemonic, return null if the item is not setup.</p>
2247+ * @return
2248+ */
2249+ GraphContextMenuItem[] getSubItems();
2250+
2251+ /**
2252+ * <p>Return name to show for this item in the context menu.</p>
2253+ * <p>Implementations can provide different names depending on the data this
2254+ * item has (for example depending on the number of nodes).</p>
2255+ * @return Name to show at current time and conditions
2256+ */
2257+ String getName();
2258+
2259+ /**
2260+ * Description of the context menu item, to show as tooltip.
2261+ * @return Description or null
2262+ */
2263+ String getDescription();
2264+
2265+ /**
2266+ * Indicates if this item has to appear in the context menu at all
2267+ * @return True to show, false otherwise
2268+ */
2269+ boolean isAvailable();
2270+
2271+ /**
2272+ * Indicates if this item can be executed when it is available.
2273+ * Implementations should evaluate the current data and conditions.
2274+ * @return True if it has to be executable, false otherwise
2275+ */
2276+ boolean canExecute();
2277+
2278+ /**
2279+ * Type of item. This is used for separating the items
2280+ * in groups when shown, using popup separators. First types to show will be the lesser.
2281+ * @return Type of this manipulator
2282+ */
2283+ int getType();
2284+
2285+ /**
2286+ * Returns a position value that indicates the position
2287+ * of this Manipulator in its type group. Less means upper.
2288+ * @return This Manipulator position
2289+ */
2290+ int getPosition();
2291+
2292+ /**
2293+ * Optional. Allows to declare a mnemonic key for this item in the menu.
2294+ * There should not be 2 items with the same mnemonic at the same time.
2295+ * @return Integer from <code>KeyEvent</code> values or null
2296+ */
2297+ Integer getMnemonicKey();
2298+
2299+ /**
2300+ * Returns an icon for this item if necessary.
2301+ * @return Icon or null
2302+ */
2303+ Icon getIcon();
2304+}
2305
2306=== modified file 'VisualizationModule/nbproject/genfiles.properties'
2307--- VisualizationModule/nbproject/genfiles.properties 2010-09-16 21:37:51 +0000
2308+++ VisualizationModule/nbproject/genfiles.properties 2011-02-01 14:23:14 +0000
2309@@ -1,8 +1,8 @@
2310-build.xml.data.CRC32=4d1f53aa
2311+build.xml.data.CRC32=4ad970b7
2312 build.xml.script.CRC32=587055f0
2313 build.xml.stylesheet.CRC32=a56c6a5b@1.42.2
2314 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
2315 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
2316-nbproject/build-impl.xml.data.CRC32=4d1f53aa
2317+nbproject/build-impl.xml.data.CRC32=4ad970b7
2318 nbproject/build-impl.xml.script.CRC32=413ca750
2319 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2
2320
2321=== modified file 'VisualizationModule/nbproject/project.xml'
2322--- VisualizationModule/nbproject/project.xml 2010-09-16 21:37:51 +0000
2323+++ VisualizationModule/nbproject/project.xml 2011-02-01 14:23:14 +0000
2324@@ -15,6 +15,14 @@
2325 </run-dependency>
2326 </dependency>
2327 <dependency>
2328+ <code-name-base>org.gephi.datalab.api</code-name-base>
2329+ <build-prerequisite/>
2330+ <compile-dependency/>
2331+ <run-dependency>
2332+ <specification-version>0.7.1.4</specification-version>
2333+ </run-dependency>
2334+ </dependency>
2335+ <dependency>
2336 <code-name-base>org.gephi.desktop.project</code-name-base>
2337 <build-prerequisite/>
2338 <compile-dependency/>
2339
2340=== added file 'VisualizationModule/src/org/gephi/visualization/api/resources/delete.png'
2341Binary files VisualizationModule/src/org/gephi/visualization/api/resources/delete.png 1970-01-01 00:00:00 +0000 and VisualizationModule/src/org/gephi/visualization/api/resources/delete.png 2011-02-01 14:23:14 +0000 differ
2342=== added file 'VisualizationModule/src/org/gephi/visualization/api/resources/free.png'
2343Binary files VisualizationModule/src/org/gephi/visualization/api/resources/free.png 1970-01-01 00:00:00 +0000 and VisualizationModule/src/org/gephi/visualization/api/resources/free.png 2011-02-01 14:23:14 +0000 differ
2344=== added file 'VisualizationModule/src/org/gephi/visualization/api/resources/globe-network.png'
2345Binary files VisualizationModule/src/org/gephi/visualization/api/resources/globe-network.png 1970-01-01 00:00:00 +0000 and VisualizationModule/src/org/gephi/visualization/api/resources/globe-network.png 2011-02-01 14:23:14 +0000 differ
2346=== added file 'VisualizationModule/src/org/gephi/visualization/api/resources/table-select.png'
2347Binary files VisualizationModule/src/org/gephi/visualization/api/resources/table-select.png 1970-01-01 00:00:00 +0000 and VisualizationModule/src/org/gephi/visualization/api/resources/table-select.png 2011-02-01 14:23:14 +0000 differ
2348=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle.properties'
2349--- VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle.properties 2010-09-16 21:37:51 +0000
2350+++ VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle.properties 1970-01-01 00:00:00 +0000
2351@@ -1,14 +0,0 @@
2352-GraphContextMenu_Group = Group
2353-GraphContextMenu_Ungroup = Ungroup
2354-GraphContextMenu_Expand = Expand
2355-GraphContextMenu_Contract = Contract
2356-GraphContextMenu_Settle = Settle
2357-GraphContextMenu_Free = Free
2358-GraphContextMenu_Delete = Delete
2359-GraphContextMenu_MoveToWorkspace = Move to...
2360-GraphContextMenu_MoveToWorkspace_NewWorkspace = New workspace
2361-GraphContextMenu_CopyToWorkspace = Copy to...
2362-GraphContextMenu_CopyToWorkspace_NewWorkspace = New workspace
2363-
2364-GraphContextMenu.Delete.message = Nodes will be deleted, do you want to proceed?
2365-GraphContextMenu.Delete.message.title = Delete nodes
2366\ No newline at end of file
2367
2368=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_es.properties'
2369--- VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_es.properties 2010-12-30 12:17:31 +0000
2370+++ VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_es.properties 1970-01-01 00:00:00 +0000
2371@@ -1,32 +0,0 @@
2372-# Spanish translation for gephi
2373-# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
2374-# This file is distributed under the same license as the gephi package.
2375-# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
2376-#
2377-!=Project-Id-Version\: gephi\nReport-Msgid-Bugs-To\: FULL NAME <EMAIL@ADDRESS>\nPOT-Creation-Date\: 2010-04-07 13\:16+0200\nPO-Revision-Date\: 2010-12-26 00\:11+0000\nLast-Translator\: Eduardo Ramos <Unknown>\nLanguage-Team\: Spanish <es@li.org>\nMIME-Version\: 1.0\nContent-Type\: text/plain; charset\=UTF-8\nContent-Transfer-Encoding\: 8bit\nX-Launchpad-Export-Date\: 2010-12-27 04\:43+0000\nX-Generator\: Launchpad (build Unknown)\n
2378-
2379-GraphContextMenu_Group=Agrupar
2380-
2381-GraphContextMenu_Ungroup=Desagrupar
2382-
2383-GraphContextMenu_Expand=Expandir
2384-
2385-GraphContextMenu_Contract=Contraer
2386-
2387-GraphContextMenu_Settle=Bloquear
2388-
2389-GraphContextMenu_Free=Desbloquear
2390-
2391-GraphContextMenu_Delete=Eliminar
2392-
2393-GraphContextMenu_MoveToWorkspace=Mover a...
2394-
2395-GraphContextMenu_MoveToWorkspace_NewWorkspace=Nuevo espacio de trabajo
2396-
2397-GraphContextMenu_CopyToWorkspace=Copiar a...
2398-
2399-GraphContextMenu_CopyToWorkspace_NewWorkspace=Nuevo espacio de trabajo
2400-
2401-GraphContextMenu.Delete.message=Los nodos ser\u00e1n eliminados, \u00bfContinuar?
2402-
2403-GraphContextMenu.Delete.message.title=Eliminar nodos
2404
2405=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_fr.properties'
2406--- VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_fr.properties 2010-12-30 12:17:31 +0000
2407+++ VisualizationModule/src/org/gephi/visualization/apiimpl/Bundle_fr.properties 1970-01-01 00:00:00 +0000
2408@@ -1,32 +0,0 @@
2409-# French translation for gephi
2410-# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
2411-# This file is distributed under the same license as the gephi package.
2412-# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
2413-#
2414-!=Project-Id-Version\: gephi\nReport-Msgid-Bugs-To\: FULL NAME <EMAIL@ADDRESS>\nPOT-Creation-Date\: 2010-04-07 13\:16+0200\nPO-Revision-Date\: 2010-12-25 19\:49+0000\nLast-Translator\: S\u00e9bastien Heymann <Unknown>\nLanguage-Team\: French <fr@li.org>\nMIME-Version\: 1.0\nContent-Type\: text/plain; charset\=UTF-8\nContent-Transfer-Encoding\: 8bit\nX-Launchpad-Export-Date\: 2010-12-26 04\:53+0000\nX-Generator\: Launchpad (build Unknown)\n
2415-
2416-GraphContextMenu_Group=Grouper
2417-
2418-GraphContextMenu_Ungroup=D\u00e9grouper
2419-
2420-GraphContextMenu_Expand=\u00c9tendre
2421-
2422-GraphContextMenu_Contract=Contracter
2423-
2424-GraphContextMenu_Settle=Fixer
2425-
2426-GraphContextMenu_Free=Lib\u00e9rer
2427-
2428-GraphContextMenu_Delete=Supprimer
2429-
2430-GraphContextMenu_MoveToWorkspace=D\u00e9placer vers...
2431-
2432-GraphContextMenu_MoveToWorkspace_NewWorkspace=Nouvel espace de travail
2433-
2434-GraphContextMenu_CopyToWorkspace=Copier vers...
2435-
2436-GraphContextMenu_CopyToWorkspace_NewWorkspace=Nouvel espace de travail
2437-
2438-GraphContextMenu.Delete.message=Les noeuds seront supprim\u00e9s. Voulez-vous continuer ?
2439-
2440-GraphContextMenu.Delete.message.title=Suppression des noeuds
2441
2442=== modified file 'VisualizationModule/src/org/gephi/visualization/apiimpl/GraphContextMenu.java'
2443--- VisualizationModule/src/org/gephi/visualization/apiimpl/GraphContextMenu.java 2010-09-16 21:37:51 +0000
2444+++ VisualizationModule/src/org/gephi/visualization/apiimpl/GraphContextMenu.java 2011-02-01 14:23:14 +0000
2445@@ -22,22 +22,20 @@
2446
2447 import java.awt.event.ActionEvent;
2448 import java.awt.event.ActionListener;
2449-import javax.swing.AbstractAction;
2450-import javax.swing.Action;
2451+import java.awt.event.KeyEvent;
2452+import java.util.ArrayList;
2453+import java.util.Collections;
2454+import java.util.Comparator;
2455 import javax.swing.JMenu;
2456 import javax.swing.JMenuItem;
2457 import javax.swing.JPopupMenu;
2458-import org.gephi.project.api.ProjectController;
2459-import org.gephi.project.api.Workspace;
2460-import org.gephi.project.api.WorkspaceInformation;
2461-import org.gephi.project.api.WorkspaceProvider;
2462+import javax.swing.KeyStroke;
2463+import org.gephi.graph.api.HierarchicalGraph;
2464+import org.gephi.graph.api.Node;
2465 import org.gephi.visualization.VizController;
2466 import org.gephi.visualization.bridge.DHNSEventBridge;
2467-import org.openide.DialogDisplayer;
2468-import org.openide.NotifyDescriptor;
2469-import org.openide.util.ImageUtilities;
2470+import org.gephi.visualization.spi.GraphContextMenuItem;
2471 import org.openide.util.Lookup;
2472-import org.openide.util.NbBundle;
2473
2474 /**
2475 *
2476@@ -54,173 +52,111 @@
2477 }
2478
2479 public JPopupMenu getMenu() {
2480- //Group
2481- GraphContextMenuAction groupAction = new GraphContextMenuImpl("GraphContextMenu_Group", "org/gephi/visualization/api/resources/group.png") {
2482-
2483- @Override
2484- public void actionPerformed(ActionEvent e) {
2485- eventBridge.group();
2486- }
2487- };
2488- groupAction.setEnabled(eventBridge.canGroup());
2489-
2490- //Ungroup
2491- GraphContextMenuAction ungroupAction = new GraphContextMenuImpl("GraphContextMenu_Ungroup", "org/gephi/visualization/api/resources/ungroup.png") {
2492-
2493- @Override
2494- public void actionPerformed(ActionEvent e) {
2495- eventBridge.ungroup();
2496- }
2497- };
2498- ungroupAction.setEnabled(eventBridge.canUngroup());
2499-
2500- //Expand
2501- GraphContextMenuAction expandAction = new GraphContextMenuImpl("GraphContextMenu_Expand", "org/gephi/visualization/api/resources/expand.png") {
2502-
2503- @Override
2504- public void actionPerformed(ActionEvent e) {
2505- eventBridge.expand();
2506- }
2507- };
2508- expandAction.setEnabled(eventBridge.canExpand());
2509-
2510- //Contract
2511- GraphContextMenuAction contractAction = new GraphContextMenuImpl("GraphContextMenu_Contract", "org/gephi/visualization/api/resources/contract.png") {
2512-
2513- @Override
2514- public void actionPerformed(ActionEvent e) {
2515- eventBridge.contract();
2516- }
2517- };
2518- contractAction.setEnabled(eventBridge.canContract());
2519-
2520- //Settle
2521- GraphContextMenuAction settleAction = new GraphContextMenuImpl("GraphContextMenu_Settle", "org/gephi/visualization/api/resources/settle.png") {
2522-
2523- @Override
2524- public void actionPerformed(ActionEvent e) {
2525- eventBridge.settle();
2526- }
2527- };
2528- settleAction.setEnabled(eventBridge.canSettle());
2529-
2530- //Free
2531- GraphContextMenuAction freeAction = new GraphContextMenuImpl("GraphContextMenu_Free") {
2532-
2533- @Override
2534- public void actionPerformed(ActionEvent e) {
2535- eventBridge.free();
2536- }
2537- };
2538- freeAction.setEnabled(eventBridge.canFree());
2539-
2540- //Free
2541- GraphContextMenuAction deleteAction = new GraphContextMenuImpl("GraphContextMenu_Delete") {
2542-
2543- @Override
2544- public void actionPerformed(ActionEvent e) {
2545- NotifyDescriptor.Confirmation notifyDescriptor = new NotifyDescriptor.Confirmation(
2546- NbBundle.getMessage(GraphContextMenu.class, "GraphContextMenu.Delete.message"),
2547- NbBundle.getMessage(GraphContextMenu.class, "GraphContextMenu.Delete.message.title"), NotifyDescriptor.YES_NO_OPTION);
2548- if (DialogDisplayer.getDefault().notify(notifyDescriptor).equals(NotifyDescriptor.YES_OPTION)) {
2549- eventBridge.delete();
2550- }
2551- }
2552- };
2553- deleteAction.setEnabled(eventBridge.canDelete());
2554-
2555- //Move workspace
2556- JMenu moveToWorkspaceMenu = new JMenu(NbBundle.getMessage(GraphContextMenu.class, "GraphContextMenu_MoveToWorkspace"));
2557- boolean moveOrCopyEnabled = eventBridge.canMoveOrCopyWorkspace();
2558- if (moveOrCopyEnabled) {
2559- moveToWorkspaceMenu.add(new GraphContextMenuImpl("GraphContextMenu_MoveToWorkspace_NewWorkspace", "org/gephi/visualization/api/resources/new-wokspace.png") {
2560-
2561- @Override
2562- public void actionPerformed(ActionEvent e) {
2563- eventBridge.moveToNewWorkspace();
2564- }
2565- });
2566- moveToWorkspaceMenu.addSeparator();
2567- ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
2568- for (final Workspace w : projectController.getCurrentProject().getLookup().lookup(WorkspaceProvider.class).getWorkspaces()) {
2569- JMenuItem item = new JMenuItem(w.getLookup().lookup(WorkspaceInformation.class).getName());
2570- item.addActionListener(new ActionListener() {
2571-
2572- public void actionPerformed(ActionEvent e) {
2573- eventBridge.moveToWorkspace(w);
2574- }
2575- });
2576- moveToWorkspaceMenu.add(item);
2577- item.setEnabled(w != projectController.getCurrentWorkspace());
2578- }
2579- }
2580- moveToWorkspaceMenu.setEnabled(moveOrCopyEnabled);
2581-
2582- //Copy workspace
2583- JMenu copyToWorkspaceMenu = new JMenu(NbBundle.getMessage(GraphContextMenu.class, "GraphContextMenu_CopyToWorkspace"));
2584- if (moveOrCopyEnabled) {
2585- copyToWorkspaceMenu.add(new GraphContextMenuImpl("GraphContextMenu_CopyToWorkspace_NewWorkspace", "org/gephi/visualization/api/resources/new-wokspace.png") {
2586-
2587- @Override
2588- public void actionPerformed(ActionEvent e) {
2589- eventBridge.copyToNewWorkspace();
2590- }
2591- });
2592- copyToWorkspaceMenu.addSeparator();
2593- ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
2594- for (final Workspace w : projectController.getCurrentProject().getLookup().lookup(WorkspaceProvider.class).getWorkspaces()) {
2595- JMenuItem item = new JMenuItem(w.getLookup().lookup(WorkspaceInformation.class).getName());
2596- item.addActionListener(new ActionListener() {
2597-
2598- public void actionPerformed(ActionEvent e) {
2599- eventBridge.copyToWorkspace(w);
2600- }
2601- });
2602- copyToWorkspaceMenu.add(item);
2603- item.setEnabled(w != projectController.getCurrentWorkspace());
2604- }
2605- }
2606- copyToWorkspaceMenu.setEnabled(moveOrCopyEnabled);
2607-
2608- //Popup
2609- JPopupMenu popupMenu = new JPopupMenu();
2610- popupMenu.add(groupAction);
2611- popupMenu.add(ungroupAction);
2612- popupMenu.addSeparator();
2613- popupMenu.add(expandAction);
2614- popupMenu.add(contractAction);
2615- popupMenu.addSeparator();
2616- popupMenu.add(deleteAction);
2617- popupMenu.add(moveToWorkspaceMenu);
2618- popupMenu.add(copyToWorkspaceMenu);
2619- popupMenu.addSeparator();
2620- popupMenu.add(settleAction);
2621- popupMenu.add(freeAction);
2622- return popupMenu;
2623- }
2624-
2625- public static interface GraphContextMenuAction extends Action {
2626-
2627- public boolean isVisible();
2628- }
2629-
2630- private static class GraphContextMenuImpl extends AbstractAction implements GraphContextMenuAction {
2631-
2632- public GraphContextMenuImpl(String key) {
2633- putValue(Action.NAME, NbBundle.getMessage(GraphContextMenu.class, key));
2634- }
2635-
2636- public GraphContextMenuImpl(String key, String icon) {
2637- putValue(Action.NAME, NbBundle.getMessage(GraphContextMenu.class, key));
2638- putValue(Action.SMALL_ICON, ImageUtilities.loadImageIcon(icon, false));
2639- }
2640-
2641- public void actionPerformed(ActionEvent e) {
2642- throw new UnsupportedOperationException("Not supported yet.");
2643- }
2644-
2645- public boolean isVisible() {
2646- return true;
2647- }
2648+ GraphContextMenuItem[] items = getGraphContextMenuItems();
2649+ final Node[] selectedNodes = eventBridge.getSelectedNodes();
2650+ final HierarchicalGraph graph = eventBridge.getGraph();
2651+ JPopupMenu contextMenu = new JPopupMenu();
2652+
2653+ //Add items ordered:
2654+ Integer lastItemType = null;
2655+ for (GraphContextMenuItem item : items) {
2656+ item.setup(graph, selectedNodes);
2657+ if (lastItemType == null) {
2658+ lastItemType = item.getType();
2659+ }
2660+ if (lastItemType != item.getType()) {
2661+ contextMenu.addSeparator();
2662+ }
2663+ lastItemType = item.getType();
2664+ if (item.isAvailable()) {
2665+ contextMenu.add(createMenuItemFromGraphContextMenuItem(item, graph, selectedNodes));
2666+ }
2667+ }
2668+
2669+ return contextMenu;
2670+ }
2671+
2672+ /**
2673+ * <p>Prepares an array with one new instance of every GraphContextMenuItem and returns it.</p>
2674+ * <p>It also returns the items ordered first by type and then by position.</p>
2675+ * @return Array of all GraphContextMenuItem implementations
2676+ */
2677+ public GraphContextMenuItem[] getGraphContextMenuItems() {
2678+ ArrayList<GraphContextMenuItem> items = new ArrayList<GraphContextMenuItem>();
2679+ items.addAll(Lookup.getDefault().lookupAll(GraphContextMenuItem.class));
2680+ sortItems(items);
2681+ return items.toArray(new GraphContextMenuItem[0]);
2682+ }
2683+
2684+ public JMenuItem createMenuItemFromGraphContextMenuItem(final GraphContextMenuItem item, final HierarchicalGraph graph, final Node[] nodes) {
2685+ GraphContextMenuItem[] subItems = item.getSubItems();
2686+ if (subItems != null && item.canExecute()) {
2687+ JMenu subMenu = new JMenu();
2688+ subMenu.setText(item.getName());
2689+ if (item.getDescription() != null && !item.getDescription().isEmpty()) {
2690+ subMenu.setToolTipText(item.getDescription());
2691+ }
2692+ subMenu.setIcon(item.getIcon());
2693+ Integer lastItemType = null;
2694+ for (GraphContextMenuItem subItem : subItems) {
2695+ subItem.setup(graph, nodes);
2696+ if (lastItemType == null) {
2697+ lastItemType = subItem.getType();
2698+ }
2699+ if (lastItemType != subItem.getType()) {
2700+ subMenu.addSeparator();
2701+ }
2702+ lastItemType = subItem.getType();
2703+ if (subItem.isAvailable()) {
2704+ subMenu.add(createMenuItemFromGraphContextMenuItem(subItem, graph, nodes));
2705+ }
2706+ }
2707+ if(item.getMnemonicKey()!=null){
2708+ subMenu.setMnemonic(item.getMnemonicKey());//Mnemonic for opening a sub menu
2709+ }
2710+ return subMenu;
2711+ } else {
2712+ JMenuItem menuItem = new JMenuItem();
2713+ menuItem.setText(item.getName());
2714+ if (item.getDescription() != null && !item.getDescription().isEmpty()) {
2715+ menuItem.setToolTipText(item.getDescription());
2716+ }
2717+ menuItem.setIcon(item.getIcon());
2718+ if (item.canExecute()) {
2719+ menuItem.addActionListener(new ActionListener() {
2720+
2721+ public void actionPerformed(ActionEvent e) {
2722+ new Thread() {
2723+
2724+ @Override
2725+ public void run() {
2726+ item.execute();
2727+ }
2728+ }.start();
2729+ }
2730+ });
2731+ } else {
2732+ menuItem.setEnabled(false);
2733+ }
2734+ if(item.getMnemonicKey()!=null){
2735+ menuItem.setMnemonic(item.getMnemonicKey());//Mnemonic for executing the action
2736+ menuItem.setAccelerator(KeyStroke.getKeyStroke(item.getMnemonicKey(),KeyEvent.CTRL_DOWN_MASK));//And the same key mnemonic + ctrl for executing the action (and as a help display for the user!).
2737+ }
2738+ return menuItem;
2739+ }
2740+ }
2741+
2742+ private void sortItems(ArrayList<? extends GraphContextMenuItem> m) {
2743+ Collections.sort(m, new Comparator<GraphContextMenuItem>() {
2744+
2745+ public int compare(GraphContextMenuItem o1, GraphContextMenuItem o2) {
2746+ //Order by type, position.
2747+ if (o1.getType() == o2.getType()) {
2748+ return o1.getPosition() - o2.getPosition();
2749+ } else {
2750+ return o1.getType() - o2.getType();
2751+ }
2752+ }
2753+ });
2754 }
2755 }
2756
2757=== added directory 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems'
2758=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle.properties'
2759--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle.properties 1970-01-01 00:00:00 +0000
2760+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle.properties 2011-02-01 14:23:14 +0000
2761@@ -0,0 +1,21 @@
2762+GraphContextMenu_Group = Group
2763+GraphContextMenu_Ungroup = Ungroup
2764+GraphContextMenu_Expand = Expand
2765+GraphContextMenu_Contract = Contract
2766+GraphContextMenu_Settle = Settle
2767+GraphContextMenu_Free = Free
2768+GraphContextMenu_TagNodes = Tag nodes...
2769+GraphContextMenu_Delete = Delete
2770+GraphContextMenu_MoveToWorkspace = Move to...
2771+GraphContextMenu_MoveToWorkspace_NewWorkspace = New workspace
2772+GraphContextMenu_CopyToWorkspace = Copy to...
2773+GraphContextMenu_CopyToWorkspace_NewWorkspace = New workspace
2774+
2775+GraphContextMenu.Delete.message = Nodes will be deleted, do you want to proceed?
2776+GraphContextMenu.Delete.message.title = Delete nodes
2777+GraphContextMenu_SelectInDataLaboratory = Select in data laboratory
2778+GraphContextMenu_OpenURL = Open in web browser
2779+GraphContextMenu_OpenURL.description = Open URL in an attribute of the node
2780+GraphContextMenu_OpenURLSubItem = Choose column...
2781+GraphContextMenu_OpenURLSubItem.message = Column:
2782+GraphContextMenu_OpenURLLastItem = Last column opened ({0})
2783\ No newline at end of file
2784
2785=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_es.properties'
2786--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_es.properties 1970-01-01 00:00:00 +0000
2787+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_es.properties 2011-02-01 14:23:14 +0000
2788@@ -0,0 +1,32 @@
2789+# Spanish translation for gephi
2790+# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
2791+# This file is distributed under the same license as the gephi package.
2792+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
2793+#
2794+!=Project-Id-Version\: gephi\nReport-Msgid-Bugs-To\: FULL NAME <EMAIL@ADDRESS>\nPOT-Creation-Date\: 2010-04-07 13\:16+0200\nPO-Revision-Date\: 2010-12-26 00\:11+0000\nLast-Translator\: Eduardo Ramos <Unknown>\nLanguage-Team\: Spanish <es@li.org>\nMIME-Version\: 1.0\nContent-Type\: text/plain; charset\=UTF-8\nContent-Transfer-Encoding\: 8bit\nX-Launchpad-Export-Date\: 2010-12-27 04\:43+0000\nX-Generator\: Launchpad (build Unknown)\n
2795+
2796+GraphContextMenu_Group=Agrupar
2797+
2798+GraphContextMenu_Ungroup=Desagrupar
2799+
2800+GraphContextMenu_Expand=Expandir
2801+
2802+GraphContextMenu_Contract=Contraer
2803+
2804+GraphContextMenu_Settle=Bloquear
2805+
2806+GraphContextMenu_Free=Desbloquear
2807+
2808+GraphContextMenu_Delete=Eliminar
2809+
2810+GraphContextMenu_MoveToWorkspace=Mover a...
2811+
2812+GraphContextMenu_MoveToWorkspace_NewWorkspace=Nuevo espacio de trabajo
2813+
2814+GraphContextMenu_CopyToWorkspace=Copiar a...
2815+
2816+GraphContextMenu_CopyToWorkspace_NewWorkspace=Nuevo espacio de trabajo
2817+
2818+GraphContextMenu.Delete.message=Los nodos ser\u00e1n eliminados, \u00bfContinuar?
2819+
2820+GraphContextMenu.Delete.message.title=Eliminar nodos
2821
2822=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_fr.properties'
2823--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_fr.properties 1970-01-01 00:00:00 +0000
2824+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Bundle_fr.properties 2011-02-01 14:23:14 +0000
2825@@ -0,0 +1,32 @@
2826+# French translation for gephi
2827+# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
2828+# This file is distributed under the same license as the gephi package.
2829+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
2830+#
2831+!=Project-Id-Version\: gephi\nReport-Msgid-Bugs-To\: FULL NAME <EMAIL@ADDRESS>\nPOT-Creation-Date\: 2010-04-07 13\:16+0200\nPO-Revision-Date\: 2010-12-25 19\:49+0000\nLast-Translator\: S\u00e9bastien Heymann <Unknown>\nLanguage-Team\: French <fr@li.org>\nMIME-Version\: 1.0\nContent-Type\: text/plain; charset\=UTF-8\nContent-Transfer-Encoding\: 8bit\nX-Launchpad-Export-Date\: 2010-12-26 04\:53+0000\nX-Generator\: Launchpad (build Unknown)\n
2832+
2833+GraphContextMenu_Group=Grouper
2834+
2835+GraphContextMenu_Ungroup=D\u00e9grouper
2836+
2837+GraphContextMenu_Expand=\u00c9tendre
2838+
2839+GraphContextMenu_Contract=Contracter
2840+
2841+GraphContextMenu_Settle=Fixer
2842+
2843+GraphContextMenu_Free=Lib\u00e9rer
2844+
2845+GraphContextMenu_Delete=Supprimer
2846+
2847+GraphContextMenu_MoveToWorkspace=D\u00e9placer vers...
2848+
2849+GraphContextMenu_MoveToWorkspace_NewWorkspace=Nouvel espace de travail
2850+
2851+GraphContextMenu_CopyToWorkspace=Copier vers...
2852+
2853+GraphContextMenu_CopyToWorkspace_NewWorkspace=Nouvel espace de travail
2854+
2855+GraphContextMenu.Delete.message=Les noeuds seront supprim\u00e9s. Voulez-vous continuer ?
2856+
2857+GraphContextMenu.Delete.message.title=Suppression des noeuds
2858
2859=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Contract.java'
2860--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Contract.java 1970-01-01 00:00:00 +0000
2861+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Contract.java 2011-02-01 14:23:14 +0000
2862@@ -0,0 +1,126 @@
2863+/*
2864+Copyright 2008-2010 Gephi
2865+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
2866+Website : http://www.gephi.org
2867+
2868+This file is part of Gephi.
2869+
2870+Gephi is free software: you can redistribute it and/or modify
2871+it under the terms of the GNU Affero General Public License as
2872+published by the Free Software Foundation, either version 3 of the
2873+License, or (at your option) any later version.
2874+
2875+Gephi is distributed in the hope that it will be useful,
2876+but WITHOUT ANY WARRANTY; without even the implied warranty of
2877+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2878+GNU Affero General Public License for more details.
2879+
2880+You should have received a copy of the GNU Affero General Public License
2881+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
2882+ */
2883+package org.gephi.visualization.apiimpl.contextmenuitems;
2884+
2885+import java.awt.event.KeyEvent;
2886+import java.util.HashSet;
2887+import java.util.Set;
2888+import javax.swing.Icon;
2889+import org.gephi.graph.api.GroupData;
2890+import org.gephi.graph.api.HierarchicalGraph;
2891+import org.gephi.graph.api.Node;
2892+import org.gephi.graph.api.NodeData;
2893+import org.gephi.visualization.hull.ConvexHull;
2894+import org.gephi.visualization.opengl.compatibility.objects.ConvexHullModel;
2895+import org.gephi.visualization.spi.GraphContextMenuItem;
2896+import org.openide.util.ImageUtilities;
2897+import org.openide.util.NbBundle;
2898+import org.openide.util.lookup.ServiceProvider;
2899+
2900+/**
2901+ *
2902+ */
2903+@ServiceProvider(service = GraphContextMenuItem.class)
2904+public class Contract implements GraphContextMenuItem {
2905+
2906+ private Node[] nodes;
2907+ private HierarchicalGraph graph;
2908+
2909+ public void setup(HierarchicalGraph graph, Node[] nodes) {
2910+ this.nodes = nodes;
2911+ this.graph = graph;
2912+ }
2913+
2914+ public void execute() {
2915+ try {
2916+ Set<Node> parents = new HashSet<Node>();
2917+ for (Node node : nodes) {
2918+ Node nodeParent = graph.getParent(node);
2919+ if (nodeParent != null) {
2920+ parents.add(nodeParent);
2921+ }
2922+ }
2923+
2924+ for (Node parent : parents) {
2925+ GroupData gd = (GroupData) parent.getNodeData();
2926+ if (gd.getHullModel() != null) {
2927+ ConvexHull hull = ((ConvexHullModel) gd.getHullModel()).getObj();
2928+ contractPositioning(hull);
2929+ }
2930+ graph.retract(parent);
2931+ }
2932+ } catch (Exception e) {
2933+ e.printStackTrace();
2934+ graph.readUnlockAll();
2935+ }
2936+ }
2937+
2938+ private void contractPositioning(ConvexHull hull) {
2939+ NodeData metaNode = hull.getMetaNode().getNodeData();
2940+ metaNode.setX(hull.x());
2941+ metaNode.setY(hull.y());
2942+
2943+ ConvexHullModel model = (ConvexHullModel) hull.getModel();
2944+ model.setScale(0.9f);
2945+ model.setScaleQuantum(-0.1f);
2946+ }
2947+
2948+ public GraphContextMenuItem[] getSubItems() {
2949+ return null;
2950+ }
2951+
2952+ public String getName() {
2953+ return NbBundle.getMessage(Contract.class, "GraphContextMenu_Contract");
2954+ }
2955+
2956+ public String getDescription() {
2957+ return null;
2958+ }
2959+
2960+ public boolean isAvailable() {
2961+ return true;
2962+ }
2963+
2964+ public boolean canExecute() {
2965+ for (Node n : nodes) {
2966+ if (graph.getParent(n)!=null) {
2967+ return true;
2968+ }
2969+ }
2970+ return false;
2971+ }
2972+
2973+ public int getType() {
2974+ return 100;
2975+ }
2976+
2977+ public int getPosition() {
2978+ return 100;
2979+ }
2980+
2981+ public Icon getIcon() {
2982+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/contract.png", false);
2983+ }
2984+
2985+ public Integer getMnemonicKey() {
2986+ return KeyEvent.VK_C;
2987+ }
2988+}
2989
2990=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspace.java'
2991--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspace.java 1970-01-01 00:00:00 +0000
2992+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspace.java 2011-02-01 14:23:14 +0000
2993@@ -0,0 +1,93 @@
2994+/*
2995+Copyright 2008-2010 Gephi
2996+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
2997+Website : http://www.gephi.org
2998+
2999+This file is part of Gephi.
3000+
3001+Gephi is free software: you can redistribute it and/or modify
3002+it under the terms of the GNU Affero General Public License as
3003+published by the Free Software Foundation, either version 3 of the
3004+License, or (at your option) any later version.
3005+
3006+Gephi is distributed in the hope that it will be useful,
3007+but WITHOUT ANY WARRANTY; without even the implied warranty of
3008+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3009+GNU Affero General Public License for more details.
3010+
3011+You should have received a copy of the GNU Affero General Public License
3012+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3013+ */
3014+package org.gephi.visualization.apiimpl.contextmenuitems;
3015+
3016+import java.util.ArrayList;
3017+import javax.swing.Icon;
3018+import org.gephi.graph.api.HierarchicalGraph;
3019+import org.gephi.graph.api.Node;
3020+import org.gephi.project.api.ProjectController;
3021+import org.gephi.project.api.Workspace;
3022+import org.gephi.project.api.WorkspaceProvider;
3023+import org.gephi.visualization.spi.GraphContextMenuItem;
3024+import org.openide.util.Lookup;
3025+
3026+/**
3027+ *
3028+ */
3029+public abstract class CopyOrMoveToWorkspace implements GraphContextMenuItem {
3030+
3031+ private Node[] nodes;
3032+
3033+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3034+ this.nodes = nodes;
3035+ }
3036+
3037+ public void execute() {
3038+ }
3039+
3040+ public GraphContextMenuItem[] getSubItems() {
3041+ if (nodes != null) {
3042+ int i = 0;
3043+ ArrayList<GraphContextMenuItem> subItems = new ArrayList<GraphContextMenuItem>();
3044+ if (canExecute()) {
3045+ subItems.add(new CopyOrMoveToWorkspaceSubItem(null, true, 0, 0, isCopy()));//New workspace
3046+ ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
3047+ for (final Workspace w : projectController.getCurrentProject().getLookup().lookup(WorkspaceProvider.class).getWorkspaces()) {
3048+ GraphContextMenuItem item = new CopyOrMoveToWorkspaceSubItem(w, w != projectController.getCurrentWorkspace(), 1, i, isCopy());
3049+ subItems.add(item);
3050+ i++;
3051+ }
3052+ return subItems.toArray(new GraphContextMenuItem[0]);
3053+ } else {
3054+ return null;
3055+ }
3056+ } else {
3057+ return null;
3058+ }
3059+ }
3060+
3061+ public String getDescription() {
3062+ return null;
3063+ }
3064+
3065+ public boolean isAvailable() {
3066+ return true;
3067+ }
3068+
3069+ public boolean canExecute() {
3070+ return nodes.length > 0;
3071+ }
3072+
3073+ public int getType() {
3074+ return 200;
3075+ }
3076+
3077+ public Icon getIcon() {
3078+ return null;
3079+ }
3080+
3081+ public Integer getMnemonicKey() {
3082+ return null;
3083+ }
3084+
3085+ protected abstract boolean isCopy();
3086+}
3087
3088=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspaceSubItem.java'
3089--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspaceSubItem.java 1970-01-01 00:00:00 +0000
3090+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyOrMoveToWorkspaceSubItem.java 2011-02-01 14:23:14 +0000
3091@@ -0,0 +1,149 @@
3092+/*
3093+Copyright 2008-2010 Gephi
3094+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3095+Website : http://www.gephi.org
3096+
3097+This file is part of Gephi.
3098+
3099+Gephi is free software: you can redistribute it and/or modify
3100+it under the terms of the GNU Affero General Public License as
3101+published by the Free Software Foundation, either version 3 of the
3102+License, or (at your option) any later version.
3103+
3104+Gephi is distributed in the hope that it will be useful,
3105+but WITHOUT ANY WARRANTY; without even the implied warranty of
3106+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3107+GNU Affero General Public License for more details.
3108+
3109+You should have received a copy of the GNU Affero General Public License
3110+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3111+ */
3112+package org.gephi.visualization.apiimpl.contextmenuitems;
3113+
3114+import javax.swing.Icon;
3115+import org.gephi.data.attributes.api.AttributeController;
3116+import org.gephi.data.attributes.api.AttributeModel;
3117+import org.gephi.desktop.project.api.ProjectControllerUI;
3118+import org.gephi.graph.api.Graph;
3119+import org.gephi.graph.api.GraphController;
3120+import org.gephi.graph.api.GraphModel;
3121+import org.gephi.graph.api.HierarchicalGraph;
3122+import org.gephi.graph.api.Node;
3123+import org.gephi.project.api.ProjectController;
3124+import org.gephi.project.api.Workspace;
3125+import org.gephi.project.api.WorkspaceInformation;
3126+import org.gephi.visualization.spi.GraphContextMenuItem;
3127+import org.openide.util.Lookup;
3128+import org.openide.util.NbBundle;
3129+
3130+public class CopyOrMoveToWorkspaceSubItem implements GraphContextMenuItem {
3131+
3132+ private Workspace workspace;
3133+ private boolean canExecute;
3134+ private int type;
3135+ private int position;
3136+ private HierarchicalGraph graph;
3137+ private Node[] nodes;
3138+ private final boolean copy;
3139+
3140+ /**
3141+ * Constructor with copy or move settings
3142+ * @param workspace Workspace to copy or move, or null to use new workspace
3143+ * @param canExecute canExecute
3144+ * @param type type
3145+ * @param position position
3146+ * @param copy True to copy, false to move
3147+ */
3148+ public CopyOrMoveToWorkspaceSubItem(Workspace workspace, boolean canExecute, int type, int position, boolean copy) {
3149+ this.workspace = workspace;
3150+ this.canExecute = canExecute;
3151+ this.type = type;
3152+ this.position = position;
3153+ this.copy = copy;
3154+ }
3155+
3156+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3157+ this.graph = graph;
3158+ this.nodes = nodes;
3159+ }
3160+
3161+ public void execute() {
3162+ if (workspace == null) {
3163+ workspace = Lookup.getDefault().lookup(ProjectControllerUI.class).newWorkspace();
3164+ }
3165+ if (copy) {
3166+ copyToWorkspace(workspace);
3167+ } else {
3168+ moveToWorkspace(workspace);
3169+ }
3170+ }
3171+
3172+ public GraphContextMenuItem[] getSubItems() {
3173+ return null;
3174+ }
3175+
3176+ public String getName() {
3177+ if (workspace != null) {
3178+ return workspace.getLookup().lookup(WorkspaceInformation.class).getName();
3179+ } else {
3180+ return NbBundle.getMessage(CopyOrMoveToWorkspaceSubItem.class, copy ? "GraphContextMenu_CopyToWorkspace_NewWorkspace" : "GraphContextMenu_MoveToWorkspace_NewWorkspace");
3181+ }
3182+ }
3183+
3184+ public String getDescription() {
3185+ return null;
3186+ }
3187+
3188+ public boolean isAvailable() {
3189+ return true;
3190+ }
3191+
3192+ public boolean canExecute() {
3193+ return canExecute;
3194+ }
3195+
3196+ public int getType() {
3197+ return type;
3198+ }
3199+
3200+ public int getPosition() {
3201+ return position;
3202+ }
3203+
3204+ public Icon getIcon() {
3205+ return null;
3206+ }
3207+
3208+ public void copyToWorkspace(Workspace workspace) {
3209+ GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
3210+ AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
3211+ ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
3212+
3213+ Workspace currentWorkspace = projectController.getCurrentWorkspace();
3214+ AttributeModel sourceAttributeModel = attributeController.getModel(currentWorkspace);
3215+ AttributeModel destAttributeModel = attributeController.getModel(workspace);
3216+ destAttributeModel.mergeModel(sourceAttributeModel);
3217+
3218+ GraphModel sourceModel = graphController.getModel(currentWorkspace);
3219+ GraphModel destModel = graphController.getModel(workspace);
3220+ Graph destGraph = destModel.getHierarchicalGraphVisible();
3221+ Graph sourceGraph = sourceModel.getHierarchicalGraphVisible();
3222+
3223+ destModel.pushNodes(sourceGraph, nodes);
3224+ }
3225+
3226+ public void moveToWorkspace(Workspace workspace) {
3227+ copyToWorkspace(workspace);
3228+ delete();
3229+ }
3230+
3231+ public void delete() {
3232+ for (Node n : nodes) {
3233+ graph.removeNode(n);
3234+ }
3235+ }
3236+
3237+ public Integer getMnemonicKey() {
3238+ return null;
3239+ }
3240+}
3241
3242=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyToWorkspace.java'
3243--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyToWorkspace.java 1970-01-01 00:00:00 +0000
3244+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/CopyToWorkspace.java 2011-02-01 14:23:14 +0000
3245@@ -0,0 +1,31 @@
3246+/*
3247+ * To change this template, choose Tools | Templates
3248+ * and open the template in the editor.
3249+ */
3250+
3251+package org.gephi.visualization.apiimpl.contextmenuitems;
3252+
3253+import org.gephi.visualization.spi.GraphContextMenuItem;
3254+import org.openide.util.NbBundle;
3255+import org.openide.util.lookup.ServiceProvider;
3256+
3257+/**
3258+ *
3259+ * @author Eduardo
3260+ */
3261+@ServiceProvider(service = GraphContextMenuItem.class)
3262+public class CopyToWorkspace extends CopyOrMoveToWorkspace{
3263+
3264+ @Override
3265+ protected boolean isCopy() {
3266+ return true;
3267+ }
3268+
3269+ public String getName() {
3270+ return NbBundle.getMessage(CopyOrMoveToWorkspace.class, "GraphContextMenu_CopyToWorkspace");
3271+ }
3272+
3273+ public int getPosition() {
3274+ return 200;
3275+ }
3276+}
3277
3278=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Delete.java'
3279--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Delete.java 1970-01-01 00:00:00 +0000
3280+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Delete.java 2011-02-01 14:23:14 +0000
3281@@ -0,0 +1,93 @@
3282+/*
3283+Copyright 2008-2010 Gephi
3284+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3285+Website : http://www.gephi.org
3286+
3287+This file is part of Gephi.
3288+
3289+Gephi is free software: you can redistribute it and/or modify
3290+it under the terms of the GNU Affero General Public License as
3291+published by the Free Software Foundation, either version 3 of the
3292+License, or (at your option) any later version.
3293+
3294+Gephi is distributed in the hope that it will be useful,
3295+but WITHOUT ANY WARRANTY; without even the implied warranty of
3296+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3297+GNU Affero General Public License for more details.
3298+
3299+You should have received a copy of the GNU Affero General Public License
3300+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3301+ */
3302+package org.gephi.visualization.apiimpl.contextmenuitems;
3303+
3304+import java.awt.event.KeyEvent;
3305+import javax.swing.Icon;
3306+import org.gephi.datalab.api.GraphElementsController;
3307+import org.gephi.graph.api.HierarchicalGraph;
3308+import org.gephi.graph.api.Node;
3309+import org.gephi.visualization.spi.GraphContextMenuItem;
3310+import org.openide.DialogDisplayer;
3311+import org.openide.NotifyDescriptor;
3312+import org.openide.util.ImageUtilities;
3313+import org.openide.util.Lookup;
3314+import org.openide.util.NbBundle;
3315+import org.openide.util.lookup.ServiceProvider;
3316+
3317+/**
3318+ *
3319+ */
3320+@ServiceProvider(service = GraphContextMenuItem.class)
3321+public class Delete implements GraphContextMenuItem {
3322+
3323+ private Node[] nodes;
3324+
3325+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3326+ this.nodes = nodes;
3327+ }
3328+
3329+ public void execute() {
3330+ NotifyDescriptor.Confirmation notifyDescriptor = new NotifyDescriptor.Confirmation(
3331+ NbBundle.getMessage(Delete.class, "GraphContextMenu.Delete.message"),
3332+ NbBundle.getMessage(Delete.class, "GraphContextMenu.Delete.message.title"), NotifyDescriptor.YES_NO_OPTION);
3333+ if (DialogDisplayer.getDefault().notify(notifyDescriptor).equals(NotifyDescriptor.YES_OPTION)) {
3334+ GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
3335+ gec.deleteNodes(nodes);
3336+ }
3337+ }
3338+
3339+ public GraphContextMenuItem[] getSubItems() {
3340+ return null;
3341+ }
3342+
3343+ public String getName() {
3344+ return NbBundle.getMessage(Delete.class, "GraphContextMenu_Delete");
3345+ }
3346+
3347+ public String getDescription() {
3348+ return null;
3349+ }
3350+
3351+ public boolean isAvailable() {
3352+ return true;
3353+ }
3354+
3355+ public boolean canExecute() {
3356+ return nodes.length > 0;
3357+ }
3358+
3359+ public int getType() {
3360+ return 200;
3361+ }
3362+
3363+ public int getPosition() {
3364+ return 0;
3365+ }
3366+
3367+ public Icon getIcon() {
3368+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/delete.png", false);
3369+ }
3370+
3371+ public Integer getMnemonicKey() {
3372+ return KeyEvent.VK_D;
3373+ }
3374+}
3375
3376=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Expand.java'
3377--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Expand.java 1970-01-01 00:00:00 +0000
3378+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Expand.java 2011-02-01 14:23:14 +0000
3379@@ -0,0 +1,124 @@
3380+/*
3381+Copyright 2008-2010 Gephi
3382+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3383+Website : http://www.gephi.org
3384+
3385+This file is part of Gephi.
3386+
3387+Gephi is free software: you can redistribute it and/or modify
3388+it under the terms of the GNU Affero General Public License as
3389+published by the Free Software Foundation, either version 3 of the
3390+License, or (at your option) any later version.
3391+
3392+Gephi is distributed in the hope that it will be useful,
3393+but WITHOUT ANY WARRANTY; without even the implied warranty of
3394+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3395+GNU Affero General Public License for more details.
3396+
3397+You should have received a copy of the GNU Affero General Public License
3398+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3399+ */
3400+package org.gephi.visualization.apiimpl.contextmenuitems;
3401+
3402+import java.awt.event.KeyEvent;
3403+import javax.swing.Icon;
3404+import org.gephi.graph.api.HierarchicalGraph;
3405+import org.gephi.graph.api.Node;
3406+import org.gephi.graph.api.NodeData;
3407+import org.gephi.visualization.spi.GraphContextMenuItem;
3408+import org.openide.util.ImageUtilities;
3409+import org.openide.util.NbBundle;
3410+import org.openide.util.lookup.ServiceProvider;
3411+
3412+/**
3413+ *
3414+ */
3415+@ServiceProvider(service = GraphContextMenuItem.class)
3416+public class Expand implements GraphContextMenuItem {
3417+
3418+ private Node[] nodes;
3419+ private HierarchicalGraph graph;
3420+
3421+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3422+ this.nodes = nodes;
3423+ this.graph=graph;
3424+ }
3425+
3426+ public void execute() {
3427+ try {
3428+ for (Node node : nodes) {
3429+ if (graph.getDescendantCount(node) > 0) {
3430+ expandPositioning(node);
3431+ graph.expand(node);
3432+ }
3433+ }
3434+ } catch (Exception e) {
3435+ e.printStackTrace();
3436+ graph.readUnlockAll();
3437+ }
3438+ }
3439+
3440+ private void expandPositioning(Node node) {
3441+ NodeData nodeData = node.getNodeData();
3442+ float centroidX = 0;
3443+ float centroidY = 0;
3444+ int len = 0;
3445+ Node[] children = graph.getChildren(node).toArray();
3446+ for (Node child : children) {
3447+ centroidX += child.getNodeData().x();
3448+ centroidY += child.getNodeData().y();
3449+ len++;
3450+ }
3451+ centroidX /= len;
3452+ centroidY /= len;
3453+
3454+ float diffX = nodeData.x() - centroidX;
3455+ float diffY = nodeData.y() - centroidY;
3456+ for (Node child : children) {
3457+ NodeData nd = child.getNodeData();
3458+ nd.setX(nd.x() + diffX);
3459+ nd.setY(nd.y() + diffY);
3460+ }
3461+ }
3462+
3463+ public GraphContextMenuItem[] getSubItems() {
3464+ return null;
3465+ }
3466+
3467+ public String getName() {
3468+ return NbBundle.getMessage(Expand.class, "GraphContextMenu_Expand");
3469+ }
3470+
3471+ public String getDescription() {
3472+ return null;
3473+ }
3474+
3475+ public boolean isAvailable() {
3476+ return true;
3477+ }
3478+
3479+ public boolean canExecute() {
3480+ for (Node n : nodes) {
3481+ if (graph.getDescendantCount(n)>0) {
3482+ return true;
3483+ }
3484+ }
3485+ return false;
3486+ }
3487+
3488+ public int getType() {
3489+ return 100;
3490+ }
3491+
3492+ public int getPosition() {
3493+ return 0;
3494+ }
3495+
3496+ public Icon getIcon() {
3497+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/expand.png", false);
3498+ }
3499+
3500+ public Integer getMnemonicKey() {
3501+ return KeyEvent.VK_E;
3502+ }
3503+}
3504
3505=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Free.java'
3506--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Free.java 1970-01-01 00:00:00 +0000
3507+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Free.java 2011-02-01 14:23:14 +0000
3508@@ -0,0 +1,91 @@
3509+/*
3510+Copyright 2008-2010 Gephi
3511+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3512+Website : http://www.gephi.org
3513+
3514+This file is part of Gephi.
3515+
3516+Gephi is free software: you can redistribute it and/or modify
3517+it under the terms of the GNU Affero General Public License as
3518+published by the Free Software Foundation, either version 3 of the
3519+License, or (at your option) any later version.
3520+
3521+Gephi is distributed in the hope that it will be useful,
3522+but WITHOUT ANY WARRANTY; without even the implied warranty of
3523+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3524+GNU Affero General Public License for more details.
3525+
3526+You should have received a copy of the GNU Affero General Public License
3527+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3528+ */
3529+package org.gephi.visualization.apiimpl.contextmenuitems;
3530+
3531+import java.awt.event.KeyEvent;
3532+import javax.swing.Icon;
3533+import org.gephi.datalab.api.GraphElementsController;
3534+import org.gephi.graph.api.HierarchicalGraph;
3535+import org.gephi.graph.api.Node;
3536+import org.gephi.visualization.spi.GraphContextMenuItem;
3537+import org.openide.util.ImageUtilities;
3538+import org.openide.util.Lookup;
3539+import org.openide.util.NbBundle;
3540+import org.openide.util.lookup.ServiceProvider;
3541+
3542+/**
3543+ *
3544+ */
3545+@ServiceProvider(service = GraphContextMenuItem.class)
3546+public class Free implements GraphContextMenuItem {
3547+
3548+ private Node[] nodes;
3549+
3550+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3551+ this.nodes = nodes;
3552+ }
3553+
3554+ public void execute() {
3555+ GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
3556+ gec.setNodesFixed(nodes, false);
3557+ }
3558+
3559+ public GraphContextMenuItem[] getSubItems() {
3560+ return null;
3561+ }
3562+
3563+ public String getName() {
3564+ return NbBundle.getMessage(Free.class, "GraphContextMenu_Free");
3565+ }
3566+
3567+ public String getDescription() {
3568+ return null;
3569+ }
3570+
3571+ public boolean isAvailable() {
3572+ return true;
3573+ }
3574+
3575+ public boolean canExecute() {
3576+ for (Node n : nodes) {
3577+ if (Lookup.getDefault().lookup(GraphElementsController.class).isNodeFixed(n)) {
3578+ return true;
3579+ }
3580+ }
3581+ return false;
3582+ }
3583+
3584+ public int getType() {
3585+ return 300;
3586+ }
3587+
3588+ public int getPosition() {
3589+ return 100;
3590+ }
3591+
3592+ public Icon getIcon() {
3593+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/free.png", false);
3594+ }
3595+
3596+ public Integer getMnemonicKey() {
3597+ return KeyEvent.VK_F;
3598+ }
3599+}
3600
3601=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Group.java'
3602--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Group.java 1970-01-01 00:00:00 +0000
3603+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Group.java 2011-02-01 14:23:14 +0000
3604@@ -0,0 +1,85 @@
3605+/*
3606+Copyright 2008-2010 Gephi
3607+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3608+Website : http://www.gephi.org
3609+
3610+This file is part of Gephi.
3611+
3612+Gephi is free software: you can redistribute it and/or modify
3613+it under the terms of the GNU Affero General Public License as
3614+published by the Free Software Foundation, either version 3 of the
3615+License, or (at your option) any later version.
3616+
3617+Gephi is distributed in the hope that it will be useful,
3618+but WITHOUT ANY WARRANTY; without even the implied warranty of
3619+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3620+GNU Affero General Public License for more details.
3621+
3622+You should have received a copy of the GNU Affero General Public License
3623+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3624+ */
3625+package org.gephi.visualization.apiimpl.contextmenuitems;
3626+
3627+import java.awt.event.KeyEvent;
3628+import javax.swing.Icon;
3629+import org.gephi.datalab.api.GraphElementsController;
3630+import org.gephi.graph.api.HierarchicalGraph;
3631+import org.gephi.graph.api.Node;
3632+import org.gephi.visualization.spi.GraphContextMenuItem;
3633+import org.openide.util.ImageUtilities;
3634+import org.openide.util.Lookup;
3635+import org.openide.util.NbBundle;
3636+import org.openide.util.lookup.ServiceProvider;
3637+
3638+/**
3639+ *
3640+ */
3641+@ServiceProvider(service=GraphContextMenuItem.class)
3642+public class Group implements GraphContextMenuItem{
3643+ private Node[] nodes;
3644+
3645+ public void setup(HierarchicalGraph graph,Node[] nodes) {
3646+ this.nodes=nodes;
3647+ }
3648+
3649+ public void execute() {
3650+ GraphElementsController gec=Lookup.getDefault().lookup(GraphElementsController.class);
3651+ gec.groupNodes(nodes);
3652+ }
3653+
3654+ public GraphContextMenuItem[] getSubItems() {
3655+ return null;
3656+ }
3657+
3658+ public String getName() {
3659+ return NbBundle.getMessage(Group.class, "GraphContextMenu_Group");
3660+ }
3661+
3662+ public String getDescription() {
3663+ return null;
3664+ }
3665+
3666+ public boolean isAvailable() {
3667+ return true;
3668+ }
3669+
3670+ public boolean canExecute() {
3671+ return nodes.length>0;
3672+ }
3673+
3674+ public int getType() {
3675+ return 0;
3676+ }
3677+
3678+ public int getPosition() {
3679+ return 0;
3680+ }
3681+
3682+ public Icon getIcon() {
3683+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/group.png", false);
3684+ }
3685+
3686+ public Integer getMnemonicKey() {
3687+ return KeyEvent.VK_G;
3688+ }
3689+}
3690
3691=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/LastColumnOpenedURL.java'
3692--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/LastColumnOpenedURL.java 1970-01-01 00:00:00 +0000
3693+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/LastColumnOpenedURL.java 2011-02-01 14:23:14 +0000
3694@@ -0,0 +1,33 @@
3695+/*
3696+Copyright 2008-2010 Gephi
3697+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3698+Website : http://www.gephi.org
3699+
3700+This file is part of Gephi.
3701+
3702+Gephi is free software: you can redistribute it and/or modify
3703+it under the terms of the GNU Affero General Public License as
3704+published by the Free Software Foundation, either version 3 of the
3705+License, or (at your option) any later version.
3706+
3707+Gephi is distributed in the hope that it will be useful,
3708+but WITHOUT ANY WARRANTY; without even the implied warranty of
3709+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3710+GNU Affero General Public License for more details.
3711+
3712+You should have received a copy of the GNU Affero General Public License
3713+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3714+ */
3715+package org.gephi.visualization.apiimpl.contextmenuitems;
3716+
3717+/**
3718+ *
3719+ * @author Eduardo
3720+ */
3721+public class LastColumnOpenedURL {
3722+ String column;
3723+
3724+ public LastColumnOpenedURL(String column) {
3725+ this.column = column;
3726+ }
3727+}
3728
3729=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/MoveToWorkspace.java'
3730--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/MoveToWorkspace.java 1970-01-01 00:00:00 +0000
3731+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/MoveToWorkspace.java 2011-02-01 14:23:14 +0000
3732@@ -0,0 +1,31 @@
3733+/*
3734+ * To change this template, choose Tools | Templates
3735+ * and open the template in the editor.
3736+ */
3737+
3738+package org.gephi.visualization.apiimpl.contextmenuitems;
3739+
3740+import org.gephi.visualization.spi.GraphContextMenuItem;
3741+import org.openide.util.NbBundle;
3742+import org.openide.util.lookup.ServiceProvider;
3743+
3744+/**
3745+ *
3746+ * @author Eduardo
3747+ */
3748+@ServiceProvider(service = GraphContextMenuItem.class)
3749+public class MoveToWorkspace extends CopyOrMoveToWorkspace{
3750+
3751+ @Override
3752+ protected boolean isCopy() {
3753+ return false;
3754+ }
3755+
3756+ public String getName() {
3757+ return NbBundle.getMessage(CopyOrMoveToWorkspace.class, "GraphContextMenu_MoveToWorkspace");
3758+ }
3759+
3760+ public int getPosition() {
3761+ return 100;
3762+ }
3763+}
3764
3765=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURL.java'
3766--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURL.java 1970-01-01 00:00:00 +0000
3767+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURL.java 2011-02-01 14:23:14 +0000
3768@@ -0,0 +1,93 @@
3769+/*
3770+Copyright 2008-2010 Gephi
3771+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3772+Website : http://www.gephi.org
3773+
3774+This file is part of Gephi.
3775+
3776+Gephi is free software: you can redistribute it and/or modify
3777+it under the terms of the GNU Affero General Public License as
3778+published by the Free Software Foundation, either version 3 of the
3779+License, or (at your option) any later version.
3780+
3781+Gephi is distributed in the hope that it will be useful,
3782+but WITHOUT ANY WARRANTY; without even the implied warranty of
3783+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3784+GNU Affero General Public License for more details.
3785+
3786+You should have received a copy of the GNU Affero General Public License
3787+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3788+ */
3789+package org.gephi.visualization.apiimpl.contextmenuitems;
3790+
3791+import java.util.ArrayList;
3792+import javax.swing.Icon;
3793+import org.gephi.data.attributes.api.AttributeRow;
3794+import org.gephi.data.attributes.api.AttributeType;
3795+import org.gephi.graph.api.HierarchicalGraph;
3796+import org.gephi.graph.api.Node;
3797+import org.gephi.visualization.spi.GraphContextMenuItem;
3798+import org.openide.util.ImageUtilities;
3799+import org.openide.util.NbBundle;
3800+import org.openide.util.lookup.ServiceProvider;
3801+
3802+/**
3803+ *
3804+ */
3805+@ServiceProvider(service = GraphContextMenuItem.class)
3806+public class OpenURL implements GraphContextMenuItem {
3807+
3808+ private Node node;
3809+
3810+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3811+ if (nodes.length == 1) {
3812+ node = nodes[0];
3813+ }else{
3814+ node=null;
3815+ }
3816+ }
3817+
3818+ public void execute() {
3819+ }
3820+
3821+ public GraphContextMenuItem[] getSubItems() {
3822+ GraphContextMenuItem[] subItems=new GraphContextMenuItem[2];
3823+
3824+ //Always provide subitems so their shortcuts are available:
3825+ subItems[0]=new OpenURLLastItem();
3826+ subItems[1]=new OpenURLSubItem();
3827+ return subItems;
3828+ }
3829+
3830+ public String getName() {
3831+ return NbBundle.getMessage(OpenURL.class, "GraphContextMenu_OpenURL");
3832+ }
3833+
3834+ public String getDescription() {
3835+ return NbBundle.getMessage(OpenURL.class, "GraphContextMenu_OpenURL.description");
3836+ }
3837+
3838+ public boolean isAvailable() {
3839+ return node != null;
3840+ }
3841+
3842+ public boolean canExecute() {
3843+ return true;
3844+ }
3845+
3846+ public int getType() {
3847+ return 400;
3848+ }
3849+
3850+ public int getPosition() {
3851+ return 300;
3852+ }
3853+
3854+ public Icon getIcon() {
3855+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/globe-network.png", false);
3856+ }
3857+
3858+ public Integer getMnemonicKey() {
3859+ return null;
3860+ }
3861+}
3862
3863=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLLastItem.java'
3864--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLLastItem.java 1970-01-01 00:00:00 +0000
3865+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLLastItem.java 2011-02-01 14:23:14 +0000
3866@@ -0,0 +1,119 @@
3867+/*
3868+Copyright 2008-2010 Gephi
3869+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3870+Website : http://www.gephi.org
3871+
3872+This file is part of Gephi.
3873+
3874+Gephi is free software: you can redistribute it and/or modify
3875+it under the terms of the GNU Affero General Public License as
3876+published by the Free Software Foundation, either version 3 of the
3877+License, or (at your option) any later version.
3878+
3879+Gephi is distributed in the hope that it will be useful,
3880+but WITHOUT ANY WARRANTY; without even the implied warranty of
3881+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3882+GNU Affero General Public License for more details.
3883+
3884+You should have received a copy of the GNU Affero General Public License
3885+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
3886+ */
3887+package org.gephi.visualization.apiimpl.contextmenuitems;
3888+
3889+import java.awt.event.KeyEvent;
3890+import java.net.URL;
3891+import javax.swing.Icon;
3892+import org.gephi.data.attributes.api.AttributeController;
3893+import org.gephi.data.attributes.api.AttributeRow;
3894+import org.gephi.data.attributes.api.AttributeTable;
3895+import org.gephi.graph.api.HierarchicalGraph;
3896+import org.gephi.graph.api.Node;
3897+import org.gephi.project.api.ProjectController;
3898+import org.gephi.visualization.spi.GraphContextMenuItem;
3899+import org.openide.awt.HtmlBrowser.URLDisplayer;
3900+import org.openide.util.Lookup;
3901+import org.openide.util.NbBundle;
3902+
3903+/**
3904+ *
3905+ */
3906+public class OpenURLLastItem implements GraphContextMenuItem {
3907+
3908+ private Node node;
3909+ private String column, url;
3910+
3911+ public void setup(HierarchicalGraph graph, Node[] nodes) {
3912+ url = null;
3913+ column = null;
3914+ if (nodes.length == 1) {
3915+ node = nodes[0];
3916+ LastColumnOpenedURL lc = Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().getLookup().lookup(LastColumnOpenedURL.class);
3917+ if (lc != null) {
3918+ column = lc.column;
3919+ AttributeTable table = Lookup.getDefault().lookup(AttributeController.class).getModel().getNodeTable();
3920+ if (table.hasColumn(column)) {
3921+ AttributeRow row = (AttributeRow) node.getNodeData().getAttributes();
3922+ Object value;
3923+ if ((value = row.getValue(column)) != null) {
3924+ url = value.toString();
3925+
3926+ if (!url.matches("(https?|ftp):(//?|\\\\?)?.*")) {
3927+ //Does not look like an URL, try http:
3928+ url = "http://" + url;
3929+ }
3930+ }
3931+ }else{
3932+ column=null;
3933+ Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().remove(lc);
3934+ }
3935+ }
3936+ } else {
3937+ node = null;
3938+ }
3939+ }
3940+
3941+ public void execute() {
3942+ if (url != null) {
3943+ try {
3944+ URLDisplayer.getDefault().showURLExternal(new URL(url));
3945+ } catch (Exception ex) {
3946+ }
3947+ }
3948+ }
3949+
3950+ public GraphContextMenuItem[] getSubItems() {
3951+ return null;
3952+ }
3953+
3954+ public String getName() {
3955+ return NbBundle.getMessage(OpenURLLastItem.class, "GraphContextMenu_OpenURLLastItem", column != null ? column : "--");
3956+ }
3957+
3958+ public String getDescription() {
3959+ return null;
3960+ }
3961+
3962+ public boolean isAvailable() {
3963+ return true;
3964+ }
3965+
3966+ public boolean canExecute() {
3967+ return url != null;
3968+ }
3969+
3970+ public int getType() {
3971+ return 0;
3972+ }
3973+
3974+ public int getPosition() {
3975+ return 0;
3976+ }
3977+
3978+ public Icon getIcon() {
3979+ return null;
3980+ }
3981+
3982+ public Integer getMnemonicKey() {
3983+ return KeyEvent.VK_P;
3984+ }
3985+}
3986
3987=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLSubItem.java'
3988--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLSubItem.java 1970-01-01 00:00:00 +0000
3989+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/OpenURLSubItem.java 2011-02-01 14:23:14 +0000
3990@@ -0,0 +1,152 @@
3991+/*
3992+Copyright 2008-2010 Gephi
3993+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
3994+Website : http://www.gephi.org
3995+
3996+This file is part of Gephi.
3997+
3998+Gephi is free software: you can redistribute it and/or modify
3999+it under the terms of the GNU Affero General Public License as
4000+published by the Free Software Foundation, either version 3 of the
4001+License, or (at your option) any later version.
4002+
4003+Gephi is distributed in the hope that it will be useful,
4004+but WITHOUT ANY WARRANTY; without even the implied warranty of
4005+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4006+GNU Affero General Public License for more details.
4007+
4008+You should have received a copy of the GNU Affero General Public License
4009+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
4010+ */
4011+package org.gephi.visualization.apiimpl.contextmenuitems;
4012+
4013+import java.awt.event.KeyEvent;
4014+import java.net.URL;
4015+import java.util.ArrayList;
4016+import javax.swing.Icon;
4017+import javax.swing.JOptionPane;
4018+import org.gephi.data.attributes.api.AttributeColumn;
4019+import org.gephi.data.attributes.api.AttributeRow;
4020+import org.gephi.data.attributes.api.AttributeType;
4021+import org.gephi.graph.api.HierarchicalGraph;
4022+import org.gephi.graph.api.Node;
4023+import org.gephi.project.api.ProjectController;
4024+import org.gephi.visualization.spi.GraphContextMenuItem;
4025+import org.openide.awt.HtmlBrowser.URLDisplayer;
4026+import org.openide.util.Lookup;
4027+import org.openide.util.NbBundle;
4028+
4029+/**
4030+ *
4031+ */
4032+public class OpenURLSubItem implements GraphContextMenuItem {
4033+
4034+ private Node node;
4035+ private String columnTitle, url;
4036+
4037+ public void setup(HierarchicalGraph graph, Node[] nodes) {
4038+ if (nodes.length == 1) {
4039+ node = nodes[0];
4040+ } else {
4041+ node = null;
4042+ }
4043+ }
4044+
4045+ public void execute() {
4046+ if (node != null) {
4047+ LastColumnOpenedURL lc = Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().getLookup().lookup(LastColumnOpenedURL.class);
4048+ ArrayList<ColumnURL> columnUrls = new ArrayList<ColumnURL>();
4049+ ColumnURL initialSelection = null;
4050+ Object value;
4051+ String str;
4052+ AttributeColumn column;
4053+ AttributeRow row = (AttributeRow) node.getNodeData().getAttributes();
4054+ for (int i = 0; i < row.countValues(); i++) {
4055+ column = row.getColumnAt(i);
4056+ if ((column.getType() == AttributeType.STRING || column.getType() == AttributeType.DYNAMIC_STRING) && (value = row.getValue(i)) != null) {
4057+ str = value.toString();
4058+ if (!str.matches("(https?|ftp):(//?|\\\\?)?.*")) {
4059+ //Does not look like an URL, try http:
4060+ str = "http://" + str;
4061+ }
4062+ if (lc != null && lc.column.equals(column.getTitle())) {
4063+ columnUrls.add(initialSelection=new ColumnURL(column.getTitle(), str));
4064+ }else{
4065+ columnUrls.add(new ColumnURL(column.getTitle(), str));
4066+ }
4067+ }
4068+ }
4069+
4070+ ColumnURL selection = (ColumnURL) JOptionPane.showInputDialog(null, NbBundle.getMessage(OpenURLSubItem.class, "GraphContextMenu_OpenURLSubItem.message"), getName(), JOptionPane.QUESTION_MESSAGE, null, columnUrls.toArray(), initialSelection);
4071+ if (selection != null) {
4072+ columnTitle = selection.column;
4073+ url = selection.url;
4074+ showUrl();
4075+ }
4076+ }
4077+ }
4078+
4079+ private void showUrl() {
4080+ try {
4081+ URLDisplayer.getDefault().showURLExternal(new URL(url));
4082+ } catch (Exception ex) {
4083+ }
4084+ LastColumnOpenedURL lc = Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().getLookup().lookup(LastColumnOpenedURL.class);
4085+ if (lc == null) {
4086+ Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace().add(new LastColumnOpenedURL(columnTitle));
4087+ } else {
4088+ lc.column = columnTitle;
4089+ }
4090+ }
4091+
4092+ public GraphContextMenuItem[] getSubItems() {
4093+ return null;
4094+ }
4095+
4096+ public String getName() {
4097+ return NbBundle.getMessage(OpenURLSubItem.class, "GraphContextMenu_OpenURLSubItem");
4098+ }
4099+
4100+ public String getDescription() {
4101+ return null;
4102+ }
4103+
4104+ public boolean isAvailable() {
4105+ return true;
4106+ }
4107+
4108+ public boolean canExecute() {
4109+ return true;
4110+ }
4111+
4112+ public int getType() {
4113+ return 100;
4114+ }
4115+
4116+ public int getPosition() {
4117+ return 0;
4118+ }
4119+
4120+ public Icon getIcon() {
4121+ return null;
4122+ }
4123+
4124+ public Integer getMnemonicKey() {
4125+ return KeyEvent.VK_N;
4126+ }
4127+
4128+ class ColumnURL {
4129+
4130+ String column, url;
4131+
4132+ public ColumnURL(String column, String url) {
4133+ this.column = column;
4134+ this.url = url;
4135+ }
4136+
4137+ @Override
4138+ public String toString() {
4139+ return String.format("%s - %s", column, url);
4140+ }
4141+ }
4142+}
4143
4144=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/SelectInDataLaboratory.java'
4145--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/SelectInDataLaboratory.java 1970-01-01 00:00:00 +0000
4146+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/SelectInDataLaboratory.java 2011-02-01 14:23:14 +0000
4147@@ -0,0 +1,86 @@
4148+/*
4149+Copyright 2008-2010 Gephi
4150+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
4151+Website : http://www.gephi.org
4152+
4153+This file is part of Gephi.
4154+
4155+Gephi is free software: you can redistribute it and/or modify
4156+it under the terms of the GNU Affero General Public License as
4157+published by the Free Software Foundation, either version 3 of the
4158+License, or (at your option) any later version.
4159+
4160+Gephi is distributed in the hope that it will be useful,
4161+but WITHOUT ANY WARRANTY; without even the implied warranty of
4162+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4163+GNU Affero General Public License for more details.
4164+
4165+You should have received a copy of the GNU Affero General Public License
4166+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
4167+ */
4168+package org.gephi.visualization.apiimpl.contextmenuitems;
4169+
4170+import java.awt.event.KeyEvent;
4171+import javax.swing.Icon;
4172+import org.gephi.datalab.api.DataTablesController;
4173+import org.gephi.graph.api.HierarchicalGraph;
4174+import org.gephi.graph.api.Node;
4175+import org.gephi.visualization.spi.GraphContextMenuItem;
4176+import org.openide.util.ImageUtilities;
4177+import org.openide.util.Lookup;
4178+import org.openide.util.NbBundle;
4179+import org.openide.util.lookup.ServiceProvider;
4180+
4181+/**
4182+ *
4183+ */
4184+@ServiceProvider(service = GraphContextMenuItem.class)
4185+public class SelectInDataLaboratory implements GraphContextMenuItem {
4186+ private Node[] nodes;
4187+ private DataTablesController dtc;
4188+ public void setup(HierarchicalGraph graph, Node[] nodes) {
4189+ this.nodes = nodes;
4190+ dtc=Lookup.getDefault().lookup(DataTablesController.class);
4191+ }
4192+
4193+ public void execute() {
4194+ dtc.setNodeTableSelection(nodes);
4195+ dtc.selectNodesTable();
4196+ }
4197+
4198+ public GraphContextMenuItem[] getSubItems() {
4199+ return null;
4200+ }
4201+
4202+ public String getName() {
4203+ return NbBundle.getMessage(SelectInDataLaboratory.class, "GraphContextMenu_SelectInDataLaboratory");
4204+ }
4205+
4206+ public String getDescription() {
4207+ return null;
4208+ }
4209+
4210+ public boolean isAvailable() {
4211+ return dtc.isDataTablesReady();
4212+ }
4213+
4214+ public boolean canExecute() {
4215+ return nodes.length>=1;
4216+ }
4217+
4218+ public int getType() {
4219+ return 400;
4220+ }
4221+
4222+ public int getPosition() {
4223+ return 100;
4224+ }
4225+
4226+ public Icon getIcon() {
4227+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/table-select.png", false);
4228+ }
4229+
4230+ public Integer getMnemonicKey() {
4231+ return KeyEvent.VK_L;
4232+ }
4233+}
4234
4235=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Settle.java'
4236--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Settle.java 1970-01-01 00:00:00 +0000
4237+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Settle.java 2011-02-01 14:23:14 +0000
4238@@ -0,0 +1,91 @@
4239+/*
4240+Copyright 2008-2010 Gephi
4241+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
4242+Website : http://www.gephi.org
4243+
4244+This file is part of Gephi.
4245+
4246+Gephi is free software: you can redistribute it and/or modify
4247+it under the terms of the GNU Affero General Public License as
4248+published by the Free Software Foundation, either version 3 of the
4249+License, or (at your option) any later version.
4250+
4251+Gephi is distributed in the hope that it will be useful,
4252+but WITHOUT ANY WARRANTY; without even the implied warranty of
4253+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4254+GNU Affero General Public License for more details.
4255+
4256+You should have received a copy of the GNU Affero General Public License
4257+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
4258+ */
4259+package org.gephi.visualization.apiimpl.contextmenuitems;
4260+
4261+import java.awt.event.KeyEvent;
4262+import javax.swing.Icon;
4263+import org.gephi.datalab.api.GraphElementsController;
4264+import org.gephi.graph.api.HierarchicalGraph;
4265+import org.gephi.graph.api.Node;
4266+import org.gephi.visualization.spi.GraphContextMenuItem;
4267+import org.openide.util.ImageUtilities;
4268+import org.openide.util.Lookup;
4269+import org.openide.util.NbBundle;
4270+import org.openide.util.lookup.ServiceProvider;
4271+
4272+/**
4273+ *
4274+ */
4275+@ServiceProvider(service = GraphContextMenuItem.class)
4276+public class Settle implements GraphContextMenuItem {
4277+
4278+ private Node[] nodes;
4279+
4280+ public void setup(HierarchicalGraph graph, Node[] nodes) {
4281+ this.nodes = nodes;
4282+ }
4283+
4284+ public void execute() {
4285+ GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
4286+ gec.setNodesFixed(nodes, true);
4287+ }
4288+
4289+ public GraphContextMenuItem[] getSubItems() {
4290+ return null;
4291+ }
4292+
4293+ public String getName() {
4294+ return NbBundle.getMessage(Settle.class, "GraphContextMenu_Settle");
4295+ }
4296+
4297+ public String getDescription() {
4298+ return null;
4299+ }
4300+
4301+ public boolean isAvailable() {
4302+ return true;
4303+ }
4304+
4305+ public boolean canExecute() {
4306+ for (Node n : nodes) {
4307+ if (!Lookup.getDefault().lookup(GraphElementsController.class).isNodeFixed(n)) {
4308+ return true;
4309+ }
4310+ }
4311+ return false;
4312+ }
4313+
4314+ public int getType() {
4315+ return 300;
4316+ }
4317+
4318+ public int getPosition() {
4319+ return 0;
4320+ }
4321+
4322+ public Icon getIcon() {
4323+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/settle.png", false);
4324+ }
4325+
4326+ public Integer getMnemonicKey() {
4327+ return KeyEvent.VK_B;
4328+ }
4329+}
4330
4331=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/TagNodes.java'
4332--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/TagNodes.java 1970-01-01 00:00:00 +0000
4333+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/TagNodes.java 2011-02-01 14:23:14 +0000
4334@@ -0,0 +1,86 @@
4335+/*
4336+Copyright 2008-2010 Gephi
4337+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
4338+Website : http://www.gephi.org
4339+
4340+This file is part of Gephi.
4341+
4342+Gephi is free software: you can redistribute it and/or modify
4343+it under the terms of the GNU Affero General Public License as
4344+published by the Free Software Foundation, either version 3 of the
4345+License, or (at your option) any later version.
4346+
4347+Gephi is distributed in the hope that it will be useful,
4348+but WITHOUT ANY WARRANTY; without even the implied warranty of
4349+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4350+GNU Affero General Public License for more details.
4351+
4352+You should have received a copy of the GNU Affero General Public License
4353+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
4354+ */
4355+package org.gephi.visualization.apiimpl.contextmenuitems;
4356+
4357+import java.awt.event.KeyEvent;
4358+import javax.swing.Icon;
4359+import org.gephi.datalab.api.DataLaboratoryHelper;
4360+import org.gephi.datalab.spi.nodes.NodesManipulator;
4361+import org.gephi.graph.api.HierarchicalGraph;
4362+import org.gephi.graph.api.Node;
4363+import org.gephi.visualization.spi.GraphContextMenuItem;
4364+import org.openide.util.lookup.ServiceProvider;
4365+
4366+/**
4367+ * Tag Nodes context menu action, uses existing same Data Laboratory manipulator when available.
4368+ */
4369+@ServiceProvider(service = GraphContextMenuItem.class)
4370+public class TagNodes implements GraphContextMenuItem {
4371+ private NodesManipulator tagNodes;
4372+
4373+ public TagNodes() {
4374+ tagNodes = DataLaboratoryHelper.getDefault().getNodesManipulatorByName("TagNodes");
4375+ }
4376+
4377+ public void setup(HierarchicalGraph graph, Node[] nodes) {
4378+ tagNodes.setup(nodes, null);
4379+ }
4380+
4381+ public void execute() {
4382+ DataLaboratoryHelper.getDefault().executeManipulator(tagNodes);
4383+ }
4384+
4385+ public GraphContextMenuItem[] getSubItems() {
4386+ return null;
4387+ }
4388+
4389+ public String getName() {
4390+ return tagNodes != null ? tagNodes.getName() : null;
4391+ }
4392+
4393+ public String getDescription() {
4394+ return null;
4395+ }
4396+
4397+ public boolean isAvailable() {
4398+ return tagNodes != null;//Do not show tag nodes action if the TagNodes nodes manipulator does not exist
4399+ }
4400+
4401+ public boolean canExecute() {
4402+ return tagNodes != null ? tagNodes.canExecute() : false;
4403+ }
4404+
4405+ public int getType() {
4406+ return 400;
4407+ }
4408+
4409+ public int getPosition() {
4410+ return 0;
4411+ }
4412+
4413+ public Icon getIcon() {
4414+ return tagNodes != null ? tagNodes.getIcon() : null;
4415+ }
4416+
4417+ public Integer getMnemonicKey() {
4418+ return KeyEvent.VK_T;
4419+ }
4420+}
4421
4422=== added file 'VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Ungroup.java'
4423--- VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Ungroup.java 1970-01-01 00:00:00 +0000
4424+++ VisualizationModule/src/org/gephi/visualization/apiimpl/contextmenuitems/Ungroup.java 2011-02-01 14:23:14 +0000
4425@@ -0,0 +1,91 @@
4426+/*
4427+Copyright 2008-2010 Gephi
4428+Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Eduardo Ramos <eduramiba@gmail.com>
4429+Website : http://www.gephi.org
4430+
4431+This file is part of Gephi.
4432+
4433+Gephi is free software: you can redistribute it and/or modify
4434+it under the terms of the GNU Affero General Public License as
4435+published by the Free Software Foundation, either version 3 of the
4436+License, or (at your option) any later version.
4437+
4438+Gephi is distributed in the hope that it will be useful,
4439+but WITHOUT ANY WARRANTY; without even the implied warranty of
4440+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4441+GNU Affero General Public License for more details.
4442+
4443+You should have received a copy of the GNU Affero General Public License
4444+along with Gephi. If not, see <http://www.gnu.org/licenses/>.
4445+ */
4446+package org.gephi.visualization.apiimpl.contextmenuitems;
4447+
4448+import java.awt.event.KeyEvent;
4449+import javax.swing.Icon;
4450+import org.gephi.datalab.api.GraphElementsController;
4451+import org.gephi.graph.api.HierarchicalGraph;
4452+import org.gephi.graph.api.Node;
4453+import org.gephi.visualization.spi.GraphContextMenuItem;
4454+import org.openide.util.ImageUtilities;
4455+import org.openide.util.Lookup;
4456+import org.openide.util.NbBundle;
4457+import org.openide.util.lookup.ServiceProvider;
4458+
4459+/**
4460+ *
4461+ */
4462+@ServiceProvider(service = GraphContextMenuItem.class)
4463+public class Ungroup implements GraphContextMenuItem {
4464+
4465+ private Node[] nodes;
4466+
4467+ public void setup(HierarchicalGraph graph, Node[] nodes) {
4468+ this.nodes = nodes;
4469+ }
4470+
4471+ public void execute() {
4472+ GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
4473+ gec.ungroupNodes(nodes);
4474+ }
4475+
4476+ public GraphContextMenuItem[] getSubItems() {
4477+ return null;
4478+ }
4479+
4480+ public String getName() {
4481+ return NbBundle.getMessage(Ungroup.class, "GraphContextMenu_Ungroup");
4482+ }
4483+
4484+ public String getDescription() {
4485+ return null;
4486+ }
4487+
4488+ public boolean isAvailable() {
4489+ return true;
4490+ }
4491+
4492+ public boolean canExecute() {
4493+ for (Node n : nodes) {
4494+ if (Lookup.getDefault().lookup(GraphElementsController.class).canUngroupNode(n)) {
4495+ return true;
4496+ }
4497+ }
4498+ return false;
4499+ }
4500+
4501+ public int getType() {
4502+ return 0;
4503+ }
4504+
4505+ public int getPosition() {
4506+ return 100;
4507+ }
4508+
4509+ public Icon getIcon() {
4510+ return ImageUtilities.loadImageIcon("org/gephi/visualization/api/resources/ungroup.png", false);
4511+ }
4512+
4513+ public Integer getMnemonicKey() {
4514+ return KeyEvent.VK_U;
4515+ }
4516+}
4517
4518=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/es.po'
4519--- VisualizationModule/src/org/gephi/visualization/apiimpl/es.po 2010-12-27 04:43:17 +0000
4520+++ VisualizationModule/src/org/gephi/visualization/apiimpl/es.po 1970-01-01 00:00:00 +0000
4521@@ -1,57 +0,0 @@
4522-# Spanish translation for gephi
4523-# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
4524-# This file is distributed under the same license as the gephi package.
4525-# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
4526-#
4527-msgid ""
4528-msgstr ""
4529-"Project-Id-Version: gephi\n"
4530-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
4531-"POT-Creation-Date: 2010-04-07 13:16+0200\n"
4532-"PO-Revision-Date: 2010-12-26 00:11+0000\n"
4533-"Last-Translator: Eduardo Ramos <Unknown>\n"
4534-"Language-Team: Spanish <es@li.org>\n"
4535-"MIME-Version: 1.0\n"
4536-"Content-Type: text/plain; charset=UTF-8\n"
4537-"Content-Transfer-Encoding: 8bit\n"
4538-"X-Launchpad-Export-Date: 2010-12-27 04:43+0000\n"
4539-"X-Generator: Launchpad (build Unknown)\n"
4540-
4541-msgid "GraphContextMenu_Group"
4542-msgstr "Agrupar"
4543-
4544-msgid "GraphContextMenu_Ungroup"
4545-msgstr "Desagrupar"
4546-
4547-msgid "GraphContextMenu_Expand"
4548-msgstr "Expandir"
4549-
4550-msgid "GraphContextMenu_Contract"
4551-msgstr "Contraer"
4552-
4553-msgid "GraphContextMenu_Settle"
4554-msgstr "Bloquear"
4555-
4556-msgid "GraphContextMenu_Free"
4557-msgstr "Desbloquear"
4558-
4559-msgid "GraphContextMenu_Delete"
4560-msgstr "Eliminar"
4561-
4562-msgid "GraphContextMenu_MoveToWorkspace"
4563-msgstr "Mover a..."
4564-
4565-msgid "GraphContextMenu_MoveToWorkspace_NewWorkspace"
4566-msgstr "Nuevo espacio de trabajo"
4567-
4568-msgid "GraphContextMenu_CopyToWorkspace"
4569-msgstr "Copiar a..."
4570-
4571-msgid "GraphContextMenu_CopyToWorkspace_NewWorkspace"
4572-msgstr "Nuevo espacio de trabajo"
4573-
4574-msgid "GraphContextMenu.Delete.message"
4575-msgstr "Los nodos serán eliminados, ¿Continuar?"
4576-
4577-msgid "GraphContextMenu.Delete.message.title"
4578-msgstr "Eliminar nodos"
4579
4580=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/fr.po'
4581--- VisualizationModule/src/org/gephi/visualization/apiimpl/fr.po 2010-12-26 04:54:12 +0000
4582+++ VisualizationModule/src/org/gephi/visualization/apiimpl/fr.po 1970-01-01 00:00:00 +0000
4583@@ -1,57 +0,0 @@
4584-# French translation for gephi
4585-# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
4586-# This file is distributed under the same license as the gephi package.
4587-# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
4588-#
4589-msgid ""
4590-msgstr ""
4591-"Project-Id-Version: gephi\n"
4592-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
4593-"POT-Creation-Date: 2010-04-07 13:16+0200\n"
4594-"PO-Revision-Date: 2010-12-25 19:49+0000\n"
4595-"Last-Translator: Sébastien Heymann <Unknown>\n"
4596-"Language-Team: French <fr@li.org>\n"
4597-"MIME-Version: 1.0\n"
4598-"Content-Type: text/plain; charset=UTF-8\n"
4599-"Content-Transfer-Encoding: 8bit\n"
4600-"X-Launchpad-Export-Date: 2010-12-26 04:53+0000\n"
4601-"X-Generator: Launchpad (build Unknown)\n"
4602-
4603-msgid "GraphContextMenu_Group"
4604-msgstr "Grouper"
4605-
4606-msgid "GraphContextMenu_Ungroup"
4607-msgstr "Dégrouper"
4608-
4609-msgid "GraphContextMenu_Expand"
4610-msgstr "Étendre"
4611-
4612-msgid "GraphContextMenu_Contract"
4613-msgstr "Contracter"
4614-
4615-msgid "GraphContextMenu_Settle"
4616-msgstr "Fixer"
4617-
4618-msgid "GraphContextMenu_Free"
4619-msgstr "Libérer"
4620-
4621-msgid "GraphContextMenu_Delete"
4622-msgstr "Supprimer"
4623-
4624-msgid "GraphContextMenu_MoveToWorkspace"
4625-msgstr "Déplacer vers..."
4626-
4627-msgid "GraphContextMenu_MoveToWorkspace_NewWorkspace"
4628-msgstr "Nouvel espace de travail"
4629-
4630-msgid "GraphContextMenu_CopyToWorkspace"
4631-msgstr "Copier vers..."
4632-
4633-msgid "GraphContextMenu_CopyToWorkspace_NewWorkspace"
4634-msgstr "Nouvel espace de travail"
4635-
4636-msgid "GraphContextMenu.Delete.message"
4637-msgstr "Les noeuds seront supprimés. Voulez-vous continuer ?"
4638-
4639-msgid "GraphContextMenu.Delete.message.title"
4640-msgstr "Suppression des noeuds"
4641
4642=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-api.pot'
4643--- VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-api.pot 2010-04-29 20:47:13 +0000
4644+++ VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-api.pot 1970-01-01 00:00:00 +0000
4645@@ -1,37 +0,0 @@
4646-# English (en) translation for Gephi.
4647-# Copyright (C) 2010 Gephi contributors.
4648-# This file is distributed under the same license as the Gephi package.
4649-# Gephi Team <gephi.team@lists.launchpad.net>, 2010.
4650-#
4651-msgid ""
4652-msgstr ""
4653-"Project-Id-Version: Gephi 0.7\n"
4654-"Report-Msgid-Bugs-To: gephi.team@lists.launchpad.net\n"
4655-"POT-Creation-Date: 2010-04-07 13:16+0200\n"
4656-"PO-Revision-Date: 2010-04-07 13:16+0200\n"
4657-"Last-Translator: Mathieu Bastian <gephi.team@lists.launchpad.net>\n"
4658-"Language-Team: English <https://launchpad.net/~gephi.team>\n"
4659-"MIME-Version: 1.0\n"
4660-"Content-Type: text/plain; charset=UTF-8\n"
4661-"Content-Transfer-Encoding: 8bit\n"
4662-
4663-msgid "GraphContextMenu_Group"
4664-msgstr "Group"
4665-
4666-msgid "GraphContextMenu_Ungroup"
4667-msgstr "Ungroup"
4668-
4669-msgid "GraphContextMenu_Expand"
4670-msgstr "Expand"
4671-
4672-msgid "GraphContextMenu_Contract"
4673-msgstr "Contract"
4674-
4675-msgid "GraphContextMenu_Settle"
4676-msgstr "Settle"
4677-
4678-msgid "GraphContextMenu_Free"
4679-msgstr "Free"
4680-
4681-msgid "GraphContextMenu_Delete"
4682-msgstr "Delete"
4683
4684=== removed file 'VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-apiimpl.pot'
4685--- VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-apiimpl.pot 2010-09-17 09:19:14 +0000
4686+++ VisualizationModule/src/org/gephi/visualization/apiimpl/org-gephi-visualization-apiimpl.pot 1970-01-01 00:00:00 +0000
4687@@ -1,55 +0,0 @@
4688-# English (en) translation for Gephi.
4689-# Copyright (C) 2010 Gephi contributors.
4690-# This file is distributed under the same license as the Gephi package.
4691-# Gephi Team <gephi.team@lists.launchpad.net>, 2010.
4692-#
4693-msgid ""
4694-msgstr ""
4695-"Project-Id-Version: Gephi 0.7\n"
4696-"Report-Msgid-Bugs-To: gephi.team@lists.launchpad.net\n"
4697-"POT-Creation-Date: 2010-04-07 13:16+0200\n"
4698-"PO-Revision-Date: 2010-04-07 13:16+0200\n"
4699-"Last-Translator: Mathieu Bastian <gephi.team@lists.launchpad.net>\n"
4700-"Language-Team: English <https://launchpad.net/~gephi.team>\n"
4701-"MIME-Version: 1.0\n"
4702-"Content-Type: text/plain; charset=UTF-8\n"
4703-"Content-Transfer-Encoding: 8bit\n"
4704-
4705-msgid "GraphContextMenu_Group"
4706-msgstr "Group"
4707-
4708-msgid "GraphContextMenu_Ungroup"
4709-msgstr "Ungroup"
4710-
4711-msgid "GraphContextMenu_Expand"
4712-msgstr "Expand"
4713-
4714-msgid "GraphContextMenu_Contract"
4715-msgstr "Contract"
4716-
4717-msgid "GraphContextMenu_Settle"
4718-msgstr "Settle"
4719-
4720-msgid "GraphContextMenu_Free"
4721-msgstr "Free"
4722-
4723-msgid "GraphContextMenu_Delete"
4724-msgstr "Delete"
4725-
4726-msgid "GraphContextMenu_MoveToWorkspace"
4727-msgstr "Move to..."
4728-
4729-msgid "GraphContextMenu_MoveToWorkspace_NewWorkspace"
4730-msgstr "New workspace"
4731-
4732-msgid "GraphContextMenu_CopyToWorkspace"
4733-msgstr "Copy to..."
4734-
4735-msgid "GraphContextMenu_CopyToWorkspace_NewWorkspace"
4736-msgstr "New workspace"
4737-
4738-msgid "GraphContextMenu.Delete.message"
4739-msgstr "Nodes will be deleted, do you want to proceed?"
4740-
4741-msgid "GraphContextMenu.Delete.message.title"
4742-msgstr "Delete nodes"
4743
4744=== modified file 'VisualizationModule/src/org/gephi/visualization/bridge/DHNSEventBridge.java'
4745--- VisualizationModule/src/org/gephi/visualization/bridge/DHNSEventBridge.java 2010-09-30 08:11:38 +0000
4746+++ VisualizationModule/src/org/gephi/visualization/bridge/DHNSEventBridge.java 2011-02-01 14:23:14 +0000
4747@@ -21,33 +21,21 @@
4748 package org.gephi.visualization.bridge;
4749
4750 import java.util.ArrayList;
4751-import java.util.Arrays;
4752-import java.util.HashSet;
4753 import java.util.List;
4754-import java.util.Set;
4755-import org.gephi.data.attributes.api.AttributeController;
4756-import org.gephi.data.attributes.api.AttributeModel;
4757-import org.gephi.desktop.project.api.ProjectControllerUI;
4758-import org.gephi.graph.api.Graph;
4759+import org.gephi.datalab.api.DataLaboratoryHelper;
4760+import org.gephi.datalab.spi.nodes.NodesManipulator;
4761 import org.gephi.graph.api.GraphController;
4762 import org.gephi.graph.api.GraphModel;
4763-import org.gephi.graph.api.GroupData;
4764 import org.gephi.graph.api.HierarchicalGraph;
4765 import org.gephi.graph.api.Model;
4766 import org.gephi.graph.api.Node;
4767 import org.gephi.graph.api.NodeData;
4768-import org.gephi.project.api.ProjectController;
4769-import org.gephi.project.api.Workspace;
4770 import org.gephi.visualization.VizArchitecture;
4771 import org.gephi.visualization.VizController;
4772 import org.gephi.visualization.apiimpl.GraphIO;
4773 import org.gephi.visualization.apiimpl.ModelImpl;
4774 import org.gephi.visualization.api.objects.ModelClass;
4775-import org.gephi.visualization.hull.ConvexHull;
4776 import org.gephi.visualization.opengl.AbstractEngine;
4777-import org.gephi.visualization.opengl.compatibility.objects.ConvexHullModel;
4778-import org.openide.DialogDisplayer;
4779-import org.openide.NotifyDescriptor;
4780 import org.openide.util.Lookup;
4781
4782 /**
4783@@ -74,380 +62,70 @@
4784 public void initEvents() {
4785 }
4786
4787- //GROUPING
4788- public boolean canExpand() {
4789- GraphModel graphModel = graphController.getModel();
4790- if (graphModel == null) {
4791- return false;
4792- }
4793- this.graph = graphController.getModel().getHierarchicalGraphVisible();
4794- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4795- for (ModelImpl metaModelImpl : selectedNodeModels) {
4796- NodeData nodeData = (NodeData) metaModelImpl.getObj();
4797- Node node = nodeData.getNode(graph.getView().getViewId());
4798- if (node != null && graph.getDescendantCount(node) > 0) {
4799- return true;
4800- }
4801- }
4802- return false;
4803- }
4804-
4805- public boolean canContract() {
4806- GraphModel graphModel = graphController.getModel();
4807- if (graphModel == null) {
4808- return false;
4809- }
4810- this.graph = graphController.getModel().getHierarchicalGraphVisible();
4811- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4812- for (ModelImpl metaModelImpl : selectedNodeModels) {
4813- NodeData nodeData = (NodeData) metaModelImpl.getObj();
4814- Node node = nodeData.getNode(graph.getView().getViewId());
4815- if (node != null && graph.getParent(node) != null) {
4816- return true;
4817- }
4818- }
4819- return false;
4820- }
4821-
4822- public boolean canGroup() {
4823- GraphModel graphModel = graphController.getModel();
4824- if (graphModel == null) {
4825- return false;
4826- }
4827- this.graph = graphController.getModel().getHierarchicalGraphVisible();
4828- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4829- int nodesReallyPresent = 0;
4830+ public HierarchicalGraph getGraph(){
4831+ return graph;
4832+ }
4833+
4834+ public Node[] getSelectedNodes(){
4835+ GraphModel graphModel = graphController.getModel();
4836+ if (graphModel == null) {
4837+ return new Node[0];
4838+ }
4839+ this.graph = graphModel.getHierarchicalGraphVisible();
4840+ ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4841+ ArrayList<Node> nodes=new ArrayList<Node>();
4842 for (ModelImpl metaModelImpl : selectedNodeModels) {
4843 NodeData nodeData = (NodeData) metaModelImpl.getObj();
4844 Node node = nodeData.getNode(graph.getView().getViewId());
4845 if (node != null) {
4846- nodesReallyPresent++;
4847- }
4848- }
4849- return nodesReallyPresent >= 1;
4850- }
4851-
4852- public boolean canUngroup() {
4853- GraphModel graphModel = graphController.getModel();
4854- if (graphModel == null) {
4855- return false;
4856- }
4857- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4858- return selectedNodeModels.length >= 1;
4859- }
4860-
4861- public void expand() {
4862- this.graph = graphController.getModel().getHierarchicalGraphVisible();
4863- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4864- final ModelImpl[] models = Arrays.copyOf(selectedNodeModels, selectedNodeModels.length);
4865- new Thread(new Runnable() {
4866-
4867- public void run() {
4868- try {
4869- for (ModelImpl metaModelImpl : models) {
4870- Node node = ((NodeData) metaModelImpl.getObj()).getNode(graph.getView().getViewId());
4871- if (node != null && graph.getDescendantCount(node) > 0) {
4872- expandPositioning(node);
4873- graph.expand(node);
4874- }
4875- }
4876- } catch (Exception e) {
4877- e.printStackTrace();
4878- graph.readUnlockAll();
4879- }
4880- }
4881- }, "Expand nodes").start();
4882- }
4883-
4884- public void contract() {
4885- this.graph = graphController.getModel().getHierarchicalGraphVisible();
4886- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4887- final ModelImpl[] models = Arrays.copyOf(selectedNodeModels, selectedNodeModels.length);
4888- new Thread(new Runnable() {
4889-
4890- public void run() {
4891- try {
4892- Set<Node> parents = new HashSet<Node>();
4893- for (ModelImpl metaModelImpl : models) {
4894- NodeData nodeData = (NodeData) metaModelImpl.getObj();
4895- Node node = nodeData.getNode(graph.getView().getViewId());
4896- if (node != null) {
4897- Node nodeParent = graph.getParent(node);
4898- if (nodeParent != null) {
4899- parents.add(nodeParent);
4900- }
4901- }
4902- }
4903-
4904- for (Node parent : parents) {
4905- GroupData gd = (GroupData) parent.getNodeData();
4906- if (gd.getHullModel() != null) {
4907- ConvexHull hull = ((ConvexHullModel) gd.getHullModel()).getObj();
4908- contractPositioning(hull);
4909- }
4910- graph.retract(parent);
4911- }
4912- } catch (Exception e) {
4913- e.printStackTrace();
4914- graph.readUnlockAll();
4915- }
4916- }
4917- }, "Contract nodes").start();
4918- }
4919-
4920- public void group() {
4921- this.graph = graphController.getModel().getHierarchicalGraphVisible();
4922- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4923- final List<Node> newGroup = new ArrayList<Node>();
4924+ nodes.add(node);
4925+ }
4926+ }
4927+ return nodes.toArray(new Node[0]);
4928+ }
4929+
4930+ //MASS TAGGING OF NODES
4931+ public boolean isTagNodesAvailable() {
4932+ return DataLaboratoryHelper.getDefault().getNodesManipulatorByName("TagNodes")!=null;//Do not show tag nodes action if the TagNodes nodes manipulator does not exist
4933+ }
4934+
4935+ public boolean canTagNodes() {
4936+ this.graph = graphController.getModel().getHierarchicalGraphVisible();
4937+ ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4938 for (int i = 0; i < selectedNodeModels.length; i++) {
4939 Node node = ((NodeData) selectedNodeModels[i].getObj()).getNode(graph.getView().getViewId());
4940 if (node != null) {
4941- newGroup.add(node);
4942- }
4943- }
4944- new Thread(new Runnable() {
4945-
4946- public void run() {
4947- try {
4948- float centroidX = 0;
4949- float centroidY = 0;
4950- int len = 0;
4951- float sizes = 0;
4952- float r = 0;
4953- float g = 0;
4954- float b = 0;
4955- Node group = graph.groupNodes(newGroup.toArray(new Node[0]));
4956- group.getNodeData().setLabel("Group (" + newGroup.size() + " nodes)");
4957- group.getNodeData().setSize(10f);
4958- for (Node child : newGroup) {
4959- centroidX += child.getNodeData().x();
4960- centroidY += child.getNodeData().y();
4961- len++;
4962- sizes += child.getNodeData().getSize() / 10f;
4963- r += child.getNodeData().r();
4964- g += child.getNodeData().g();
4965- b += child.getNodeData().b();
4966- }
4967- centroidX /= len;
4968- centroidY /= len;
4969- group.getNodeData().setSize(sizes);
4970- group.getNodeData().setColor(r / len, g / len, b / len);
4971- group.getNodeData().setX(centroidX);
4972- group.getNodeData().setY(centroidY);
4973- } catch (Exception e) {
4974- graph.readUnlockAll();
4975- NotifyDescriptor.Message nd = new NotifyDescriptor.Message(e.getMessage());
4976- DialogDisplayer.getDefault().notifyLater(nd);
4977- }
4978- }
4979- }, "Group nodes").start();
4980- }
4981-
4982- public void ungroup() {
4983- this.graph = graphController.getModel().getHierarchicalGraph();
4984- ModelImpl[] selectedNodeModels = engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
4985- final ModelImpl[] models = Arrays.copyOf(selectedNodeModels, selectedNodeModels.length);
4986- new Thread(new Runnable() {
4987-
4988- public void run() {
4989- try {
4990- Set<Node> parents = new HashSet<Node>();
4991- for (ModelImpl metaModelImpl : models) {
4992- NodeData nodeData = (NodeData) metaModelImpl.getObj();
4993- Node node = nodeData.getNode(graph.getView().getViewId());
4994- if (node != null && graph.getDescendantCount(node) > 0) {
4995- parents.add(node);
4996- } else if (node != null && graph.getParent(node) != null) {
4997- parents.add(graph.getParent(node));
4998- }
4999- }
5000- for (Node parent : parents) {
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: