Package org.apache.click.control

Examples of org.apache.click.control.Panel


        // Since tabbedPanel is zero index based, setting tabPanelIndex to 1
        // should set the active panel to panel2
        context.getMockRequest().setParameter("tabPanelIndex", "1");

        TabbedPanel tabbedPanel = new TabbedPanel("tabbedPanel");
        tabbedPanel.add(new Panel("panel1"));
        tabbedPanel.add(new Panel("panel2"));
        tabbedPanel.onInit();
        String activePanelName = tabbedPanel.getActivePanel().getName();

        // By default panel2 should be the active panel
        assertEquals("panel2", activePanelName);
View Full Code Here


        // Since tabbedPanel is zero index based, setting tabPanelIndex to 1
        // should set the active panel to panel2
        context.getMockRequest().setParameter("tabPanelIndex-" + tabbedPanel.getName(), "1");

        tabbedPanel.add(new Panel("panel1"));
        tabbedPanel.add(new Panel("panel2"));
        tabbedPanel.onInit();
        String activePanelName = tabbedPanel.getActivePanel().getName();

        // By default panel2 should be the active panel
        assertEquals("panel2", activePanelName);
View Full Code Here

        // Simulate user selecting panel2
        context.getMockRequest().setParameter(ActionLink.ACTION_LINK, "tabLink-" + tabbedPanel.getName());
        context.getMockRequest().setParameter(ActionLink.VALUE, "panel2");

        tabbedPanel.add(new Panel("panel1"));
        tabbedPanel.add(new Panel("panel2"));
        tabbedPanel.onInit();
        String activePanelName = tabbedPanel.getActivePanel().getName();

        // By default panel2 should be the active panel
        assertEquals("panel2", activePanelName);
View Full Code Here

        // Simulate user selecting panel2
        context.getMockRequest().setParameter(ActionLink.ACTION_LINK, "tabLink-" + tabbedPanel.getName());
        context.getMockRequest().setParameter(ActionLink.VALUE, "panel2");

        tabbedPanel.add(new Panel("panel1"));
        tabbedPanel.add(new Panel("panel2"));

        tabbedPanel.setTabListener(new ActionListener() {
            private static final long serialVersionUID = 1L;

            public boolean onAction(Control source) {
View Full Code Here

        Page page = new Page();
        TabbedPanel panel = new TabbedPanel("panel");
        page.addControl(panel);

        // Add two panels named child1 and child2
        Panel child1 = new Panel("child1");
        Panel child2 = new Panel("child2");
        panel.add(child1);
        panel.add(child2);

        // Execute onInit event
        panel.onInit();

        assertEquals(3, panel.getControlMap().size());
        assertEquals(3, panel.getControls().size());
        assertSame(child1, panel.getControls().get(1));
        assertSame(child2, panel.getControls().get(2));
        assertSame(child1, panel.getPanels().get(0));
        assertSame(child2, panel.getPanels().get(1));
        assertTrue(child1.isActive());
        assertFalse(child2.isActive());

        // Add another two panels named child1 and child2 and test that these
        // panels replaces the previous panels
        child1 = new Panel("child1");
        child2 = new Panel("child2");
        panel.add(child1);
        panel.add(child2);
        assertEquals(3, panel.getControlMap().size());
        assertEquals(3, panel.getControls().size());
        assertSame(child1, panel.getControls().get(1));
        assertSame(child2, panel.getControls().get(2));
        assertSame(child1, panel.getPanels().get(0));
        assertSame(child2, panel.getPanels().get(1));
        assertTrue(child1.isActive());
        assertFalse(child2.isActive());
    }
View Full Code Here

    public void testGetState() {
        // Setup Panel
        TabbedPanel panel = new TabbedPanel("panel");

        // Add two panels named child1 and child2
        Panel child1 = new Panel("child1");
        Panel child2 = new Panel("child2");
        panel.add(child1);
        panel.add(child2);

        Map expectedTabLinkState = new HashMap();
        expectedTabLinkState.put("id", "1");
View Full Code Here

    public void testSetState() {
        // Setup Panel
        TabbedPanel panel = new TabbedPanel("panel");

        // Add two panels named child1 and child2
        Panel child1 = new Panel("child1");
        Panel child2 = new Panel("child2");
        panel.add(child1);
        panel.add(child2);

        Map expectedTabLinkState = new HashMap();
        expectedTabLinkState.put("id", "1");
View Full Code Here

     *     of the control is not defined or the container already contains a
     *     control with the same name
     */
    @Override
    public Control insert(Control control, int index) {
        Panel panel = null;
        if (control instanceof Panel) {
            panel = (Panel) control;
            panel.setActive(false);
        }

        super.insert(control, index);

        if (panel != null) {
View Full Code Here

    @Override
    public Control replace(Control currentControl, Control newControl) {
        super.replace(currentControl, newControl);

        if (currentControl instanceof Panel) {
            Panel currentPanel = (Panel) currentControl;
            if (currentPanel == getActivePanel()) {
                setActivePanel((Panel) newControl);
            }
        }
        return newControl;
View Full Code Here

     */
    public Object getState() {
        Object[] panelState = new Object[2];
        boolean hasState = false;

        Panel localActivePanel = getActivePanel();
        if (localActivePanel != null) {
            String activePanelName = localActivePanel.getName();
            hasState = true;
            panelState[0] = activePanelName;
        }

        Object tabLinkState = getTabLink().getState();
View Full Code Here

TOP

Related Classes of org.apache.click.control.Panel

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.