Note that there are some explanatory texts on larger screens.

plurals
  1. PODeckLayoutPanel in a HTMLPanel with HTML table doesn't display
    primarykey
    data
    text
    <p>I have a GWT app with one main panel showing a table of PostgreSQL instances. I want the app to show other kinds of instances, e.g. Redis instances. So I'm initially wrapping the main panel in a DeckLayoutPanel to swap out the PostgreSQL panel with a Redis panel. There will a vertical menu on the left side that the user will use to select the type of instance to show.</p> <p>Adding DeckLayoutPanel to the UI XML causes the main panel to not display, although I do see the content in a DOM inspector.</p> <p>Here's the original, working UI, without <code>g:DeckLayoutPanel</code>:</p> <pre><code>&lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt; &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"&gt; &lt;g:HTMLPanel&gt; &lt;table width="100%" border="1"&gt; &lt;tr&gt; &lt;td colspan="2" align="left"&gt; &lt;a href="/"&gt;Logo&lt;/a&gt; &lt;/td&gt; &lt;td colspan="2" align="right"&gt; Hello John &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="4"&gt; &lt;g:VerticalPanel ui:field="instancesPanel"&gt; &lt;g:Label ui:field="mainErrorLabel" /&gt; &lt;g:FlexTable ui:field="flexTable" /&gt; &lt;g:HorizontalPanel&gt; &lt;g:TextBox ui:field="createInstanceTextBox" /&gt; &lt;g:ListBox ui:field="createInstanceVersionsListBox" /&gt; &lt;g:Button ui:field="createInstanceButton"&gt;Create&lt;/g:Button&gt; &lt;g:Label ui:field="createInstanceErrorLabel" /&gt; &lt;/g:HorizontalPanel&gt; &lt;/g:VerticalPanel&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Help&lt;/td&gt; &lt;td&gt;About&lt;/td&gt; &lt;td&gt;Contact&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/g:HTMLPanel&gt; &lt;/ui:UiBinder&gt; </code></pre> <p>If I remove the <code>g:HTMLPanel</code> and also the HTML table, trimming it to, this works:</p> <pre><code>&lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt; &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"&gt; &lt;g:DeckLayoutPanel ui:field="deckLayoutPanel"&gt; &lt;g:VerticalPanel ui:field="instancesPanel"&gt; &lt;g:Label ui:field="mainErrorLabel" /&gt; &lt;g:FlexTable ui:field="flexTable" /&gt; &lt;g:HorizontalPanel&gt; &lt;g:TextBox ui:field="createInstanceTextBox" /&gt; &lt;g:ListBox ui:field="createInstanceVersionsListBox" /&gt; &lt;g:Button ui:field="createInstanceButton"&gt;Create&lt;/g:Button&gt; &lt;g:Label ui:field="createInstanceErrorLabel" /&gt; &lt;/g:HorizontalPanel&gt; &lt;/g:VerticalPanel&gt; &lt;/g:DeckLayoutPanel&gt; &lt;/ui:UiBinder&gt; </code></pre> <p>I'm using an HTML table here since I'm not a front-end designer and I have similar HTML for the non-GWT JSP pages (using a JSTL tag) so want to make sure the GWT and non-GWT pages render the same.</p> <p>Should I be using something else than a table? Should I switch to <code>div</code>s for placement instead? Is using a <code>g:DeckLayoutPanel</code> in an HTML table not supported? How is one supposed to get identical HTML pages for GWT and non-GWT pages if one needs to use only GWT layout widgets?</p> <p>BTW, I tried using RootPanel and that didn't work either with the HTML page.</p> <p>I'm binding to it using:</p> <pre><code>interface Binder extends UiBinder&lt;HTMLPanel, MyWebApp&gt; { } private static final Binder binder = GWT.create(Binder.class); @UiField DeckLayoutPanel deckLayoutPanel; @UiField VerticalPanel instancesPanel; @Override public void onModuleLoad() { HTMLPanel outer = binder.createAndBindUi(this); // Tweak a bunch of settings on the UI elements. ... RootLayoutPanel.get().add(outer); deckLayoutPanel.showWidget(instancesPanel); } </code></pre> <p>The HTML hosting the page is this:</p> <pre><code>&lt;!doctype html&gt; &lt;%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %&gt; &lt;html&gt; &lt;head&gt; &lt;link type="text/css" rel="stylesheet" href="MyWebApp.css"&gt; &lt;title&gt;MyWebApp&lt;/title&gt; &lt;script type="text/javascript" language="javascript" src="MyWebApp/MyWebApp.nocache.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"&gt;&lt;/iframe&gt; &lt;noscript&gt; &lt;div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"&gt; Your web browser must have JavaScript enabled in order for this application to display correctly. &lt;/div&gt; &lt;/noscript&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload