Package nextapp.echo2.app

Examples of nextapp.echo2.app.Color


    public static  Color randomBrightColor() {
        return new Color(((int) (16777216 * Math.random())) | 0xb0b0b0);
    }

    public static Color randomColor() {
        return new Color((int) (16777216 * Math.random()));
    }
View Full Code Here


    public void testColorRender() {
        assertEquals("#000000", ColorRender.renderCssAttributeValue(Color.BLACK));
        assertEquals("#0000ff", ColorRender.renderCssAttributeValue(Color.BLUE));
        assertEquals("#ffffff", ColorRender.renderCssAttributeValue(Color.WHITE));
        assertEquals("#123456", ColorRender.renderCssAttributeValue(new Color(0x123456)));
        assertEquals("#abcdef", ColorRender.renderCssAttributeValue(new Color(0xabcdef)));
    }
View Full Code Here

        CssStyle cssStyle = new CssStyle();

        boolean renderEnabled = textComponent.isRenderEnabled();

        Border border;
        Color foreground, background;
        Font font;
        FillImage backgroundImage;
        if (!renderEnabled) {
            // Retrieve disabled style information.
            background = (Color) textComponent.getRenderProperty(TextComponent.PROPERTY_DISABLED_BACKGROUND);
View Full Code Here

        }
       
        if (!splitPane.isRenderEnabled()) {
            initElement.setAttribute("enabled", "false");
        }
        Color background = (Color) splitPane.getRenderProperty(SplitPane.PROPERTY_BACKGROUND);
        if (background != null) {
            initElement.setAttribute("background", ColorRender.renderCssAttributeValue(background));
        }
        Color foreground = (Color) splitPane.getRenderProperty(SplitPane.PROPERTY_FOREGROUND);
        if (foreground != null) {
            initElement.setAttribute("foreground", ColorRender.renderCssAttributeValue(foreground));
        }
        Font font = (Font) splitPane.getRenderProperty(SplitPane.PROPERTY_FONT);
        if (font != null) {
            CssStyle fontCssStyle = new CssStyle();
            FontRender.renderToStyle(fontCssStyle, font);
            initElement.setAttribute("font", fontCssStyle.renderInline());
        }

        Boolean booleanValue = (Boolean) splitPane.getRenderProperty(SplitPane.PROPERTY_RESIZABLE);
        boolean resizable = booleanValue == null ? false : booleanValue.booleanValue();
        initElement.setAttribute("resizable", resizable ? "true" : "false");
       
        initElement.setAttribute("separator-size", Integer.toString(calculateSeparatorSize(splitPane)));
       
        Color separatorColor = (Color) splitPane.getRenderProperty(SplitPane.PROPERTY_SEPARATOR_COLOR);
        if (separatorColor != null) {
            initElement.setAttribute("separator-color", ColorRender.renderCssAttributeValue(separatorColor));
        }
       
        FillImage separatorImage = vertical
View Full Code Here

        }

        boolean renderEnabled = button.isRenderEnabled();

        Border border;
        Color foreground, background;
        Font font = null;
        FillImage backgroundImage;
        if (!renderEnabled) {
            // Retrieve disabled style information.
            background = (Color) button.getRenderProperty(AbstractButton.PROPERTY_DISABLED_BACKGROUND);
View Full Code Here

                }
            }
        });
        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 {
                    textField.setDisabledBackgroundImage(null);
                    passwordField.setDisabledBackgroundImage(null);
                    textArea.setDisabledBackgroundImage(null);
                }
            }
        });
        controlsColumn.addButton("Set Disabled Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setDisabledForeground(color);
                passwordField.setDisabledForeground(color);
                textArea.setDisabledForeground(color);
            }
        });
        controlsColumn.addButton("Clear Disabled Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setDisabledForeground(null);
                passwordField.setDisabledForeground(null);
                textArea.setDisabledForeground(null);
            }
        });
        controlsColumn.addButton("Set Disabled Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setDisabledBackground(color);
                passwordField.setDisabledBackground(color);
                textArea.setDisabledBackground(color);
            }
        });
View Full Code Here

        // Content Appearance
        Insets insets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_INSETS);
        if (insets != null) {
            initElement.setAttribute("insets", InsetsRender.renderCssAttributeValue(insets));
        }
        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) {
View Full Code Here

                }
            }
        });
        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(Label label) {
                        label.setForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(Label label) {
                        label.setForeground(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(Label label) {
                        label.setBackground(color);
                    }
                });
View Full Code Here

            layoutData.setBackground(null);
            selectedButton.setLayoutData(layoutData);
        }
        if (button != null) {
            layoutData = (GridLayoutData) button.getLayoutData();
            layoutData.setBackground(new Color(0xefefaf));
            button.setLayoutData(layoutData);
        }
        selectedButton = button;
    }
View Full Code Here

        CssStyle cssStyle = new CssStyle();

        boolean renderEnabled = listComponent.isRenderEnabled();

        Border border;
        Color foreground, background;
        Font font;
        if (!renderEnabled) {
            // Retrieve disabled style information.
            background = (Color) listComponent.getRenderProperty(AbstractListComponent.PROPERTY_DISABLED_BACKGROUND);
            border = (Border) listComponent.getRenderProperty(AbstractListComponent.PROPERTY_DISABLED_BORDER);
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Color

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.