Package org.apache.click.control

Examples of org.apache.click.control.Panel


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

    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


    @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

        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

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

    public ListPanelDemo() {
        addControl(listPanel);
        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

     *     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

        // 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 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 onInit() {
        super.onInit();

        addControl(tabbedPanel);

        Panel panel1 = new Panel("panel1", "panel/tabbed/panel1.htm");
        tabbedPanel.add(panel1);

        Panel panel2 = new Panel("panel2", "panel/tabbed/form-panel2.htm");
        Form form = new Form("form");
        panel2.add(form);

        final TextField field = new TextField("name", "Enter your name");
        form.add(field);
        Submit submit = new Submit("go");
        submit.setActionListener(new ActionListener() {

            public boolean onAction(Control source) {
                addModel("msg", "Hi " + field.getValue() + ". Your form has been saved!");
                return true;
            }
        });

        form.add(submit);

        panel2.setLabel("The Second Panel");
        tabbedPanel.add(panel2);

        Panel panel3 = new Panel("panel3", "panel/tabbed/table-panel3.htm");
        Table table = new Table("table");
        table = new Table("table");

        table.setClass(Table.CLASS_ITS);

        table.addColumn(new Column("id"));
        table.addColumn(new Column("name"));
        table.addColumn(new Column("email"));
        table.addColumn(new Column("investments"));
        table.setPageSize(5);
        table.setSortable(true);

        List list = customerService.getCustomersSortedByName(100);
        table.setRowList(list);

        panel3.add(table);

        tabbedPanel.add(panel3);

        // NOTE: Save the TabbedPanel state when a new panel is activated.
        // Register a listener that is notified when a different panel is selected.
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

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.