Package nextapp.echo2.app

Examples of nextapp.echo2.app.FillImage


                textArea.setBorder(border);
            }
        });
        controlsColumn.addButton("Toggle Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FillImage backgroundImage = textField.getBackgroundImage();
                if (backgroundImage == null) {
                    textField.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    passwordField.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    textArea.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                } else {
                    textField.setBackgroundImage(null);
                    passwordField.setBackgroundImage(null);
                    textArea.setBackgroundImage(null);
                }
            }
        });
        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setForeground(color);
                passwordField.setForeground(color);
                textArea.setForeground(color);
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setForeground(null);
                passwordField.setForeground(null);
                textArea.setForeground(null);
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setBackground(color);
                passwordField.setBackground(color);
                textArea.setBackground(color);
            }
        });
        controlsColumn.addButton("Clear Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setBackground(null);
                passwordField.setBackground(null);
                textArea.setBackground(null);
            }
        });
        controlsColumn.addButton("Change Disabled Border (All Attributes)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.randomBorder();
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Change Disabled Border Color", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = textField.getDisabledBorder();
                if (border == null) {
                    return;
                }
                border = new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle());
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Change Disabled Border Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.nextBorderSize(textField.getDisabledBorder());
                if (border == null) {
                    return;
                }
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Change Disabled Border Style", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.nextBorderStyle(textField.getDisabledBorder());
                if (border == null) {
                    return;
                }
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Toggle Disabled Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FillImage backgroundImage = textField.getDisabledBackgroundImage();
                if (backgroundImage == null) {
                    textField.setDisabledBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    passwordField.setDisabledBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    textArea.setDisabledBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                } else {
View Full Code Here


     * @see nextapp.echo2.webcontainer.image.ImageRenderSupport#getImage(nextapp.echo2.app.Component,
     *      java.lang.String)
     */
    public ImageReference getImage(Component component, String imageId) {
        if (IMAGE_ID_TITLE_BACKGROUND.equals(imageId)) {
            FillImage backgroundImage = (FillImage) component.getRenderProperty(WindowPane.PROPERTY_TITLE_BACKGROUND_IMAGE);
            return backgroundImage == null ? null : backgroundImage.getImage();
        } else if (IMAGE_ID_BACKGROUND.equals(imageId)) {
            FillImage backgroundImage = (FillImage) component.getRenderProperty(WindowPane.PROPERTY_BACKGROUND_IMAGE);
            return backgroundImage == null ? null : backgroundImage.getImage();
        } else if (IMAGE_ID_ICON.equals(imageId)) {
            return (ImageReference) component.getRenderProperty(WindowPane.PROPERTY_ICON);
        } else if (IMAGE_ID_CLOSE_ICON.equals(imageId)) {
            return (ImageReference) component.getRenderProperty(WindowPane.PROPERTY_CLOSE_ICON, DEFAULT_CLOSE_ICON);
        } else if (IMAGE_ID_BORDER_TOP_LEFT.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.TOP_LEFT);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_TOP.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.TOP);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_TOP_RIGHT.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.TOP_RIGHT);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_LEFT.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.LEFT);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_RIGHT.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.RIGHT);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_BOTTOM_LEFT.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.BOTTOM_LEFT);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_BOTTOM.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.BOTTOM);
            return fillImage == null ? null : fillImage.getImage();
        } else if (IMAGE_ID_BORDER_BOTTOM_RIGHT.equals(imageId)) {
            FillImageBorder fillImageBorder = ((FillImageBorder) component.getRenderProperty(WindowPane.PROPERTY_BORDER));
            FillImage fillImage = fillImageBorder == null ? null : fillImageBorder.getFillImage(FillImageBorder.BOTTOM_RIGHT);
            return fillImage == null ? null : fillImage.getImage();
        } else {
            return null;
        }
    }
View Full Code Here

        }
        Color background = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_BACKGROUND);
        if (background != null) {
            initElement.setAttribute("background", ColorRender.renderCssAttributeValue(background));
        }
        FillImage backgroundImage = (FillImage) windowPane.getRenderProperty(WindowPane.PROPERTY_BACKGROUND_IMAGE);
        if (backgroundImage != null) {
            CssStyle backgroundImageCssStyle = new CssStyle();
            FillImageRender.renderToStyle(backgroundImageCssStyle, rc, this, windowPane, IMAGE_ID_BACKGROUND,
                    backgroundImage, 0);
            initElement.setAttribute("background-image", backgroundImageCssStyle.renderInline());
        }
        Color foreground = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_FOREGROUND);
        if (foreground != null) {
            initElement.setAttribute("foreground", ColorRender.renderCssAttributeValue(foreground));
        }
        Font font = (Font) windowPane.getRenderProperty(WindowPane.PROPERTY_FONT);
        if (font != null) {
            CssStyle fontCssStyle = new CssStyle();
            FontRender.renderToStyle(fontCssStyle, font);
            initElement.setAttribute("font", fontCssStyle.renderInline());
        }

        // Positioning
        renderPixelProperty(windowPane, WindowPane.PROPERTY_POSITION_X, initElement, "position-x");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_POSITION_Y, initElement, "position-y");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_WIDTH, initElement, "width");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_HEIGHT, initElement, "height");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_MINIMUM_WIDTH, initElement, "minimum-width");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_MINIMUM_HEIGHT, initElement, "minimum-height");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_MAXIMUM_WIDTH, initElement, "maximum-width");
        renderPixelProperty(windowPane, WindowPane.PROPERTY_MAXIMUM_HEIGHT, initElement, "maximum-height");
       
        int fillImageRenderFlags = ((Boolean) windowPane.getRenderProperty(PROPERTY_IE_ALPHA_RENDER_BORDER,
                Boolean.FALSE)).booleanValue() ? FillImageRender.FLAG_ENABLE_IE_PNG_ALPHA_FILTER : 0;
   
        // Title-related
        if (windowPane.getRenderProperty(WindowPane.PROPERTY_ICON) != null) {
            initElement.setAttribute("icon", ImageTools.getUri(rc, this, windowPane, IMAGE_ID_ICON));
            Insets iconInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_ICON_INSETS);
            if (iconInsets != null) {
                initElement.setAttribute("icon-insets", InsetsRender.renderCssAttributeValue(iconInsets));
            }
        }
        String title = (String) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE);
        if (title != null) {
            initElement.setAttribute("title", title);
            Insets titleInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_INSETS);
            Color titleForeground = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_FOREGROUND);
            if (titleForeground != null) {
                initElement.setAttribute("title-foreground", ColorRender.renderCssAttributeValue(titleForeground));
            }
            if (titleInsets != null) {
                initElement.setAttribute("title-insets", InsetsRender.renderCssAttributeValue(titleInsets));
            }
            Font titleFont = (Font) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_FONT);
            if (titleFont != null) {
                CssStyle fontCssStyle = new CssStyle();
                FontRender.renderToStyle(fontCssStyle, titleFont);
                initElement.setAttribute("title-font", fontCssStyle.renderInline());
            }
        }
        Insets titleBarInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_BAR_INSETS);
        if (titleBarInsets != null) {
            initElement.setAttribute("title-bar-insets", InsetsRender.renderCssAttributeValue(titleBarInsets));
        }
        renderPixelProperty(windowPane, WindowPane.PROPERTY_TITLE_HEIGHT, initElement, "title-height");
        Color titleBackground = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_BACKGROUND);
        if (titleBackground != null) {
            initElement.setAttribute("title-background", ColorRender.renderCssAttributeValue(titleBackground));
        }
        FillImage titleBackgroundImage = (FillImage) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_BACKGROUND_IMAGE);
        if (titleBackgroundImage != null) {
            CssStyle titleBackgroundImageCssStyle = new CssStyle();
            FillImageRender.renderToStyle(titleBackgroundImageCssStyle, rc, this, windowPane, IMAGE_ID_TITLE_BACKGROUND,
                    titleBackgroundImage, fillImageRenderFlags);
            initElement.setAttribute("title-background-image", titleBackgroundImageCssStyle.renderInline());
        }
       
        // Move/Close/Resize
        Boolean resizableBoolean = (Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_RESIZABLE);
        boolean resizable = resizableBoolean == null ? true : resizableBoolean.booleanValue();
        initElement.setAttribute("resizable", resizable ? "true" : "false");
        Boolean closableBoolean = (Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_CLOSABLE);
        boolean closable = closableBoolean == null ? true : closableBoolean.booleanValue();
        initElement.setAttribute("closable", closable ? "true" : "false");
        if (closable) {
            if (getImage(windowPane, IMAGE_ID_CLOSE_ICON) != null) {
                initElement.setAttribute("close-icon", ImageTools.getUri(rc, this, windowPane, IMAGE_ID_CLOSE_ICON));
                Insets closeIconInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_CLOSE_ICON_INSETS);
                if (closeIconInsets != null) {
                    initElement.setAttribute("close-icon-insets", InsetsRender.renderCssAttributeValue(closeIconInsets));
                }
            }
        }
        Boolean movableBoolean = (Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_MOVABLE);
        boolean movable = movableBoolean == null ? true : movableBoolean.booleanValue();
        initElement.setAttribute("movable", movable ? "true" : "false");

        // Border
        FillImageBorder border = (FillImageBorder) windowPane.getRenderProperty(WindowPane.PROPERTY_BORDER);
        if (border != null && border.getBorderInsets() != null && border.getContentInsets() != null) {
            Element borderElement = serverMessage.getDocument().createElement("border");
            if (border.getColor() != null) {
                borderElement.setAttribute("color", ColorRender.renderCssAttributeValue(border.getColor()));
            }
            borderElement.setAttribute("border-insets", InsetsRender.renderCssAttributeValue(border.getBorderInsets()));
            borderElement.setAttribute("content-insets", InsetsRender.renderCssAttributeValue(border.getContentInsets()));
            for (int i = 0; i < 8; ++i) {
                FillImage fillImage = border.getFillImage(i);
                if (fillImage != null) {
                    Element imageElement = serverMessage.getDocument().createElement("image");
                    imageElement.setAttribute("name", FILL_IMAGE_NAMES[i]);
                    CssStyle fillImageCssStyle = new CssStyle();
                    FillImageRender.renderToStyle(fillImageCssStyle, rc, this, windowPane, FILL_IMAGE_IDS[i], fillImage,
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

        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

TOP

Related Classes of nextapp.echo2.app.FillImage

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.