Package nextapp.echo2.app

Examples of nextapp.echo2.app.Component


    private void doRemove() {
        if (components.size() == 0) {
            // No components to remove.
            return;
        }
        Component child = (Component) components.get((int) (Math.random() * components.size()));
        child.getParent().remove(child);
        recursiveRemoveComponentFromList(child);
    }
View Full Code Here


    /**
     * @see nextapp.echo2.testapp.thousandmonkeys.ComponentFactory#newInstance()
     */
    public Component newInstance() {
        try {
            Component component = (Component) componentClass.newInstance();
            switch ((int) (Math.random() * 3)) {
            case 1:
                component.setForeground(new Color((int) (16777216 * Math.random()) & 0x7f7f7f));
                component.setBackground(new Color((int) (16777216 * Math.random()) | 0xb0b0b0));
                break;
            case 2:
                component.setBackground(new Color((int) (16777216 * Math.random())));
                break;
            case 3:
                component.setForeground(new Color((int) (16777216 * Math.random())));
                break;
            }
            return component;
        } catch (InstantiationException ex) {
            throw new RuntimeException(ex);
View Full Code Here

   
    /**
     * Test <code>focusTraversalIndex</code> property.
     */
    public void testFocusTraversalIndex() {
        Component c = new NullComponent();
        PropertyChangeEvaluator pce = new PropertyChangeEvaluator();
        c.addPropertyChangeListener(pce);
        assertEquals(0, c.getFocusTraversalIndex());
        c.setFocusTraversalIndex(5);
        assertEquals(Component.FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, pce.lastEvent.getPropertyName());
        assertEquals(5, c.getFocusTraversalIndex());
        c.setVisible(false);
        assertEquals(false, c.isVisible());
        assertEquals(5, c.getFocusTraversalIndex());
        c.setFocusTraversalIndex(70);
        assertEquals(false, c.isVisible());
        assertEquals(70, c.getFocusTraversalIndex());
    }
View Full Code Here

        app.setLocale(Locale.ITALIAN);
        assertTrue(app.getLayoutDirection().isLeftToRight());
    }
   
    public void testComponentInheritanceFromApplication() {
        Component component = new NullComponent();
        assertNull(component.getRenderLayoutDirection());
       
        app.getColumn().add(component);
       
        app.setLocale(Locale.US);
        assertTrue(component.getRenderLayoutDirection().isLeftToRight());
       
        app.setLocale(ARABIC);
        assertFalse(component.getRenderLayoutDirection().isLeftToRight());
    }
View Full Code Here

        app.setLocale(ARABIC);
        assertFalse(component.getRenderLayoutDirection().isLeftToRight());
    }
   
    public void testComponentInheritanceFromHierarchy() {
        Component component = new NullComponent();
        app.getColumn().add(component);
       
        app.setLocale(Locale.US);
        assertTrue(component.getRenderLayoutDirection().isLeftToRight());
       
        app.getDefaultWindow().setLocale(ARABIC);
        assertFalse(component.getRenderLayoutDirection().isLeftToRight());
       
        app.getContentPane().setLocale(Locale.ITALY);
        assertTrue(component.getRenderLayoutDirection().isLeftToRight());
       
        app.getContentPane().setLayoutDirection(LayoutDirection.RTL);
        assertFalse(component.getRenderLayoutDirection().isLeftToRight());
       
        app.getContentPane().setLayoutDirection(null);
        assertTrue(component.getRenderLayoutDirection().isLeftToRight());
       
        app.getColumn().setLocale(HEBREW);
        assertFalse(component.getRenderLayoutDirection().isLeftToRight());
       
        app.getColumn().setLayoutDirection(LayoutDirection.LTR);
        assertTrue(component.getRenderLayoutDirection().isLeftToRight());
    }
View Full Code Here

     *
     * @param component the <code>Component</code> to investigate
     * @return true if an ancestor of the component is being added
     */
    private boolean isAncestorBeingAdded(Component component) {
        Component child = component;
        Component parent = component.getParent();
        while (parent != null) {
            ServerComponentUpdate update = (ServerComponentUpdate) componentUpdateMap.get(parent);
            if (update != null) {
                if (update.hasAddedChild(child)) {
                    return true;
                }
            }
            child = parent;
            parent = parent.getParent();
        }
        return false;
    }
View Full Code Here

        }
        if (!updatedComponent.isRenderVisible()) {
            return;
        }

        Component parentComponent = updatedComponent.getParent();
        if (parentComponent == null || isAncestorBeingAdded(parentComponent)) {
            // Do nothing.
            return;
        }
        ServerComponentUpdate update = createComponentUpdate(parentComponent);
View Full Code Here

        // Search updated components for descendants of removed component.
        // Any found descendants will be removed and added to this update's
        // list of removed descendants.
        Iterator it = componentUpdateMap.keySet().iterator();
        while (it.hasNext()) {
            Component testComponent = (Component) it.next();
            if (child.isAncestorOf(testComponent)) {
                ServerComponentUpdate childUpdate = (ServerComponentUpdate) componentUpdateMap.get(testComponent);
                update.appendRemovedDescendants(childUpdate);
                it.remove();
            }
View Full Code Here

     *
     * @param updatedComponent a component which currently exists in the
     *        hierarchy whose visible state has changed.
     */
    public void processComponentVisibilityUpdate(Component updatedComponent) {
        Component parentComponent = updatedComponent.getParent();
        if (updatedComponent.isVisible()) {
            processComponentAdd(parentComponent, updatedComponent);
        } else {
            processComponentRemove(parentComponent, updatedComponent);
        }
View Full Code Here

            fullRefreshUpdate.removeDescendant(applicationInstance.getDefaultWindow());
        }

        Iterator it = componentUpdateMap.keySet().iterator();
        while (it.hasNext()) {
            Component testComponent = (Component) it.next();
            ServerComponentUpdate childUpdate = (ServerComponentUpdate) componentUpdateMap.get(testComponent);
            fullRefreshUpdate.appendRemovedDescendants(childUpdate);
            it.remove();
        }
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Component

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.