Examples of VFlexBox


Examples of org.joshy.gfx.node.layout.VFlexBox

                            case 1: width.setText("1024"); height.setText("768"); break;
                        }
                    }
                };
                popup.onClicked(clicked);
                dialog.setContent(new VFlexBox().add(
                        new HFlexBox().add(new Label("Preset:"),popup),
                        new HFlexBox().add(new Label("Width (px):"), width),
                        new HFlexBox().add(new Label("Height (px):"), height),
                        new HFlexBox().add(
                                new Button("Cancel")
View Full Code Here

Examples of org.joshy.gfx.node.layout.VFlexBox

    public SketchCanvas getSketchCanvas() {
        return canvas;
    }

    public void setupTools() throws Exception {
        toolbar = new VFlexBox();
        moveRectTool = new SelectMoveTool(this);
        drawTextTool = new DrawTextTool(this);
        drawPathTool = new DrawPathTool(this);
        drawNGonTool = new DrawNgonTool(this);
        drawArrowTool = new DrawArrowTool(this);
View Full Code Here

Examples of org.joshy.gfx.node.layout.VFlexBox

                Callback<ActionEvent> cancelAction = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) throws Exception {
                        stage.hide();
                    }
                };
                stage.setContent(new VFlexBox()
                        .add(builder, 1)
                        .add(new HFlexBox()
                                .add(new Button("cancel").onClicked(cancelAction), 0)
                                .add(new Button("save").onClicked(closeAction), 0)
                                ,0)
                );
                stage.setWidth(600);
                stage.setHeight(350);
                stage.centerOnScreen();
            }
        });
        VFlexBox vbox = new VFlexBox();
        vbox.setBoxAlign(FlexBox.Align.Stretch);
        vbox.setFill(FlatColor.GRAY);
        vbox.add(patternList, 1);
        vbox.add(new HFlexBox().add(addButton).add(createButton));
        panel.add("Patterns", vbox);
    }
View Full Code Here

Examples of org.joshy.gfx.node.layout.VFlexBox

                Callback<ActionEvent> canceled = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) {
                        dialog.hide();
                    }
                };
                dialog.setContent(new VFlexBox()
                        .add(picker)
                        .add(new HFlexBox()
                                .add(new Button("okay").onClicked(okay))
                                .add(new Button("cancel").onClicked(canceled))
                        )
                );
                dialog.setWidth(400);
                dialog.setHeight(370);
                dialog.centerOnScreen();
            }
        });

        switcher.setTextRenderer(new ListView.TextRenderer() {
            public String toString(SelectableControl selectableControl, Object palette, int i) {
                if(palette instanceof Palette) {
                    return ((Palette)palette).getName();
                } else {
                    return "foo";
                }
            }
        });

        EventBus.getSystem().addListener(switcher, SelectionEvent.Changed, new Callback<SelectionEvent>() {
            public void call(SelectionEvent selectionEvent) throws Exception {
                int n = selectionEvent.getView().getSelectedIndex();
                manager.colorManager.setCurrentPalette(palettes.get(n));
                colorList.setModel(manager.colorManager.getSwatchModel());
            }
        });

        VFlexBox vbox = new VFlexBox();
        vbox.setFill(FlatColor.GRAY);
        vbox.add(colorList, 1);
        vbox.add(new HFlexBox().add(addButton).add(switcher));
        vbox.setBoxAlign(FlexBox.Align.Stretch);
        panel.add("Swatches", vbox);
    }
View Full Code Here

Examples of org.joshy.gfx.node.layout.VFlexBox

    }

    public static Control setupMain() {
        db = AssetDB.getInstance();

        VFlexBox vbox = new VFlexBox();
        vbox.setBoxAlign(FlexBox.Align.Stretch);

        HFlexBox toolbar = new HFlexBox();
        toolbar.add(new Button("Add"));
        toolbar.add(new Button("New List"));
        toolbar.add(new Button("Delete"));
        toolbar.add(new Button("Table View"));
        toolbar.add(new Button("Thumb View"));

        toolbar.add(new Textbox("").setHintText("search").setWidth(100),1.0);
        vbox.add(toolbar);


        HFlexBox main = new HFlexBox();
        main.setBoxAlign(FlexBox.Align.Stretch);
        Query library = new Query("LIBRARY","----");
        library.setSelectable(false);
        all = new LibraryQuery("Everything","*",0,1);
        Query fonts = new Query("Fonts",AssetDB.FONT,6,2);
        Query symbols = new Query("Symbols",AssetDB.SYMBOLSET,4,0);
        Query textures = new Query("Textures",AssetDB.PATTERN,10,0);
        Query gradients = new Query("Gradients","gradient",19,1);
        Query images = new Query("Images","image",19,2);
        Query palettes = new Query("Palettes",AssetDB.PALETTE,4,5);
        final Query staticList = new Query("LISTS","----");
        staticList.setSelectable(false);

        sidebarList = new ListView<Query>();
        ArrayListModel<Query> sidebarModel = new ArrayListModel<Query>();
        sidebarModel.add(library);
        sidebarModel.add(all);
        sidebarModel.add(staticList);
        sidebarModel.add(fonts);
        sidebarModel.add(symbols);
        sidebarModel.add(textures);
        sidebarModel.add(gradients);
        sidebarModel.add(images);
        sidebarModel.add(palettes);
        sidebarList.setModel(sidebarModel);

        sidebarList.setRenderer(new ListView.ItemRenderer<assetmanager.Query>() {
            public void draw(GFX gfx, ListView listView, Query query, int i, double x, double y, double w, double h) {
                if(query == null) return;
                if(!query.isSelectable()) {
                    gfx.setPaint(FlatColor.GRAY);
                    gfx.fillRect(x, y, w, h);
                    gfx.setPaint(FlatColor.BLACK);
                    Font.drawCenteredVertically(gfx, query.getName(), Font.DEFAULT, x, y, w, h, false);
                    return;
                }

                gfx.setPaint(FlatColor.WHITE);
                if(listView.getSelectedIndex() == i) {
                    gfx.setPaint(FlatColor.BLUE);
                }
                gfx.fillRect(x, y, w, h);
                gfx.setPaint(FlatColor.BLACK);
                if(listView.getSelectedIndex() == i) {
                    gfx.setPaint(FlatColor.WHITE);
                }
                Font.drawCenteredVertically(gfx, query.getName(), Font.DEFAULT, x, y, w, h, false);
            }
        });


        EventBus.getSystem().addListener(sidebarList, SelectionEvent.Changed, new Callback<SelectionEvent>() {
            public void call(SelectionEvent selectionEvent) throws Exception {
                Query query = sidebarList.getModel().get(sidebarList.getSelectedIndex());
                if(query == null || !query.isSelectable()) return;
                tableView.setModel(new AssetTableModel(query.execute(db)));

            }
        });

        tableView = new TableView<Asset,String>();
        /*
        tableView.setSorter(new TableView.Sorter() {
            public Comparator createComparator(TableView.TableModel tableModel, int col, TableView.SortOrder sortOrder) {
                return Collator.getInstance();
            }
        });
        */
        tableView.setModel(new AssetTableModel(new ArrayList<Asset>()));
        tableView.setRenderer(new TableView.DataRenderer<assetmanager.Asset>() {
            public void draw(GFX gfx, TableView tableView, Asset asset, int row, int column, double x, double y, double w, double h) {
                if(asset == null) return;
                gfx.setPaint(FlatColor.WHITE);
                gfx.fillRect(x,y,w,h);
                gfx.setPaint(FlatColor.BLACK);
                if(column == 0) {
                    Font.drawCenteredVertically(gfx, asset.getName(), Font.DEFAULT, x, y, w, h, false);
                }
                if(column == 1) {
                    Font.drawCenteredVertically(gfx, asset.getKind(), Font.DEFAULT, x, y, w, h, false);
                }
                if(column == 2) {
                    Image img = null;
                    if(asset.getKind().equals(AssetDB.PATTERN)) {
                        img = RenderUtil.patternToImage(asset);
                    }
                    if(asset.getKind().equals(AssetDB.PALETTE)) {
                        img = RenderUtil.toImage((Palette)asset);
                    }
                    if(asset.getKind().equals(AssetDB.FONT)) {
                        img = RenderUtil.fontToImage(asset);
                    }
                    if(img != null) {
                        Bounds oldClip = gfx.getClipRect();
                        gfx.setClipRect(new Bounds(x,y,w,h));
                        gfx.drawImage(img,x,y);
                        gfx.setClipRect(oldClip);
                    }
                }
            }
        });
        main.add(new ScrollPane(sidebarList).setPrefWidth(200));
        main.add(new ScrollPane(tableView).setPrefWidth(200),1.0);
        vbox.add(main,1.0);
        return vbox;
    }
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.