Package diva.graph

Examples of diva.graph.NodeRenderer


     * looking up the class of its semantic object.
     */
    public Figure render(Object node) {
        try {
            Object o = _controller.getGraphModel().getSemanticObject(node);
            NodeRenderer r = (NodeRenderer) _typedRenderers.get(o.getClass());
            return r.render(node);
        } catch (Exception ex) {
            return _defaultRenderer.render(node);
        }
    }
View Full Code Here


    private NodeRendererTutorial(AppContext context) {
        final BasicGraphController bgc = new BasicGraphController();

        // Build the renderers
        NodeRenderer defaultRenderer = new BasicNodeRenderer(bgc,
                new Ellipse2D.Double(0.0, 0.0, 40.0, 40.0),
                new Ellipse2D.Double(0.0, 0.0, 600.0, 600.0), Color.gray,
                Color.gray, .3);
        NodeRenderer stringRenderer = new BasicNodeRenderer(bgc,
                new Ellipse2D.Double(0.0, 0.0, 40.0, 40.0),
                new Ellipse2D.Double(0.0, 0.0, 600.0, 600.0), Color.blue,
                Color.blue, .3);
        NodeRenderer integerRenderer = new BasicNodeRenderer(bgc,
                new Rectangle2D.Double(0.0, 0.0, 40.0, 40.0),
                new Rectangle2D.Double(0.0, 0.0, 600.0, 600.0), Color.orange,
                Color.orange, .3);
        NodeRenderer setRenderer = new BasicNodeRenderer(bgc,
                new Ellipse2D.Double(0.0, 0.0, 40.0, 40.0),
                new Ellipse2D.Double(0.0, 0.0, 600.0, 600.0), Color.red,
                Color.red, .3);
        TypedNodeRenderer typedRenderer = new TypedNodeRenderer(bgc,
                defaultRenderer);
View Full Code Here

            if (iconRoles != null) {
                GUIUtilities.addIcons(this, iconRoles);
            } else {
                // Standard toolbar icons are 25x25 pixels.
                NodeRenderer renderer = _relationController.getNodeRenderer();
                Figure figure = renderer.render(null);

                FigureIcon icon = new FigureIcon(figure, 25, 25, 1, true);
                putValue(diva.gui.GUIUtilities.LARGE_ICON, icon);
            }
            putValue("tooltip", "Control-click to create a new relation");
View Full Code Here

            if (iconRoles != null) {
                GUIUtilities.addIcons(this, iconRoles);
            } else {
                // Creating the renderers this way is rather nasty..
                // Standard toolbar icons are 25x25 pixels.
                NodeRenderer renderer = _portController.getNodeRenderer();

                Object location = null;

                if (_prototype != null) {
                    location = _prototype.getAttribute("_location");
                }

                Figure figure = renderer.render(location);

                FigureIcon icon = new FigureIcon(figure, 25, 25, 1, true);
                putValue(GUIUtilities.LARGE_ICON, icon);
            }
            putValue("tooltip", description);
View Full Code Here

        /** Construct a new state. */
        public NewStateAction() {
            super("New State");
            putValue("tooltip", "New State");

            NodeRenderer renderer = new StateController.StateRenderer(
                    getGraphModel());
            Figure figure = renderer.render(_prototypeState);

            // Standard toolbar icons are 25x25 pixels.
            FigureIcon icon = new FigureIcon(figure, 25, 25, 1, true);
            putValue(diva.gui.GUIUtilities.LARGE_ICON, icon);
            putValue("tooltip", "New State");
View Full Code Here

TOP

Related Classes of diva.graph.NodeRenderer

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.