center of the DocLayoutPanel is not rendering properly when embebed inside SimplePanel/SimpleLayoutPanel/ResizeLayoutPanel. - gwt

Child view has DocLayoutPanel and Want to embed it into SimplePanel. center position is ScrollView and it is not displayed properly.
position in Parent View
<ui:SimplePanel ui:field="plageHolderID"/>
layout in Child view
<ui:Binder>
<g:DoclayoutPanel>
<g:north>
</g:north>
<g:center>
<g:ScrollPanel>
<g:VerticalPanel ui:field="paneForList">
<!-- Display List here-->
</g:VerticalPanel>
</g:ScorllPanel>
</g:center>
<g:south>
</g:south>
</ui:DoclayoutPanel>
</ui:Binder>

I am assuming you mean DockLayoutPanel.
The issue with the center not showing correctly is caused by the SimplePanel, which does not implement ProvidesResize.
DockLayoutPanel implements RequiresResize and therfore either needs to be placed in a panel, which implements ProvidesResize, or it needs to be given a specific height by calling [setSize()](http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/UIObject.html#setSize(java.lang.String, java.lang.String)).

Related

How to align controls vertically?

I have several elements on screen in XML file
<layout:VerticalLayout xmlns:layout="sap.ui.layout" xmlns="sap.m">
<Input />
<Button />
<!-- ... -->
</layout:VerticalLayout>
How can I add something like layout gravity or align the controls vertically? E.g. I want the elements in the center of the screen.
Since you're using the sap.m library anyway, I would recommend to use the sap.m.VBox control (or sap.m.HBox for horizontal layouts)
The VBox does exactly the same as the VerticalLayout and more (you can specify alignment, justification in a truly flexible way).
The VBox and HBox inherit from sap.m.FlexBox, see these examples on what you can do: https://sdk.openui5.org/entity/sap.m.FlexBox

DockLayoutPanel issues with text wrapping

So I am using a dock layout panel. In the north I have a title and menubar and center has a table. My problem is when the title gets long and wraps the text, it pushed the menubar down and you can no longer see it. This is because you have to set fixed sizes for all panels except center.
I thought about moving it all to center panel but the problem is that when my table gets big and a scroll bar appears I want to always see the header and menubar even when scrolling on the table. So I cant just put everything in scroll panel.
How can I create a layout that fills these requirements:
1. Always see the title and menubar
2. Scrollable table
3. When the window is resized and text from title wraps it resizes the whole thing correctly.
here is Layout right now:
<g:DockLayoutPanel >
<g:north size="80">
<g:VerticalPanel width="100%">
<g:HorizontalPanel width="100%">
<g:HTML ui:field="title" styleName="{style.title}"></g:HTML>
</g:HorizontalPanel>
<g:HorizontalPanel styleName="{style.infoBar}" width="100%">
<g:MenuBar animationEnabled="true" styleName="{res.css.menuBar}" focusOnHoverEnabled="false" ui:field="menuBar"></g:MenuBar>
</g:HorizontalPanel>
</g:VerticalPanel>
</g:north>
<g:center>
<g:ScrollPanel>
<g:SimplePanel ui:field="content" styleName="{style.content}">Table or tree goes here
</g:SimplePanel>
</g:ScrollPanel>
</g:center>
<g:south size="20">
<g:VerticalPanel styleName="{style.footerPanel}">
<g:HTML ui:field="messageBar">Fotter text here</g:HTML>
</g:VerticalPanel>
</g:south>
</g:DockLayoutPanel>
Have you tried to use two DockLayoutPanel?
The first has the title in the center area and in the south another DockLayoutPanel with the menu in the north area and the table in the center?
If title and menu may be shown underneath each other you can put title and menu in separate north-panels (that actually works).
With that you can at least ensure that the menu gets shown.

Resizing Children in SplitLayoutPanel

I'm having an issue resizing the child widget inside a SplitLayoutPanel. I have a table in the South region of my layout. When I drag the splitter to increase the size the table doesn't resize. It stays at it's fixed height which causes white space under neath the table. When I shrink the South panel the table appears to "hide" behind the footer div image I have at the bottom of the Window. Is there a way to resize the table as the panel increases/decreases in size?
How I my South Panel is laid out. The "South" panel is real just the center panel filling out the rest of the space.
That center panel has a SimplePanel.
Attached to the SimplePanel is a LayoutPanel. I'm using that because there is a button bar above the table and SimplePanel only takes one Widget so I had to nest the widgets inside something else.
LayoutPanel's height and width are set to 100%
I'm guessing what needs to happen is the layout panel height needs to adjust. I'm not sure.
If need be I can post code. I'm also using the MVP/Activity/Places method
UPDATE
SplitLayoutPanel UI:
<g:SplitLayoutPanel>
<g:north size='250'>
. . .
</g:north size='250'>
<g:center>
<g:SimplePanel ui:field="south"/>
</g:center>
</g:SplitLayoutPanel>
Table Layout:
<g:LayoutPanel width="100%" height="100%">
<g:layer top='0px' height='125px'>
ButtonBar is here
</g:layer>
<g:layer top='30px' bottom='5px'>
<g:HorizontalPanel width="100%" height="100%">
<table:CustomTable height="500"/>
</g:HorizontalPanel>
</g:layer>
</g:LayoutPanel>
The Table Widget is placed into the center panel of the SplitLayoutPanel.

GWT Layout: "take up the rest of the space."

My existing layout is a stack of two divs - g:layers in a LayoutPanel. The top div should be as big as it needs to be to contain its contents. The bottom div should take up the rest of the space on the screen, without causing scrollbars to appear.
The contents of the top div can change, so the size of the top div can change.
My current solution is a callback that's triggered whenever the contents of the top div change. The containing LayoutPanel can then recalculate the size of the top div and explicitly set the top and bottom attributes of the second layer to take up the rest of the space. Is there a better way? Something like,
<g:LayoutPanel>
<g:layer top="0px" height="whatever you need, baby">
<c:SomeWidget/>
</g:layer>
<g:layer top="the bottom of the first layer" bottom="0px">
<c:Anotherwidget/>
</g:layer>
</g:LayoutPanel>
What about using DockLayoutPanel?
<g:DockLayoutPanel unit='PX'>
<north size="10" ui:field='northWidget'>
<c:SomeWidget/>
</north>
<center>
<c:Anotherwidget/>
</center>
</g:DockLayoutPanel>
Then the center will take up the rest of the space. If you want to resize the top, call
setWidgetSize(northWidget, newSize); and the center widget will be recalculated.
The answer seems to be that there is not a better way. Manual recalculation isn't so bad when you get used to it!
I think HeaderPanel is the standard Widget to do this. Maybe it was added after the question was asked. We missed it too and had our own version for a while.

GWT UIBinder Tab panel

I want to put some anchor inside the body of tab panel with two tabs. But my anchors are not visible. The code is as follows
<g:TabLayoutPanel ui:field="lhsTabPanel" barUnit="PX" barHeight="60">
<g:tab>
<g:header>Analysis</g:header>
<g:FlowPanel>
<g:Anchor ui:field='personalInformation'>Personal Information</g:Anchor>
</g:FlowPanel>
</g:tab>
<g:tab>
<g:header>Comparison</g:header>
<g:FlowPanel ui:field="comparisonContent"/>
</g:tab>
</g:TabLayoutPanel>
The personal information tab is not visible
TabLayoutPanels must be added to other widgets that implement ProvidesResize. For example, if you are adding this TabLayoutPanel to RootPanel instead of RootLayoutPanel, you won't be able to see the TabLayoutPanel because RootPanel does not implement ProvidesResize.
You can't see the contents of the tabs because the TabLayoutPanel does not know how big it should be. Try adding it to some descendant of a LayoutPanel and setting its size explicitly with the setWidgetLeftRight and related functions.
Check out http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#LayoutPanels for more information.