Package org.antlr.xjlib.appkit.gview.object

Examples of org.antlr.xjlib.appkit.gview.object.GElement


        public Point origin;
        public Rectangle r;
        public boolean dragging;

        public void mousePressed(MouseEvent e) {
            GElement elem = treeGraphView.getElementAtMousePosition(e);
            if(elem != null && elem instanceof AWTreeGraphView.GElementNode) {
                TreeNode node = treeGraphView.getTreeNodeForElement((AWTreeGraphView.GElementNode)elem);
                if(node == null)
                    return;
View Full Code Here


     */

    public void rebuildNoModel() {
        clearMaps();

        GElement element = buildGraph(null);
        element.move(MARGIN, MARGIN);

        setSizeMargin(MARGIN);
        setRootElement(element);
    }
View Full Code Here

        public double getLastChildRightSpan() {
            if(elements == null)
                return 0;

            for (int i = elements.size()-1; i >= 0; i--) {
                GElement element = (GElement) elements.get(i);
                if(element instanceof GElementNode) {
                    GElementNode n = (GElementNode)element;
                    return n.getRightSpan();
                }
            }
View Full Code Here

                if(c == '\n') {
                    if(pc == '\\') {
                        // Remove the last \ if it was part of the DOT wrapping character
                        line.deleteCharAt(line.length()-1);
                    } else {
                        GElement element = parseLine(line.toString());
                        if(element != null) {
                            if(graph == null)
                                graph = element;
                            else
                                graph.addElement(element);
View Full Code Here

            label = tokens[labelIndex];
            labelPosition = new Vector2D(Float.parseFloat(tokens[labelIndex+1])*factor,
                                (height-Float.parseFloat(tokens[labelIndex+2]))*factor);
        }

        GElement source = graph.findElementWithLabel(tokens[1]);
        GElement target = graph.findElementWithLabel(tokens[2]);

        GLink link = new GLink(source, GElementCircle.ANCHOR_CENTER,
                target, GElementCircle.ANCHOR_CENTER,
                GLink.SHAPE_BEZIER, label, 0);

View Full Code Here

                points = parseControlPoints(tokens[index+=2]);
            } else if(tokens[index].equals(";"))
                break;
        }

        GElement source = graph.findElementWithLabel(sourceName);
        GElement target = graph.findElementWithLabel(targetName);

        GLink link = new GLink(source, GElementCircle.ANCHOR_CENTER,
                target, GElementCircle.ANCHOR_CENTER,
                GLink.SHAPE_BEZIER, labelName, 0);
View Full Code Here

    public GEventCreateLinkElement(GView view) {
        super(view);
    }

    public void mousePressed(MouseEvent e, Point mousePosition) {
        GElement selectedElement = delegate.eventQueryElementAtPoint(mousePosition);

        if(startElement != null) {
            if(selectedElement != null) {
                int type;
                if(linkElement instanceof SLinkElbow)
                    type = GLink.SHAPE_ELBOW;
                else
                    type = GLink.SHAPE_ARC;

                delegate.eventCreateLink(startElement, startAnchorKey,
                                            selectedElement, selectedElement.getAnchorKeyClosestToPoint(mousePosition),
                                            type, mousePosition);
            }
            removeExclusiveValue(GEventManager.EXCLUSIVE_CREATE_LINK_VALUE);
            startElement = null;
            linkElement = null;
            delegate.eventShouldRepaint();
            return;
        }

        if(selectedElement == null || !selectedElement.acceptOutgoingLink()) {
            return;
        }

        int mask = InputEvent.SHIFT_DOWN_MASK + InputEvent.BUTTON1_DOWN_MASK;
        if((e.getModifiersEx() & mask) == mask || delegate.eventCanCreateLink()) {
View Full Code Here

        else
            return element.acceptIncomingLink();
    }

    public void updateLink(Point mouse) {
        GElement ce = delegate.eventQueryElementAtPoint(mouse);

        boolean selfLoop = ce == startElement;
        setLinkStartAnchor(startElement.getAnchor(startAnchorKey));

        if(ce == null || ce instanceof GLink) {
            setLinkEnd(Vector2D.vector(mouse), Anchor2D.DIRECTION_BOTTOM);
        } else {
            Anchor2D anchor = ce.getAnchorClosestToPoint(mouse);
            String anchorKey = ce.getAnchorKeyClosestToPoint(mouse);
            setLinkEnd(anchor.position, anchor.direction);

            if(selfLoop) {
                if(anchor.direction == Anchor2D.DIRECTION_FREE)
                    linkArc.setMouse(mouse);
                else
                    linkArc.setMouse(anchor.position.add(anchor.direction));
                linkArc.setEndTangentOffset(startElement.getDefaultAnchorOffset(anchorKey));
            } else {
                linkArc.setMouse(mouse);
                linkArc.setEndTangentOffset(ce.getDefaultAnchorOffset(anchorKey));
            }

            if(selfLoop && view.defaultLinkShape() == GLink.SHAPE_ELBOW
                && startElement.getAnchor(startAnchorKey).equals(anchor))
            {
View Full Code Here

    public GEventEditElement(GView view) {
        super(view);
    }

    public void mousePressed(MouseEvent e, Point mousePosition) {
        GElement selectedElement = delegate.eventQueryElementAtPoint(mousePosition);
        if(e.getClickCount() == 2 && selectedElement != null) {
            delegate.eventEditElement(selectedElement);
        }
    }
View Full Code Here

    public GEventCreateElement(GView view) {
        super(view);
    }

    public void mousePressed(MouseEvent e, Point mousePosition) {
        GElement selectedElement = delegate.eventQueryElementAtPoint(mousePosition);

        if(selectedElement == null) {
            if(e.getClickCount() == 1)
                delegate.eventCreateElement(mousePosition, false);
            else
View Full Code Here

TOP

Related Classes of org.antlr.xjlib.appkit.gview.object.GElement

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.