/** Initialize this example. */ @ShowcaseSource @Override public Widget onInitialize() { // Create a Split Panel SplitLayoutPanel splitPanel = new SplitLayoutPanel(5); splitPanel.ensureDebugId("cwSplitLayoutPanel"); splitPanel.setPixelSize(500, 400); splitPanel.getElement().getStyle().setProperty("border", "3px solid #e7e7e7"); // Add text all around. splitPanel.addNorth(new Label(constants.cwSplitLayoutPanelNorth1()), 50); splitPanel.addSouth(new Label(constants.cwSplitLayoutPanelSouth1()), 50); splitPanel.addEast(new Label(constants.cwSplitLayoutPanelEast()), 100); splitPanel.addWest(new Label(constants.cwSplitLayoutPanelWest()), 100); splitPanel.addNorth(new Label(constants.cwSplitLayoutPanelNorth2()), 50); splitPanel.addSouth(new Label(constants.cwSplitLayoutPanelSouth2()), 50); // Add scrollable text to the center. String centerText = constants.cwSplitLayoutPanelCenter(); for (int i = 0; i < 3; i++) { centerText += " " + centerText; } Label centerLabel = new Label(centerText); ScrollPanel centerScrollable = new ScrollPanel(centerLabel); splitPanel.add(centerScrollable); // Return the content return splitPanel; }
private void adjustHeight() { Element pucHeader = DOM.getElementById("pucHeader"); int offset; if (pucHeader != null) { offset = pucHeader.getOffsetHeight(); setElementHeightOffset(navigatorAndContentSplit.getElement(), -1 * offset); setElementHeightOffset(contentTabPanel.getElement(), -1 * offset); } }
private void buildUI() { FlowPanel topPanel = new FlowPanel(); SimplePanel toolbarWrapper = new SimplePanel(); toolbarWrapper.setWidget(new BrowserToolbar()); toolbarWrapper.setStyleName("files-toolbar"); // $NON-NLS-1$ topPanel.add(toolbarWrapper); topPanel.add(new SolutionTreeWrapper(solutionTree)); solutionNavigatorPanel.setStyleName("puc-vertical-split-panel"); solutionNavigatorPanel.setWidth("100%"); solutionNavigatorPanel.addNorth(topPanel, 500); solutionNavigatorPanel.add(filesListPanel); navigatorAndContentSplit.setStyleName("puc-horizontal-split-panel"); navigatorAndContentSplit.addWest(solutionNavigatorPanel, 300); navigatorAndContentSplit.add(contentTabPanel); navigatorAndContentSplit.getElement().setAttribute("id", "solutionNavigatorAndContentPanel"); Window.addResizeHandler( new ResizeHandler() { @Override public void onResize(ResizeEvent event) { adjustContentPanelSize(); } }); solutionNavigatorPanel.getElement().getParentElement().addClassName("puc-navigator-panel"); solutionNavigatorPanel.getElement().getParentElement().removeAttribute("style"); setStyleName("panelWithTitledToolbar"); // $NON-NLS-1$ setHeight("100%"); // $NON-NLS-1$ setWidth("100%"); // $NON-NLS-1$ add(navigatorAndContentSplit); sinkEvents(Event.MOUSEEVENTS); navigatorAndContentSplit.getWidget(1).setWidth("100%"); navigatorAndContentSplit.getElement().getStyle().setHeight(1, Unit.PX); contentTabPanel.getElement().getStyle().setHeight(1, Unit.PX); }
/** Improves splitter visibility. */ private void tuneSplitter() { NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.getItem(i); if (node.hasChildNodes()) { com.google.gwt.dom.client.Element el = node.getFirstChild().cast(); if ("gwt-SplitLayoutPanel-HDragger".equals(el.getClassName())) { tuneSplitter(el); return; } } } }