chellymehdi / vopenlayers

Automatically exported from code.google.com/p/vopenlayers
0 stars 0 forks source link

Add/remove to different layouts gives problems #90

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Vaadin application (6.8.4 tested) with the add-on and put google 
maps API script in the widget set.
2. Use the following code for the application subclass:

    private boolean           isInLayout1      = true;

    @Override
    public void init() {
        Window mainWindow = new Window("Openlayers layout add/remove issue");
        setMainWindow(mainWindow);

        final OpenLayersMap map = new OpenLayersMap();
        OpenStreetMapLayer osm = new OpenStreetMapLayer();
        GoogleStreetMapLayer googleStreets = new GoogleStreetMapLayer();
        map.addLayer(osm);
        map.addLayer(googleStreets);
        map.setCenter(22.30083, 60.452541);

        final HorizontalLayout layout1 = new HorizontalLayout();
        layout1.setSizeFull();
        final HorizontalLayout layout2 = new HorizontalLayout();
        layout2.setSizeFull();
        layout1.addComponent(map);
        final Label label2 = new Label("Some other component");
        layout2.addComponent(label2);

        Button toggle = new Button("Toggle");
        toggle.addListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                if (isInLayout1) {
                    layout2.addComponent(map);
                    layout1.addComponent(label2);
                    OpenlayersIssueApplication.this.isInLayout1 = false;
                } else {
                    layout1.addComponent(map);
                    layout2.addComponent(label2);
                    OpenlayersIssueApplication.this.isInLayout1 = true;
                }
            }
        });

        mainWindow.getContent().setSizeFull();
        mainWindow.addComponent(toggle);
        mainWindow.addComponent(layout1);
        mainWindow.addComponent(layout2);

    }

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

Clicking the toggle button should toggle the map between both layouts.  But 
after the first toggle only the controls are displayed and a browser refresh is 
necessary to show the map again.

I was doing something similar to implement a "maximize" functionality to show 
the map full screen, with the same problem.

What version of the product are you using? On what operating system?

1.2.0.  Tested on FF and IE.

Original issue reported on code.google.com by herman.b...@gmail.com on 1 Oct 2012 at 2:09