Package nextapp.echo2.app

Examples of nextapp.echo2.app.ResourceImageReference


    }
   
    public void testResourceImageReferenceInline() {
        Style alphaStyle = styleSheet.getStyle(Button.class, "alpha");
        assertTrue(alphaStyle.getProperty(Button.PROPERTY_ICON) instanceof ResourceImageReference);
        ResourceImageReference icon = (ResourceImageReference) alphaStyle.getProperty(Button.PROPERTY_ICON);
        assertEquals("nextapp.echo2/test/componentxml/Alpha.png", icon.getResource());
    }
View Full Code Here


    }
   
    public void testResourceImageReferencePlain() {
        Style bravoStyle = styleSheet.getStyle(Button.class, "bravo");
        assertTrue(bravoStyle.getProperty(Button.PROPERTY_ICON) instanceof ResourceImageReference);
        ResourceImageReference icon = (ResourceImageReference) bravoStyle.getProperty(Button.PROPERTY_ICON);
        assertEquals("nextapp.echo2/test/componentxml/Bravo.png", icon.getResource());
    }
View Full Code Here

    }
   
    public void testResourceImageReferenceDimensioned() {
        Style charlieStyle = styleSheet.getStyle(Button.class, "charlie");
        assertTrue(charlieStyle.getProperty(Button.PROPERTY_ICON) instanceof ResourceImageReference);
        ResourceImageReference icon = (ResourceImageReference) charlieStyle.getProperty(Button.PROPERTY_ICON);
        assertEquals("nextapp.echo2/test/componentxml/Charlie.png", icon.getResource());
        assertEquals(new Extent(20), icon.getWidth());
        assertEquals(new Extent(30), icon.getHeight());
    }
View Full Code Here

    }
   
    public void testResourceImageReferenceContentTypeHalfDimensioned() {
        Style deltaStyle = styleSheet.getStyle(Button.class, "delta");
        assertTrue(deltaStyle.getProperty(Button.PROPERTY_ICON) instanceof ResourceImageReference);
        ResourceImageReference icon = (ResourceImageReference) deltaStyle.getProperty(Button.PROPERTY_ICON);
        assertEquals("nextapp.echo2/test/componentxml/Delta.whoknows", icon.getResource());
        assertEquals("image/gif", icon.getContentType());
        assertEquals(new Extent(30), icon.getWidth());
        assertNull(icon.getHeight());
    }
View Full Code Here

     * Test property accessors and mutators.
     */
    public void testProperties() {
        CheckBox checkBox = new CheckBox();
       
        checkBox.setSelectedStateIcon(new ResourceImageReference("SelectedState.png"));
        checkBox.setStateIcon(new ResourceImageReference("State.png"));
        checkBox.setPressedSelectedStateIcon(new ResourceImageReference("PressedSelectedState.png"));
        checkBox.setPressedStateIcon(new ResourceImageReference("PressedState.png"));
        checkBox.setRolloverSelectedStateIcon(new ResourceImageReference("RolloverSelectedState.png"));
        checkBox.setRolloverStateIcon(new ResourceImageReference("RolloverState.png"));
        checkBox.setStateAlignment(new Alignment(Alignment.RIGHT, Alignment.BOTTOM));
        checkBox.setStatePosition(new Alignment(Alignment.TRAILING, Alignment.DEFAULT));
        checkBox.setStateMargin(TestConstants.EXTENT_100_PX);
       
        assertEquals(new ResourceImageReference("SelectedState.png"), checkBox.getSelectedStateIcon());
        assertEquals(new ResourceImageReference("State.png"), checkBox.getStateIcon());
        assertEquals(new ResourceImageReference("PressedSelectedState.png"), checkBox.getPressedSelectedStateIcon());
        assertEquals(new ResourceImageReference("PressedState.png"), checkBox.getPressedStateIcon());
        assertEquals(new ResourceImageReference("RolloverSelectedState.png"), checkBox.getRolloverSelectedStateIcon());
        assertEquals(new ResourceImageReference("RolloverState.png"), checkBox.getRolloverStateIcon());
        assertEquals(new Alignment(Alignment.RIGHT, Alignment.BOTTOM), checkBox.getStateAlignment());
        assertEquals(new Alignment(Alignment.TRAILING, Alignment.DEFAULT), checkBox.getStatePosition());
        assertEquals(TestConstants.EXTENT_100_PX, checkBox.getStateMargin());
       
        checkBox.setSelected(true);
View Full Code Here

    };
   
    public ImageReferenceTest() {
        addHeaderRow("ImageReference Types");
        HttpImageReference httpImageReference = new HttpImageReference("images/two.jpg");
        ResourceImageReference resourceImageReference
                = new ResourceImageReference(RESOURCE_IMAGE_LOCATION);
        addTestRow("AwtImageReference", new Label(AWT_IMAGE_REFERENCE));
        addTestRow("HttpImageReference", new Label(httpImageReference));
        addTestRow("ResourceImageReference", new Label(resourceImageReference));
        addTestRow("StreamImageReference", new Label(streamImageReference));
    }
View Full Code Here

     *      java.lang.Class, org.w3c.dom.Element)
     */
    public Object getValue(ClassLoader classLoader, Class objectClass, Element propertyElement)
    throws InvalidPropertyException {
        if (propertyElement.hasAttribute("value")) {
            return new ResourceImageReference(propertyElement.getAttribute("value"));
        } else {
            Element resourceImageReferenceElement = DomUtil.getChildElementByTagName(propertyElement,
                    "resource-image-reference");
            if (!resourceImageReferenceElement.hasAttribute("resource")) {
                throw new InvalidPropertyException("Invalid ResourceImageReference property (resource not specified).", null);
            }
            String resource = resourceImageReferenceElement.getAttribute("resource");
            String contentType = null;
            if (resourceImageReferenceElement.hasAttribute("content-type")) {
                contentType = resourceImageReferenceElement.getAttribute("content-type");
            }
            Extent width = null;
            if (resourceImageReferenceElement.hasAttribute("width")) {
                width = ExtentPeer.toExtent(resourceImageReferenceElement.getAttribute("width"));
            }
            Extent height = null;
            if (resourceImageReferenceElement.hasAttribute("height")) {
                height = ExtentPeer.toExtent(resourceImageReferenceElement.getAttribute("height"));
            }
            return new ResourceImageReference(resource, contentType, width, height);
        }
    }
View Full Code Here

        Column layoutColumn = new Column();
        layoutColumn.setInsets(new Insets(30));
        layoutColumn.setCellSpacing(new Extent(10));
        add(layoutColumn);
       
        layoutColumn.add(new Label(new ResourceImageReference("/echo2tutorial/numberguess/TitleBanner.png")));
        layoutColumn.add(statusLabel);
        layoutColumn.add(countLabel);
        layoutColumn.add(promptLabel);
       
        guessEntryField = new TextField();
View Full Code Here

        Column layoutColumn = new Column();
        layoutColumn.setInsets(new Insets(30));
        layoutColumn.setCellSpacing(new Extent(30));
        add(layoutColumn);
       
        layoutColumn.add(new Label(new ResourceImageReference("/echo2tutorial/numberguess/CongratulationsBanner.png")));
        layoutColumn.add(new Label("You got the correct answer in " + numberOfTries + (numberOfTries == 1 ? " try." : " tries.")));

        Button button = new Button("Play Again");
        button.setForeground(Color.WHITE);
        button.setBackground(Color.RED);
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.ResourceImageReference

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.