提交 e747df94 编写于 作者: M Mathieu Bastian

Fix label custom coloring and remove unneeded reset actions

上级 0702b6f3
...@@ -130,37 +130,6 @@ public class ActionsToolbar extends JToolBar { ...@@ -130,37 +130,6 @@ public class ActionsToolbar extends JToolBar {
add(resetColorButton); add(resetColorButton);
//Reset sizes //Reset sizes
final JButton resetSizeButton = new JButton();
resetSizeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetSize.png")));
resetSizeButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetSizes"));
resetSizeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes()) {
n.setSize(size);
}
}
});
resetSizeButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
Object res = JOptionPane.showInputDialog(resetSizeButton, NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetSizes.dialog"), "" + size);
if (res != null) {
try {
size = Float.parseFloat((String) res);
} catch (Exception ex) {
}
}
}
}
});
add(resetSizeButton);
//Reset label colors //Reset label colors
final JButton resetLabelColorButton = new JButton(); final JButton resetLabelColorButton = new JButton();
resetLabelColorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelColor.png"))); resetLabelColorButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelColor.png")));
...@@ -173,15 +142,17 @@ public class ActionsToolbar extends JToolBar { ...@@ -173,15 +142,17 @@ public class ActionsToolbar extends JToolBar {
Graph graph = gm.getGraphVisible(); Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes().toArray()) { for (Node n : graph.getNodes().toArray()) {
n.getTextProperties().setColor(Color.BLACK); n.getTextProperties().setColor(Color.BLACK);
n.getTextProperties().setAlpha(0f);
} }
for (Edge e : graph.getEdges().toArray()) { for (Edge e : graph.getEdges().toArray()) {
e.getTextProperties().setColor(Color.BLACK); e.getTextProperties().setColor(Color.BLACK);
e.getTextProperties().setAlpha(0f);
} }
} }
}); });
add(resetLabelColorButton); add(resetLabelColorButton);
//Reset label colors //Reset label visible
final JButton resetLabelVisibleButton = new JButton(); final JButton resetLabelVisibleButton = new JButton();
resetLabelVisibleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelVisible.png"))); resetLabelVisibleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelVisible.png")));
resetLabelVisibleButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetLabelVisible")); resetLabelVisibleButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetLabelVisible"));
...@@ -200,23 +171,6 @@ public class ActionsToolbar extends JToolBar { ...@@ -200,23 +171,6 @@ public class ActionsToolbar extends JToolBar {
} }
}); });
add(resetLabelVisibleButton); add(resetLabelVisibleButton);
//Reset label size
JButton resetLabelSizeButton = new JButton();
resetLabelSizeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/resetLabelSize.png")));
resetLabelSizeButton.setToolTipText(NbBundle.getMessage(ActionsToolbar.class, "ActionsToolbar.resetLabelSizes"));
resetLabelSizeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes()) {
n.getTextProperties().setSize(1f);
}
}
});
add(resetLabelSizeButton);
} }
private void initDesign() { private void initDesign() {
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
*/ */
package org.gephi.visualization.model; package org.gephi.visualization.model;
import java.awt.geom.Rectangle2D;
import org.gephi.graph.api.ElementProperties; import org.gephi.graph.api.ElementProperties;
/** /**
......
...@@ -100,7 +100,7 @@ public abstract class EdgeModel implements Model, TextModel { ...@@ -100,7 +100,7 @@ public abstract class EdgeModel implements Model, TextModel {
@Override @Override
public boolean hasCustomTextColor() { public boolean hasCustomTextColor() {
return edge.getTextProperties().getR() > 0; return edge.getTextProperties().getAlpha()> 0;
} }
@Override @Override
......
...@@ -165,7 +165,7 @@ public abstract class NodeModel implements Model, TextModel { ...@@ -165,7 +165,7 @@ public abstract class NodeModel implements Model, TextModel {
@Override @Override
public boolean hasCustomTextColor() { public boolean hasCustomTextColor() {
return node.getTextProperties().getR() > 0; return node.getTextProperties().getAlpha()> 0;
} }
@Override @Override
......
...@@ -53,10 +53,7 @@ SelectionToolbar.drag.tooltip = Drag ...@@ -53,10 +53,7 @@ SelectionToolbar.drag.tooltip = Drag
ActionsToolbar.centerOnGraph = Center On Graph ActionsToolbar.centerOnGraph = Center On Graph
ActionsToolbar.centerOnZero = Center On Zero ActionsToolbar.centerOnZero = Center On Zero
ActionsToolbar.resetColors = Reset colors ActionsToolbar.resetColors = Reset colors
ActionsToolbar.resetSizes = Reset size
ActionsToolbar.resetSizes.dialog = Set size
ActionsToolbar.resetLabelColors = Reset label color ActionsToolbar.resetLabelColors = Reset label color
ActionsToolbar.resetLabelSizes = Reset label size
ActionsToolbar.resetLabelVisible = Reset label visible ActionsToolbar.resetLabelVisible = Reset label visible
LabelAttributesPanel.title = Label text settings LabelAttributesPanel.title = Label text settings
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册