Package org.apache.click.control

Examples of org.apache.click.control.Panel


        if (panelState[0] != null) {

            String activePanelName = (String) panelState[0];
               Control control = getControlMap().get(activePanelName);
                if (control instanceof Panel) {
                    Panel localActivePanel = (Panel) control;
                    setActivePanel(localActivePanel);
                }
            }

        if (panelState[1] != null) {
View Full Code Here


            tabPanelIndex = context.getRequestParameter("tabPanelIndex");
        }
        if (NumberUtils.isNumber(tabPanelIndex)) {
            int tabIndex = Integer.parseInt(tabPanelIndex);
            if (tabIndex >= 0 && tabIndex < getPanels().size()) {
                Panel targetPanel = getPanels().get(tabIndex);
                if (!targetPanel.isDisabled()) {
                    // Deactivate panels
                    for (Panel panel : getPanels()) {
                        panel.setActive(false);
                    }

                    setActivePanel(targetPanel);
                }
            }
        } else {
            // Explicitly bind the link to the request and check if the
            // link was clicked
            ActionLink link = getTabLink();
            link.bindRequestValue();
            if (link.isClicked()) {

                // Check which panel user selected and set that Panel as active
                for (int i = 0; i < getPanels().size(); i++) {
                    Panel panel = getPanels().get(i);

                    // Deactivate panel
                    panel.setActive(false);

                    if (link.getValue().equals(panel.getName())
                        && !panel.isDisabled()) {

                        setActivePanel(panel);
                    }
                }
            }
View Full Code Here

    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

    public TabbedPanel tabbedPanel = new TabbedPanel();
    public List customers;

    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

        if (hasControls()) {
            for (int i = 0, size = getControls().size(); i < size; i++) {
                Control control = (Control) getControls().get(i);

                if (control instanceof Panel) {
                    Panel panel = (Panel) control;
                    if (panel == getActivePanel()) {
                        String htmlImports = panel.getHtmlImports();
                        if (htmlImports != null) {
                            buffer.append(htmlImports);
                        }
                    }
View Full Code Here

        // Select panel specified by tabPanelIndex if defined
        String tabPanelIndex = getContext().getRequestParameter("tabPanelIndex");
        if (NumberUtils.isNumber(tabPanelIndex)) {
            int tabIndex = Integer.parseInt(tabPanelIndex);
            if (tabIndex >= 0 && tabIndex < getPanels().size()) {
                Panel panel = (Panel) getPanels().get(tabIndex);
                if (!panel.isDisabled()) {
                    setActivePanel(panel);
                }
            }
        } else {
            // Explicitly bind the tabLink to the request and check if the
            // tabLink was clicked
            tabLink.bindRequestValue();
            if (tabLink.isClicked()) {

                // Check which panel user selected and set that Panel as active
                for (int i = 0; i < getPanels().size(); i++) {
                    Panel panel = (Panel) getPanels().get(i);

                    if (tabLink.getValue().equals(panel.getName())
                        && !panel.isDisabled()) {

                        setActivePanel(panel);
                    }
                }
            }
View Full Code Here

    public ListPanel listPanel = new ListPanel();
    public List customers;

    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

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.