Full size portlet

How I can do full size where width and height is 100%. This work fine in normal application, but not inside portlet.
After I set pixels portlet work fine. Without this I can’t get work liferay freeform layout. s

This is what I see in Firebug. Panel is hided, but it show after I change OpenLayers height and width to pixels.

Percentage heights won’t work unless each and every parent element has a defined height. In the HTML snippet you provided, there are two DIV elements that don’t have a specified height, hence your _OpenLayers_ViewPort 100% height results in 0 height.

You either need to specify a fixed height for your portlet, and set all of your Vaadin layouts/components to 100% height, or set a fixed height to the OpenLayers component.

What would 100% height mean? 100% of what? I there is no size reference at all, 100% of 0px is 0px - which is quite confusing…

With portlets, you might want to consider leaving the height undefined. This way the height will be calculated from the contents of your application.

Actually there is reference size if you look below html elements. Besides all other component work porperly,
but not my widget.

Main layout is Horizontal layout with width 100% and height 100%.
Portlet set width to 1433px and height to 615px (so it is full size) and if I rezise portlet window those values also change.
Inside horizontal layout has two component.
First component inside horizontallayout is accordion where width is 240px and height is 100%. This work also how it should work.
Second component is my own widget and work properly if I run application without liferay portal, if I add same application
to liferay portal I can’t see map. I wonder why it (portlet) can set pixel values.


<div class="v-horizontallayout" style="overflow: hidden; width: 1433px; height: 615px;">
  <div style="margin: 0px; overflow: hidden; width: 1433px; height: 615px;">
    <div style="overflow: hidden; height: 623px; width: 241px; float: left; padding-left: 0px; padding-top: 0px;">
    </div>
    <div style="overflow: hidden; height: 623px; width: 1257px; float: left; padding-left: 0px; padding-top: 0px;">
      <div style="float: left; margin-left: 0px;">
        <div class="v-mappanel" style="width: 1257px;">
          <div id="_OpenLayers_ViewPort" class="olMapViewport" style="overflow: hidden; position: relative; width: 100%; height: 100%;">

I think the problem is that you do not convert those percentage values into pixels, as all other Vaadin widgets do. Are you calling updateComponent method inside updateFromUIDL? That should take care of relative sizes for you.

I mean something like this:

public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
        // This call should be made first. Ensure correct implementation,
        // and let the containing layout manage caption, etc.
        if (client.updateComponent(this, uidl, true)) {
            return;
        }
        ...
}

I am calling updateComponent before actual code inside updateFromUIDL method. My client component extends composite class and there is MapWidget where width and height is 100%. Maybe this is problem for size. I will try to fix this doing same thing than in

google map widget
(overridden setHeight and setWidth and set mapwidget size after calling super.set). I am still wondering why same code work properly in normal servlet but not in portlet.

Thanks anyway for help!

The question is still actualy. I’m using Vaadin7 portlet inside the Liferay. Setting setSizeFull() to my Vaadin porlet doesn’t make the trick - the portlet has height of zero.
How can I set the size of Vaadin portlet so it takes the full available height of the screen?

Calling setSizeFull() makes the portlet fill the space given to it by the portal. However, when the size of the portlet hasn’t been defined on the portal, the portal deduces the size of the portlet from what the portlet div requests in absolute (non-percentual) terms, which in this case means 100% of 0px.

The solution is making the portlet a full screen portlet. Usually you can create the page on the portal so that the portlet is already maximized, so that should be enough for many use cases.

If this is not an option for you, see e.g.
this StackOverflow thread
. Unfortunately, changing portlet modes in Vaadin 7 is not well documented and possibly tricky at the moment as it requires triggering an action request or hooking onto the render phase of the portlet (related also to
#12274
). Vaadin 6 documentation for reacting to portlet mode changes is
here
and there is a Vaadin 7 test class that reacts to portlet mode changes
here
but I can’t recall where there would be an example of forcing a portlet mode change if you are not able to set the correct mode from outside the portlet.