Package nextapp.echo2.app

Examples of nextapp.echo2.app.MutableStyle$IndexedPropertyValue


        assertFalse(indices.contains(new Integer(2)));
        assertTrue(indices.contains(new Integer(5)));
    }
   
    public void testGetPropertyNames() {
        MutableStyle style = new MutableStyle();
        style.setProperty("alpha", "bravo");
        style.setProperty("charlie", "delta");
        style.setProperty("echo", "foxtrot");
        Iterator it = style.getPropertyNames();
        assertNotNull(it);
        Set names = new HashSet();
        while (it.hasNext()) {
            names.add(it.next());
        }
View Full Code Here


        assertFalse(names.contains("delta"));
        assertFalse(names.contains("foxtrot"));
    }
   
    public void testIndexedProperty() {
        MutableStyle style = new MutableStyle();
        style.setIndexedProperty("alpha", 0, "0");
        style.setIndexedProperty("alpha", 1, "1");
        style.setIndexedProperty("alpha", 2, "2");
        style.setIndexedProperty("alpha", 0, "3");
       
        assertFalse(style.isIndexedPropertySet("alpha", -1));
        assertTrue(style.isIndexedPropertySet("alpha", 0));
        assertTrue(style.isIndexedPropertySet("alpha", 1));
        assertTrue(style.isIndexedPropertySet("alpha", 2));
        assertFalse(style.isIndexedPropertySet("alpha", 3));
        assertEquals("3", style.getIndexedProperty("alpha", 0));
        assertEquals("1", style.getIndexedProperty("alpha", 1));
        assertEquals("2", style.getIndexedProperty("alpha", 2));
       
        style.removeIndexedProperty("alpha", 1);
        assertFalse(style.isIndexedPropertySet("alpha", 1));
    }
View Full Code Here

        style.removeIndexedProperty("alpha", 1);
        assertFalse(style.isIndexedPropertySet("alpha", 1));
    }
   
    public void testSet1Set2Remove2Set2() {
        MutableStyle style = new MutableStyle();
        style.setProperty("golf", "hotel");
        style.setProperty("alpha", "bravo");
        assertEquals("hotel", style.getProperty("golf"));
        assertEquals("bravo", style.getProperty("alpha"));
        style.setProperty("alpha", null);
        assertEquals("hotel", style.getProperty("golf"));
        assertEquals(null, style.getProperty("alpha"));
        style.setProperty("alpha", "bravo");
        assertEquals("hotel", style.getProperty("golf"));
        assertEquals("bravo", style.getProperty("alpha"));
    }
View Full Code Here

     * @return a style representing the retrieved property names and values
     * @throws ComponentXmlException
     */
    public Style createStyle(Element propertiesElement, String type)
    throws ComponentXmlException {
        MutableStyle propertyStyle = new MutableStyle();
       
        if (propertiesElement == null) {
            // No properties.
            return new MutableStyle();
        }
       
        ComponentIntrospector ci;
        try {
            ci = ComponentIntrospector.forName(type, classLoader);
        } catch (ClassNotFoundException ex) {
            throw new ComponentXmlException("Unable to introspect component: " + type, ex);
        }
       
        Element[] propertyElements = DomUtil.getChildElementsByTagName(propertiesElement, "property");
        for (int i = 0; i < propertyElements.length; ++i) {
            String propertyName = propertyElements[i].getAttribute("name");
            Class propertyClass;
            if (propertyElements[i].hasAttribute("type")) {
                try {
                    propertyClass = Class.forName(propertyElements[i].getAttribute("type"));
                } catch (ClassNotFoundException ex) {
                    throw new ComponentXmlException("Custom property class not found: "
                            + propertyElements[i].getAttribute("type"), ex);
                }
            } else {
                propertyClass = ci.getPropertyClass(propertyName);
            }
           
            if (propertyClass == null) {
                throw new ComponentXmlException("Property does not exist: " + propertyName, null);
            }
           
            Object propertyValue = getPropertyValue(ci.getObjectClass(), propertyClass, propertyElements[i]);
           
            if (ci.isIndexedProperty(propertyName)) {
                try {
                    int index = Integer.parseInt(propertyElements[i].getAttribute("index"));
                    propertyStyle.setIndexedProperty(propertyName, index, propertyValue);
                } catch (NumberFormatException ex) {
                    throw new ComponentXmlException("Index not set.", ex);
                }
            } else {
                propertyStyle.setProperty(propertyName, propertyValue);
            }
        }
       
        return propertyStyle;
    }
View Full Code Here

        this.getBtnMain().setBackground(Color.WHITE);
        this.getBtnMain().setBorder(BorderEx.NONE);
        this.getBtnMain().setRolloverBackground(Color.WHITE);
        this.getBtnMain().setRolloverBorder(BorderEx.NONE);

        this.setToggleIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setTogglePressedIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setToggleRolloverIcon(new ResourceImageReference(IMG_DROPDOWN));
       

        /*
        this.getBtnMain().addActionListener(new ActionListener() {

View Full Code Here

     * @param title The title of the button
     */
    public JbsAccPaneButton(String imgFileName, String title) {
        super();
        try {
            ResourceImageReference ref = new ResourceImageReference(Styles.getIconPath() + imgFileName);
            this.setIcon(ref);
        } catch (Exception e) {
            logger.debug(Styles.getIconPath() + imgFileName + " not found.");
        }
        this.setStyleName("Default");
View Full Code Here

        this.setBorder(BorderEx.NONE);
        this.setRolloverBorder(BorderEx.NONE);
        this.setTarget(this.getBtnMain());
        this.setPopUp(this.getMnuMain());
        this.setToggleIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setTogglePressedIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setToggleRolloverIcon(new ResourceImageReference(IMG_DROPDOWN));
    }
View Full Code Here

    private Logger logger = Logger.getLogger(BtnToolbar.class);
    private static final long serialVersionUID = 176100334500789000L;

    public BtnToolbar(String imgFileName) {
        super();
        ResourceImageReference ref = new ResourceImageReference(Styles.getIconPath() + imgFileName);
        if (ref != null) {
            this.setIcon(ref);
        } else {
            logger.warn("Image " + imgFileName + " not found.");
        }
View Full Code Here

                    break; // no icon
            }

            if (iconName != null) {
                final String imagePath = Styles.getIconPath(); //"../resource/images/";
                messageIcons[messageType] = new ResourceImageReference(
                        imagePath + iconName, new JbsExtent(ICON_HEIGHT), new JbsExtent(ICON_HEIGHT));
            }
        }

        return messageIcons[messageType];
View Full Code Here

    public void addControl(String groupName, Component control) {
        this.addControl(groupName, groupName, control);
    }

    public void addSeparator(String groupName) {
        Row row = new Row();
        ColumnLayoutData layout = new ColumnLayoutData();
        layout.setHeight(new JbsExtent(15, JbsExtent.PX));
        row.setLayoutData(layout);
        this.addControl(groupName, row);
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.MutableStyle$IndexedPropertyValue

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.