Search code examples
gwtlayoutpanels

LayoutPanel with right alignment


I'm using a layout panel with some layers. One of the layers is quite simple but I want it to have a float: right on the element. But this is actually not working because subwidgets are styled with style="postition: absolute; left: 0px; ..." which overrides the styling and so the subpanels/widgets will always be placed on the left. Any workaround for this?


Solution

  • After adding your element to your layout container, did you try setWidgetHorizontalPosition ?

    If above method does not work and you want to use float right, maybe you can use a non-layout system with FlowPanel maybe. Otherwise you will have to fix the position and width/height of your components but you may loose responsive design.

    Last trick : If you really need to change the absolute style. In your component do something like this (do this after your component has been added to the dom)

    this.getElement().getParent().getStyle().set.....
    

    You can reset whatever property you want but this might break your layout