Package org.apache.click.control

Examples of org.apache.click.control.Panel


    public void testDefaultActivePanel() {
        MockContext.initContext();

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

        // By default panel1 should be the active panel
        assertEquals("panel1", 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", "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

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

        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

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

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

        tabbedPanel.setTabListener(new ActionListener() {
            public boolean onAction(Control source) {
                return false;
            }
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

     * @param control the control to process
     */
    public void processControl(Control control) {
        // Don't process inactive panels
        if (control instanceof Panel) {
            Panel panel = (Panel) control;
            if (!panel.isActive()) {
                return;
            }
        }

        processHeadElements(control.getHeadElements());
View Full Code Here

    @Resource(name="customerService")
    private CustomerService customerService;

    public ListPanelDemo() {
        listPanel.add(new Panel("panel1", "/panel/customersPanel1.htm"));
        listPanel.add(new Panel("panel2", "/panel/customersPanel2.htm"));
        listPanel.add(new Panel("panel3", "/panel/customersPanel3.htm"));
    }
View Full Code Here

    private CustomerService customerService;

    // Constructor ------------------------------------------------------------

    public TabbedPanelDemo() {
        Panel panel1 = new Panel("panel1", "panel/customersPanel1.htm");
        panel1.setLabel("The First Panel");
        tabbedPanel.add(panel1);

        Panel panel2 = new Panel("panel2", "panel/customersPanel2.htm");
        panel2.setLabel("The Second Panel");
        tabbedPanel.add(panel2);

        Panel panel3 = new Panel("panel3", "panel/customersPanel3.htm");
        panel3.setLabel("The Third Panel");
        tabbedPanel.add(panel3);

        // Register a listener that is notified when a different panel is selected.
        tabbedPanel.setTabListener(this, "onTabClick");
    }
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

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.