Examples of Stage


Examples of org.joshy.gfx.stage.Stage

            @Override
            public void execute() throws Exception {
                u.p("managing assets");

                try {
                    Stage stage = Stage.createStage();
                    stage.setContent(AssetManager.setupMain());
                    stage.centerOnScreen();
                } catch (Throwable thr) {
                    thr.printStackTrace();
                }
            }
        });
       
        /*editMenu.addItem("Enable Analytics Tracking", new ToggleAction(){
            @Override
            public boolean getToggleState() {
                return trackingEnabled;
            }

            @Override
            public void setToggleState(boolean toggleState) {
                trackingEnabled = toggleState;
            }
        });
        */
        menubar.add(editMenu);
        context.createAfterEditMenu(menubar);

        Menu viewMenu = new Menu().setTitle(getString("menus.view"))
                .addItem(getString("menus.zoomIn"),     "EQUALS", new ViewActions.ZoomInAction(context))
                .addItem(getString("menus.zoomOut"),    "MINUS"new ViewActions.ZoomOutAction(context))
                .addItem(getString("menus.zoomActual"), "0",      new ViewActions.ZoomResetAction(context))
                .separator()
                .addItem(getString("menus.fullScreen"), "F",      new ViewActions.ToggleFullScreen(context))
                .addItem(getString("menus.fullScreenWithMenubar"), new ViewActions.ToggleFullScreenMenubar(context))
                .separator()
                .addItem(getString("menus.newView"), new ViewActions.NewView(context))
                .addItem("Show Rulers", new ViewActions.ShowRulers(context))
                .addItem("Show Page List", new ViewActions.ShowPageList(context))
                ;
       
        if(context instanceof VectorDocContext) {
            VectorDocContext vdc = (VectorDocContext) context;
            viewMenu
                    .addItem(getString("menus.showDocumentBounds")new ViewActions.ShowDocumentBounds(vdc))
                    .addItem(getString("menus.showGrid"),             new ViewActions.ShowGridAction(vdc))
                    .addItem(getString("menus.snapGrid"),          new ViewActions.SnapGridAction(vdc))
                    .addItem(getString("menus.snapDocEdges"),          new ViewActions.SnapDocBoundsAction(vdc))
                    .addItem(getString("menus.snapNodeEdges"),          new ViewActions.SnapNodeBoundsAction(vdc))
                    .separator();
            viewMenu.addItem(getString("menus.viewSidebar"), new ViewActions.ViewSidebarAction(vdc));
            for(SAction a : vdc.getSidebarPanelViewActions()) {
                viewMenu.addItem(a.getDisplayName(), a);
            }
        }

        //view menu
        menubar.add(viewMenu);

        Menu shareMenu = new Menu().setTitle(getString("menus.share"))
                .addItem(getString("menus.sendTwitter"), new TwitPicAction(context))
                .addItem(getString("menus.configTwitter"), new TwitPicAction.ChangeSettingsAction(context, true))
                .addItem(getString("menus.sendFlickr"), new FlickrUploadAction(context))
                .addItem(getString("menus.changeFlickrSettings"), new FlickrUploadAction.ChangeFlickrSettingsAction(context,true))
        ;

        if(OSUtil.isMac()) {
            shareMenu.addItem(getString("menus.sendEmailPNG"), new SendMacMail(context));
        }
        menubar.add(shareMenu);

        Menu scriptMenu = new Menu().setTitle(getString("menus.scripts"));
        if(SCRIPTS_DIR.exists()) {
            for(File file : SCRIPTS_DIR.listFiles()) {
                if(file.exists() && file.getName().toLowerCase().endsWith(".js")) {
                    scriptMenu.addItem(file.getName(),new ScriptTools.RunScriptAction(file,context));
                }
            }
        }
        menubar.add(scriptMenu);

        if(settings.containsKey(DEBUG_MENU)) {
            if("true".equals(settings.getProperty(DEBUG_MENU))) {
                Menu debugMenu = new Menu().setTitle(getString("menus.debug"));
                /*debugMenu.addItem("Show Console", new SAction(){
                    @Override
                    public void execute() throws Exception {

                    }
                })*/
                debugMenu.addItem(getString("menus.editTranslations"), new SAction() {
                    @Override
                    public void execute() throws Exception {
                        Stage s = Stage.createStage();
                        s.setContent(new TranslationEditor());
                        s.setWidth(800);
                        s.setHeight(400);
                        s.centerOnScreen();
                    }
                });
                menubar.add(debugMenu);
            }
        }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

        Core.init();
        Core.getShared().defer(new PathTests());
    }

    public void run() {
        Stage stage = Stage.createStage();
        EventBus.getSystem().addListener(MouseEvent.MouseMoved, new Callback<MouseEvent>(){
            public void call(MouseEvent event) {
                //u.p("-----");
                P closest = calculatePoint(p1,p2,p3,p4,0);
                double closestDistance = calculateDistance(event.getX(),event.getY(),closest);
                double closestT = 0;
                for(double t=0; t<=1.0; t+=0.01) {
                    P b = calculatePoint(p1,p2,p3,p4,t);
                    double distance = calculateDistance(event.getX(),event.getY(),b);
                    if(distance < closestDistance) {
                        closestDistance = distance;
                        closest = b;
                        closestT = t;
                    }
                }
                //u.p("point = " + closest.x + " " + closest.y + " " + closestDistance + " " + closestT);
                realClosest = closest;
                node.redraw();
            }

            private double calculateDistance(double x, double y, P b) {
                double dx = x-b.x;
                double dy = y-b.y;
                double distance = Math.sqrt(dx*dx+dy*dy);
                return distance;
            }
        });
        node = new MyNode();

        stage.setContent(node);
    }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

        g.fillDisplacementClouds(20,20,100,200);




        Stage stage = Stage.createStage();
        stage.setContent(new PixelCanvasNode(doc));
        stage.setWidth(800);
        stage.setHeight(600);
    }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

        }

        Textarea log = new Textarea();
        log.setText(buf.toString());
        final Stage stage = Stage.createStage();
        stage.setContent(new VFlexBox()
                .setBoxAlign(VFlexBox.Align.Stretch)
                .add(new Label(s))
                .add(new ScrollPane(log),1)
                .add(new Button("Close").onClicked(new Callback<ActionEvent>(){
            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
            }
        }))
        );
        stage.centerOnScreen();
    }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

                set the size of the doc in pixels
                hit the cancel button
                hit the okay button
                 */

        final Stage dialog = Stage.createStage();
        dialog.setTitle(getString("newDocumentDialog.title"));

        final Textbox width = new Textbox("800");
        width.setPrefWidth(100);
        final Textbox height = new Textbox("600");
        height.setPrefWidth(100);
        Callback<ActionEvent> canceled = new Callback<ActionEvent>() {
            public void call(ActionEvent event) {
                dialog.hide();
            }
        };

        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.
                }
            }
        };


        final PopupMenuButton popup = new PopupMenuButton();
        popup.setModel(ListView.createModel(new String[]{"800x600","1024x1024"}));
        Callback<ActionEvent> clicked = new Callback<ActionEvent>() {
            public void call(ActionEvent event) {
                switch(popup.getSelectedIndex()) {
                    case 0: width.setText("800"); height.setText("600"); break;
                    case 1: width.setText("1024"); height.setText("768"); break;
                }
            }
        };
        popup.onClicked(clicked);
        dialog.setContent(
                new GridBox()
                        .setPadding(5)
                        .createColumn(70, GridBox.Align.Right)
                        .createColumn(100, GridBox.Align.Left)
                        .addControl(new Label(getString("newDocumentDialog.preset")))
                        .addControl(popup)
                        .nextRow()
                        .addControl(new Label(getString("newDocumentDialog.width") +" (px):"))
                        .addControl(width)
                        .nextRow()
                        .addControl(new Label(getString("newDocumentDialog.height")+" (px):"))
                        .addControl(height)
                        .nextRow()
                        .addControl(new Button(getString("dialog.cancel")).onClicked(canceled))
                        .addControl(new Button(getString("dialog.okay")).onClicked(okay))
                );
        dialog.setWidth(300);
        dialog.setHeight(200);
        dialog.centerOnScreen();
    }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

                undoFullscreen.call(null);
                undoFullscreen = null;
                return;
            }
           
            final Stage stage = context.getStage();
            GraphicsDevice device = GraphicsEnvironment.
                    getLocalGraphicsEnvironment().
                    getDefaultScreenDevice();
            if (device.isFullScreenSupported()) {
                stage.setUndecorated(true);
                JFrame frame = (JFrame) stage.getNativeWindow();
                device.setFullScreenWindow(frame);
            } else {
                System.err.println("Full screen not supported");
            }
            undoFullscreen = new Callback(){
                public void call(Object event) {
                    GraphicsDevice device = GraphicsEnvironment.
                            getLocalGraphicsEnvironment().
                            getDefaultScreenDevice();
                    device.setFullScreenWindow(null);
                    stage.setUndecorated(false);
                }
            };
        }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

                undoFullscreen.call(null);
                undoFullscreen = null;
                return;
            }

            final Stage stage = context.getStage();
           
            final JFrame f2 = (JFrame) stage.getNativeWindow();
            final Point oldLocation = f2.getLocation();
            final Dimension oldSize = f2.getSize();

            Toolkit tk = Toolkit.getDefaultToolkit();
            Insets insets = tk.getScreenInsets(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration());
            Dimension size = tk.getScreenSize();
            stage.setUndecorated(true);
            final JFrame frame = (JFrame) stage.getNativeWindow();
            undoFullscreen = new Callback() {
                public void call(Object event) {
                    stage.setUndecorated(false);
                    frame.setLocation(oldLocation);
                    frame.setSize(oldSize);
                }
            };
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

            this.context = context;
        }

        @Override
        public void execute() {
            Stage stage = Stage.createStage();
            stage.setTitle("View 1");
            stage.setContent(new ViewPanel());
            stage.setWidth(300);
            stage.setHeight(300);
        }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

        return getString("menus.about");
    }

    @Override
    public void execute() throws Exception {
        final Stage stage = Stage.createStage();
        stage.setTitle("About Leonardo");
        Callback openLink = new org.joshy.gfx.event.Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                OSUtil.openBrowser("http://leonardosketch.org/download-source/");
            }
        };
        Callback closeStage = new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
            }
        };
       
        //leonardo sketch
        stage.setContent(new VFlexBox().setBoxAlign(VFlexBox.Align.Stretch)
                .add(new HFlexBox()
                        .add(new ImageBox().setImage(Main.class.getResource("resources/Turtle.png"))))
                //.add(new HFlexBox().add(new Label("Leonardo")).setId("aboutHeader"))
                //.add(new HFlexBox().add(new Linkbutton("http://leonardosketch.org/").onClicked(openLink)))
                .add(new HFlexBox().add(new Label("Leonardo is open source, BSD licensed."+
                        " It contains software from Apache, Twitter4J, Parboiled."+
                        " Fonts from The League Of Movable Type." +
                        " Icon by VisualPharm (Ivan Boyko).").setPrefWidth(370)))
                .add(new HFlexBox().add(new Linkbutton("Click for license info").onClicked(openLink)))
                .add(new HFlexBox()
                        .add(new Label("Version"))
                        .add(new Label(Main.releaseProperties.getProperty("org.joshy.sketch.build.version"))))
                .add(new HFlexBox()
                        .add(new Label("Build number"))
                        .add(new Label(Main.releaseProperties.getProperty("org.joshy.sketch.build.number"))))
                .add(new HFlexBox()
                        .add(new Label("Build date"))
                        .add(new Label(Main.releaseProperties.getProperty("org.joshy.sketch.build.date"))))
                .add(new Spacer(),1)
                .add(new HFlexBox().add(new Spacer(),1).add(new Button("Close").onClicked(closeStage)))
        );
        stage.setWidth(400);
        stage.setHeight(400);
        stage.centerOnScreen();
    }
View Full Code Here

Examples of org.joshy.gfx.stage.Stage

    public static void main(String ... args) throws Exception {
        Core.init();
        Core.getShared().defer(new Runnable() {
            public void run() {
                Stage stage = Stage.createStage();
                stage.setContent(new HSVColorPicker6());
                stage.setWidth(600);
                stage.setHeight(600);
                EventBus.getSystem().addListener(SystemMenuEvent.Quit, new Callback<Event>() {
                    public void call(Event event) throws Exception {
                        System.exit(0);
                    }
                });
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.