2
Copyright 2008-2010 Gephi
3
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
4
Website : http://www.gephi.org
6
This file is part of Gephi.
8
Gephi is free software: you can redistribute it and/or modify
9
it under the terms of the GNU Affero General Public License as
10
published by the Free Software Foundation, either version 3 of the
11
License, or (at your option) any later version.
13
Gephi is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU Affero General Public License for more details.
18
You should have received a copy of the GNU Affero General Public License
19
along with Gephi. If not, see <http://www.gnu.org/licenses/>.
21
package org.gephi.ui.exporter.plugin;
23
import javax.swing.JPanel;
24
import org.gephi.io.exporter.plugin.ExporterGraphML;
25
import org.gephi.io.exporter.spi.Exporter;
26
import org.gephi.io.exporter.spi.ExporterUI;
27
import org.openide.util.NbBundle;
28
import org.openide.util.lookup.ServiceProvider;
32
* @author Mathieu Bastian
34
@ServiceProvider(service = ExporterUI.class)
35
public class UIExporterGraphML implements ExporterUI {
37
private UIExporterGraphMLPanel panel;
38
private ExporterGraphML exporterGraphML;
39
private ExporterGraphMLSettings settings = new ExporterGraphMLSettings();
41
public void setup(Exporter exporter) {
42
exporterGraphML = (ExporterGraphML) exporter;
43
settings.load(exporterGraphML);
44
panel.setup(exporterGraphML);
47
public void unsetup(boolean update) {
49
panel.unsetup(exporterGraphML);
50
settings.save(exporterGraphML);
53
exporterGraphML = null;
56
public JPanel getPanel() {
57
panel = new UIExporterGraphMLPanel();
61
public boolean isUIForExporter(Exporter exporter) {
62
return exporter instanceof ExporterGraphML;
65
public String getDisplayName() {
66
return NbBundle.getMessage(UIExporterGraphML.class, "UIExporterGraphML.name");
69
private static class ExporterGraphMLSettings {
71
private boolean normalize = false;
72
private boolean exportColors = true;
73
private boolean exportPosition = true;
74
private boolean exportSize = true;
75
private boolean exportAttributes = true;
76
private boolean exportHierarchy = false;
78
private void save(ExporterGraphML exporterGraphML) {
79
this.normalize = exporterGraphML.isNormalize();
80
this.exportColors = exporterGraphML.isExportColors();
81
this.exportPosition = exporterGraphML.isExportPosition();
82
this.exportSize = exporterGraphML.isExportSize();
83
this.exportAttributes = exporterGraphML.isExportAttributes();
84
this.exportHierarchy = exporterGraphML.isExportHierarchy();
87
private void load(ExporterGraphML exporterGraphML) {
88
exporterGraphML.setNormalize(normalize);
89
exporterGraphML.setExportColors(exportColors);
90
exporterGraphML.setExportAttributes(exportAttributes);
91
exporterGraphML.setExportPosition(exportPosition);
92
exporterGraphML.setExportSize(exportSize);
93
exporterGraphML.setExportHierarchy(exportHierarchy);