Package org.gephi.preview.types

Examples of org.gephi.preview.types.DependantColor


        colorButton.addPropertyChangeListener(JColorButton.EVENT_COLOR, new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                Color newColor = (Color) evt.getNewValue();
                propertyEditor.setValue(new DependantColor(newColor));
            }
        });

        parentRadio.addItemListener(this);
        customRadio.addItemListener(this);
View Full Code Here


        if (parentRadio.isSelected()) {
            selectedMode = DependantColor.Mode.PARENT;
        } else if (customRadio.isSelected()) {
            selectedMode = DependantColor.Mode.CUSTOM;
        }
        propertyEditor.setValue(new DependantColor(selectedMode));
    }
View Full Code Here

    }
    private DependantColorPropertyEditor propertyEditor;

    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);
        }
    }
View Full Code Here

        String label = item.getData(EdgeLabelItem.LABEL);
        Float x = item.getData(LABEL_X);
        Float y = item.getData(LABEL_Y);

        //Outline
        DependantColor outlineDependantColor = properties.getValue(PreviewProperty.EDGE_LABEL_OUTLINE_COLOR);
        Float outlineSize = properties.getFloatValue(PreviewProperty.EDGE_LABEL_OUTLINE_SIZE);
        outlineSize = outlineSize * (font.getSize() / 32f);
        int outlineAlpha = (int) ((properties.getFloatValue(PreviewProperty.EDGE_LABEL_OUTLINE_OPACITY) / 100f) * 255f);
        if (outlineAlpha > 255) {
            outlineAlpha = 255;
        }
        Color outlineColor = outlineDependantColor.getColor(edgeColor);
        outlineColor = new Color(outlineColor.getRed(), outlineColor.getGreen(), outlineColor.getBlue(), outlineAlpha);

        if (target instanceof G2DTarget) {
            renderG2D((G2DTarget) target, label, x, y, color, outlineSize, outlineColor);
        } else if (target instanceof SVGTarget) {
View Full Code Here

        Integer fontSize = item.getData(FONT_SIZE);
        Float x = item.getData(NODE_X);
        Float y = item.getData(NODE_Y);

        //Outline
        DependantColor outlineDependantColor = properties.getValue(PreviewProperty.NODE_LABEL_OUTLINE_COLOR);
        Float outlineSize = properties.getFloatValue(PreviewProperty.NODE_LABEL_OUTLINE_SIZE);
        outlineSize = outlineSize * (fontSize / 32f);
        int outlineAlpha = (int) ((properties.getFloatValue(PreviewProperty.NODE_LABEL_OUTLINE_OPACITY) / 100f) * 255f);
        if (outlineAlpha > 255) {
            outlineAlpha = 255;
        }
        Color outlineColor = outlineDependantColor.getColor(nodeColor);
        outlineColor = new Color(outlineColor.getRed(), outlineColor.getGreen(), outlineColor.getBlue(), outlineAlpha);

        //Box
        Boolean showBox = properties.getValue(PreviewProperty.NODE_LABEL_SHOW_BOX);
        DependantColor boxDependantColor = properties.getValue(PreviewProperty.NODE_LABEL_BOX_COLOR);
        Color boxColor = boxDependantColor.getColor(nodeColor);
        int boxAlpha = (int) ((properties.getFloatValue(PreviewProperty.NODE_LABEL_BOX_OPACITY) / 100f) * 255f);
        if (boxAlpha > 255) {
            boxAlpha = 255;
        }
        boxColor = new Color(boxColor.getRed(), boxColor.getGreen(), boxColor.getBlue(), boxAlpha);
View Full Code Here

*/
public class BasicDependantColorPropertyEditor extends PropertyEditorSupport {

    @Override
    public String getAsText() {
        DependantColor c = (DependantColor) getValue();
        if (c.getMode().equals(DependantColor.Mode.CUSTOM)) {
            Color color = c.getCustomColor() == null ? Color.BLACK : c.getCustomColor();
            return String.format(
                    "%s [%d,%d,%d]",
                    c.getMode().name().toLowerCase(),
                    color.getRed(),
                    color.getGreen(),
                    color.getBlue());
        } else {
            return c.getMode().name().toLowerCase();
        }
    }
View Full Code Here

            if (m.lookingAt()) {
                int r = Integer.valueOf(m.group(1));
                int g = Integer.valueOf(m.group(2));
                int b = Integer.valueOf(m.group(3));

                setValue(new DependantColor(new Color(r, g, b)));
            }
        } else if (matchColorMode(s, DependantColor.Mode.PARENT.name().toLowerCase())) {
            setValue(new DependantColor());
        }
    }
View Full Code Here

        properties.put(PreviewProperty.BACKGROUND_COLOR, Color.BLACK);
        properties.put(PreviewProperty.SHOW_EDGE_LABELS, Boolean.TRUE);
        properties.put(PreviewProperty.SHOW_NODE_LABELS, Boolean.TRUE);
        properties.put(PreviewProperty.NODE_LABEL_COLOR, new DependantOriginalColor(Color.WHITE));
        properties.put(PreviewProperty.EDGE_LABEL_COLOR, new DependantOriginalColor(Color.WHITE));
        properties.put(PreviewProperty.NODE_LABEL_OUTLINE_COLOR, new DependantColor(DependantColor.Mode.PARENT));
        properties.put(PreviewProperty.EDGE_LABEL_OUTLINE_COLOR, new DependantColor(DependantColor.Mode.PARENT));
        properties.put(PreviewProperty.EDGE_OPACITY, 70f);
    }
View Full Code Here

        DefaultPreset defaultPreset = new DefaultPreset();
        properties.putAll(defaultPreset.getProperties());
       
        //Custom values
        properties.put(PreviewProperty.NODE_LABEL_SHOW_BOX, Boolean.TRUE);
        properties.put(PreviewProperty.NODE_LABEL_BOX_COLOR, new DependantColor(Color.WHITE));
        properties.put(PreviewProperty.NODE_LABEL_BOX_OPACITY, 80f);
        properties.put(PreviewProperty.SHOW_EDGE_LABELS, Boolean.TRUE);
        properties.put(PreviewProperty.SHOW_NODE_LABELS, Boolean.TRUE);
        properties.put(PreviewProperty.NODE_OPACITY, 0);
        properties.put(PreviewProperty.EDGE_COLOR, new EdgeColor(new Color(76, 168, 36)));
View Full Code Here

        properties.put(PreviewProperty.EDGE_THICKNESS, 1f);

        properties.put(PreviewProperty.EDGE_LABEL_COLOR, new DependantOriginalColor(DependantOriginalColor.Mode.ORIGINAL));
        properties.put(PreviewProperty.EDGE_LABEL_FONT, new Font("Arial", Font.PLAIN, 10));
        properties.put(PreviewProperty.EDGE_LABEL_MAX_CHAR, 30);
        properties.put(PreviewProperty.EDGE_LABEL_OUTLINE_COLOR, new DependantColor(Color.WHITE));
        properties.put(PreviewProperty.EDGE_LABEL_OUTLINE_OPACITY, 80f);
        properties.put(PreviewProperty.EDGE_LABEL_OUTLINE_SIZE, 0f);
        properties.put(PreviewProperty.EDGE_LABEL_SHORTEN, false);

        properties.put(PreviewProperty.NODE_BORDER_COLOR, new DependantColor(Color.BLACK));
        properties.put(PreviewProperty.NODE_BORDER_WIDTH, 1.0f);
        properties.put(PreviewProperty.NODE_OPACITY, 100f);

        properties.put(PreviewProperty.NODE_LABEL_BOX_COLOR, new DependantColor(DependantColor.Mode.PARENT));
        properties.put(PreviewProperty.NODE_LABEL_BOX_OPACITY, 100f);
        properties.put(PreviewProperty.NODE_LABEL_COLOR, new DependantOriginalColor(Color.BLACK));
        properties.put(PreviewProperty.NODE_LABEL_FONT, new Font("Arial", Font.PLAIN, 12));
        properties.put(PreviewProperty.NODE_LABEL_MAX_CHAR, 30);
        properties.put(PreviewProperty.NODE_LABEL_OUTLINE_COLOR, new DependantColor(Color.WHITE));
        properties.put(PreviewProperty.NODE_LABEL_OUTLINE_OPACITY, 80f);
        properties.put(PreviewProperty.NODE_LABEL_OUTLINE_SIZE, 0f);
        properties.put(PreviewProperty.NODE_LABEL_PROPORTIONAL_SIZE, true);
        properties.put(PreviewProperty.NODE_LABEL_SHORTEN, false);
        properties.put(PreviewProperty.NODE_LABEL_SHOW_BOX, false);
View Full Code Here

TOP

Related Classes of org.gephi.preview.types.DependantColor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.