Update some Tools to the new GraphAPI

Esse commit está contido em:
Mathieu Bastian
2013-04-16 23:54:46 -07:00
commit 3d12ba9b88
9 arquivos alterados com 384 adições e 353 exclusões
-4
Ver Arquivo
@@ -20,10 +20,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>algorithms-plugin</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>data-attributes-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>datalab-api</artifactId>
@@ -1,47 +1,46 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import org.gephi.tools.spi.ToolSelectionType;
import java.awt.Color;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@@ -52,6 +51,7 @@ import org.gephi.graph.api.Node;
import org.gephi.tools.spi.NodePressingEventListener;
import org.gephi.tools.spi.Tool;
import org.gephi.tools.spi.ToolEventListener;
import org.gephi.tools.spi.ToolSelectionType;
import org.gephi.tools.spi.ToolUI;
import org.gephi.ui.tools.plugin.BrushPanel;
import org.openide.util.Lookup;
@@ -73,9 +73,11 @@ public class Brush implements Tool {
private float intensity = 0.3f;
private DiffusionMethods.DiffusionMethod diffusionMethod = DiffusionMethods.DiffusionMethod.NEIGHBORS;
@Override
public void select() {
}
@Override
public void unselect() {
listeners = null;
brushPanel = null;
@@ -84,32 +86,32 @@ public class Brush implements Tool {
private void brush(Node[] nodes) {
for (Node node : nodes) {
float r = node.getNodeData().r();
float g = node.getNodeData().g();
float b = node.getNodeData().b();
float r = node.r();
float g = node.g();
float b = node.b();
r = intensity * color[0] + (1 - intensity) * r;
g = intensity * color[1] + (1 - intensity) * g;
b = intensity * color[2] + (1 - intensity) * b;
node.getNodeData().setR(r);
node.getNodeData().setG(g);
node.getNodeData().setB(b);
node.setR(r);
node.setG(g);
node.setB(b);
}
for (Node node : getDiffusedNodes(nodes)) {
float r = node.getNodeData().r();
float g = node.getNodeData().g();
float b = node.getNodeData().b();
float r = node.r();
float g = node.g();
float b = node.b();
r = intensity * color[0] + (1 - intensity) * r;
g = intensity * color[1] + (1 - intensity) * g;
b = intensity * color[2] + (1 - intensity) * b;
node.getNodeData().setR(r);
node.getNodeData().setG(g);
node.getNodeData().setB(b);
node.setR(r);
node.setG(g);
node.setB(b);
}
}
private Node[] getDiffusedNodes(Node[] input) {
GraphModel model = Lookup.getDefault().lookup(GraphController.class).getModel();
GraphModel model = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
switch (diffusionMethod) {
case NEIGHBORS:
return DiffusionMethods.getNeighbors(model.getGraphVisible(), input);
@@ -131,10 +133,11 @@ public class Brush implements Tool {
return new Node[0];
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[1];
listeners[0] = new NodePressingEventListener() {
@Override
public void pressingNodes(Node[] nodes) {
diffusionMethod = brushPanel.getDiffusionMethod();
color = brushPanel.getColor().getColorComponents(color);
@@ -142,15 +145,17 @@ public class Brush implements Tool {
brush(nodes);
}
@Override
public void released() {
}
};
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
brushPanel = new BrushPanel();
brushPanel.setDiffusionMethod(diffusionMethod);
@@ -159,24 +164,29 @@ public class Brush implements Tool {
return brushPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(Brush.class, "Brush.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/brush.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(Painter.class, "Brush.description");
}
@Override
public int getPosition() {
return 110;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION;
}
@@ -1,50 +1,48 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import java.util.ArrayList;
import java.util.Iterator;
import org.gephi.utils.collection.avl.AVLItemAccessor;
import org.gephi.utils.collection.avl.ParamAVLTree;
import java.util.HashSet;
import java.util.Set;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.Node;
@@ -58,11 +56,9 @@ public class DiffusionMethods {
public static Node[] getNeighbors(Graph graph, Node[] nodes) {
graph.readLock();
NodeTree nodeTree = new NodeTree();
Set<Node> nodeTree = new HashSet<Node>();
for (Node n : nodes) {
for (Node neighbor : graph.getNeighbors(n).toArray()) {
nodeTree.add(neighbor);
}
nodeTree.addAll(graph.getNeighbors(n).toCollection());
}
graph.readUnlock();
//remove original nodes
@@ -74,20 +70,16 @@ public class DiffusionMethods {
public static Node[] getNeighborsOfNeighbors(Graph graph, Node[] nodes) {
graph.readLock();
NodeTree nodeTree = new NodeTree();
Set<Node> nodeTree = new HashSet<Node>();
for (Node n : nodes) {
for (Node neighbor : graph.getNeighbors(n).toArray()) {
nodeTree.add(neighbor);
}
nodeTree.addAll(graph.getNeighbors(n).toCollection());
}
//remove original nodes
for (Node n : nodes) {
nodeTree.remove(n);
}
for (Node n : nodeTree.toArray(new Node[0])) {
for (Node neighbor : graph.getNeighbors(n).toArray()) {
nodeTree.add(neighbor);
}
nodeTree.addAll(graph.getNeighbors(n).toCollection());
}
graph.readUnlock();
//remove original nodes
@@ -99,11 +91,9 @@ public class DiffusionMethods {
public static Node[] getPredecessors(DirectedGraph graph, Node[] nodes) {
graph.readLock();
NodeTree nodeTree = new NodeTree();
Set<Node> nodeTree = new HashSet<Node>();
for (Node n : nodes) {
for (Node neighbor : graph.getPredecessors(n).toArray()) {
nodeTree.add(neighbor);
}
nodeTree.addAll(graph.getPredecessors(n).toCollection());
}
graph.readUnlock();
//remove original nodes
@@ -115,11 +105,9 @@ public class DiffusionMethods {
public static Node[] getSuccessors(DirectedGraph graph, Node[] nodes) {
graph.readLock();
NodeTree nodeTree = new NodeTree();
Set<Node> nodeTree = new HashSet<Node>();
for (Node n : nodes) {
for (Node neighbor : graph.getSuccessors(n).toArray()) {
nodeTree.add(neighbor);
}
nodeTree.addAll(graph.getSuccessors(n).toCollection());
}
graph.readUnlock();
//remove original nodes
@@ -151,24 +139,4 @@ public class DiffusionMethods {
return getName();
}
}
//NodeTree
private static class NodeTree extends ParamAVLTree<Node> {
public NodeTree(Node[] initialNodes) {
this();
for (int i = 0; i < initialNodes.length; i++) {
add(initialNodes[i]);
}
}
public NodeTree() {
super(new AVLItemAccessor<Node>() {
public int getNumber(Node item) {
return item.getId();
}
});
}
}
}
@@ -86,21 +86,25 @@ public class EdgePencil implements Tool {
//Add workspace listener for updating edge pencil panel options and status
Lookup.getDefault().lookup(ProjectController.class).addWorkspaceListener(new WorkspaceListener() {
@Override
public void initialize(Workspace workspace) {
updatePanel();
}
@Override
public void select(Workspace workspace) {
updatePanel();
}
@Override
public void unselect(Workspace workspace) {
}
@Override
public void close(Workspace workspace) {
}
@Override
public void disable() {
}
});
@@ -109,17 +113,19 @@ public class EdgePencil implements Tool {
private void updatePanel() {
if (edgePencilPanel != null) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
if (gc.getModel() != null) {
edgePencilPanel.setType(gc.getModel().isDirected() || gc.getModel().isMixed());
if (gc.getGraphModel() != null) {
edgePencilPanel.setType(gc.getGraphModel().isDirected() || gc.getGraphModel().isMixed());
}
sourceNode = null;
edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status1"));
}
}
@Override
public void select() {
}
@Override
public void unselect() {
listeners = null;
sourceNode = null;
@@ -127,10 +133,11 @@ public class EdgePencil implements Tool {
weight = edgePencilPanel.getWeight();
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[2];
listeners[0] = new NodeClickEventListener() {
@Override
public void clickNodes(Node[] nodes) {
Node n = nodes[0];
@@ -142,16 +149,14 @@ public class EdgePencil implements Tool {
weight = edgePencilPanel.getWeight();
boolean directed = edgePencilPanel.isDirected;
Edge edge = Lookup.getDefault().lookup(GraphElementsController.class).createEdge(sourceNode, n, directed);
edge.getEdgeData().setR(color.getRed() / 255f);
edge.getEdgeData().setG(color.getGreen() / 255f);
edge.getEdgeData().setB(color.getBlue() / 255f);
edge.setColor(color);
sourceNode = null;
edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status1"));
}
}
};
listeners[1] = new MouseClickEventListener() {
@Override
public void mouseClick(int[] positionViewport, float[] position3d) {
if (sourceNode != null) {
//Cancel
@@ -163,9 +168,10 @@ public class EdgePencil implements Tool {
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
edgePencilPanel = new EdgePencilPanel();
edgePencilPanel.setColor(color);
@@ -174,24 +180,29 @@ public class EdgePencil implements Tool {
return edgePencilPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(EdgePencil.class, "EdgePencil.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/edgepencil.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(EdgePencil.class, "EdgePencil.description");
}
@Override
public int getPosition() {
return 130;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION;
}
@@ -1,44 +1,44 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import java.awt.Color;
@@ -56,7 +56,6 @@ import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.Node;
import org.gephi.graph.api.NodeData;
import org.gephi.tools.spi.NodeClickEventListener;
import org.gephi.tools.spi.Tool;
import org.gephi.tools.spi.ToolEventListener;
@@ -89,18 +88,21 @@ public class HeatMap implements Tool {
gradientPositions = new float[]{0f, 0.5f, 1f};
}
@Override
public void select() {
}
@Override
public void unselect() {
listeners = null;
heatMapPanel = null;
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[1];
listeners[0] = new NodeClickEventListener() {
@Override
public void clickNodes(Node[] nodes) {
try {
Node n = nodes[0];
@@ -118,12 +120,12 @@ public class HeatMap implements Tool {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
AbstractShortestPathAlgorithm algorithm;
if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
DirectedGraph graph = (DirectedGraph) gc.getModel().getGraphVisible();
if (gc.getGraphModel().isDirected()) {
DirectedGraph graph = gc.getGraphModel().getDirectedGraphVisible();
algorithm = new BellmanFordShortestPathAlgorithm(graph, n);
algorithm.compute();
} else {
Graph graph = gc.getModel().getGraphVisible();
Graph graph = gc.getGraphModel().getGraphVisible();
algorithm = new DijkstraShortestPathAlgorithm(graph, n);
algorithm.compute();
}
@@ -139,20 +141,20 @@ public class HeatMap implements Tool {
maxDistance++; //+1 to have the maxdistance nodes a ratio<1
}
if (maxDistance > 0) {
for (Entry<NodeData, Double> entry : algorithm.getDistances().entrySet()) {
NodeData node = entry.getKey();
for (Entry<Node, Double> entry : algorithm.getDistances().entrySet()) {
Node node = entry.getKey();
if (!Double.isInfinite(entry.getValue())) {
float ratio = (float) (entry.getValue() / maxDistance);
Color c = linearGradient.getValue(ratio);
node.setColor(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f);
node.setColor(c);
} else if (!dontPaintUnreachable) {
Color c = colors[colors.length - 1];
node.setColor(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f);
node.setColor(c);
}
}
}
Color c = colors[0];
n.getNodeData().setColor(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f);
n.setColor(c);
heatMapPanel.setStatus(NbBundle.getMessage(HeatMap.class, "HeatMap.status.maxdistance") + new DecimalFormat("#.##").format(algorithm.getMaxDistance()));
} catch (Exception e) {
Logger.getLogger("").log(Level.SEVERE, "", e);
@@ -162,32 +164,38 @@ public class HeatMap implements Tool {
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
heatMapPanel = new HeatMapPanel(gradientColors, gradientPositions, dontPaintUnreachable);
return heatMapPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(HeatMap.class, "HeatMap.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/heatmap.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(ShortestPath.class, "HeatMap.description");
}
@Override
public int getPosition() {
return 150;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION;
}
@@ -1,44 +1,44 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import java.awt.Color;
@@ -47,6 +47,7 @@ import javax.swing.ImageIcon;
import javax.swing.JPanel;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.Node;
import org.gephi.tools.spi.MouseClickEventListener;
import org.gephi.tools.spi.Tool;
@@ -78,39 +79,42 @@ public class NodePencil implements Tool {
size = 10f;
}
@Override
public void select() {
}
@Override
public void unselect() {
listeners = null;
nodePencilPanel = null;
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[1];
listeners[0] = new MouseClickEventListener() {
@Override
public void mouseClick(int[] positionViewport, float[] position3d) {
color = nodePencilPanel.getColor();
size = nodePencilPanel.getNodeSize();
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
Graph graph = gc.getModel().getGraph();
Node node = gc.getModel().factory().newNode();
node.getNodeData().setX(position3d[0]);
node.getNodeData().setY(position3d[1]);
node.getNodeData().setSize(size);
node.getNodeData().setR(color.getRed() / 255f);
node.getNodeData().setG(color.getGreen() / 255f);
node.getNodeData().setB(color.getBlue() / 255f);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraph();
Node node = gm.factory().newNode();
node.setX(position3d[0]);
node.setY(position3d[1]);
node.setSize(size);
node.setColor(color);
graph.addNode(node);
}
};
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
nodePencilPanel = new NodePencilPanel();
nodePencilPanel.setColor(color);
@@ -118,24 +122,29 @@ public class NodePencil implements Tool {
return nodePencilPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(NodePencil.class, "NodePencil.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/nodepencil.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(NodePencil.class, "NodePencil.description");
}
@Override
public int getPosition() {
return 120;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.NONE;
}
@@ -1,44 +1,44 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import java.awt.Color;
@@ -68,66 +68,76 @@ public class Painter implements Tool {
private float[] color = {1f, 0f, 0f};
private float intensity = 0.3f;
@Override
public void select() {
}
@Override
public void unselect() {
listeners = null;
painterPanel = null;
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[1];
listeners[0] = new NodePressingEventListener() {
@Override
public void pressingNodes(Node[] nodes) {
color = painterPanel.getColor().getColorComponents(color);
for (Node node : nodes) {
float r = node.getNodeData().r();
float g = node.getNodeData().g();
float b = node.getNodeData().b();
float r = node.r();
float g = node.g();
float b = node.b();
r = intensity * color[0] + (1 - intensity) * r;
g = intensity * color[1] + (1 - intensity) * g;
b = intensity * color[2] + (1 - intensity) * b;
node.getNodeData().setR(r);
node.getNodeData().setG(g);
node.getNodeData().setB(b);
node.setR(r);
node.setG(g);
node.setB(b);
}
}
@Override
public void released() {
}
};
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
painterPanel = new PainterPanel();
painterPanel.setColor(new Color(color[0], color[1], color[2]));
return painterPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(Painter.class, "Painter.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/painter.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(Painter.class, "Painter.description");
}
@Override
public int getPosition() {
return 100;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION;
}
@@ -1,44 +1,44 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import java.awt.Color;
@@ -48,17 +48,17 @@ import javax.swing.JPanel;
import org.gephi.algorithms.shortestpath.AbstractShortestPathAlgorithm;
import org.gephi.algorithms.shortestpath.BellmanFordShortestPathAlgorithm;
import org.gephi.algorithms.shortestpath.DijkstraShortestPathAlgorithm;
import org.gephi.graph.api.DirectedGraph;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.graph.api.Node;
import org.gephi.tools.spi.MouseClickEventListener;
import org.gephi.tools.spi.NodeClickEventListener;
import org.gephi.tools.spi.Tool;
import org.gephi.tools.spi.ToolEventListener;
import org.gephi.tools.spi.ToolSelectionType;
import org.gephi.ui.tools.plugin.ShortestPathPanel;
import org.gephi.tools.spi.ToolUI;
import org.gephi.ui.tools.plugin.ShortestPathPanel;
import org.gephi.visualization.VizController;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
@@ -85,12 +85,14 @@ public class ShortestPath implements Tool {
color = Color.RED;
}
@Override
public void select() {
settingEdgeSourceColor = !VizController.getInstance().getVizModel().isEdgeHasUniColor();
VizController.getInstance().getVizModel().setEdgeHasUniColor(true);
VizController.getInstance().getVizConfig().setEnableAutoSelect(false);
}
@Override
public void unselect() {
listeners = null;
sourceNode = null;
@@ -99,10 +101,11 @@ public class ShortestPath implements Tool {
VizController.getInstance().getVizConfig().setEnableAutoSelect(true);
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[2];
listeners[0] = new NodeClickEventListener() {
@Override
public void clickNodes(Node[] nodes) {
Node n = nodes[0];
if (sourceNode == null) {
@@ -111,35 +114,35 @@ public class ShortestPath implements Tool {
shortestPathPanel.setStatus(NbBundle.getMessage(ShortestPath.class, "ShortestPath.status2"));
} else if (n != sourceNode) {
color = shortestPathPanel.getColor();
float[] colorArray = new float[]{color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f};
Node targetNode = n;
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
AbstractShortestPathAlgorithm algorithm;
if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
algorithm = new BellmanFordShortestPathAlgorithm((DirectedGraph) gc.getModel().getGraphVisible(), sourceNode);
if (gm.isDirected()) {
algorithm = new BellmanFordShortestPathAlgorithm(gm.getDirectedGraphVisible(), sourceNode);
} else {
algorithm = new DijkstraShortestPathAlgorithm(gc.getModel().getGraphVisible(), sourceNode);
algorithm = new DijkstraShortestPathAlgorithm(gm.getGraphVisible(), sourceNode);
}
algorithm.compute();
double distance;
if ((distance = algorithm.getDistances().get(targetNode.getNodeData())) != Double.POSITIVE_INFINITY) {
targetNode.getNodeData().setColor(colorArray[0], colorArray[1], colorArray[2]);
if ((distance = algorithm.getDistances().get(targetNode)) != Double.POSITIVE_INFINITY) {
targetNode.setColor(color);
VizController.getInstance().selectNode(targetNode);
Edge predecessorEdge = algorithm.getPredecessorIncoming(targetNode);
Node predecessor = algorithm.getPredecessor(targetNode);
while (predecessorEdge != null && predecessor.getNodeData() != sourceNode.getNodeData()) {
predecessorEdge.getEdgeData().setColor(colorArray[0], colorArray[1], colorArray[2]);
while (predecessorEdge != null && predecessor != sourceNode) {
predecessorEdge.setColor(color);
VizController.getInstance().selectEdge(predecessorEdge);
predecessor.getNodeData().setColor(colorArray[0], colorArray[1], colorArray[2]);
predecessor.setColor(color);
VizController.getInstance().selectNode(predecessor);
predecessorEdge = algorithm.getPredecessorIncoming(predecessor);
predecessor = algorithm.getPredecessor(predecessor);
}
predecessorEdge.getEdgeData().setColor(colorArray[0], colorArray[1], colorArray[2]);
predecessorEdge.setColor(color);
VizController.getInstance().selectEdge(predecessorEdge);
sourceNode.getNodeData().setColor(colorArray[0], colorArray[1], colorArray[2]);
sourceNode.setColor(color);
VizController.getInstance().selectNode(sourceNode);
shortestPathPanel.setResult(NbBundle.getMessage(ShortestPath.class, "ShortestPath.result", distance));
} else {
@@ -153,7 +156,7 @@ public class ShortestPath implements Tool {
}
};
listeners[1] = new MouseClickEventListener() {
@Override
public void mouseClick(int[] positionViewport, float[] position3d) {
if (sourceNode != null) {
//Cancel
@@ -167,9 +170,10 @@ public class ShortestPath implements Tool {
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
shortestPathPanel = new ShortestPathPanel();
shortestPathPanel.setColor(color);
@@ -177,24 +181,29 @@ public class ShortestPath implements Tool {
return shortestPathPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(ShortestPath.class, "ShortestPath.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/shortestpath.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(ShortestPath.class, "ShortestPath.description");
}
@Override
public int getPosition() {
return 140;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION;
}
@@ -1,44 +1,44 @@
/*
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
Copyright 2008-2010 Gephi
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
Website : http://www.gephi.org
This file is part of Gephi.
This file is part of Gephi.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2011 Gephi Consortium. All rights reserved.
Copyright 2011 Gephi Consortium. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The contents of this file are subject to the terms of either the GNU
General Public License Version 3 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://gephi.org/about/legal/license-notice/
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License files at
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 3, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 3] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 3 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 3 code and therefore, elected the GPL
Version 3 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
Contributor(s):
Portions Copyrighted 2011 Gephi Consortium.
*/
Portions Copyrighted 2011 Gephi Consortium.
*/
package org.gephi.tools.plugin;
import javax.swing.Icon;
@@ -69,9 +69,11 @@ public class Sizer implements Tool {
private Node[] nodes;
private float[] sizes;
@Override
public void select() {
}
@Override
public void unselect() {
listeners = null;
sizerPanel = null;
@@ -79,24 +81,27 @@ public class Sizer implements Tool {
sizes = null;
}
@Override
public ToolEventListener[] getListeners() {
listeners = new ToolEventListener[1];
listeners[0] = new NodePressAndDraggingEventListener() {
@Override
public void pressNodes(Node[] nodes) {
Sizer.this.nodes = nodes;
sizes = new float[nodes.length];
for (int i = 0; i < nodes.length; i++) {
Node n = nodes[i];
sizes[i] = n.getNodeData().getSize();
sizes[i] = n.size();
}
}
@Override
public void released() {
nodes = null;
sizerPanel.setAvgSize(-1);
}
@Override
public void drag(float displacementX, float displacementY) {
if (nodes != null) {
float averageSize = 0f;
@@ -108,7 +113,7 @@ public class Sizer implements Tool {
size = LIMIT;
}
averageSize += size;
n.getNodeData().setSize(size);
n.setSize(size);
}
averageSize /= nodes.length;
sizerPanel.setAvgSize(averageSize);
@@ -118,34 +123,39 @@ public class Sizer implements Tool {
return listeners;
}
@Override
public ToolUI getUI() {
return new ToolUI() {
@Override
public JPanel getPropertiesBar(Tool tool) {
sizerPanel = new SizerPanel();
return sizerPanel;
}
@Override
public String getName() {
return NbBundle.getMessage(Sizer.class, "Sizer.name");
}
@Override
public Icon getIcon() {
return new ImageIcon(getClass().getResource("/org/gephi/tools/plugin/resources/sizer.png"));
}
@Override
public String getDescription() {
return NbBundle.getMessage(Sizer.class, "Sizer.description");
}
@Override
public int getPosition() {
return 105;
}
};
}
@Override
public ToolSelectionType getSelectionType() {
return ToolSelectionType.SELECTION_AND_DRAGGING;
}
}