2
* Copyright 2008-2010 Gephi
3
* Authors : Cezary Bartosiak
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 General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (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 General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Gephi. If not, see <http://www.gnu.org/licenses/>.
21
package org.gephi.ui.complexgenerator.plugin;
23
import javax.swing.JPanel;
24
import org.gephi.io.complexgenerator.plugin.BarabasiAlbert;
25
import org.gephi.io.complexgenerator.plugin.BarabasiAlbertUI;
26
import org.gephi.io.generator.spi.Generator;
27
import org.openide.util.lookup.ServiceProvider;
32
* @author Cezary Bartosiak
34
@ServiceProvider(service = BarabasiAlbertUI.class)
35
public class BarabasiAlbertUIImpl implements BarabasiAlbertUI {
36
private BarabasiAlbertPanel panel;
37
private BarabasiAlbert barabasiAlbert;
39
public BarabasiAlbertUIImpl() { }
41
public JPanel getPanel() {
43
panel = new BarabasiAlbertPanel();
44
return BarabasiAlbertPanel.createValidationPanel(panel);
47
public void setup(Generator generator) {
48
this.barabasiAlbert = (BarabasiAlbert)generator;
51
panel = new BarabasiAlbertPanel();
53
panel.NField.setText(String.valueOf(barabasiAlbert.getN()));
54
panel.m0Field.setText(String.valueOf(barabasiAlbert.getm0()));
55
panel.MField.setText(String.valueOf(barabasiAlbert.getM()));
58
public void unsetup() {
59
barabasiAlbert.setN(Integer.parseInt(panel.NField.getText()));
60
barabasiAlbert.setm0(Integer.parseInt(panel.m0Field.getText()));
61
barabasiAlbert.setM(Integer.parseInt(panel.MField.getText()));