poptanimukesh / google-web-toolkit-incubator

Automatically exported from code.google.com/p/google-web-toolkit-incubator
0 stars 0 forks source link

CollapsiblePanell not visible always. #145

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of gwt and gwt-incubator are you using?
gwt-incubator : 1-5_Sept_04
gwt : 1.5.2
e-mail : aquua77@gmail.com
What OS and browser are you using?
Widow xp, gwt host brower

Do you see this error in hosted mode, web mode, or both?
 nothing error message.

(If possible, please include a test case that shows the problem)

Hopefully using the test case you have generously provided, what steps will 
reproduce the problem? 
1.
2.
3.

What is the expected output? What do you see instead?

Workaround if you have one:

Please provide any additional information below,  and thank you for taking 
the time and effort to report this issue, as good issue reports are 
critical for our quest to make GWT's new widgets and libraries shine.
  ////////////////// Test Code ///////

I use CollapiblePanell and ScrollPanelsample code..

package com.rontab.test.client;

/*
 * Copyright 2007 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
 * use this file except in compliance with the License. You may obtain a 
copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations 
under
 * the License.
 */

import java.util.ArrayList;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.libideas.logging.shared.Log;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.StackPanel;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.widgetideas.client.CollapsiblePanel;
import com.google.gwt.widgetideas.client.FastTree;
import com.google.gwt.widgetideas.client.FastTreeItem;
import com.google.gwt.widgetideas.table.client.FixedWidthFlexTable;
import com.google.gwt.widgetideas.table.client.FixedWidthGrid;
import com.google.gwt.widgetideas.table.client.ScrollTable;
import 
com.google.gwt.widgetideas.table.client.overrides.FlexTable.FlexCellFormatt
er;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class PinnedTest implements EntryPoint {
    protected static FixedWidthGrid dataTable = null;
    HorizontalPanel hPanel = new HorizontalPanel();
    /**
     * The footer portion of the  {@link ScrollTable} .
     */
    protected static FixedWidthFlexTable footerTable = null;

    /**
     * The header portion of the {@link ScrollTable}.
     */
    protected static FixedWidthFlexTable headerTable = null;

    /**
     * The scroll table.
     */
    protected static ScrollTable scrollTable = null;
    /**
     * A special purpose widget to allow scrollable stack panels.
     */
    public class MyStackPanel extends StackPanel {
        private ArrayList scrollers = new ArrayList();

        public void insert(Widget w, int before) {
            ScrollPanel p = new ScrollPanel(w);
            p.setWidth("100%");
            scrollers.add(before, p);
            super.insert(p, before);
        }

        public void onLoad() {
            setWidth("100%");
            showStack(getSelectedIndex());
        }

        /**
         * Shows the widget at the specified child index.
         * 
         * @param index the index of the child to be shown
         */
        public void showStack(int index) {
            super.showStack(index);

            if (this.isAttached()) {
                ScrollPanel me = (ScrollPanel) 
scrollers.get(index);
                me.setHeight("1px");
                Element tr = 
DOM.getChild(DOM.getFirstChild(getElement()),
                        index * 2 + 1);
                int trHeight = 
DOM.getElementPropertyInt(tr, "offsetHeight");
                me.setHeight(trHeight + "px");
            }
        }
    }

    ToggleButton controlButton;

    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {

         // Create the inner tables
        getHeaderTable();
        getFooterTable();
        getDataTable();

        // Add the scroll table to the page
        scrollTable = new ScrollTable(dataTable, headerTable);
        scrollTable.setFooterTable(footerTable);

        // Setup the header
        setupScrollTable();

        // Add some data the data table
        dataTable.resize(0, 13);
        for (int i = 0; i < 15; i++) {
          insertDataRow(i);
        }

        // Add some data to the footer table
        for (int i = 0; i < 13; i++) {
          footerTable.setText(0, i, "Col " + i);
        }

        // Redraw the scroll table
        scrollTable.redraw();

        // Add the components to the page
        try {

            // Some random contents to make the tree 
interesting.
            Panel contents = createSchoolNavBar();
//          FastTree.addDefaultCSS();

            // The actual pinned panel.
            final CollapsiblePanel pinned = new 
CollapsiblePanel();
            hPanel.add(scrollTable);
            hPanel.add(pinned);
            RootPanel.get().add(hPanel);
            pinned.add(contents);
            pinned.setWidth("200px");
            pinned.hookupControlToggle(controlButton);
//          RootPanel.get().add(pinned);
        } catch (RuntimeException e) {
            if (GWT.isScript()) {
                Log.severe(e.getMessage());
            }
            throw e;
        }
        //    RootPanel.get().add(new Button("D"));
    }

    private Panel createSchoolNavBar() {
        controlButton = createToggleButton();

        MyStackPanel wrapper = new MyStackPanel();
        FlowPanel navBar = new FlowPanel();
        navBar.setSize("200px", "100%");
        final HTML title = new HTML("School Directory");

        HorizontalPanel panel = new HorizontalPanel();
        panel.setWidth("100%");

        panel.setCellHorizontalAlignment(controlButton,
                HasHorizontalAlignment.ALIGN_LEFT);

        panel.add(title);
        panel.add(controlButton);
        panel.setCellWidth(controlButton, "1px");
        panel.setCellHorizontalAlignment(title, 
HorizontalPanel.ALIGN_CENTER);

        navBar.add(panel);

        panel.setStyleName("nav-Tree-title");
        wrapper = new MyStackPanel();
        wrapper.setHeight("250px");

        final FastTree contents = new FastTree();
        wrapper.add(contents, "<b>People</b>", true);

        wrapper.add(new Label("None"), "<b>Academics</b>", true);
        navBar.add(wrapper);

        FastTreeItem students = contents.addItem("Students");
        students.addItem("Jill");
        students.addItem("Jack");
        students.addItem("Molly");
        students.addItem("Ms. Muffat");

        FastTreeItem teachers = contents.addItem("Teachers");
        teachers.addItem("Mrs Black");
        teachers.addItem("Mr White");

        FastTreeItem admin = contents.addItem("Administrators");
        admin.addItem("The Soup Nazi");
        admin.addItem("The Grand High Supreme Master Pubba");
        return navBar;
    }

    private ToggleButton createToggleButton() {
        Image show = new Image("show.gif");
        Image hide = new Image("hide.gif");
        ToggleButton toggler = new ToggleButton(hide, show);
        return toggler;
    }
    public static FixedWidthGrid getDataTable() {
        if (dataTable == null) {
            dataTable = new FixedWidthGrid();
        }
        return dataTable;
    }
    /**
     * Get the footer table.
     * 
     * @return the footer table.
     */
    public static FixedWidthFlexTable getFooterTable() {
        if (footerTable == null) {
            footerTable = new FixedWidthFlexTable();
        }
        return footerTable;
    }

    /**
     * Get the header table.
     * 
     * @return the header table.
     */
    public static FixedWidthFlexTable getHeaderTable() {
        if (headerTable == null) {
            headerTable = new FixedWidthFlexTable();
        }
        return headerTable;
    }

    /**
     * Get the scroll table.
     * 
     * @return the scroll table.
     */
    public static ScrollTable getScrollTable() {
        return scrollTable;
    }

    /**
     * Add a row of data cells each consisting of a string that 
describes the
     * row:column coordinates of the new cell. The number of columns in 
the new
     * row will match the number of columns in the grid.
     * 
     * @param beforeRow the index to add the new row into
     */
    public static void insertDataRow(int beforeRow) {
        // Insert the new row
        beforeRow = dataTable.insertRow(beforeRow);

        // Set the data in the new row
        int numColumns = dataTable.getColumnCount();
        for (int column = 0; column < numColumns; column++) {
            String label = beforeRow + ":" + column;
            if (column == 0) {
                dataTable.setWidget(beforeRow, column, new 
CheckBox(label));
            } else if (column == 2) {
                int rand = (int) (Math.random() * 100000);
                dataTable.setHTML(beforeRow, column, rand + 
"");
            } else {
                dataTable.setHTML(beforeRow, column, 
label);
            }
        }
    }

    /**
     * Setup the scroll table.
     */
    private void setupScrollTable() {
        // Setup the formatting
        scrollTable.setSize("95%", "50%");
        scrollTable.setCellPadding(3);
        scrollTable.setCellSpacing(1);

scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH);

        // Level 1 headers
        FlexCellFormatter headerFormatter = 
headerTable.getFlexCellFormatter();
        headerTable.setHTML(0, 0, "Info Table");
        headerFormatter.setColSpan(0, 0, 13);

        // Level 2 headers
        headerTable.setHTML(1, 0, "Group Header 0<BR>Multiline");
        headerFormatter.setColSpan(1, 0, 2);
        headerFormatter.setRowSpan(1, 0, 2);
        headerTable.setHTML(1, 1, "Group Header 1");
        headerFormatter.setColSpan(1, 1, 3);
        headerTable.setHTML(1, 2, "Group Header 2");
        headerFormatter.setColSpan(1, 2, 1);
        headerFormatter.setRowSpan(1, 2, 2);
        headerTable.setHTML(1, 3, "Group Header 3");
        headerFormatter.setColSpan(1, 3, 1);
        headerFormatter.setRowSpan(1, 3, 2);
        headerTable.setHTML(1, 4, "Group Header 4");
        headerFormatter.setColSpan(1, 4, 3);
        headerTable.setHTML(1, 5, "Group Header 5");
        headerFormatter.setColSpan(1, 5, 3);

        // Level 3 headers
        for (int cell = 0; cell < 9; cell++) {
            headerTable.setHTML(2, cell, "Header " + cell);
        }
    }
}

Original issue reported on code.google.com by aquu...@gmail.com on 15 Sep 2008 at 2:00

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by ecc%google.com@gtempaccount.com on 18 Sep 2008 at 3:09

GoogleCodeExporter commented 8 years ago
Work around for the issue: Add a style with higher z-index will work for you.

You will end up with the same problem when you have a vertical menubar in case 
if 
you have higher z-index for collapsible panel.

for this i am seeking some advice from google team

Original comment by jerome...@gmail.com on 22 Sep 2009 at 7:43