Examples of SNode


Examples of org.joshy.sketch.model.SNode

                    int size = selectionChangeEvent.getSelection().size();
                    if(size != 1) {
                        setEnabled(false);
                        return;
                    }
                    SNode node = selectionChangeEvent.getSelection().firstItem();
                    setEnabled(node instanceof SPath);
                }
            });

        }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

        }

        @Override
        public void execute() {
            if(context.getSelection().size() != 1) return;
            SNode node = context.getSelection().firstItem();
            if(!(node instanceof SPath)) return;
            SPath path = (SPath) node;
            Bounds bounds = path.getTransformedBounds();
            for(SPath.SubPath sub : path.getSubPaths()) {
                for(SPath.PathPoint pt : sub.getPoints()) {
View Full Code Here

Examples of org.joshy.sketch.model.SNode

        @Override
        public void execute() throws Exception {
            if(context.getSelection().isEmpty()) return;
            if(context.getSelection().size() != 1) return;

            SNode first = context.getSelection().firstItem();
            if(! (first instanceof SShape)) return;
            SShape shape = (SShape) first;
            if(shape instanceof SPath) return;

            SPath path = shape.toPath();
View Full Code Here

Examples of org.joshy.sketch.model.SNode

        }

        @Override
        public void execute() throws Exception {
            if(context.getSelection().isEmpty()) return;
            SNode first = context.getSelection().firstItem();
            if(first instanceof SText) {
                ((SText)first).setAutoSize(true);
                ((SText)first).refresh();
            }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

            if(context instanceof VectorDocContext) {
                VectorDocContext vc = (VectorDocContext) context;
                vc.getSelection().clear();
                SketchDocument doc = (SketchDocument) context.getDocument();
                for(SNode node : clipboardNodes) {
                    SNode dupe = node.duplicate(null);
                    doc.getCurrentPage().add(dupe);
                    doc.setDirty(true);
                    vc.getSelection().addSelectedNode(dupe);
                }
            }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

        symbolPane.setHorizontalVisiblePolicy(ScrollPane.VisiblePolicy.Never);

        symbolAddButton = new Button(getString("sidebar.insertSymbol"));
        symbolAddButton.onClicked(new Callback<ActionEvent>() { public void call(ActionEvent event) {
            if(listView.getSelectedIndex() < 0) return;
            SNode node = listView.getModel().get(listView.getSelectedIndex());
            SketchDocument sd = context.getDocument();
            sd.getCurrentPage().add(node.duplicate(null));
            context.redraw();
        }});


        EventBus.getSystem().addListener(listView, MouseEvent.MouseAll, new Callback<MouseEvent>() {
            public double prevx;
            public boolean created;
            public SNode dupe;

            public void call(MouseEvent event) {
                if(event.getType() == MouseEvent.MousePressed) {
                    ContextMenu.hideAll();
                    if(event.getButton() == 3) { // check for right clicks to open the context menu
                        showContextMenu(event);
                        return;
                    }
                }
                if(event.getType() == MouseEvent.MouseDragged) {
                    if(created && dupe != null) {
                        Point2D pt = event.getPointInNodeCoords(context.getCanvas());
                        pt = context.getSketchCanvas().transformToCanvas(pt);
                        Bounds b = dupe.getBounds();
                        dupe.setTranslateX(pt.getX()-b.getWidth()/2);
                        dupe.setTranslateY(pt.getY()-b.getHeight()/2);
                        context.redraw();
                    }
                    if(event.getX() < 0 && prevx >= 0 && !created) {
                        created = true;
                        if(listView.getSelectedIndex() < 0) return;
                        SNode node = listView.getModel().get(listView.getSelectedIndex());
                        SketchDocument sd = context.getDocument();
                        dupe = node.duplicate(null);
                        Bounds b = dupe.getBounds();
                        sd.getCurrentPage().add(dupe);
                        Point2D pt = event.getPointInNodeCoords(context.getCanvas());
                        pt = context.getSketchCanvas().transformToCanvas(pt);
                        dupe.setTranslateX(pt.getX()-b.getWidth()/2);
View Full Code Here

Examples of org.joshy.sketch.model.SNode

    private void showContextMenu(MouseEvent event) {
        if(listView.getSelectedIndex()<0) return;
        if(listView.getModel().size() <= listView.getSelectedIndex()) return;
       
        final SNode shape = listView.getModel().get(listView.getSelectedIndex());
        contextMenu = new ContextMenu();
        contextMenu.addActions(
            new SAction(){
                @Override public String getDisplayName() { return "Delete"; }
                @Override
                public void execute() {
                    symbolManager.remove(shape);
                }
            },
            new SAction(){
                @Override public String getDisplayName() { return "Rename"; }
                @Override
                public void execute() {
                    u.p("renaming");
                    String name = shape.getStringProperty("symbolName");
                    if(name == null) {
                        name = shape.getClass().getSimpleName();
                    }
                    String result = StandardDialog.showEditText("Rename Symbol",name);
                    if(result != null) {
                        shape.setStringProperty(SYMBOL_NAME,result);
                        //symbolManager.save();
                    }
                }
            }
        );
View Full Code Here

Examples of org.joshy.sketch.model.SNode

    @Override
    public void execute() {
        if(context.getSelection().isEmpty()) return;
        if(context.getSelection().size() > 1) return;

        SNode shape = context.getSelection().items().iterator().next();
        SNode dupe = shape.duplicate(null);
        dupe.setTranslateX(0);
        dupe.setTranslateY(0);

        context.getSymbolManager().add(dupe);
        //context.getSymbolManager().save();
    }
View Full Code Here

Examples of org.joshy.sketch.model.SNode

                items.add(item);
            }
        }

        public double getDoubleValue() {
            SNode first = items.iterator().next();

            try {
                Method method = getMethod();
                Object value = method.invoke(first);
                Double dval = (Double) value;
View Full Code Here

Examples of org.joshy.sketch.model.SNode

            }
            return 0;
        }

        public boolean getBooleanValue() {
            SNode first = items.iterator().next();

            try {
                Method method = getBooleanMethod();
                Object value = method.invoke(first);
                Boolean dval = (Boolean) value;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.