Package nextapp.echo2.app

Examples of nextapp.echo2.app.Style


        styleSheet = StyleSheetLoader.load(in, StyleSheetLoaderTest.class.getClassLoader());
        in.close();
    }
   
    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);
View Full Code Here


            String type = layoutDataElement.getAttribute("type");

            // Load properties from XML into Style.
            PropertyLoader propertyLoader = PropertyLoader.forClassLoader(classLoader);
            Element propertiesElement = DomUtil.getChildElementByTagName(layoutDataElement, "properties");
            Style propertyStyle = propertyLoader.createStyle(propertiesElement, type);
           
            // Instantiate LayoutData instance.
            Class propertyClass = Class.forName(type, true, classLoader);
            LayoutData layoutData = (LayoutData) propertyClass.newInstance();
           
            // Create introspector to analyze LayoutData class.
            ComponentIntrospector ci = ComponentIntrospector.forName(type, classLoader);
           
            // Set property values of LayoutData instance.
            Iterator it = propertyStyle.getPropertyNames();
            while (it.hasNext()) {
                String propertyName = (String) it.next();
                Method writeMethod = ci.getWriteMethod(propertyName);
                writeMethod.invoke(layoutData, new Object[]{propertyStyle.getProperty(propertyName)});
            }
           
            return layoutData;
        } catch (ClassNotFoundException ex) {
            throw new InvalidPropertyException("Unable to process properties.", ex);
View Full Code Here

        styleSheet = StyleSheetLoader.load(in, StyleSheetLoaderTest.class.getClassLoader());
        in.close();
    }
   
    public void testMappedTypeface() {
        Style style = styleSheet.getStyle(Component.class, "alpha");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
View Full Code Here

        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
   
    public void testMultipleSpecifiedTypefaces() {
        Style style = styleSheet.getStyle(Component.class, "bravo");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        Font.Typeface customFace = new Font.Typeface("Verdana", new Font.Typeface("Arial"));
        assertEquals(new Font(customFace, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
View Full Code Here

        Font.Typeface customFace = new Font.Typeface("Verdana", new Font.Typeface("Arial"));
        assertEquals(new Font(customFace, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
   
    public void testStyleConstants() {
        Style style = styleSheet.getStyle(Component.class, "charlie");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD | Font.ITALIC | Font.UNDERLINE | Font.OVERLINE | Font.LINE_THROUGH,
                new Extent(24, Extent.PT)), font);
    }
View Full Code Here

        assertEquals(new Font(Font.VERDANA, Font.BOLD | Font.ITALIC | Font.UNDERLINE | Font.OVERLINE | Font.LINE_THROUGH,
                new Extent(24, Extent.PT)), font);
    }
   
    public void testInlineTypeface() {
        Style style = styleSheet.getStyle(Component.class, "delta");
        Font font = (Font) style.getProperty(Component.PROPERTY_FONT);
        assertEquals(new Font(Font.VERDANA, Font.BOLD, new Extent(24, Extent.PT)), font);
    }
View Full Code Here

        styleSheet = StyleSheetLoader.load(in, StyleSheetLoaderTest.class.getClassLoader());
        in.close();
    }
   
    public void testBasic() {
        Style charlieStyle = styleSheet.getStyle(Grid.class, "charlie");
        assertEquals(new Integer(0), charlieStyle.getProperty("orientation"));
    }
View Full Code Here

        Style charlieStyle = styleSheet.getStyle(Grid.class, "charlie");
        assertEquals(new Integer(0), charlieStyle.getProperty("orientation"));
    }
   
    public void testIntrospectedConstant() {
        Style deltaStyle = styleSheet.getStyle(Grid.class, "delta");
        assertEquals(new Integer(Grid.ORIENTATION_VERTICAL), deltaStyle.getProperty("orientation"));
    }
View Full Code Here

   
    /**
     * Test retrieval of boolean properties.
     */
    public void testBasic() {
        Style charlieStyle = styleSheet.getStyle(Label.class, "charlie");
        assertEquals(Boolean.FALSE, charlieStyle.getProperty("lineWrap"));
        Style deltaStyle = styleSheet.getStyle(Button.class, "delta");
        assertEquals(Boolean.TRUE, deltaStyle.getProperty("lineWrap"));
    }
View Full Code Here

        styleSheet = StyleSheetLoader.load(in, StyleSheetLoaderTest.class.getClassLoader());
        in.close();
    }

    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);
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Style

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.