Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Map disappears when it changes position into a VerticalLayout #95

Open
ImMak opened this issue Jun 13, 2017 · 2 comments
Open

Map disappears when it changes position into a VerticalLayout #95

ImMak opened this issue Jun 13, 2017 · 2 comments

Comments

@ImMak
Copy link

ImMak commented Jun 13, 2017

Hi All,
I'm facing a strange problem:
when I've the OLMap inside a VerticalLayout not in the position 0 if
I remove a Component that is above it the latter is correctly moved up
but it becomes like invisible.

You can reproduce the problem with a VL with inside a Button and the OLMap:

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();
    final Button button = new Button("Remove me");

    button.addClickListener(new ClickListener() {
        @Override
	public void buttonClick(ClickEvent event) {
            layout.removeComponent(button);
	}
    });

    OLOSMSourceOptions opts = new OLOSMSourceOptions();
    opts.setCustomAttributions(new String []{"custom attribution"});
    opts.setShowAttributions(true);
    opts.setMaxZoom(16);

    OLOSMSource source = new OLOSMSource(opts);

    OLViewOptions opts2 = new OLViewOptions();
    opts2.setInputProjection(Projections.EPSG4326);
    OLView view = new OLView(opts2);
    view.setCenter(0, 0);
    view.setZoom(3);

    OLMap map = new OLMap();
    map.addLayer(new OLTileLayer(source));
    map.setView(view);

    layout.addComponent(button);
    layout.addComponent(map);

    getPage().setTitle("Test");
    setContent(layout);
    setSizeFull();
}

It looks like the VerticalLayout calls some methods to move up the map
and something in these methods makes it like invisible.

This is the only workaround I found:

map.setVisible(false);
getUI().push();
map.setVisible(true);
getUI().push();

but it's not really elegant and it should be called before any refresh
from the UI thread or manual push.

I hope somebody has a better idea or at least, an explanation of why this is happening.
The Vaadin version I'm using is the 7.7.8.

@ImMak
Copy link
Author

ImMak commented Jun 19, 2017

Nobody?

@All4Gis
Copy link

All4Gis commented Nov 18, 2020

The problem I think started with this commit cfb0cf1
Your workaround work well, but in the end you did it differently?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants