use of org.gephi.ui.components.JColorButton in project gephi by gephi.
the class GlobalSettingsPanel method refreshSharedConfig.
private void refreshSharedConfig() {
VizModel vizModel = VizController.getInstance().getVizModel();
setEnable(!vizModel.isDefaultModel());
if (vizModel.isDefaultModel()) {
return;
}
if (autoSelectNeigborCheckbox.isSelected() != vizModel.isAutoSelectNeighbor()) {
autoSelectNeigborCheckbox.setSelected(vizModel.isAutoSelectNeighbor());
}
((JColorButton) backgroundColorButton).setColor(vizModel.getBackgroundColor());
if (hightlightCheckBox.isSelected() != vizModel.isLightenNonSelectedAuto()) {
hightlightCheckBox.setSelected(vizModel.isLightenNonSelectedAuto());
}
}
use of org.gephi.ui.components.JColorButton in project gephi by gephi.
the class EdgeSettingsPanel method setup.
public void setup() {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("init")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeHasUniColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("showEdges")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeUniColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeInSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeOutSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeBothSelectionColor")) {
refreshSharedConfig();
} else if (evt.getPropertyName().equals("edgeScale")) {
refreshSharedConfig();
}
}
});
refreshSharedConfig();
showEdgesCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setShowEdges(showEdgesCheckbox.isSelected());
setEnable(true);
}
});
((JColorButton) edgeColorButton).addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeUniColor(((JColorButton) edgeColorButton).getColorArray());
}
});
sourceNodeColorCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeHasUniColor(!sourceNodeColorCheckbox.isSelected());
}
});
selectionColorCheckbox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeSelectionColor(selectionColorCheckbox.isSelected());
}
});
edgeInSelectionColorChooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeInSelectionColor(edgeInSelectionColorChooser.getColor().getComponents(null));
}
});
edgeBothSelectionColorChooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeBothSelectionColor(edgeBothSelectionColorChooser.getColor().getComponents(null));
}
});
edgeOutSelectionColorChooser.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
VizModel vizModel = VizController.getInstance().getVizModel();
vizModel.setEdgeOutSelectionColor(edgeOutSelectionColorChooser.getColor().getComponents(null));
}
});
scaleSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
VizModel vizModel = VizController.getInstance().getVizModel();
if (vizModel.getEdgeScale() != (scaleSlider.getValue() / 10f + 0.1f)) {
vizModel.setEdgeScale(scaleSlider.getValue() / 10f + 0.1f);
}
}
});
}
use of org.gephi.ui.components.JColorButton in project gephi by gephi.
the class DependantColorPanel method setup.
public void setup(DependantColorPropertyEditor propertyEditor) {
this.propertyEditor = propertyEditor;
DependantColor dependantColor = (DependantColor) propertyEditor.getValue();
if (dependantColor.getMode().equals(DependantColor.Mode.CUSTOM)) {
customRadio.setSelected(true);
((JColorButton) colorButton).setColor(dependantColor.getCustomColor());
} else if (dependantColor.getMode().equals(DependantColor.Mode.PARENT)) {
parentRadio.setSelected(true);
}
}
use of org.gephi.ui.components.JColorButton in project gephi by gephi.
the class EdgeColorPanel method setup.
public void setup(EdgeColorPropertyEditor propertyEditor) {
this.propertyEditor = propertyEditor;
EdgeColor edgeColor = (EdgeColor) propertyEditor.getValue();
if (edgeColor.getMode().equals(EdgeColor.Mode.CUSTOM)) {
customRadio.setSelected(true);
((JColorButton) colorButton).setColor(edgeColor.getCustomColor());
} else if (edgeColor.getMode().equals(EdgeColor.Mode.MIXED)) {
mixedRadio.setSelected(true);
} else if (edgeColor.getMode().equals(EdgeColor.Mode.ORIGINAL)) {
originalRadio.setSelected(true);
} else if (edgeColor.getMode().equals(EdgeColor.Mode.SOURCE)) {
sourceRadio.setSelected(true);
} else if (edgeColor.getMode().equals(EdgeColor.Mode.TARGET)) {
targetRadio.setSelected(true);
}
}
use of org.gephi.ui.components.JColorButton in project gephi by gephi.
the class PreviewTopComponent method initComponents.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
southBusyLabel = new JXBusyLabel(new Dimension(14, 14));
bannerPanel = new javax.swing.JPanel();
bannerLabel = new javax.swing.JLabel();
refreshButton = new javax.swing.JButton();
previewPanel = new javax.swing.JPanel();
sketchPanel = new javax.swing.JPanel();
refreshPanel = new javax.swing.JPanel();
busyLabel = new JXBusyLabel(new Dimension(20, 20));
southToolbar = new javax.swing.JToolBar();
backgroundButton = new JColorButton(Color.WHITE);
resetZoomButton = new javax.swing.JButton();
minusButton = new javax.swing.JButton();
plusButton = new javax.swing.JButton();
setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
add(southBusyLabel, gridBagConstraints);
bannerPanel.setBackground(new java.awt.Color(178, 223, 240));
bannerPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
bannerPanel.setLayout(new java.awt.GridBagLayout());
// NOI18N
bannerLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/preview/resources/info.png")));
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(bannerLabel, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.bannerLabel.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
bannerPanel.add(bannerLabel, gridBagConstraints);
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(refreshButton, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.refreshButton.text"));
refreshButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
refreshButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(1, 0, 1, 1);
bannerPanel.add(refreshButton, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
add(bannerPanel, gridBagConstraints);
previewPanel.setLayout(new java.awt.CardLayout());
sketchPanel.setBackground(new java.awt.Color(255, 255, 255));
sketchPanel.setPreferredSize(new java.awt.Dimension(500, 500));
sketchPanel.setLayout(new java.awt.BorderLayout());
previewPanel.add(sketchPanel, "previewCard");
refreshPanel.setOpaque(false);
refreshPanel.setLayout(new java.awt.GridBagLayout());
busyLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(busyLabel, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.busyLabel.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
refreshPanel.add(busyLabel, gridBagConstraints);
previewPanel.add(refreshPanel, "refreshCard");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(previewPanel, gridBagConstraints);
southToolbar.setFloatable(false);
southToolbar.setRollover(true);
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(backgroundButton, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.backgroundButton.text"));
backgroundButton.setFocusable(false);
southToolbar.add(backgroundButton);
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(resetZoomButton, org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.resetZoomButton.text"));
resetZoomButton.setFocusable(false);
resetZoomButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
resetZoomButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
southToolbar.add(resetZoomButton);
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(minusButton, "-");
// NOI18N
minusButton.setToolTipText(org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.minusButton.toolTipText"));
minusButton.setFocusable(false);
minusButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
minusButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
southToolbar.add(minusButton);
// NOI18N
org.openide.awt.Mnemonics.setLocalizedText(plusButton, "+");
// NOI18N
plusButton.setToolTipText(org.openide.util.NbBundle.getMessage(PreviewTopComponent.class, "PreviewTopComponent.plusButton.toolTipText"));
plusButton.setFocusable(false);
plusButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
plusButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
southToolbar.add(plusButton);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
add(southToolbar, gridBagConstraints);
}
Aggregations