Search in sources :

Example 1 with DotPalette

use of edu.mit.csail.sdg.alloy4graph.DotPalette in project org.alloytools.alloy by AlloyTools.

the class VizCustomizationPanel method createGeneralWidget.

// =============================================================================================================//
/**
 * Generates the "general graph settings" widgets, and add them to "parent".
 */
private void createGeneralWidget(JPanel parent) {
    final List<Integer> fontSizes = Util.asList(9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 32, 36, 40, 44, 48, 54, 60, 66, 72);
    JLabel nLabel = OurUtil.label("Node Color Palette:");
    JLabel eLabel = OurUtil.label("Edge Color Palette:");
    JLabel aLabel = OurUtil.label("Use original atom names:");
    JLabel pLabel = OurUtil.label("Hide private sigs/relations:");
    JLabel mLabel = OurUtil.label("Hide meta sigs/relations:");
    JLabel fLabel = OurUtil.label("Font Size:");
    JComboBox fontSize = new OurCombobox(false, fontSizes.toArray(), 60, 32, vizState.getFontSize()) {

        private static final long serialVersionUID = 0;

        @Override
        public void do_changed(Object value) {
            if (fontSizes.contains(value))
                vizState.setFontSize((Integer) value);
        }
    };
    JComboBox nodepal = new OurCombobox(false, DotPalette.values(), 100, 32, vizState.getNodePalette()) {

        private static final long serialVersionUID = 0;

        @Override
        public String do_getText(Object value) {
            return ((DotPalette) value).getDisplayedText();
        }

        @Override
        public void do_changed(Object value) {
            vizState.setNodePalette((DotPalette) value);
        }
    };
    JComboBox edgepal = new OurCombobox(false, DotPalette.values(), 100, 32, vizState.getEdgePalette()) {

        private static final long serialVersionUID = 0;

        @Override
        public String do_getText(Object value) {
            return ((DotPalette) value).getDisplayedText();
        }

        @Override
        public void do_changed(Object value) {
            vizState.setEdgePalette((DotPalette) value);
        }
    };
    JPanel name = new OurCheckbox("", "Whether the visualizer should use the original atom names as-is.", vizState.useOriginalName() ? OurCheckbox.ON : OurCheckbox.OFF) {

        private static final long serialVersionUID = 0;

        @Override
        public Icon do_action() {
            boolean x = vizState.useOriginalName();
            vizState.useOriginalName(!x);
            return (!x ? ON : OFF);
        }
    };
    JPanel priv = new OurCheckbox("", "Whether the visualizer should hide private sigs, sets, and relations by default.", vizState.hidePrivate() ? OurCheckbox.ON : OurCheckbox.OFF) {

        private static final long serialVersionUID = 0;

        @Override
        public Icon do_action() {
            boolean x = vizState.hidePrivate();
            vizState.hidePrivate(!x);
            remakeAll();
            return (!x ? ON : OFF);
        }
    };
    JPanel meta = new OurCheckbox("", "Whether the visualizer should hide meta sigs, sets, and relations by default.", vizState.hideMeta() ? OurCheckbox.ON : OurCheckbox.OFF) {

        private static final long serialVersionUID = 0;

        @Override
        public Icon do_action() {
            boolean x = vizState.hideMeta();
            vizState.hideMeta(!x);
            remakeAll();
            return (!x ? ON : OFF);
        }
    };
    parent.add(makelabel(" General Graph Settings:"));
    parent.add(OurUtil.makeH(wcolor, new Dimension(6, 6)));
    parent.add(OurUtil.makeH(wcolor, 25, nLabel, 5, nodepal, 8, aLabel, 5, name, 2, null));
    parent.add(OurUtil.makeH(wcolor, 25, eLabel, 5, edgepal, 8, fLabel, 5, fontSize, 2, null));
    parent.add(OurUtil.makeH(wcolor, 25, pLabel, 5, priv, 2, null));
    parent.add(OurUtil.makeH(wcolor, 25, mLabel, 5, meta, 2, null));
}
Also used : OurCombobox(edu.mit.csail.sdg.alloy4.OurCombobox) JPanel(javax.swing.JPanel) DotPalette(edu.mit.csail.sdg.alloy4graph.DotPalette) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) OurCheckbox(edu.mit.csail.sdg.alloy4.OurCheckbox)

Aggregations

OurCheckbox (edu.mit.csail.sdg.alloy4.OurCheckbox)1 OurCombobox (edu.mit.csail.sdg.alloy4.OurCombobox)1 DotPalette (edu.mit.csail.sdg.alloy4graph.DotPalette)1 Dimension (java.awt.Dimension)1 JComboBox (javax.swing.JComboBox)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1