Package nextapp.echo2.app

Examples of nextapp.echo2.app.Grid


        controlsColumn.addButton("Set Content (Grid)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (panel.getComponentCount() > 0) {
                    panel.removeAll();
                }
                Grid grid = new Grid();
                grid.setBorder(StyleUtil.randomBorder());
                grid.setInsets(new Insets(StyleUtil.randomExtent(8)));
                grid.add(new Label("A label"));
                grid.add(new Label("A label"));
                grid.add(new Label("A label"));
                grid.add(new Label("A label"));
                grid.add(new Label("A label"));
                panel.add(grid);
            }
        });
        controlsColumn.addButton("Clear Content", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
View Full Code Here


       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Insert/Delete Cells"));
        groupContainerColumn.add(controlsColumn);
       
        final Grid grid = new Grid(4);
        grid.setBorder(new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID));
        while (nextCellNumber < 17) {
            grid.add(createGridCellButton());
        }
        testColumn.add(grid);

        controlsColumn.addButton("Clear Selection", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                selectCellButton(null);
            }
        });

        controlsColumn.addButton("Insert Cell Before Selected", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    grid.add(createGridCellButton(), grid.indexOf(selectedButton));
                }
            }
        });

        controlsColumn.addButton("Append New Cell", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Button button = createGridCellButton();
                grid.add(button);
                selectCellButton(button);
            }
        });

        controlsColumn.addButton("Append 10 New Cells", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Button button = null;
                for (int i = 0; i < 10; ++i) {
                    button = createGridCellButton();
                    grid.add(button);
                }
                selectCellButton(button);
            }
        });

        controlsColumn.addButton("Delete Selected Cell", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    int index = grid.indexOf(selectedButton);
                    grid.remove(selectedButton);
                    if (grid.getComponentCount() != 0) {
                        if (index < grid.getComponentCount()) {
                            selectCellButton((Button) grid.getComponent(index));
                        } else {
                            selectCellButton((Button) grid.getComponent(grid.getComponentCount() - 1));
                        }
                    } else {
                        selectCellButton(null);
                    }
                }
            }
        });
       
        controlsColumn.addButton("Delete All Cells", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.removeAll();
            }
        });
       
        controlsColumn.addButton("Add Row-Button Cell", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Row row = new Row();
                for (int i = 0; i < 3; ++i) {
                    Button button = new Button("Test (" + i + ") Test");
                    button.setStyleName("Default");
                    row.add(button);
                }
                grid.add(row);
            }
        });
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Configure Grid"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Swap Orientation", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setOrientation(grid.getOrientation() == Grid.ORIENTATION_VERTICAL
                        ? Grid.ORIENTATION_HORIZONTAL : Grid.ORIENTATION_VERTICAL);
            }
        });
       
        controlsColumn.addButton("[+] Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setSize(grid.getSize() + 1);
            }
        });

        controlsColumn.addButton("[-] Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (grid.getSize() > 1) {
                    grid.setSize(grid.getSize() - 1);
                }
            }
        });
        controlsColumn.addButton("Change Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Change Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Change Border (All Attributes)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setBorder(StyleUtil.randomBorder());
            }
        });
        controlsColumn.addButton("Change Border Color", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = grid.getBorder();
                grid.setBorder(new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle()));
            }
        });
        controlsColumn.addButton("Change Border Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setBorder(StyleUtil.nextBorderSize(grid.getBorder()));
            }
        });
        controlsColumn.addButton("Change Border Style", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setBorder(StyleUtil.nextBorderStyle(grid.getBorder()));
            }
        });
       
        controlsColumn.addButton("Set Insets 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Set Insets 2px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setInsets(new Insets(2));
            }
        });
        controlsColumn.addButton("Set Insets 10/5px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setInsets(new Insets(10, 5));
            }
        });
        controlsColumn.addButton("Set Insets 10/20/30/40px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setInsets(new Insets(10, 20, 30, 40));
            }
        });
        controlsColumn.addButton("Set Width = null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setWidth(null);
            }
        });
        controlsColumn.addButton("Set Width = 500px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setWidth(new Extent(500));
            }
        });
        controlsColumn.addButton("Set Width = 100%", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                grid.setWidth(new Extent(100, Extent.PERCENT));
            }
        });
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Configure Cell"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("[+] Column Span", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    if (layoutData.getColumnSpan() < 1) {
                        layoutData.setColumnSpan(1);
                    } else {
                        layoutData.setColumnSpan(layoutData.getColumnSpan() + 1);
                    }
                    selectedButton.setLayoutData(layoutData);
                    retitle(selectedButton);
                }
            }
        });

        controlsColumn.addButton("[-] Column Span", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    if (layoutData.getColumnSpan() > 1) {
                        layoutData.setColumnSpan(layoutData.getColumnSpan() - 1);
                    } else {
                        layoutData.setColumnSpan(1);
                    }
                    selectedButton.setLayoutData(layoutData);
                    retitle(selectedButton);
                }
            }
        });
       
        controlsColumn.addButton("[+] Row Span", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    if (layoutData.getRowSpan() < 1) {
                        layoutData.setRowSpan(1);
                    } else {
                        layoutData.setRowSpan(layoutData.getRowSpan() + 1);
                    }
                    selectedButton.setLayoutData(layoutData);
                    retitle(selectedButton);
                }
            }
        });

        controlsColumn.addButton("[-] Row Span", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    if (layoutData.getRowSpan() > 1) {
                        layoutData.setRowSpan(layoutData.getRowSpan() - 1);
                    } else {
                        layoutData.setRowSpan(1);
                    }
                    selectedButton.setLayoutData(layoutData);
                    retitle(selectedButton);
                }
            }
        });

        controlsColumn.addButton("Column Span: FILL", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setColumnSpan(GridLayoutData.SPAN_FILL);
                    selectedButton.setLayoutData(layoutData);
                    retitle(selectedButton);
                }
            }
        });

        controlsColumn.addButton("Row Span: FILL", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setRowSpan(GridLayoutData.SPAN_FILL);
                    selectedButton.setLayoutData(layoutData);
                    retitle(selectedButton);
                }
            }
        });

        controlsColumn.addButton("Set Insets 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setInsets(new Insets(0));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Insets 2px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setInsets(new Insets(2));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Insets 10/5px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setInsets(new Insets(10, 5));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Insets 10/20/30/40px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setInsets(new Insets(10, 20, 30, 40));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Alignment = Default", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setAlignment(null);
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Alignment = Leading/Top", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setAlignment(new Alignment(Alignment.LEADING, Alignment.TOP));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Alignment = Trailing/Bottom", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setAlignment(new Alignment(Alignment.TRAILING, Alignment.BOTTOM));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Alignment = Left/Top", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setAlignment(new Alignment(Alignment.LEFT, Alignment.TOP));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Alignment = Right/Bottom", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setAlignment(new Alignment(Alignment.RIGHT, Alignment.BOTTOM));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Alignment = Center/Center", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setAlignment(new Alignment(Alignment.CENTER, Alignment.CENTER));
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Background Image (5px)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_5_PX_REPEAT);
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Set Background Image (1%)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_1_PERCENT_REPEAT);
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });
        controlsColumn.addButton("Clear BackgroundImage", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selectedButton != null) {
                    GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
                    layoutData.setBackgroundImage(null);
                    selectedButton.setLayoutData(layoutData);
                }
            }
        });

        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Configure Rows/Columns"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Clear Widths of First 16 Columns", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                for (int i = 0; i < 16; ++i) {
                    grid.setColumnWidth(i, null);
                }
            }
        });
       
        controlsColumn.addButton("Set First 16 Columns to 100px Width", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Extent width = new Extent(100);
                for (int i = 0; i < 16; ++i) {
                    grid.setColumnWidth(i, width);
                }
            }
        });
       
        controlsColumn.addButton("Set First 16 Columns to Random Width", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                for (int i = 0; i < 16; ++i) {
                    grid.setColumnWidth(i, new Extent( ((int) (Math.random() * 100)) + 50));
                }
            }
        });

        controlsColumn.addButton("Clear Heights of First 16 Rows", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                for (int i = 0; i < 16; ++i) {
                    grid.setRowHeight(i, null);
                }
            }
        });
       
        controlsColumn.addButton("Set First 16 Rows to 100px Height", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Extent height = new Extent(100);
                for (int i = 0; i < 16; ++i) {
                    grid.setRowHeight(i, height);
                }
            }
        });

        controlsColumn.addButton("Set First 16 Rows to Random Height", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                for (int i = 0; i < 16; ++i) {
                    grid.setRowHeight(i, new Extent( ((int) (Math.random() * 100)) + 50));
                }
            }
        });
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Additional Tests"));
        groupContainerColumn.add(controlsColumn);

        controlsColumn.addButton("Grid/Column/Grid FillImage Test", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                WindowPane windowPane = new WindowPane();
                windowPane.setTitle("Grid/Column/Grid FillImage Test");
                windowPane.setInsets(new Insets(10));
                windowPane.setStyleName("Default");
                windowPane.setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
                InteractiveApp.getApp().getDefaultWindow().getContent().add(windowPane);
               
                GridLayoutData gld;
                ColumnLayoutData cld;
               
                Grid grid0 = new Grid();
                grid0.setInsets(new Insets(5));
               
                grid0.add(new Label("Grid 0 Label"));
                grid0.add(new Label("Grid 0 Label"));
                grid0.add(new Label("Grid 0 Label"));
               
                Column column = new Column();
                column.setInsets(new Insets(5));
                grid0.add(column);
               
                column.add(new Label("Column Label"));
                column.add(new Label("Column Label"));
                column.add(new Label("Column Label"));
               
                gld = new GridLayoutData();
                gld.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PX_REPEAT);
                column.setLayoutData(gld);
                grid0.add(column);
               
                Grid grid1 = new Grid();
                grid1.setInsets(new Insets(5));
                cld = new ColumnLayoutData();
                cld.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_5_PX_REPEAT);
                grid1.setLayoutData(cld);
                column.add(grid1);

                grid1.add(new Label("Grid 1 Label"));
                grid1.add(new Label("Grid 1 Label"));
                grid1.add(new Label("Grid 1 Label"));

                windowPane.add(grid0);
            }
        });       
    }
View Full Code Here

        this.setStyleName("Default");
        this.setMaximizable(false);
        this.setMinimizable(false);
        this.setResizable(false);
        this.setModal(true);
        ImageReference icon = getMessageIcon(messageType);
        Label iconLabel = new Label("");
        int iconHeight = 0;
        if (icon != null) {
            iconLabel.setIcon(icon);
            iconHeight = icon.getHeight().getValue();
        }


        // Split newlines into multiple labels
        if (message instanceof String) {
View Full Code Here

    protected JbsContentPane initPnButtons() {
        pnButtons = new JbsContentPane();
        Row mainRow = new Row();
        mainRow.setAlignment(new Alignment(Alignment.RIGHT, Alignment.DEFAULT));
        mainRow.setInsets(new Insets(new JbsExtent(5), new JbsExtent(5)));

        btnOK = new JbsButton(JbsL10N.getString("Generic.ok"));
        btnOK.setAlignmentHorizontal(Alignment.CENTER);
        btnOK.setWidth(new JbsExtent(80));
        btnOK.addActionListener(new ActionListener() {
View Full Code Here

        return new JbsLangEntryTextArea(language);
    }

    protected void initPanel() {
        Column colMain = new Column();
        colMain.setInsets(new Insets(5, 5));

        Iterator<JbsLangEntryHelper> it = this.getTextFields().iterator();
        while (it.hasNext()) {
            JbsLangEntryTextArea txtField = (JbsLangEntryTextArea) it.next();
            txtField.setWidth(new JbsExtent(400, JbsExtent.PX));
View Full Code Here

    private static final long serialVersionUID = -4933280397139021471L;
    //private Row rowMain;

    public JbsToolbar() {
        super();
        this.setInsets(new Insets(new JbsExtent(5),new JbsExtent(0)));
        /*
        rowMain = new Row();
        rowMain.setStyleName("ToolBar");
        this.add(rowMain);
         */
 
View Full Code Here

     * Adds a button to the toolbar
     * @param button
     */
    public void addButton(BtnToolbar button) {
        Column colButton = new Column();
        colButton.setInsets(new Insets(5));
        colButton.add(button);
        this.add(colButton);
    }
View Full Code Here

     * Adds a component to the Toolbar
     * @param comp
     */
    public void addComponent(Component comp) {
        Column colButton = new Column();
        colButton.setInsets(new Insets(5));
        colButton.add(comp);
        this.add(colButton);
    }
View Full Code Here

    protected EventListenerList listenerList = new EventListenerList();
    protected PnPermissionsEdit pnPermissions;
   
    public PnEditJbsObject(DlgState state) {
        super();
        this.setInsets(new Insets(new JbsExtent(8, JbsExtent.PX)));
        this.setDlgState(state);
        this.setJbsBaseObject(null);
        this.setPnPermissions(null);
        createComponents();
        this.initPanel();
View Full Code Here

                DIALOG_INSETS + COMMAND_SEPARATION + BUTTON_HEIGHT;
       
        setHeight(new JbsExtent(dialogHeight));
        setWidth(new JbsExtent(600))// Reasonable default
        setModal(true);
        setInsets(new Insets(DIALOG_INSETS));
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Grid

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.