Package nextapp.echo2.app

Examples of nextapp.echo2.app.Component


     *
     * @param rc the relevant <code>RenderContext</code>
     */
    private void setModalContextRootId(RenderContext rc) {
        ApplicationInstance applicationInstance = rc.getContainerInstance().getApplicationInstance();
        Component modalContextRoot = applicationInstance.getModalContextRoot();
        if (modalContextRoot == null) {
            rc.getServerMessage().setModalContextRootId(null);
        } else {
            rc.getServerMessage().setModalContextRootId(ContainerInstance.getElementId(modalContextRoot));
        }
View Full Code Here


            public void actionPerformed(ActionEvent e) {
                int itemCount = testColumn.getComponentCount();
                if (itemCount == 0) {
                    return;
                }
                Component item = testColumn.getComponent((int) (Math.random() * itemCount));
                testColumn.remove(item);
                testColumn.add(item, (int) (Math.random() * (itemCount - 1)));
            }
        });
        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setForeground(null);
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setBackground(null);
            }
        });
        controlsColumn.addButton("Set Border (All Attributes)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setBorder(StyleUtil.randomBorder());
            }
        });
        controlsColumn.addButton("Set Border Color", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = testColumn.getBorder();
                if (border == null) {
                    border = new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID);
                }
                testColumn.setBorder(new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle()));
            }
        });
        controlsColumn.addButton("Set Border Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setBorder(StyleUtil.nextBorderSize(testColumn.getBorder()));
            }
        });
        controlsColumn.addButton("Set Border Style", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setBorder(StyleUtil.nextBorderStyle(testColumn.getBorder()));
            }
        });
        controlsColumn.addButton("Remove Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setBorder(null);
            }
        });
        controlsColumn.addButton("Cell Spacing -> 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setCellSpacing(new Extent(0, Extent.PX));
            }
        });
        controlsColumn.addButton("Cell Spacing -> 2px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setCellSpacing(new Extent(2, Extent.PX));
            }
        });
        controlsColumn.addButton("Cell Spacing -> 20px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setCellSpacing(new Extent(20, Extent.PX));
            }
        });
        controlsColumn.addButton("Insets -> null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setInsets(null);
            }
        });
        controlsColumn.addButton("Insets -> 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Insets -> 5px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setInsets(new Insets(5));
            }
        });
        controlsColumn.addButton("Insets -> 10/20/30/40px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.setInsets(new Insets(10, 20, 30, 40));
            }
        });
        controlsColumn.addButton("Set Layout Data (of random item)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int componentCount = testColumn.getComponentCount();
                if (componentCount == 0) {
                    return;
                }
                Component component =  testColumn.getComponent((int) (Math.random() * componentCount));
                ColumnLayoutData columnLayoutData = new ColumnLayoutData();
                columnLayoutData.setAlignment(StyleUtil.randomAlignmentHV());
                columnLayoutData.setBackground(StyleUtil.randomBrightColor());
                columnLayoutData.setInsets(new Insets((int) (Math.random() * 30)));
                switch((int) (Math.random() * 7)) {
                case 0:
                     columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_DARK_BLUE);
                     break;
                case 1:
                     columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                     break;
                case 2:
                     columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_5_PX_REPEAT);
                     break;
                case 3:
                     columnLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_1_PERCENT_REPEAT);
                     break;
                default:
                     columnLayoutData.setBackgroundImage(null);
                }
               
                component.setLayoutData(columnLayoutData);
            }
        });
        controlsColumn.addButton("Add Item, Randomize Column Insets", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testColumn.add(new Label("Added item [" + nextValue++ + "]"));
View Full Code Here

            public void actionPerformed(ActionEvent e) {
                int itemCount = testRow.getComponentCount();
                if (itemCount == 0) {
                    return;
                }
                Component item = testRow.getComponent((int) (Math.random() * itemCount));
                testRow.remove(item);
                testRow.add(item, (int) (Math.random() * (itemCount - 1)));
            }
        });
        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setForeground(null);
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setBackground(null);
            }
        });
        controlsColumn.addButton("Set Border (All Attributes)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setBorder(StyleUtil.randomBorder());
            }
        });
        controlsColumn.addButton("Set Border Color", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = testRow.getBorder();
                if (border == null) {
                    border = new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID);
                }
                testRow.setBorder(new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle()));
            }
        });
        controlsColumn.addButton("Set Border Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setBorder(StyleUtil.nextBorderSize(testRow.getBorder()));
            }
        });
        controlsColumn.addButton("Set Border Style", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setBorder(StyleUtil.nextBorderStyle(testRow.getBorder()));
            }
        });
        controlsColumn.addButton("Remove Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setBorder(null);
            }
        });
        controlsColumn.addButton("Cell Spacing -> 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setCellSpacing(new Extent(0, Extent.PX));
            }
        });
        controlsColumn.addButton("Cell Spacing -> 2px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setCellSpacing(new Extent(2, Extent.PX));
            }
        });
        controlsColumn.addButton("Cell Spacing -> 20px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setCellSpacing(new Extent(20, Extent.PX));
            }
        });
        controlsColumn.addButton("Insets -> null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setInsets(null);
            }
        });
        controlsColumn.addButton("Insets -> 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Insets -> 5px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setInsets(new Insets(5));
            }
        });
        controlsColumn.addButton("Insets -> 10/20/30/40px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.setInsets(new Insets(10, 20, 30, 40));
            }
        });
        controlsColumn.addButton("Alignment -> Leading", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                testRow.setAlignment(new Alignment(Alignment.LEADING, Alignment.DEFAULT));
            }
        });
        controlsColumn.addButton("Alignment -> Trailing", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                testRow.setAlignment(new Alignment(Alignment.TRAILING, Alignment.DEFAULT));
            }
        });
        controlsColumn.addButton("Alignment -> Left", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                testRow.setAlignment(new Alignment(Alignment.LEFT, Alignment.DEFAULT));
            }
        });
        controlsColumn.addButton("Alignment -> Center", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                testRow.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT));
            }
        });
        controlsColumn.addButton("Alignment -> Right", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                testRow.setAlignment(new Alignment(Alignment.RIGHT, Alignment.DEFAULT));
            }
        });
        controlsColumn.addButton("Alignment -> Default", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                testRow.setAlignment(new Alignment(Alignment.DEFAULT, Alignment.DEFAULT));
            }
        });
       
        controlsColumn.addButton("Clear All LayoutData", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int componentCount = testRow.getComponentCount();
                for (int i = 0; i < componentCount; ++i) {
                    testRow.getComponent(i).setLayoutData(null);
                }
            }
        });

        controlsColumn.addButton("Set Layout Data of All Items to 100%/count Width", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int componentCount = testRow.getComponentCount();
                for (int i = 0; i < componentCount; ++i) {
                    RowLayoutData rowLayoutData = new RowLayoutData();
                    rowLayoutData.setWidth(new Extent(100 / componentCount, Extent.PERCENT));
                    rowLayoutData.setBackground(StyleUtil.randomBrightColor());
                    testRow.getComponent(i).setLayoutData(rowLayoutData);
                }
            }
        });
       
        controlsColumn.addButton("Set Layout Data (of random item)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int componentCount = testRow.getComponentCount();
                if (componentCount == 0) {
                    return;
                }
                Component component =  testRow.getComponent((int) (Math.random() * componentCount));
                RowLayoutData rowLayoutData = new RowLayoutData();
                rowLayoutData.setAlignment(StyleUtil.randomAlignmentHV());
                rowLayoutData.setBackground(StyleUtil.randomBrightColor());
                rowLayoutData.setInsets(new Insets((int) (Math.random() * 30)));
                switch((int) (Math.random() * 7)) {
                case 0:
                     rowLayoutData.setBackgroundImage(Styles.BG_SHADOW_DARK_BLUE);
                     break;
                case 1:
                     rowLayoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                     break;
                default:
                     rowLayoutData.setBackgroundImage(null);
                }
               
                component.setLayoutData(rowLayoutData);
            }
        });
        controlsColumn.addButton("Add Item, Randomize Column Insets", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testRow.add(new Label("Added item [" + nextValue++ + "]"));
View Full Code Here

     * @param rc the relevant <code>RenderContext</code>
     * @param update the update
     */
    private void renderRemoveChildren(RenderContext rc, ServerComponentUpdate update) {
        Component[] removedChildren = update.getRemovedChildren();
        Component parent = update.getParent();
        String parentId = ContainerInstance.getElementId(parent);
        for (int i = 0; i < removedChildren.length; ++i) {
            String childId = ContainerInstance.getElementId(removedChildren[i]);
            DomUpdate.renderElementRemove(rc.getServerMessage(),
                    parentId + "_cell_" + childId);
            DomUpdate.renderElementRemove(rc.getServerMessage(),
                    parentId + "_spacing_" + childId);
        }

        int componentCount = parent.getVisibleComponentCount();
        if (componentCount > 0) {
            DomUpdate.renderElementRemove(rc.getServerMessage(), parentId + "_spacing_"
                    + ContainerInstance.getElementId(parent.getVisibleComponent(componentCount - 1)));
        }
    }
View Full Code Here

     * @param rc the relevant <code>RenderContext</code>
     * @param update the update
     */
    private void renderRemoveChildren(RenderContext rc, ServerComponentUpdate update) {
        Component[] removedChildren = update.getRemovedChildren();
        Component parent = update.getParent();
        String parentId = ContainerInstance.getElementId(parent);
        for (int i = 0; i < removedChildren.length; ++i) {
            String childId = ContainerInstance.getElementId(removedChildren[i]);
            DomUpdate.renderElementRemove(rc.getServerMessage(),
                    parentId + "_cell_" + childId);
            DomUpdate.renderElementRemove(rc.getServerMessage(),
                    parentId + "_spacing_" + childId);
        }

        int componentCount = parent.getVisibleComponentCount();
        if (componentCount > 0) {
            DomUpdate.renderElementRemove(rc.getServerMessage(), parentId + "_spacing_"
                    + ContainerInstance.getElementId(parent.getVisibleComponent(componentCount - 1)));
        }
    }
View Full Code Here

    public static ImageReference getCellLayoutDataBackgroundImage(Component component, String imageId) {
        if (imageId.startsWith(IMAGE_ID_PREFIX_LAYOUT_DATA_BACKGROUND_IMAGE)) {
            String childRenderId = imageId.substring(IMAGE_ID_PREFIX_LAYOUT_DATA_BACKGROUND_IMAGE_LENGTH);
            int childCount = component.getComponentCount();
            for (int i = 0; i < childCount; ++i) {
                Component child = component.getComponent(i);
                if (child.getRenderId().equals(childRenderId)) {
                    return ((CellLayoutData) child.getRenderProperty(Component.PROPERTY_LAYOUT_DATA))
                            .getBackgroundImage().getImage();
                }
            }
        }
        return null;
View Full Code Here

     */
    @Override
    protected void createControls() throws Exception {
        super.createControls();
        this.tbMain = new JbsToolbar();
        this.pnMain = new ContentPane();
       
        this.btnNew = new JbsObjectToolPaneButton("add.png",JbsL10N.getString("StdList.newCaption"),false);
        this.btnNew.setToolTipText(JbsL10N.getString("StdList.newTooltip"));
        this.btnNew.addActionListener(new ActionListener() {
       
View Full Code Here

    protected JbsLangEntryHelper createTextField(JbsLanguage language) {
        return new JbsLangEntryTextField(language);
    }

    protected void initPanel() {
        Grid grdMain = new Grid(2);
        grdMain.setInsets(new nextapp.echo2.app.Insets(5, 5));
        grdMain.setColumnWidth(0, new JbsExtent(300));

        Iterator<JbsLangEntryHelper> it = this.getTextFields().iterator();
        while (it.hasNext()) {
            JbsLangEntryTextField txtField = (JbsLangEntryTextField) it.next();
            grdMain.add(new Label(txtField.getLanguage().getName()));
            grdMain.add(txtField);
        }

        this.getPnMain().add(grdMain);
    }
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

TOP

Related Classes of nextapp.echo2.app.Component

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.