Merge lp:~daniel-bernardes/gephi/gephi-0.8a-PajekExportPlugin into lp:~gephi.team/gephi/0.8
- gephi-0.8a-PajekExportPlugin
- Merge into 0.8
Proposed by
Sébastien Heymann
Status: | Merged |
---|---|
Merged at revision: | 2248 |
Proposed branch: | lp:~daniel-bernardes/gephi/gephi-0.8a-PajekExportPlugin |
Merge into: | lp:~gephi.team/gephi/0.8 |
Diff against target: |
782 lines (+548/-123) 14 files modified
ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle.properties (+2/-1) ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_es.properties (+2/-0) ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_fr.properties (+2/-0) ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterBuilderPajek.java (+48/-0) ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterPajek.java (+172/-0) ExportPluginUI/build.xml (+8/-8) ExportPluginUI/nbproject/build-impl.xml (+45/-45) ExportPluginUI/nbproject/genfiles.properties (+8/-8) ExportPluginUI/nbproject/project.xml (+64/-61) ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle.properties (+4/-0) ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_es.properties (+6/-0) ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_fr.properties (+6/-0) ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajek.java (+84/-0) ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajekPanel.java (+97/-0) |
To merge this branch: | bzr merge lp:~daniel-bernardes/gephi/gephi-0.8a-PajekExportPlugin |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sébastien Heymann | Approve | ||
Review via email: mp+62498@code.launchpad.net |
Commit message
Description of the change
Add Pajek exporter.
To post a comment you must log in.
Revision history for this message
Mathieu Bastian (mathieu.bastian) wrote : | # |
- 2193. By Daniel Bernardes
-
Included an options dialog for Pajek export
- 2194. By Daniel Bernardes
-
Included an options dialog for Pajek export
Revision history for this message
Sébastien Heymann (sebastien.heymann) : | # |
review:
Approve
Revision history for this message
Sébastien Heymann (sebastien.heymann) wrote : | # |
Merged on rev 2248
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle.properties' |
2 | --- ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle.properties 2011-01-27 22:21:27 +0000 |
3 | +++ ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle.properties 2011-06-14 13:34:29 +0000 |
4 | @@ -8,4 +8,5 @@ |
5 | fileType_GDF_Name = GDF Files (GUESS) |
6 | fileType_GEXF_Name = GEXF Files |
7 | fileType_GraphML_Name = GraphML Files |
8 | -fileType_CSV_Name = CSV Files |
9 | \ No newline at end of file |
10 | +fileType_CSV_Name = CSV Files |
11 | +fileType_Pajek_Name = Pajek Files |
12 | |
13 | === modified file 'ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_es.properties' |
14 | --- ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_es.properties 2011-03-13 13:34:53 +0000 |
15 | +++ ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_es.properties 2011-06-14 13:34:29 +0000 |
16 | @@ -16,3 +16,5 @@ |
17 | fileType_GraphML_Name=Archivos GraphML |
18 | |
19 | fileType_CSV_Name=Archivos CSV |
20 | + |
21 | +fileType_Pajek_Name = Archivos Pajek |
22 | \ No newline at end of file |
23 | |
24 | === modified file 'ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_fr.properties' |
25 | --- ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_fr.properties 2011-03-13 13:34:53 +0000 |
26 | +++ ExportPlugin/src/org/gephi/io/exporter/plugin/Bundle_fr.properties 2011-06-14 13:34:29 +0000 |
27 | @@ -16,3 +16,5 @@ |
28 | fileType_GraphML_Name=Fichiers GraphML |
29 | |
30 | fileType_CSV_Name=Fichiers CSV |
31 | + |
32 | +fileType_Pajek_Name =Fichiers Pajek |
33 | \ No newline at end of file |
34 | |
35 | === added file 'ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterBuilderPajek.java' |
36 | --- ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterBuilderPajek.java 1970-01-01 00:00:00 +0000 |
37 | +++ ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterBuilderPajek.java 2011-06-14 13:34:29 +0000 |
38 | @@ -0,0 +1,48 @@ |
39 | +/* |
40 | +Copyright 2008-2010 Gephi |
41 | +Authors : Mathieu Bastian <mathieu.bastian@gephi.org> |
42 | +Website : http://www.gephi.org |
43 | + |
44 | +This file is part of Gephi. |
45 | + |
46 | +Gephi is free software: you can redistribute it and/or modify |
47 | +it under the terms of the GNU Affero General Public License as |
48 | +published by the Free Software Foundation, either version 3 of the |
49 | +License, or (at your option) any later version. |
50 | + |
51 | +Gephi is distributed in the hope that it will be useful, |
52 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
53 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
54 | +GNU Affero General Public License for more details. |
55 | + |
56 | +You should have received a copy of the GNU Affero General Public License |
57 | +along with Gephi. If not, see <http://www.gnu.org/licenses/>. |
58 | + */ |
59 | +package org.gephi.io.exporter.plugin; |
60 | + |
61 | +import org.gephi.io.exporter.api.FileType; |
62 | +import org.gephi.io.exporter.spi.GraphExporter; |
63 | +import org.gephi.io.exporter.spi.GraphFileExporterBuilder; |
64 | +import org.openide.util.NbBundle; |
65 | +import org.openide.util.lookup.ServiceProvider; |
66 | + |
67 | +/** |
68 | + * |
69 | + * @author Daniel Bernardes |
70 | + */ |
71 | +@ServiceProvider(service = GraphFileExporterBuilder.class) |
72 | +public class ExporterBuilderPajek implements GraphFileExporterBuilder { |
73 | + |
74 | + public GraphExporter buildExporter() { |
75 | + return new ExporterPajek(); |
76 | + } |
77 | + |
78 | + public FileType[] getFileTypes() { |
79 | + FileType ft = new FileType(".net", NbBundle.getMessage(ExporterBuilderCSV.class, "fileType_Pajek_Name")); |
80 | + return new FileType[]{ft}; |
81 | + } |
82 | + |
83 | + public String getName() { |
84 | + return "Pajek"; |
85 | + } |
86 | +} |
87 | |
88 | === added file 'ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterPajek.java' |
89 | --- ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterPajek.java 1970-01-01 00:00:00 +0000 |
90 | +++ ExportPlugin/src/org/gephi/io/exporter/plugin/ExporterPajek.java 2011-06-14 13:34:29 +0000 |
91 | @@ -0,0 +1,172 @@ |
92 | +/* |
93 | +Copyright 2008-2010 Gephi |
94 | +Authors : Mathieu Bastian <mathieu.bastian@gephi.org> |
95 | +Website : http://www.gephi.org |
96 | + |
97 | +This file is part of Gephi. |
98 | + |
99 | +Gephi is free software: you can redistribute it and/or modify |
100 | +it under the terms of the GNU Affero General Public License as |
101 | +published by the Free Software Foundation, either version 3 of the |
102 | +License, or (at your option) any later version. |
103 | + |
104 | +Gephi is distributed in the hope that it will be useful, |
105 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
106 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
107 | +GNU Affero General Public License for more details. |
108 | + |
109 | +You should have received a copy of the GNU Affero General Public License |
110 | +along with Gephi. If not, see <http://www.gnu.org/licenses/>. |
111 | + */ |
112 | +package org.gephi.io.exporter.plugin; |
113 | + |
114 | +import java.io.Writer; |
115 | +import java.util.HashMap; |
116 | +import org.gephi.graph.api.Edge; |
117 | +import org.gephi.graph.api.GraphModel; |
118 | +import org.gephi.graph.api.HierarchicalGraph; |
119 | +import org.gephi.graph.api.Node; |
120 | +import org.gephi.graph.api.UndirectedGraph; |
121 | +import org.gephi.io.exporter.api.FileType; |
122 | +import org.gephi.io.exporter.spi.CharacterExporter; |
123 | +import org.gephi.io.exporter.spi.GraphExporter; |
124 | +import org.gephi.project.api.Workspace; |
125 | +import org.gephi.utils.longtask.spi.LongTask; |
126 | +import org.gephi.utils.progress.Progress; |
127 | +import org.gephi.utils.progress.ProgressTicket; |
128 | +import org.openide.util.NbBundle; |
129 | + |
130 | +/** |
131 | + * |
132 | + * @author Daniel Bernardes |
133 | + */ |
134 | +public class ExporterPajek implements GraphExporter, CharacterExporter, LongTask { |
135 | + |
136 | + // Options |
137 | + private boolean exportPosition = true; |
138 | + private boolean exportEdgeWeight = true; |
139 | + // Architecture |
140 | + private Workspace workspace; |
141 | + private Writer writer; |
142 | + private boolean exportVisible; |
143 | + private boolean cancel = false; |
144 | + private ProgressTicket progressTicket; |
145 | + |
146 | + public void setExportEdgeWeight(boolean exportEdgeWeight) { |
147 | + this.exportEdgeWeight = exportEdgeWeight; |
148 | + } |
149 | + |
150 | + public boolean isExportEdgeWeight() { |
151 | + return exportEdgeWeight; |
152 | + } |
153 | + |
154 | + public void setExportPosition(boolean exportPosition) { |
155 | + this.exportPosition = exportPosition; |
156 | + } |
157 | + |
158 | + public boolean isExportPosition() { |
159 | + return exportPosition; |
160 | + } |
161 | + |
162 | + public boolean cancel() { |
163 | + cancel = true; |
164 | + return true; |
165 | + } |
166 | + |
167 | + public void setProgressTicket(ProgressTicket progressTicket) { |
168 | + this.progressTicket = progressTicket; |
169 | + } |
170 | + |
171 | + public boolean isExportVisible() { |
172 | + return exportVisible; |
173 | + } |
174 | + |
175 | + public void setExportVisible(boolean exportVisible) { |
176 | + this.exportVisible = exportVisible; |
177 | + } |
178 | + |
179 | + public void setWriter(Writer writer) { |
180 | + this.writer = writer; |
181 | + } |
182 | + |
183 | + public Workspace getWorkspace() { |
184 | + return workspace; |
185 | + } |
186 | + |
187 | + public void setWorkspace(Workspace workspace) { |
188 | + this.workspace = workspace; |
189 | + } |
190 | + |
191 | + public String getName() { |
192 | + return NbBundle.getMessage(getClass(), "ExporterPajek_name"); |
193 | + } |
194 | + |
195 | + public FileType[] getFileTypes() { |
196 | + FileType ft = new FileType(".net", NbBundle.getMessage(getClass(), "fileType_Pajek_Name")); |
197 | + return new FileType[]{ft}; |
198 | + } |
199 | + |
200 | + public boolean execute() { |
201 | + GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class); |
202 | + HierarchicalGraph graph = null; |
203 | + if (exportVisible) { |
204 | + graph = graphModel.getHierarchicalGraphVisible(); |
205 | + } else { |
206 | + graph = graphModel.getHierarchicalGraph(); |
207 | + } |
208 | + try { |
209 | + exportData(graph); |
210 | + } catch (Exception e) { |
211 | + throw new RuntimeException(e); |
212 | + } |
213 | + |
214 | + return !cancel; |
215 | + } |
216 | + |
217 | + private void exportData(HierarchicalGraph graph) throws Exception { |
218 | + int max = graph.getNodeCount(), i=1; |
219 | + HashMap<String, Integer> idx = new HashMap<String, Integer>(3*max/2+1); |
220 | + |
221 | + Progress.start(progressTicket, max); |
222 | + graph.readLock(); |
223 | + |
224 | + writer.append("*Vertices " + max + "\n"); |
225 | + |
226 | + for (Node node : graph.getNodes()) { |
227 | + writer.append(Integer.toString(i)); |
228 | + writer.append(" \"" + node.getNodeData().getLabel() + "\""); |
229 | + if(exportPosition) { |
230 | + writer.append(" "+node.getNodeData().x()+" "+node.getNodeData().y()+" "+node.getNodeData().z()); |
231 | + } |
232 | + writer.append("\n"); |
233 | + idx.put(node.getNodeData().getId(), i++); // assigns Ids from the interval [1..max] |
234 | + } |
235 | + |
236 | + if (graph instanceof UndirectedGraph) { |
237 | + writer.append("*Edges\n"); |
238 | + } else { |
239 | + writer.append("*Arcs\n"); |
240 | + } |
241 | + |
242 | + for (Edge edge : graph.getEdgesAndMetaEdges()) { |
243 | + if (cancel) { |
244 | + break; |
245 | + } |
246 | + if (edge != null) { |
247 | + writer.append(Integer.toString(idx.get(edge.getSource().getNodeData().getId())) + " "); |
248 | + writer.append(Integer.toString(idx.get(edge.getTarget().getNodeData().getId()))); |
249 | + if (exportEdgeWeight) { |
250 | + writer.append(" " + edge.getWeight()); |
251 | + } |
252 | + writer.append("\n"); |
253 | + } |
254 | + |
255 | + Progress.progress(progressTicket); |
256 | + } |
257 | + |
258 | + graph.readUnlockAll(); |
259 | + |
260 | + Progress.finish(progressTicket); |
261 | + } |
262 | + |
263 | +} |
264 | |
265 | === modified file 'ExportPluginUI/build.xml' |
266 | --- ExportPluginUI/build.xml 2010-01-21 00:07:58 +0000 |
267 | +++ ExportPluginUI/build.xml 2011-06-14 13:34:29 +0000 |
268 | @@ -1,8 +1,8 @@ |
269 | -<?xml version="1.0" encoding="UTF-8"?> |
270 | -<!-- You may freely edit this file. See harness/README in the NetBeans platform --> |
271 | -<!-- for some information on what you could do (e.g. targets to override). --> |
272 | -<!-- If you delete this file and reopen the project it will be recreated. --> |
273 | -<project name="org.gephi.ui.exporter.plugin" default="netbeans" basedir="."> |
274 | - <description>Builds, tests, and runs the project org.gephi.ui.exporter.plugin.</description> |
275 | - <import file="nbproject/build-impl.xml"/> |
276 | -</project> |
277 | +<?xml version="1.0" encoding="UTF-8"?> |
278 | +<!-- You may freely edit this file. See harness/README in the NetBeans platform --> |
279 | +<!-- for some information on what you could do (e.g. targets to override). --> |
280 | +<!-- If you delete this file and reopen the project it will be recreated. --> |
281 | +<project name="org.gephi.ui.exporter.plugin" default="netbeans" basedir="."> |
282 | + <description>Builds, tests, and runs the project org.gephi.ui.exporter.plugin.</description> |
283 | + <import file="nbproject/build-impl.xml"/> |
284 | +</project> |
285 | |
286 | === modified file 'ExportPluginUI/nbproject/build-impl.xml' |
287 | --- ExportPluginUI/nbproject/build-impl.xml 2010-01-21 00:07:58 +0000 |
288 | +++ ExportPluginUI/nbproject/build-impl.xml 2011-06-14 13:34:29 +0000 |
289 | @@ -1,45 +1,45 @@ |
290 | -<?xml version="1.0" encoding="UTF-8"?> |
291 | -<!-- |
292 | -*** GENERATED FROM project.xml - DO NOT EDIT *** |
293 | -*** EDIT ../build.xml INSTEAD *** |
294 | ---> |
295 | -<project name="org.gephi.ui.exporter.plugin-impl" basedir=".."> |
296 | - <fail message="Please build using Ant 1.7.1 or higher."> |
297 | - <condition> |
298 | - <not> |
299 | - <antversion atleast="1.7.1"/> |
300 | - </not> |
301 | - </condition> |
302 | - </fail> |
303 | - <property file="nbproject/private/suite-private.properties"/> |
304 | - <property file="nbproject/suite.properties"/> |
305 | - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> |
306 | - <property file="${suite.dir}/nbproject/private/platform-private.properties"/> |
307 | - <property file="${suite.dir}/nbproject/platform.properties"/> |
308 | - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> |
309 | - <attribute name="name"/> |
310 | - <attribute name="value"/> |
311 | - <sequential> |
312 | - <property name="@{name}" value="${@{value}}"/> |
313 | - </sequential> |
314 | - </macrodef> |
315 | - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> |
316 | - <attribute name="property"/> |
317 | - <attribute name="value"/> |
318 | - <sequential> |
319 | - <property name="@{property}" value="@{value}"/> |
320 | - </sequential> |
321 | - </macrodef> |
322 | - <property file="${user.properties.file}"/> |
323 | - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
324 | - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
325 | - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
326 | - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> |
327 | - <condition> |
328 | - <not> |
329 | - <contains string="${cluster.path.evaluated}" substring="platform"/> |
330 | - </not> |
331 | - </condition> |
332 | - </fail> |
333 | - <import file="${harness.dir}/build.xml"/> |
334 | -</project> |
335 | +<?xml version="1.0" encoding="UTF-8"?> |
336 | +<!-- |
337 | +*** GENERATED FROM project.xml - DO NOT EDIT *** |
338 | +*** EDIT ../build.xml INSTEAD *** |
339 | +--> |
340 | +<project name="org.gephi.ui.exporter.plugin-impl" basedir=".."> |
341 | + <fail message="Please build using Ant 1.7.1 or higher."> |
342 | + <condition> |
343 | + <not> |
344 | + <antversion atleast="1.7.1"/> |
345 | + </not> |
346 | + </condition> |
347 | + </fail> |
348 | + <property file="nbproject/private/suite-private.properties"/> |
349 | + <property file="nbproject/suite.properties"/> |
350 | + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> |
351 | + <property file="${suite.dir}/nbproject/private/platform-private.properties"/> |
352 | + <property file="${suite.dir}/nbproject/platform.properties"/> |
353 | + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> |
354 | + <attribute name="name"/> |
355 | + <attribute name="value"/> |
356 | + <sequential> |
357 | + <property name="@{name}" value="${@{value}}"/> |
358 | + </sequential> |
359 | + </macrodef> |
360 | + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> |
361 | + <attribute name="property"/> |
362 | + <attribute name="value"/> |
363 | + <sequential> |
364 | + <property name="@{property}" value="@{value}"/> |
365 | + </sequential> |
366 | + </macrodef> |
367 | + <property file="${user.properties.file}"/> |
368 | + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
369 | + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
370 | + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
371 | + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> |
372 | + <condition> |
373 | + <not> |
374 | + <contains string="${cluster.path.evaluated}" substring="platform"/> |
375 | + </not> |
376 | + </condition> |
377 | + </fail> |
378 | + <import file="${harness.dir}/build.xml"/> |
379 | +</project> |
380 | |
381 | === modified file 'ExportPluginUI/nbproject/genfiles.properties' |
382 | --- ExportPluginUI/nbproject/genfiles.properties 2010-09-01 21:20:48 +0000 |
383 | +++ ExportPluginUI/nbproject/genfiles.properties 2011-06-14 13:34:29 +0000 |
384 | @@ -1,8 +1,8 @@ |
385 | -build.xml.data.CRC32=dc93b3b1 |
386 | -build.xml.script.CRC32=5d165b47 |
387 | -build.xml.stylesheet.CRC32=a56c6a5b@1.42.2 |
388 | -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
389 | -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
390 | -nbproject/build-impl.xml.data.CRC32=dc93b3b1 |
391 | -nbproject/build-impl.xml.script.CRC32=1b675ee1 |
392 | -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2 |
393 | +build.xml.data.CRC32=9d1378f1 |
394 | +build.xml.script.CRC32=5d165b47 |
395 | +build.xml.stylesheet.CRC32=a56c6a5b@1.45.1 |
396 | +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
397 | +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
398 | +nbproject/build-impl.xml.data.CRC32=9d1378f1 |
399 | +nbproject/build-impl.xml.script.CRC32=1b675ee1 |
400 | +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 |
401 | |
402 | === modified file 'ExportPluginUI/nbproject/project.xml' |
403 | --- ExportPluginUI/nbproject/project.xml 2010-09-01 21:20:48 +0000 |
404 | +++ ExportPluginUI/nbproject/project.xml 2011-06-14 13:34:29 +0000 |
405 | @@ -1,61 +1,64 @@ |
406 | -<?xml version="1.0" encoding="UTF-8"?> |
407 | -<project xmlns="http://www.netbeans.org/ns/project/1"> |
408 | - <type>org.netbeans.modules.apisupport.project</type> |
409 | - <configuration> |
410 | - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> |
411 | - <code-name-base>org.gephi.ui.exporter.plugin</code-name-base> |
412 | - <suite-component/> |
413 | - <module-dependencies> |
414 | - <dependency> |
415 | - <code-name-base>org.gephi.graph.api</code-name-base> |
416 | - <build-prerequisite/> |
417 | - <compile-dependency/> |
418 | - <run-dependency> |
419 | - <specification-version>0.7.1.1</specification-version> |
420 | - </run-dependency> |
421 | - </dependency> |
422 | - <dependency> |
423 | - <code-name-base>org.gephi.io.exporter.api</code-name-base> |
424 | - <build-prerequisite/> |
425 | - <compile-dependency/> |
426 | - <run-dependency> |
427 | - <specification-version>0.7</specification-version> |
428 | - </run-dependency> |
429 | - </dependency> |
430 | - <dependency> |
431 | - <code-name-base>org.gephi.io.exporter.plugin</code-name-base> |
432 | - <build-prerequisite/> |
433 | - <compile-dependency/> |
434 | - <run-dependency> |
435 | - <specification-version>0.7</specification-version> |
436 | - </run-dependency> |
437 | - </dependency> |
438 | - <dependency> |
439 | - <code-name-base>org.gephi.lib.beansbinding</code-name-base> |
440 | - <build-prerequisite/> |
441 | - <compile-dependency/> |
442 | - <run-dependency> |
443 | - <specification-version>1.2.1</specification-version> |
444 | - </run-dependency> |
445 | - </dependency> |
446 | - <dependency> |
447 | - <code-name-base>org.openide.util</code-name-base> |
448 | - <build-prerequisite/> |
449 | - <compile-dependency/> |
450 | - <run-dependency> |
451 | - <specification-version>8.6.1</specification-version> |
452 | - </run-dependency> |
453 | - </dependency> |
454 | - <dependency> |
455 | - <code-name-base>org.openide.util.lookup</code-name-base> |
456 | - <build-prerequisite/> |
457 | - <compile-dependency/> |
458 | - <run-dependency> |
459 | - <specification-version>8.3.1</specification-version> |
460 | - </run-dependency> |
461 | - </dependency> |
462 | - </module-dependencies> |
463 | - <public-packages/> |
464 | - </data> |
465 | - </configuration> |
466 | -</project> |
467 | +<?xml version="1.0" encoding="UTF-8"?> |
468 | +<project xmlns="http://www.netbeans.org/ns/project/1"> |
469 | + <type>org.netbeans.modules.apisupport.project</type> |
470 | + <configuration> |
471 | + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> |
472 | + <code-name-base>org.gephi.ui.exporter.plugin</code-name-base> |
473 | + <suite-component/> |
474 | + <module-dependencies> |
475 | + <dependency> |
476 | + <code-name-base>org.gephi.graph.api</code-name-base> |
477 | + <build-prerequisite/> |
478 | + <compile-dependency/> |
479 | + <run-dependency> |
480 | + <specification-version>0.7.1.1</specification-version> |
481 | + </run-dependency> |
482 | + </dependency> |
483 | + <dependency> |
484 | + <code-name-base>org.gephi.io.exporter.api</code-name-base> |
485 | + <build-prerequisite/> |
486 | + <compile-dependency/> |
487 | + <run-dependency> |
488 | + <specification-version>0.7</specification-version> |
489 | + </run-dependency> |
490 | + </dependency> |
491 | + <dependency> |
492 | + <code-name-base>org.gephi.io.exporter.plugin</code-name-base> |
493 | + <build-prerequisite/> |
494 | + <compile-dependency/> |
495 | + <run-dependency> |
496 | + <specification-version>0.7</specification-version> |
497 | + </run-dependency> |
498 | + </dependency> |
499 | + <dependency> |
500 | + <code-name-base>org.gephi.lib.beansbinding</code-name-base> |
501 | + <build-prerequisite/> |
502 | + <compile-dependency/> |
503 | + <run-dependency> |
504 | + <specification-version>1.2.1</specification-version> |
505 | + </run-dependency> |
506 | + </dependency> |
507 | + <dependency> |
508 | + <code-name-base>org.openide.util</code-name-base> |
509 | + <build-prerequisite/> |
510 | + <compile-dependency/> |
511 | + <run-dependency> |
512 | + <specification-version>8.6.1</specification-version> |
513 | + </run-dependency> |
514 | + </dependency> |
515 | + <dependency> |
516 | + <code-name-base>org.openide.util.lookup</code-name-base> |
517 | + <build-prerequisite/> |
518 | + <compile-dependency/> |
519 | + <run-dependency> |
520 | + <specification-version>8.3.1</specification-version> |
521 | + </run-dependency> |
522 | + </dependency> |
523 | + </module-dependencies> |
524 | + <public-packages/> |
525 | + </data> |
526 | + <spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1"> |
527 | + <word>Pajek</word> |
528 | + </spellchecker-wordlist> |
529 | + </configuration> |
530 | +</project> |
531 | |
532 | === modified file 'ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle.properties' |
533 | --- ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle.properties 2010-09-14 15:01:51 +0000 |
534 | +++ ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle.properties 2011-06-14 13:34:29 +0000 |
535 | @@ -6,6 +6,7 @@ |
536 | UIExporterGEXF.name = GEXF |
537 | UIExporterGraphML.name = GraphML |
538 | UIExporterCSV.name = CSV |
539 | +UIExporterPajek.name = Pajek |
540 | |
541 | UIExporterGDFPanel.jRadioButton1.text=Simple quotes |
542 | UIExporterGDFPanel.positionExportCheckbox.text=Position (x,y) |
543 | @@ -49,3 +50,6 @@ |
544 | UIExporterGEXFPanel.labelNormalize1.text=Complete node tree without meta edges |
545 | UIExporterGEXFPanel.hierarchyCheckbox.text=Export hierarchy |
546 | |
547 | +UIExporterPajekPanel.labelExport.text=Export: |
548 | +UIExporterPajekPanel.positionExportCheckbox.text=Position (x,y) |
549 | +UIExporterPajekPanel.edgeWeightCheckbox.text=Edge weights |
550 | |
551 | === modified file 'ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_es.properties' |
552 | --- ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_es.properties 2011-03-13 13:34:53 +0000 |
553 | +++ ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_es.properties 2011-06-14 13:34:29 +0000 |
554 | @@ -15,6 +15,8 @@ |
555 | |
556 | UIExporterCSV.name=CSV |
557 | |
558 | +UIExporterCSV.name=Pajek |
559 | + |
560 | UIExporterGDFPanel.jRadioButton1.text=Comillas simples |
561 | |
562 | UIExporterGDFPanel.positionExportCheckbox.text=Posici\u00f3n (x,y) |
563 | @@ -90,3 +92,7 @@ |
564 | UIExporterGEXFPanel.labelNormalize1.text=Completar el arbol de nodos sin meta-aristas |
565 | |
566 | UIExporterGEXFPanel.hierarchyCheckbox.text=Exportar jerarqu\u00eda |
567 | + |
568 | +UIExporterPajekPanel.labelExport.text=Exportar: |
569 | +UIExporterPajekPanel.positionExportCheckbox.text=Posici\u00f3n (x,y) |
570 | +UIExporterPajekPanel.edgeWeightCheckbox.text=Peso de arista |
571 | |
572 | === modified file 'ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_fr.properties' |
573 | --- ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_fr.properties 2011-03-13 13:34:53 +0000 |
574 | +++ ExportPluginUI/src/org/gephi/ui/exporter/plugin/Bundle_fr.properties 2011-06-14 13:34:29 +0000 |
575 | @@ -15,6 +15,8 @@ |
576 | |
577 | UIExporterCSV.name=CSV |
578 | |
579 | +UIExporterCSV.name=Pajek |
580 | + |
581 | UIExporterGDFPanel.jRadioButton1.text=Guillemets simples |
582 | |
583 | UIExporterGDFPanel.positionExportCheckbox.text=Position (x,y) |
584 | @@ -90,3 +92,7 @@ |
585 | UIExporterGEXFPanel.labelNormalize1.text=Arbre complet sous les m\u00e9ta-liens |
586 | |
587 | UIExporterGEXFPanel.hierarchyCheckbox.text=Exporter la hi\u00e9rarchie |
588 | + |
589 | +UIExporterPajekPanel.labelExport.text=Export: |
590 | +UIExporterPajekPanel.positionExportCheckbox.text=Position (x,y) |
591 | +UIExporterPajekPanel.edgeWeightCheckbox.text=Poids des liens |
592 | |
593 | === added file 'ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajek.java' |
594 | --- ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajek.java 1970-01-01 00:00:00 +0000 |
595 | +++ ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajek.java 2011-06-14 13:34:29 +0000 |
596 | @@ -0,0 +1,84 @@ |
597 | +/* |
598 | +Copyright 2008-2010 Gephi |
599 | +Authors : Mathieu Bastian <mathieu.bastian@gephi.org> |
600 | +Website : http://www.gephi.org |
601 | + |
602 | +This file is part of Gephi. |
603 | + |
604 | +Gephi is free software: you can redistribute it and/or modify |
605 | +it under the terms of the GNU Affero General Public License as |
606 | +published by the Free Software Foundation, either version 3 of the |
607 | +License, or (at your option) any later version. |
608 | + |
609 | +Gephi is distributed in the hope that it will be useful, |
610 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
611 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
612 | +GNU Affero General Public License for more details. |
613 | + |
614 | +You should have received a copy of the GNU Affero General Public License |
615 | +along with Gephi. If not, see <http://www.gnu.org/licenses/>. |
616 | +*/ |
617 | +package org.gephi.ui.exporter.plugin; |
618 | + |
619 | +import javax.swing.JPanel; |
620 | +import org.gephi.io.exporter.plugin.ExporterPajek; |
621 | +import org.gephi.io.exporter.spi.Exporter; |
622 | +import org.gephi.io.exporter.spi.ExporterUI; |
623 | +import org.openide.util.NbBundle; |
624 | +import org.openide.util.lookup.ServiceProvider; |
625 | + |
626 | +/** |
627 | + * |
628 | + * @author Daniel Bernardes |
629 | + */ |
630 | +@ServiceProvider(service = ExporterUI.class) |
631 | +public class UIExporterPajek implements ExporterUI { |
632 | + |
633 | + private UIExporterPajekPanel panel; |
634 | + private ExporterPajek exporterPajek; |
635 | + private ExporterPajekSettings settings = new ExporterPajekSettings(); |
636 | + |
637 | + public void setup(Exporter exporter) { |
638 | + exporterPajek = (ExporterPajek) exporter; |
639 | + settings.load(exporterPajek); |
640 | + panel.setup(exporterPajek); |
641 | + } |
642 | + |
643 | + public void unsetup(boolean update) { |
644 | + if (update) { |
645 | + panel.unsetup(exporterPajek); |
646 | + settings.save(exporterPajek); |
647 | + } |
648 | + panel = null; |
649 | + exporterPajek = null; |
650 | + } |
651 | + |
652 | + public JPanel getPanel() { |
653 | + panel = new UIExporterPajekPanel(); |
654 | + return panel; |
655 | + } |
656 | + |
657 | + public boolean isUIForExporter(Exporter exporter) { |
658 | + return exporter instanceof ExporterPajek; |
659 | + } |
660 | + |
661 | + public String getDisplayName() { |
662 | + return NbBundle.getMessage(UIExporterPajek.class, "UIExporterPajek.name"); |
663 | + } |
664 | + |
665 | + private static class ExporterPajekSettings { |
666 | + |
667 | + private boolean exportPosition = true; |
668 | + private boolean exportEdgeWeight = true; |
669 | + |
670 | + private void save(ExporterPajek exporterPajek) { |
671 | + this.exportPosition = exporterPajek.isExportPosition(); |
672 | + this.exportEdgeWeight = exporterPajek.isExportEdgeWeight(); |
673 | + } |
674 | + |
675 | + private void load(ExporterPajek exporterPajek) { |
676 | + exporterPajek.setExportPosition(exportPosition); |
677 | + exporterPajek.setExportEdgeWeight(exportEdgeWeight); |
678 | + } |
679 | + } |
680 | +} |
681 | |
682 | === added file 'ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajekPanel.java' |
683 | --- ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajekPanel.java 1970-01-01 00:00:00 +0000 |
684 | +++ ExportPluginUI/src/org/gephi/ui/exporter/plugin/UIExporterPajekPanel.java 2011-06-14 13:34:29 +0000 |
685 | @@ -0,0 +1,97 @@ |
686 | +/* |
687 | +Copyright 2008-2010 Gephi |
688 | +Authors : Mathieu Bastian <mathieu.bastian@gephi.org> |
689 | +Website : http://www.gephi.org |
690 | + |
691 | +This file is part of Gephi. |
692 | + |
693 | +Gephi is free software: you can redistribute it and/or modify |
694 | +it under the terms of the GNU Affero General Public License as |
695 | +published by the Free Software Foundation, either version 3 of the |
696 | +License, or (at your option) any later version. |
697 | + |
698 | +Gephi is distributed in the hope that it will be useful, |
699 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
700 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
701 | +GNU Affero General Public License for more details. |
702 | + |
703 | +You should have received a copy of the GNU Affero General Public License |
704 | +along with Gephi. If not, see <http://www.gnu.org/licenses/>. |
705 | + */ |
706 | +package org.gephi.ui.exporter.plugin; |
707 | + |
708 | +import org.gephi.io.exporter.plugin.ExporterPajek; |
709 | + |
710 | +/** |
711 | + * |
712 | + * @author Daniel Bernardes |
713 | + */ |
714 | +public class UIExporterPajekPanel extends javax.swing.JPanel { |
715 | + |
716 | + public UIExporterPajekPanel() { |
717 | + initComponents(); |
718 | + } |
719 | + |
720 | + public void setup(ExporterPajek exporterPajek) { |
721 | + positionExportCheckbox.setSelected(exporterPajek.isExportPosition()); |
722 | + edgeWeightCheckbox.setSelected(exporterPajek.isExportEdgeWeight()); |
723 | + } |
724 | + |
725 | + public void unsetup(ExporterPajek exporterPajek) { |
726 | + exporterPajek.setExportPosition(positionExportCheckbox.isSelected()); |
727 | + exporterPajek.setExportEdgeWeight(edgeWeightCheckbox.isSelected()); |
728 | + } |
729 | + |
730 | + /** This method is called from within the constructor to |
731 | + * initialize the form. |
732 | + * WARNING: Do NOT modify this code. The content of this method is |
733 | + * always regenerated by the Form Editor. |
734 | + */ |
735 | + @SuppressWarnings("unchecked") |
736 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
737 | + private void initComponents() { |
738 | + |
739 | + labelExport = new javax.swing.JLabel(); |
740 | + positionExportCheckbox = new javax.swing.JCheckBox(); |
741 | + edgeWeightCheckbox = new javax.swing.JCheckBox(); |
742 | + |
743 | + |
744 | + labelExport.setText(org.openide.util.NbBundle.getMessage(UIExporterPajekPanel.class, "UIExporterPajekPanel.labelExport.text")); // NOI18N |
745 | + |
746 | + positionExportCheckbox.setText(org.openide.util.NbBundle.getMessage(UIExporterPajekPanel.class, "UIExporterPajekPanel.positionExportCheckbox.text")); // NOI18N |
747 | + |
748 | + edgeWeightCheckbox.setText(org.openide.util.NbBundle.getMessage(UIExporterPajekPanel.class, "UIExporterPajekPanel.edgeWeightCheckbox.text")); // NOI18N |
749 | + |
750 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
751 | + this.setLayout(layout); |
752 | + layout.setHorizontalGroup( |
753 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
754 | + .addGroup(layout.createSequentialGroup() |
755 | + .addContainerGap() |
756 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
757 | + .addGroup(layout.createSequentialGroup() |
758 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
759 | + .addGroup(layout.createSequentialGroup() |
760 | + .addComponent(labelExport) |
761 | + .addGap(18, 18, 18) |
762 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
763 | + .addComponent(edgeWeightCheckbox) |
764 | + .addComponent(positionExportCheckbox))))))) |
765 | + ); |
766 | + layout.setVerticalGroup( |
767 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
768 | + .addGroup(layout.createSequentialGroup() |
769 | + .addContainerGap() |
770 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
771 | + .addComponent(labelExport) |
772 | + .addComponent(positionExportCheckbox)) |
773 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
774 | + .addComponent(edgeWeightCheckbox)) |
775 | + ); |
776 | + }// </editor-fold>//GEN-END:initComponents |
777 | + // Variables declaration - do not modify//GEN-BEGIN:variables |
778 | + private javax.swing.JCheckBox edgeWeightCheckbox; |
779 | + private javax.swing.JLabel labelExport; |
780 | + private javax.swing.JCheckBox positionExportCheckbox; |
781 | + // End of variables declaration//GEN-END:variables |
782 | +} |
Great, that sounds right. However we need an UI for configuring the options I think.