Package org.joshy.sketch.model

Examples of org.joshy.sketch.model.SText


    protected void mouseReleased(MouseEvent event, Point2D.Double cursor) {
        startEditing(textNode);
    }

    private void createTextNode(double x, double y) {
        textNode = new SText();
        textNode.setText("");
        textNode.setFillPaint(FlatColor.BLACK);
        textNode.setFontName(Settings.DEFAULT_FONT_NAME);
        textNode.setFontSize(24);
        Point2D.Double point = context.getSketchCanvas().transformToCanvas(x,y);
View Full Code Here


            context.pageList.listview.setSelectedIndex(doc.getCurrentPageIndex());
        }

        public void insertContents(SketchDocument.SketchPage page) {
            SwitchTheme.PresoThemeAction theme = (SwitchTheme.PresoThemeAction) page.getDocument().getProperties().get("theme");
            SText title = new SText();
            title.setText("Presentation Title");
            title.setFillPaint(FlatColor.BLACK);
            title.setFontName("OpenSans");
            title.setFontSize(70);

            title.setAutoSize(false);
            title.setWidth(600);
            center(title, page);
            title.setStringProperty("text-class","title");
            title.setTranslateY(190);
            theme.styleText(title);
            page.add(title);

            SText subtitle = new SText();
            subtitle.setText("by the author");
            subtitle.setFillPaint(FlatColor.BLACK);
            subtitle.setFontName("OpenSans");
            subtitle.setFontSize(36);
            subtitle.setAutoSize(false);
            subtitle.setWidth(350);
            center(subtitle, page);
            subtitle.setStringProperty("text-class", "subtitle");
            subtitle.setTranslateY(280);
            theme.styleText(subtitle);
            page.add(subtitle);
        }
View Full Code Here

            insertContents(page);
            context.pageList.listview.setSelectedIndex(doc.getCurrentPageIndex());
        }
        public void insertContents(SketchDocument.SketchPage page) {
            SwitchTheme.PresoThemeAction theme = (SwitchTheme.PresoThemeAction) page.getDocument().getProperties().get("theme");
            SText header = new SText();
            header.setText("A Page Header");
            header.setFillPaint(FlatColor.BLACK);
            header.setTranslateX(50);
            header.setTranslateY(40);
            header.setFontName("OpenSans");
            header.setFontSize(48);
            header.setBulleted(false);
            header.setStringProperty("text-class", "header");
            theme.styleText(header);
            page.add(header);

            SText content = new SText();
            content.setText("my first point\nmy second point\nmy third point\nmy fourth point");
            content.setFillPaint(FlatColor.BLACK);
            content.setTranslateX(70);
            content.setTranslateY(140);
            content.setFontName("OpenSans");
            content.setFontSize(30);
            content.setBulleted(true);
            theme.styleText(content);
            page.add(content);
        }
View Full Code Here

            doc.getProperties().put("theme",this);

            for(SketchDocument.SketchPage page : doc.getPages()) {
                for(SNode node : page.getNodes()) {
                    if(node instanceof SText) {
                        SText text = (SText) node;
                        styleText(text);
                    }
                }
            }
            if(context != null) {
View Full Code Here

            }


            for(SNode node : page.getNodes()) {
                if(node instanceof SText) {
                    SText text = (SText) node;
                    if(text.isBulleted()) {
                        String[] lines = text.getText().split("\n");
                        out.start("ul");
                        for(String line : lines) {
                            out.start("li").text(line).end();
                        }
                        out.end();
                        continue;
                    }
                    if("title".equals(text.getStringProperty("text-class"))) {
                        out.start("h1").text(text.getText()).end();
                        continue;
                    }
                    if("subtitle".equals(text.getStringProperty("text-class"))) {
                        out.start("h3").text(text.getText()).end();
                        continue;
                    }
                    if("header".equals(text.getStringProperty("text-class"))) {
                        out.start("h2").text(text.getText()).end();
                        continue;
                    }
                    //do other kinds of text
                    String style = "position: absolute;"
                            +" left:"+(node.getTranslateX()+text.getX())+"px;"
                            +" top:" +(node.getTranslateY()+text.getY())+"px;"
                            +" color:"+toHTMLColor(text.getFillPaint())+";"
                            +" font:"+toHTMLFont(text)+";"
                            ;
                    out.start("p")
                            .attr("style",style)
                            .text(text.getText())
                            .end();
                } else {
                    renderShape(out,node);
                }
            }
View Full Code Here

TOP

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

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.