Search in sources :

Example 1 with EdgeColorConfiguration

use of org.freeplane.features.edge.EdgeColorConfiguration in project freeplane by freeplane.

the class MEdgeController method editEdgeColorConfiguration.

public void editEdgeColorConfiguration(MapModel map) {
    final List<Color> oldColors = edgeColorsConfigurationFactory.create(map).colors;
    final ColorListEditorPanelBuilder colorListEditorPanelBuilder = new ColorListEditorPanelBuilder(oldColors);
    final JComponent panel = colorListEditorPanelBuilder.getPanel();
    JScrollPane jscrollpane = new JRestrictedSizeScrollPane(panel);
    UITools.setScrollbarIncrement(jscrollpane);
    jscrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    jscrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jscrollpane.setMaximumSize(new Dimension(Integer.MAX_VALUE, 600));
    String title = TextUtils.getText("editEdgeColors");
    final int status = JOptionPane.showConfirmDialog(UITools.getCurrentFrame(), jscrollpane, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    switch(status) {
        case JOptionPane.OK_OPTION:
            final List<Color> newColors = colorListEditorPanelBuilder.getColors();
            edgeColorsConfigurationFactory.setConfiguration(map, new EdgeColorConfiguration(newColors));
            break;
        default:
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JRestrictedSizeScrollPane(org.freeplane.core.ui.components.JRestrictedSizeScrollPane) Color(java.awt.Color) JComponent(javax.swing.JComponent) EdgeColorConfiguration(org.freeplane.features.edge.EdgeColorConfiguration) Dimension(java.awt.Dimension)

Aggregations

Color (java.awt.Color)1 Dimension (java.awt.Dimension)1 JComponent (javax.swing.JComponent)1 JScrollPane (javax.swing.JScrollPane)1 JRestrictedSizeScrollPane (org.freeplane.core.ui.components.JRestrictedSizeScrollPane)1 EdgeColorConfiguration (org.freeplane.features.edge.EdgeColorConfiguration)1