Java tutorial
package com.google.gwt.sample.stockwatcher.client; import static com.google.gwt.dom.client.Style.Unit.EM; import static com.google.gwt.dom.client.Style.Unit.PCT; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.DockLayoutPanel; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.LayoutPanel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.SplitLayoutPanel; import com.google.gwt.user.client.ui.StackLayoutPanel; import com.google.gwt.user.client.ui.TabLayoutPanel; import com.google.gwt.user.client.ui.Widget; public class Panels extends Content { private static final String MUSSUM_IPSUM_LITERIS = "Mussum ipsum cacilds, vidis litro abertis. Consetis adipiscings elitis. " + "Pra l , depois divoltis porris, paradis. Paisis, filhis, espiritis santis. " + "M faiz elementum girarzis, nisi eros vermeio, in elementis m pra quem amistosis quis leo. Manduma pindureta quium dia nois paga. " + "Sapien in monti palavris qui num significa nadis i pareci latim. Interessantiss quisso pudia ce receita de bolis, mais bolis eu num gostis." + "Suco de cevadiss, um leite divinis, qui tem lupuliz, matis, aguis e fermentis. Interagi no m, cursus quis, vehicula ac nisi. Aenean vel dui dui. " + "Nullam leo erat, aliquet quis tempus a, posuere ut mi. Ut scelerisque neque et turpis posuere pulvinar pellentesque nibh ullamcorper. " + "Pharetra in mattis molestie, volutpat elementum justo. Aenean ut ante turpis. Pellentesque laoreet m vel lectus scelerisque interdum cursus velit auctor. " + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac mauris lectus, non scelerisque augue. Aenean justo massa."; private Anchor dockLayoutLink = new Anchor("Dock Layout"); private Anchor splitLayoutLink = new Anchor("Split Layout"); private Anchor stackLayoutLink = new Anchor("Stack Layout"); private Anchor tabLayoutLink = new Anchor("Tab Layout"); public String getPageTitle() { return "Panel's Page"; } @Override public void loadContent() { loadLinks(); RootPanel contentPanel = RootPanel.get("content"); contentPanel.clear(); contentPanel.add(loadFlowPanel()); } private void loadContent(Widget content) { RootPanel contentPanel = RootPanel.get("content"); contentPanel.clear(); contentPanel.add(content); } private void loadLinks() { RootPanel links = RootPanel.get("navigationLinks"); links.clear(); HorizontalPanel linksPanel = new HorizontalPanel(); linksPanel.setSpacing(5); dockLayoutLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadContent(loadDockLayoutPanel()); } }); splitLayoutLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadContent(loadSplitLayoutPanel()); } }); stackLayoutLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadContent(loadStackLayoutPanel()); } }); tabLayoutLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadContent(loadTabLayoutPanel()); } }); linksPanel.add(dockLayoutLink); linksPanel.add(splitLayoutLink); linksPanel.add(stackLayoutLink); linksPanel.add(tabLayoutLink); links.add(linksPanel); } private Widget loadFlowPanel() { FlowPanel panel = new FlowPanel(); panel.add(new HTML("TEST Flow Panel")); panel.add(new HTML("TEST2 Flow Panel")); return panel; } private void loadHTMLPanel() { } private void loadFormPanel() { } private void loadScrollPanel() { } private void loadPopupPanel() { } private void loadDialogBox() { } private void loadGrid() { } private void loadFlexTable() { } private Widget loadLayouPanel() { Widget child0 = new Label("Test 1"); Widget child1 = new Label("Test 2"); Widget child2 = new Label("Test 3"); LayoutPanel p = new LayoutPanel(); p.add(child0); p.add(child1); p.add(child2); p.setWidgetLeftWidth(child0, 0, PCT, 50, PCT); // Left panel p.setWidgetRightWidth(child1, 0, PCT, 50, PCT); // Right panel p.setWidgetLeftRight(child2, 5, EM, 5, EM); // Center panel p.setWidgetTopBottom(child2, 5, EM, 5, EM); return p; } private Widget loadDockLayoutPanel() { DockLayoutPanel p = new DockLayoutPanel(Unit.EM); p.addNorth(new HTML("header"), 2); p.addSouth(new HTML("footer"), 2); p.addWest(new HTML("navigation"), 10); p.add(new HTML(MUSSUM_IPSUM_LITERIS)); p.setPixelSize(800, 500); return p; } private Widget loadSplitLayoutPanel() { SplitLayoutPanel p = new SplitLayoutPanel(); p.addWest(new HTML("navigation"), 128); p.addNorth(new HTML("list"), 384); p.add(new HTML(MUSSUM_IPSUM_LITERIS)); p.setPixelSize(800, 500); return p; } private Widget loadStackLayoutPanel() { StackLayoutPanel p = new StackLayoutPanel(EM); p.add(new HTML("this content"), new HTML("this"), 4); p.add(new HTML("that content"), new HTML("that"), 4); p.add(new HTML(MUSSUM_IPSUM_LITERIS), new HTML("the other"), 4); p.setPixelSize(800, 500); return p; } private Widget loadTabLayoutPanel() { TabLayoutPanel p = new TabLayoutPanel(1.5, EM); p.add(new HTML("this content"), "this"); p.add(new HTML("that content"), "that"); p.add(new HTML(MUSSUM_IPSUM_LITERIS), "the other"); p.setPixelSize(800, 500); return p; } }