Package nextapp.echo2.app

Examples of nextapp.echo2.app.Extent


        super();
        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        setCellSpacing(new Extent(3));
       
        Label label;
        label = new Label("This test will cause the application to continuously push asynchronous updates "
                + "to the client by clicking buttons randomly on the screen.  Once started, the test cannot be "
                + "stopped until your application session is destroyed, i.e., by exiting your browser or "
View Full Code Here


      Element httpImageReferenceElement = DomUtil.getChildElementByTagName(propertyElement, "http-image-reference");
      if (!httpImageReferenceElement.hasAttribute("uri")) {
        throw new InvalidPropertyException("Invalid HttpImageReference property (uri not specified).", null);
      }
      String url = httpImageReferenceElement.getAttribute("uri");
      Extent width = null;
      if (httpImageReferenceElement.hasAttribute("width")) {
        width = ExtentPeer.toExtent(httpImageReferenceElement.getAttribute("width"));
      }
      Extent height = null;
      if (httpImageReferenceElement.hasAttribute("height")) {
        height = ExtentPeer.toExtent(httpImageReferenceElement.getAttribute("height"));
      }
      return new HttpImageReference(url, width, height);
    }
View Full Code Here

   
    private WindowPane windowPane;
    private ContentPane contentPane;
   
    public WindowPaneTest() {
        super(SplitPane.ORIENTATION_HORIZONTAL, new Extent(250, Extent.PX));
        setStyleName("DefaultResizable");
       
        Column groupContainerColumn = new Column();
        groupContainerColumn.setCellSpacing(new Extent(5));
        groupContainerColumn.setStyleName("TestControlsColumn");
        add(groupContainerColumn);
       
        contentPane = new ContentPane();
        add(contentPane);
        windowPane = new WindowPane();
        contentPane.add(windowPane);

        ButtonColumn controlsColumn;
       
        // Content
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Content"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Set Content = Small Label", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                windowPane.add(new Label("Hello, World!"));
            }
        });
       
        controlsColumn.addButton("Set Content = Big Label", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                windowPane.add(new Label(StyleUtil.QUASI_LATIN_TEXT_1));
            }
        });
       
        controlsColumn.addButton("Set Content = WindowPaneTest", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                windowPane.add(new WindowPaneTest());
            }
        });
       
        controlsColumn.addButton("Set Content = Nothing", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
            }
        });
       
        controlsColumn.addButton("Add-Remove-Add", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.removeAll();
                Label label = new Label("Hello, World!");
                windowPane.add(label);
                windowPane.remove(label);
                windowPane.add(label);
            }
        });
       
        // Properties
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Properties"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Set Style Name = Default", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setStyleName("Default");
            }
        });
        controlsColumn.addButton("Clear Style Name", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setStyleName(null);
            }
        });
       
        controlsColumn.addButton("Set Border 1", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBorder(new FillImageBorder(Color.GREEN, new Insets(20), new Insets(5)));
            }
        });

        controlsColumn.addButton("Set Border 2 (L/R only)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FillImageBorder fib = new FillImageBorder(Color.GREEN, new Insets(20), new Insets(5));
                fib.setFillImage(FillImageBorder.LEFT, Styles.BG_SHADOW_DARK_BLUE);
                fib.setFillImage(FillImageBorder.RIGHT, Styles.BG_SHADOW_LIGHT_BLUE);
                windowPane.setBorder(fib);
            }
        });

        controlsColumn.addButton("Clear Border", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBorder(null);
            }
        });

        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setForeground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setForeground(null);
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackground(StyleUtil.randomColor());
            }
        });
        controlsColumn.addButton("Clear Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackground(null);
            }
        });
        controlsColumn.addButton("Set Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setFont(StyleUtil.randomFont());
            }
        });
        controlsColumn.addButton("Clear Font", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setFont(null);
            }
        });
        controlsColumn.addButton("Set Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
            }
        });
        controlsColumn.addButton("Clear Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setBackgroundImage(null);
            }
        });
        controlsColumn.addButton("Set Content Insets to 0", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Set Content Insets to 5", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(new Insets(5));
            }
        });
        controlsColumn.addButton("Set Content Insets to 10/20/40/80", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(new Insets(10, 20, 40, 80));
            }
        });
        controlsColumn.addButton("Clear Content Insets", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setInsets(null);
            }
        });

        controlsColumn.addButton("Set Position Random", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setPositionX(new Extent((int) (Math.random() * 600)));
                windowPane.setPositionY(new Extent((int) (Math.random() * 500)));
            }
        });
        controlsColumn.addButton("Set Size Random", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setWidth(new Extent(100 + (int) (Math.random() * 400)));
                windowPane.setHeight(new Extent(100 + (int) (Math.random() * 300)));
            }
        });
        controlsColumn.addButton("Set Position&Size Random", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setPositionX(new Extent((int) (Math.random() * 600)));
                windowPane.setPositionY(new Extent((int) (Math.random() * 500)));
                windowPane.setWidth(new Extent(100 + (int) (Math.random() * 400)));
                windowPane.setHeight(new Extent(100 + (int) (Math.random() * 300)));
            }
        });       
       
        // Title-Related Properties
       
        controlsColumn = new ButtonColumn();
        controlsColumn.add(new Label("Properties"));
        groupContainerColumn.add(controlsColumn);
       
        controlsColumn.addButton("Set Title", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitle("Window Title");
            }
        });
        controlsColumn.addButton("Set Title Long", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitle("This is a fairly long window title that goes on for a little to long to see if " +
                        "wrapping is handled properly and such.");
            }
        });
        controlsColumn.addButton("Clear Title", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitle(null);
            }
        });
        controlsColumn.addButton("Set Title Height", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleHeight(new Extent(((int) (Math.random() * 24)) + 24));
            }
        });
        controlsColumn.addButton("Clear Title Height", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                windowPane.setTitleHeight(null);
View Full Code Here

    public Object getValue(ClassLoader classLoader, Class objectClass, Element propertyElement)
    throws InvalidPropertyException {
        Element borderElement = DomUtil.getChildElementByTagName(propertyElement, "border");
       
        Color color = borderElement.hasAttribute("color") ? ColorPeer.toColor(borderElement.getAttribute("color")) : null;
        Extent size = borderElement.hasAttribute("size") ? ExtentPeer.toExtent(borderElement.getAttribute("size")) : null;
       
        String styleString = borderElement.getAttribute("style");
        int style;
        if (styleString == null) {
            style = Border.STYLE_NONE;
View Full Code Here

        Element fillImageElement = DomUtil.getChildElementByTagName(propertyElement, "fill-image");
        if (fillImageElement == null) {
            throw new InvalidPropertyException("Invalid FillImage property.", null);
        }
       
        Extent offsetX = fillImageElement.hasAttribute("horizontal")
                ? ExtentPeer.toExtent(fillImageElement.getAttribute("horizontal")) : null;
        Extent offsetY = fillImageElement.hasAttribute("vertical")
                ? ExtentPeer.toExtent(fillImageElement.getAttribute("vertical")) : null;
       
        int repeat;
        String repeatString = fillImageElement.getAttribute("repeat");
        if ("horizontal".equals(repeatString)) {
View Full Code Here

        if (!UNITS_TEXT_TO_CONSTANT.containsKey(unitsText)) {
            throw new IllegalArgumentException("Invalid Extent units: " + value);
        }
        int units = ((Integer) UNITS_TEXT_TO_CONSTANT.get(unitsText)).intValue();
       
        return new Extent(size, units);
    }
View Full Code Here

public class LocalizationTest extends SplitPane {

    final Column testColumn;
   
    public LocalizationTest() {
        super(SplitPane.ORIENTATION_HORIZONTAL, new Extent(300, Extent.PX));
        setStyleName("DefaultResizable");
       
        ButtonColumn controlsColumn = new ButtonColumn();
        controlsColumn.setStyleName("TestControlsColumn");
        add(controlsColumn);

        controlsColumn.addButton("App Locale = VM Default", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setLocale(Locale.getDefault());
            }
        });

        controlsColumn.addButton("App Locale = US", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setLocale(Locale.US);
            }
        });

        controlsColumn.addButton("App Locale = Arabic (RTL)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                getApplicationInstance().setLocale(new Locale("ar"));
            }
        });

        testColumn = new Column();
        testColumn.setCellSpacing(new Extent(5));
        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        testColumn.setLayoutData(splitPaneLayoutData);
        add(testColumn);
    }
View Full Code Here

* Interactive test for top-level <code>Window</code>s.
*/
public class WindowTest extends SplitPane {
   
    public WindowTest() {
        super(SplitPane.ORIENTATION_HORIZONTAL, new Extent(250, Extent.PX));
        setStyleName("DefaultResizable");
       
        ButtonColumn controlsColumn = new ButtonColumn();
        controlsColumn.setStyleName("TestControlsColumn");
        add(controlsColumn);
View Full Code Here

        assertNotNull(imageReference);
        assertTrue(imageReference instanceof ResourceImageReference);
        assertEquals("nextapp/echo2/test/componentxml/BackgroundImage.png",
                ((ResourceImageReference) imageReference).getResource());
        assertEquals(FillImage.REPEAT_HORIZONTAL, backgroundImage.getRepeat());
        assertEquals(new Extent(50), backgroundImage.getHorizontalOffset());
        assertEquals(new Extent(-30, Extent.PERCENT), backgroundImage.getVerticalOffset());
    }
View Full Code Here

        in.close();
    }
   
    public void testIndexedProperties() {
        Style alphaStyle = styleSheet.getStyle(Grid.class, "alpha");
        assertEquals(new Extent(100), alphaStyle.getIndexedProperty(Grid.PROPERTY_COLUMN_WIDTH, 0));
        assertEquals(new Extent(200), alphaStyle.getIndexedProperty(Grid.PROPERTY_COLUMN_WIDTH, 1));
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Extent

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.