Package org.joshy.sketch.controls

Examples of org.joshy.sketch.controls.ToggleGroup


        tools.add(new ToolbarButton(Main.getIcon("cr22-action-tool_rect_selection.png")),selectionTool);

        lineTool = new LineTool(this);
        tools.add(new ToolbarButton(Main.getIcon("cr22-action-14_polyline.png")),lineTool);

        group = new ToggleGroup();
        for(Button button : tools.keys()) {
            group.add(button);
            toolbar.add(button);
        }
        EventBus.getSystem().addListener(ActionEvent.Action, new Callback<ActionEvent>(){
View Full Code Here


        final Radiobutton contents = new Radiobutton("Page contents (just big enough for the content)");
        final Radiobutton page = new Radiobutton("Entire page (clipped at page edges)");
        final Checkbox includeStamp = new Checkbox("include 'handcrafted with LeonardoSketch.org' in lower left");
        includeStamp.setSelected(true);

        final ToggleGroup tg = new ToggleGroup();
        tg.add(selected)
                .add(contents)
                .add(page);
        tg.setSelectedButton(page);

        grid.addControl(new Label("Share:"));
        grid.addControl(selected);
        grid.nextRow();
        grid.addControl(new Spacer());
        grid.addControl(contents);
        grid.nextRow();
        grid.addControl(new Spacer());
        grid.addControl(page);
        grid.nextRow();
        grid.nextRow();
        grid.addControl(includeStamp);
        grid.nextRow();
        Button cancelButton = new Button("cancel");
        cancelButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
            }
        });
        grid.addControl(cancelButton);
        Button continueButton = new Button("continue");
        continueButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
                final File file = File.createTempFile("foo", ".png");
                file.deleteOnExit();

                CanvasDocument doc = context.getDocument();
                if(doc instanceof SketchDocument) {
                    SketchDocument sdoc = (SketchDocument) doc;
                    SavePNGAction save = new SavePNGAction(null);
                    VectorDocContext vdc = (VectorDocContext) context;
                    save.includeBackground = true;
                    if(includeStamp.isSelected()) {
                        save.includeStamp = true;
                    }
                    if(tg.getSelectedButton() == page) {
                        save.includeDocumentBounds = true;
                    }
                    if(tg.getSelectedButton() == selected) {
                        SavePNGAction.exportFragment(file, (Iterable<SNode>) vdc.getSelection().items());
                    } else {
                        save.export(file, sdoc);
                    }
                }
View Full Code Here

TOP

Related Classes of org.joshy.sketch.controls.ToggleGroup

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.