Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Last active February 1, 2020 08:49
Show Gist options
  • Save branflake2267/ec75a7a8fe7b056e7253e932fea94da8 to your computer and use it in GitHub Desktop.
Save branflake2267/ec75a7a8fe7b056e7253e932fea94da8 to your computer and use it in GitHub Desktop.
GXT 4 HtmlLayoutContainer with a Holy Grail Flex Layout.
<style>
.HolyGrail {
display: flex;
min-height: 100vh;
flex-direction: column;
}
.HolyGrail-body {
display: flex;
flex: 1;
}
.HolyGrail-content {
flex: 1;
}
.HolyGrail-nav, .HolyGrail-ads {
flex: 0 0 12em;
}
.HolyGrail-nav {
order: -1;
}
.HolyGrail,
.HolyGrail-body {
display: flex;
flex-direction: column;
}
@media (min-width: 768px) {
.HolyGrail-body {
flex-direction: row;
flex: 1;
}
.HolyGrail-content {
flex: 1;
}
.HolyGrail-nav, .HolyGrail-ads {
flex: 0 0 12em;
}
}
.HolyGrail-nav {
border: 1px dashed green;
margin: 5px;
}
.HolyGrail-content {
border: 1px dashed blue;
margin: 5px;
padding: 5px;
}
.HolyGrail-ads {
border: 1px dashed coral;
margin: 5px;
}
header {
border: 1px dashed brown;
margin: 5px;
}
footer {
border: 1px dashed brown;
margin: 5px;
}
.gxtField { width: 100% !important; } .gxtField * { width: 100% !important; }
</style>
<div class="HolyGrail">
<header>header</header>
<div class="HolyGrail-body">
<main class="HolyGrail-content">
<div class="textField"></div>
</main>
<nav class="HolyGrail-nav">nav</nav>
<aside class="HolyGrail-ads">ads</aside>
</div>
<footer>footer</footer>
</div>
package com.sencha.gxt.test.client.layout_htmllayout.flex;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.widget.core.client.container.AbstractHtmlLayoutContainer.HtmlData;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.form.TextField;
public class HtmlContainerFlexExample implements EntryPoint {
public interface FlexTemplate extends XTemplates {
@XTemplate(source = "FlexTemplate.html")
SafeHtml getTemplate();
}
@Override
public void onModuleLoad() {
HtmlLayoutContainer form = createLayout();
RootPanel.get().add(form);
}
private HtmlLayoutContainer createLayout() {
final TextField textField = new TextField();
textField.setEmptyText("Empty Text");
textField.addStyleName("gxtField"); // in the stylesheet
FlexTemplate template = GWT.create(FlexTemplate.class);
final HtmlLayoutContainer container = new HtmlLayoutContainer(template.getTemplate());
container.add(textField, new HtmlData(".textField"));
return container;
}
}
@branflake2267
Copy link
Author

Example:
htmllayoutcontainer-flex-layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment