public JComponent[] getToolbarComponents() {
TextModel model = VizController.getInstance().getVizModel().getTextModel();
//Mode
final JPopupButton labelSizeModeButton = new JPopupButton();
TextManager textManager = VizController.getInstance().getTextManager();
for (final SizeMode sm : textManager.getSizeModes()) {
labelSizeModeButton.addItem(sm, sm.getIcon());
}
labelSizeModeButton.setSelectedItem(model.getSizeMode());
labelSizeModeButton.setChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
SizeMode sm = (SizeMode) e.getSource();
TextModel model = VizController.getInstance().getVizModel().getTextModel();
model.setSizeMode(sm);
}
});
labelSizeModeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/visualization/component/labelSizeMode.png")));
labelSizeModeButton.setToolTipText(NbBundle.getMessage(VizBarController.class, "VizToolbar.Labels.sizeMode"));
model.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
TextModel model = VizController.getInstance().getVizModel().getTextModel();
if (model.getSizeMode() != labelSizeModeButton.getSelectedItem()) {
labelSizeModeButton.setSelectedItem(model.getSizeMode());
}
}
});
components[0] = labelSizeModeButton;
//Color mode
final JPopupButton labelColorModeButton = new JPopupButton();
for (final ColorMode cm : textManager.getColorModes()) {
labelColorModeButton.addItem(cm, cm.getIcon());
}
labelColorModeButton.setSelectedItem(textManager.getModel().getColorMode());
labelColorModeButton.setChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
ColorMode cm = (ColorMode) e.getSource();
TextModel model = VizController.getInstance().getVizModel().getTextModel();