Package nextapp.echo2.app

Examples of nextapp.echo2.app.Color


    public void testBasic() {
        Style alphaStyle = styleSheet.getStyle(Column.class, "alpha");
        GridLayoutData layoutData = (GridLayoutData) alphaStyle.getProperty(Component.PROPERTY_LAYOUT_DATA);
        assertEquals(2, layoutData.getColumnSpan());
        assertEquals(1, layoutData.getRowSpan());
        assertEquals(new Color(0xabcdef), layoutData.getBackground());
        assertEquals(new Insets(20, 30), layoutData.getInsets());
        assertNotNull(layoutData.getBackgroundImage());
        ImageReference imageReference = layoutData.getBackgroundImage().getImage();
        assertNotNull(imageReference);
        assertTrue(imageReference instanceof ResourceImageReference);
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(AbstractListComponent listComponent) {
                        listComponent.setForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setBackground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Font font = StyleUtil.randomFont();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setFont(font);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setFont(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Border border = StyleUtil.randomBorder();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledBorder(border);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Disabled Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledBorder(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledBackground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Disabled Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Font font = StyleUtil.randomFont();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledFont(font);
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Disabled Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setDisabledFont(null);
                    }
                });
            }
        });
        controlsColumn.addButton("Toggle ToolTip Text", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        if (listComponent.getToolTipText() == null) {
                            listComponent.setToolTipText("This is a tool tip.");
                        } else {
                            listComponent.setToolTipText(null);
                        }
                    }
                });
            }
        });
        controlsColumn.addButton("Enable Rollover Effects", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverEnabled(true);
                    }
                });
            }
        });
        controlsColumn.addButton("Disable Rollover Effects", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverEnabled(false);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Rollover Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverForeground(color);
                    }
                });
            }
        });
        controlsColumn.addButton("Set Rollover Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final Color color = StyleUtil.randomColor();
                apply(new Applicator() {
                    public void apply(AbstractListComponent listComponent) {
                        listComponent.setRolloverBackground(color);
                    }
                });
View Full Code Here

    }
   
    public void testBasic() {
        Style alphaStyle = styleSheet.getStyle(Column.class, "alpha");
        SplitPaneLayoutData layoutData = (SplitPaneLayoutData) alphaStyle.getProperty(Component.PROPERTY_LAYOUT_DATA);
        assertEquals(new Color(0xabcdef), layoutData.getBackground());
        assertEquals(new Insets(20, 30), layoutData.getInsets());
        assertNotNull(layoutData.getBackgroundImage());
        ImageReference imageReference = layoutData.getBackgroundImage().getImage();
        assertNotNull(imageReference);
        assertTrue(imageReference instanceof ResourceImageReference);
View Full Code Here

        FillImageBorder fillImageBorder = new FillImageBorder();
        PropertyLoader propertyLoader = PropertyLoader.forClassLoader(classLoader);
       
        if (fillImageBorderElement.hasAttribute("color")) {
            Color color = ColorPeer.toColor(fillImageBorderElement.getAttribute("color"));
            fillImageBorder.setColor(color);
        }
        if (fillImageBorderElement.hasAttribute("border-insets")) {
            Insets insets = InsetsPeer.toInsets(fillImageBorderElement.getAttribute("border-insets"));
            fillImageBorder.setBorderInsets(insets);
View Full Code Here

    }
   
    private void addComponentSampler(Column contentColumn, boolean launchModals) {
        Column componentSamplerColumn = new Column();
        if (launchModals) {
            componentSamplerColumn.setBorder(new Border(new Extent(5, Extent.PX), new Color(0xffafaf), Border.STYLE_INSET));
        } else {
            componentSamplerColumn.setBorder(new Border(new Extent(5, Extent.PX), new Color(0xafafff), Border.STYLE_INSET));
        }
        componentSamplerColumn.setInsets(new Insets(10));
        componentSamplerColumn.setCellSpacing(new Extent(1));
        contentColumn.add(componentSamplerColumn);
       
        for (int i = 1; i <= 3; ++i) {
            Button button = new Button("Button #" + i);
            button.setStyleName("Default");
            componentSamplerColumn.add(button);
            if (launchModals && i == 1) {
                button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        getApplicationInstance().getDefaultWindow().getContent().add(createComponentSamplerModalTestWindow());
                    }
                });
            }
        }
       
        ButtonGroup buttonGroup = new ButtonGroup();
        for (int i = 1; i <= 3; ++i) {
            RadioButton radioButton = new RadioButton("RadioButton #" + i);
            radioButton.setGroup(buttonGroup);
            radioButton.setStyleName("Default");
            componentSamplerColumn.add(radioButton);
            if (launchModals && i == 1) {
                radioButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        getApplicationInstance().getDefaultWindow().getContent().add(createComponentSamplerModalTestWindow());
                    }
                });
            }
        }
       
        for (int i = 1; i <= 3; ++i) {
            CheckBox checkBox = new CheckBox("CheckBox #" + i);
            checkBox.setStyleName("Default");
            componentSamplerColumn.add(checkBox);
            if (launchModals && i == 1) {
                checkBox.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        getApplicationInstance().getDefaultWindow().getContent().add(createComponentSamplerModalTestWindow());
                    }
                });
            }
        }
       
        Table table = new Table(TableTest.createEmployeeTableModel());
        table.setBorder(new Border(new Extent(2), new Color(0xafffcf), Border.STYLE_GROOVE));
        table.setInsets(new Insets(15, 5));
        table.setSelectionEnabled(true);
        table.setSelectionBackground(new Color(0xffcfaf));
        table.setRolloverEnabled(true);
        table.setRolloverBackground(new Color(0xafefff));
        if (launchModals) {
            table.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    getApplicationInstance().getDefaultWindow().getContent().add(createComponentSamplerModalTestWindow());
                }
View Full Code Here

    private WindowPane createModalWindow(String name) {
        final WindowPane windowPane = new WindowPane();
        positionWindowPane(windowPane);
        windowPane.setTitle(name + " Window #" + windowNumber++);
        windowPane.setTitleInsets(new Insets(10, 5));
        windowPane.setTitleBackground(new Color(0x2f2f4f));
        windowPane.setInsets(new Insets(10));
        windowPane.setWidth(new Extent(500));
        windowPane.setHeight(new Extent(280));
        windowPane.setStyleName("Default");
       
View Full Code Here

    private WindowPane createTestWindow(String name) {
        final WindowPane windowPane = new WindowPane();
        positionWindowPane(windowPane);
        windowPane.setTitle(name + " Window #" + windowNumber++);
        windowPane.setTitleInsets(new Insets(10, 5));
        windowPane.setTitleBackground(new Color(0x2f2f4f));
        windowPane.setInsets(new Insets(10));
        windowPane.setWidth(new Extent(500));
        windowPane.setHeight(new Extent(280));
        windowPane.setStyleName("Default");
       
View Full Code Here

                    positionWindowPane(windowPane);
                    targetContentPane.add(windowPane);
                    windowPane.setTitle("SplitPane Window #" + windowNumber++);
                    windowPane.setTitleInsets(new Insets(10, 5));
                    windowPane.setStyleName("Default");
                    windowPane.setTitleBackground(new Color(0x2f2f4f));
                    windowPane.setWidth(new Extent(500, Extent.PX));
                    windowPane.setHeight(new Extent(300, Extent.PX));
                    SplitPane splitPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(42));
                    SplitPaneLayoutData splitPaneLayoutData;
                   
                    Button okButton = new Button("Ok");
                    okButton.addActionListener(new ActionListener() {
                        /**
                         * @see nextapp.echo2.app.event.ActionListener#actionPerformed(nextapp.echo2.app.event.ActionEvent)
                         */
                        public void actionPerformed(ActionEvent e) {
                            windowPane.getParent().remove(windowPane);
                        }
                    });
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0x5f5f9f));
                    splitPaneLayoutData.setInsets(new Insets(8));
                    splitPaneLayoutData.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT));
                    splitPaneLayoutData.setOverflow(SplitPaneLayoutData.OVERFLOW_HIDDEN);
                    okButton.setLayoutData(splitPaneLayoutData);
                    okButton.setWidth(new Extent(100));
                    okButton.setStyleName("Default");
                    splitPane.add(okButton);
                   
                    Label contentLabel = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0xefefff));
                    contentLabel.setLayoutData(splitPaneLayoutData);
                    splitPane.add(contentLabel);
                   
                    windowPane.add(splitPane);
                }
            });
   
            addButton("Add Multiple SplitPane Nautilus Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final WindowPane windowPane = new WindowPane();
                    windowPane.setStyleName("Default");
                    windowPane.setWidth(new Extent(500, Extent.PX));
                    windowPane.setHeight(new Extent(500, Extent.PX));
                    windowPane.setTitle("SP Nautilus Window #" + windowNumber++);
                    windowPane.add(new SplitPaneNestedTest(new Extent(50)));
                    positionWindowPane(windowPane);
                    targetContentPane.add(windowPane);
                }
            });
           
            addButton("Add Multiple SplitPane Window", new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final WindowPane windowPane = new WindowPane();
                    positionWindowPane(windowPane);
                    targetContentPane.add(windowPane);
                    windowPane.setTitle("Multiple SplitPane Window #" + windowNumber++);
                    windowPane.setTitleInsets(new Insets(10, 5));
                    windowPane.setStyleName("Default");
                    windowPane.setTitleBackground(new Color(0x2f2f4f));
                    windowPane.setWidth(new Extent(700, Extent.PX));
                    windowPane.setHeight(new Extent(500, Extent.PX));
                   
                    SplitPane splitPane1 = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL, new Extent(100));
                    splitPane1.setStyleName("DefaultResizable");
                    SplitPaneLayoutData splitPaneLayoutData;
                   
                    Label label;
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0x3fbf5f));
                    splitPaneLayoutData.setInsets(new Insets(5));
                    label.setLayoutData(splitPaneLayoutData);
                    splitPane1.add(label);

                    SplitPane splitPane2 = new SplitPane(SplitPane.ORIENTATION_VERTICAL, new Extent(120));
                    splitPane2.setStyleName("DefaultResizable");
                   
                    SplitPane splitPane3 = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL, new Extent(200));
                    splitPane3.setStyleName("DefaultResizable");
                    splitPane2.add(splitPane3);
                   
                    SplitPane splitPane4 = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL, new Extent(300));
                    splitPane4.setStyleName("DefaultResizable");
                    splitPane2.add(splitPane4);
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0x5f3fbf));
                    splitPaneLayoutData.setInsets(new Insets(5));
                    label.setLayoutData(splitPaneLayoutData);
                    splitPane3.add(label);
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0x3f5fbf));
                    splitPaneLayoutData.setInsets(new Insets(5));
                    label.setLayoutData(splitPaneLayoutData);
                    splitPane3.add(label);
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0xbf5f3f));
                    splitPaneLayoutData.setInsets(new Insets(5));
                    label.setLayoutData(splitPaneLayoutData);
                    splitPane4.add(label);
                   
                    label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
                    splitPaneLayoutData = new SplitPaneLayoutData();
                    splitPaneLayoutData.setBackground(new Color(0xbf3f5f));
                    splitPaneLayoutData.setInsets(new Insets(5));
                    label.setLayoutData(splitPaneLayoutData);
                    splitPane4.add(label);
   
                    splitPane1.add(splitPane2);
View Full Code Here

    }

    public void testSimple() {
        Style alphaStyle = styleSheet.getStyle(WindowPane.class, "alpha");
        FillImageBorder fillImageBorder = (FillImageBorder) alphaStyle.getProperty(WindowPane.PROPERTY_BORDER);
        assertEquals(new Color(0xabcdef), fillImageBorder.getColor());
        assertEquals(new Insets(12), fillImageBorder.getContentInsets());
        assertEquals(new Insets(6, 4), fillImageBorder.getBorderInsets());
       
        FillImage topLeftFillImage = fillImageBorder.getFillImage(FillImageBorder.TOP_LEFT);
        assertNotNull(topLeftFillImage);
View Full Code Here

    public static int randomBorderStyle() {
        return BORDER_STYLES[(int) (Math.random() * BORDER_STYLES.length)];
    }
   
    public static  Color randomBrightColor() {
        return new Color(((int) (16777216 * Math.random())) | 0xb0b0b0);
    }
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.