Package nextapp.echo2.app

Examples of nextapp.echo2.app.WindowPane


    /**
     * Ensure WindowPane can be legally added to a ContentPane.
     */
    public void testValidParent() {
        ContentPane contentPane = new ContentPane();
        WindowPane windowPane = new WindowPane();
        contentPane.add(windowPane);
    }
View Full Code Here


   
    /**
     * Attempt to illegally add more than one child, test for failure.
     */
    public void testOverload() {
        WindowPane windowPane = new WindowPane();
        windowPane.add(new Label("one label"));
        boolean exceptionThrown = false;
        try {
            windowPane.add(new Label("one label too many"));
        } catch (IllegalChildException ex) {
            exceptionThrown = true;
        }
        assertTrue(exceptionThrown);
    }
View Full Code Here

   
    /**
     * Test primary constructor.
     */
    public void testPrimaryConstructor() {
        WindowPane windowPane = new WindowPane("Hello", TestConstants.EXTENT_500_PX, TestConstants.EXTENT_200_PX);
        assertEquals(TestConstants.EXTENT_500_PX, windowPane.getWidth());
        assertEquals(TestConstants.EXTENT_200_PX, windowPane.getHeight());
        assertEquals("Hello", windowPane.getTitle());
    }
View Full Code Here

   
    /**
     * Test property accessors and mutators.
     */
    public void testProperties() {
        WindowPane windowPane = new WindowPane();
        windowPane.setBorder(TestConstants.FILL_IMAGE_BORDER);
        assertEquals(TestConstants.FILL_IMAGE_BORDER, windowPane.getBorder());
        windowPane.setHeight(TestConstants.EXTENT_200_PX);
        assertEquals(TestConstants.EXTENT_200_PX, windowPane.getHeight());
        windowPane.setPositionX(TestConstants.EXTENT_100_PX);
        assertEquals(TestConstants.EXTENT_100_PX, windowPane.getPositionX());
        windowPane.setPositionY(TestConstants.EXTENT_30_PX);
        assertEquals(TestConstants.EXTENT_30_PX, windowPane.getPositionY());
        windowPane.setTitle("Title!");
        assertEquals("Title!", windowPane.getTitle());
        windowPane.setTitleBackground(Color.ORANGE);
        assertEquals(Color.ORANGE, windowPane.getTitleBackground());
        windowPane.setTitleFont(TestConstants.MONOSPACE_12);
        assertEquals(TestConstants.MONOSPACE_12, windowPane.getTitleFont());
        windowPane.setTitleForeground(Color.PINK);
        assertEquals(Color.PINK, windowPane.getTitleForeground());
        windowPane.setWidth(TestConstants.EXTENT_500_PX);
        assertEquals(TestConstants.EXTENT_500_PX, windowPane.getWidth());
        windowPane.setClosable(false);
        assertFalse(windowPane.isClosable());
    }
View Full Code Here

       
        return mainWindow;
    }

    private void showDialog(boolean error, String message) {
         WindowPane windowPane = new WindowPane();
         windowPane.setModal(true);
         windowPane.setTitle(error ? "Error" : "Status");
         windowPane.setTitleBackground(error ? Color.RED : Color.GREEN);
         windowPane.setInsets(new Insets(20));
         windowPane.add(new Label(message));
         mainWindow.getContent().add(windowPane);
    }
View Full Code Here

        controlsColumn.add(new Label("Additional Tests"));
        groupContainerColumn.add(controlsColumn);

        controlsColumn.addButton("Grid/Column/Grid FillImage Test", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                WindowPane windowPane = new WindowPane();
                windowPane.setTitle("Grid/Column/Grid FillImage Test");
                windowPane.setInsets(new Insets(10));
                windowPane.setStyleName("Default");
                windowPane.setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
                InteractiveApp.getApp().getDefaultWindow().getContent().add(windowPane);
               
                GridLayoutData gld;
                ColumnLayoutData cld;
               
                Grid grid0 = new Grid();
                grid0.setInsets(new Insets(5));
               
                grid0.add(new Label("Grid 0 Label"));
                grid0.add(new Label("Grid 0 Label"));
                grid0.add(new Label("Grid 0 Label"));
               
                Column column = new Column();
                column.setInsets(new Insets(5));
                grid0.add(column);
               
                column.add(new Label("Column Label"));
                column.add(new Label("Column Label"));
                column.add(new Label("Column Label"));
               
                gld = new GridLayoutData();
                gld.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PX_REPEAT);
                column.setLayoutData(gld);
                grid0.add(column);
               
                Grid grid1 = new Grid();
                grid1.setInsets(new Insets(5));
                cld = new ColumnLayoutData();
                cld.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_5_PX_REPEAT);
                grid1.setLayoutData(cld);
                column.add(grid1);

                grid1.add(new Label("Grid 1 Label"));
                grid1.add(new Label("Grid 1 Label"));
                grid1.add(new Label("Grid 1 Label"));

                windowPane.add(grid0);
            }
        });       
    }
View Full Code Here

    /**
     * @see nextapp.echo2.webcontainer.ActionProcessor#processAction(nextapp.echo2.webcontainer.ContainerInstance,
     *      nextapp.echo2.app.Component, org.w3c.dom.Element)
     */
    public void processAction(ContainerInstance ci, Component component, Element actionElement) {
        WindowPane windowPane = (WindowPane) component;
        boolean closable = ((Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_CLOSABLE, Boolean.TRUE)).booleanValue();
        if (closable) {
            ci.getUpdateManager().getClientUpdateManager().setComponentAction(component, WindowPane.INPUT_CLOSE, null);
        }
    }
View Full Code Here

     *      nextapp.echo2.webcontainer.ContainerInstance,
     *      nextapp.echo2.app.Component, org.w3c.dom.Element)
     */
    public void processPropertyUpdate(ContainerInstance ci, Component component, Element propertyElement) {
        String propertyName = propertyElement.getAttribute(PropertyUpdateProcessor.PROPERTY_NAME);
        WindowPane windowPane = (WindowPane) component;
        boolean movable = ((Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_MOVABLE, Boolean.TRUE)).booleanValue();
        boolean resizable = ((Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_RESIZABLE, Boolean.TRUE)).booleanValue();
        if (WindowPane.PROPERTY_POSITION_X.equals(propertyName)) {
            if (movable) {
                ci.getUpdateManager().getClientUpdateManager().setComponentProperty(component, WindowPane.PROPERTY_POSITION_X,
                        ExtentRender.toExtent(propertyElement.getAttribute(PropertyUpdateProcessor.PROPERTY_VALUE)));
            }
View Full Code Here

     */
    public void renderAdd(RenderContext rc, ServerComponentUpdate update,
            String targetId, Component component) {
        ServerMessage serverMessage = rc.getServerMessage();
        serverMessage.addLibrary(WINDOW_PANE_SERVICE.getId());
        WindowPane windowPane = (WindowPane) component;
        renderInitDirective(rc, windowPane, targetId);
        Component[] children = windowPane.getVisibleComponents();
        if (children.length != 0) {
            ComponentSynchronizePeer syncPeer = SynchronizePeerFactory.getPeerForComponent(children[0].getClass());
            syncPeer.renderAdd(rc, update, getContainerId(children[0]), children[0]);
        }
    }
View Full Code Here

     *
     * @param rc the relevant <code>RenderContext</code>
     * @param update the update
     */
    private void renderUpdateDirective(RenderContext rc, ServerComponentUpdate update) {
        WindowPane windowPane = (WindowPane) update.getParent();

        Element updateElement = rc.getServerMessage().appendPartDirective(ServerMessage.GROUP_ID_PREREMOVE,
                "EchoWindowPane.MessageProcessor", "update");
        String elementId = ContainerInstance.getElementId(windowPane);
        updateElement.setAttribute("eid", elementId);

        PropertyUpdate positionX = update.getUpdatedProperty(WindowPane.PROPERTY_POSITION_X);
        if (positionX != null) {
            renderPixelProperty(windowPane, WindowPane.PROPERTY_POSITION_X, updateElement, "position-x");
        }

        PropertyUpdate positionY = update.getUpdatedProperty(WindowPane.PROPERTY_POSITION_Y);
        if (positionY != null) {
            renderPixelProperty(windowPane, WindowPane.PROPERTY_POSITION_Y, updateElement, "position-y");
        }
       
        PropertyUpdate width = update.getUpdatedProperty(WindowPane.PROPERTY_WIDTH);
        if (width != null) {
            renderPixelProperty(windowPane, WindowPane.PROPERTY_WIDTH, updateElement, "width");
        }

        PropertyUpdate height = update.getUpdatedProperty(WindowPane.PROPERTY_HEIGHT);
        if (height != null) {
            renderPixelProperty(windowPane, WindowPane.PROPERTY_HEIGHT, updateElement, "height");
        }
       
        if (update.getUpdatedProperty(WindowPane.PROPERTY_TITLE) != null) {
            updateElement.setAttribute("title", (String) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE, " "));
        }
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.WindowPane

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.