Package org.joshy.sketch.model

Examples of org.joshy.sketch.model.SketchDocument


                Callback<ActionEvent> okay = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) {
                        dialog.hide();
                        double dwidth = Double.parseDouble(width.getText());
                        double dheight = Double.parseDouble(height.getText());
                        SketchDocument doc = context.getDocument();
                        doc.setWidth(dwidth);
                        doc.setHeight(dheight);
                        context.redraw();
                    }
                };

                final PopupMenuButton popup = new PopupMenuButton();
View Full Code Here


            this.context = context;
        }

        @Override
        public void execute() throws Exception {
            SketchDocument doc = context.getDocument();
            SketchDocument.SketchPage page = doc.addPage();
            context.pageList.listview.setSelectedIndex(doc.getPages().size()-1);
        }
View Full Code Here

            this.context = context;
        }

        @Override
        public void execute() throws Exception {
            SketchDocument doc = context.getDocument();
            String name = StandardDialog.showEditText("Set Page Name",doc.getCurrentPage().getName());
            if(name != null) doc.getCurrentPage().setName(name);
        }
View Full Code Here

            }
            startedEditing = false;
            return;
        } else {
            if(node == null) return;
            SketchDocument doc = context.getDocument();
            doc.getCurrentPage().add(node);
            context.getUndoManager().pushAction(new UndoableAddNodeAction(context,node,"Ngon"));
            context.getSelection().setSelectedNode(node);
            node = null;
            start = null;
            context.redraw();
View Full Code Here

        Callback<ActionEvent> okay = new Callback<ActionEvent>() {
            public void call(ActionEvent event) {
                dialog.hide();
                double dwidth = Double.parseDouble(width.getText());
                double dheight = Double.parseDouble(height.getText());
                SketchDocument doc = new SketchDocument();
                doc.setDocBoundsActive(true);
                doc.setUnits(CanvasDocument.LengthUnits.Pixels);
                doc.setWidth(dwidth);
                doc.setHeight(dheight);
                try {
                    newDocCreated(doc);
                } catch (Exception e) {
                    e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                }
View Full Code Here

        Point2D.Double point = context.getSketchCanvas().transformToCanvas(x,y);
        textNode.setX(point.x);
        textNode.setY(point.y);

        if(!notInMainDocument) {
            SketchDocument doc = context.getDocument();
            doc.getCurrentPage().add(textNode);
            context.getSelection().setSelectedNode(textNode);
        }
        context.getUndoManager().pushAction(new UndoableAddNodeAction(context,textNode,"text"));
        this.notInMainDocument = false;
    }
View Full Code Here

        textNode.setTranslateY(textNode.getTranslateY()+textNode.getY());
        textNode.setX(0);
        textNode.setY(0);
        overlayTextBox = null;
        if(!notInMainDocument) {
            SketchDocument doc = context.getDocument();
            doc.getCurrentPage().add(textNode);
            context.getSelection().setSelectedNode(textNode);
        }
        context.getUndoManager().pushAction(new UndoableAddNodeAction(context,textNode,"text"));
        textNode = null;
        this.notInMainDocument = false;
View Full Code Here

        textNode = null;
        this.notInMainDocument = false;
    }

    public void startEditing(SNode node) {
        SketchDocument doc = context.getDocument();
        double offsetX = 0;
        double offsetY = 0;
        if(node instanceof SText) {
            this.notInMainDocument = false;
            textNode = (SText) node;
            doc.getCurrentPage().remove(textNode);
        }
        if(node instanceof ResizableGrid9Shape) {
            ResizableGrid9Shape grid9 = (ResizableGrid9Shape) node;
            textNode = grid9.getTextChild();
            this.notInMainDocument = true;
View Full Code Here

            public SketchDocument.Guideline newGuide;

            public void call(MouseEvent mouseEvent) throws Exception {
                if(mouseEvent.getType() == MouseEvent.MouseDragged) {
                    if(doc instanceof SketchDocument) {
                        SketchDocument sdoc = (SketchDocument) doc;
                        if(Ruler.this.vertical) {
                            if(mouseEvent.getPointInNodeCoords(Ruler.this).getX() > getWidth()) {
                                if(newGuide == null) {
                                    newGuide = sdoc.getCurrentPage().createGuideline(0,true);
                                } else {
                                    Point2D pt = mouseEvent.getPointInNodeCoords(context.getCanvas());
                                    pt = context.getCanvas().transformToCanvas(pt);
                                    newGuide.setPosition(pt.getX());
                                }
                            }
                        } else {
                            if(mouseEvent.getPointInNodeCoords(Ruler.this).getY() > getHeight()) {
                                if(newGuide == null) {
                                    newGuide = sdoc.getCurrentPage().createGuideline(0,false);
                                } else {
                                    Point2D pt = mouseEvent.getPointInNodeCoords(context.getCanvas());
                                    pt = context.getCanvas().transformToCanvas(pt);
                                    newGuide.setPosition(pt.getY());
                                }
View Full Code Here


    public void setDocument(final CanvasDocument doc) {
        this.doc = doc;
        if(doc instanceof SketchDocument) {
            final SketchDocument sdoc = (SketchDocument) doc;
            regenHandles(sdoc);

            EventBus.getSystem().addListener(sdoc, CanvasDocument.DocumentEvent.PageChanged, new Callback<CanvasDocument.DocumentEvent>() {
                public void call(CanvasDocument.DocumentEvent documentEvent) throws Exception {
                    regenHandles((SketchDocument) documentEvent.getDocument());
View Full Code Here

TOP

Related Classes of org.joshy.sketch.model.SketchDocument

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.