List of usage examples for com.google.gwt.user.client.ui SplitLayoutPanel addNorth
public void addNorth(Widget widget, double size)
From source file:com.google.gwt.examples.SplitLayoutPanelExample.java
License:Apache License
public void onModuleLoad() { // Create a three-pane layout with splitters. SplitLayoutPanel p = new SplitLayoutPanel(); p.addWest(new HTML("navigation"), 128); p.addNorth(new HTML("list"), 384); p.add(new HTML("details")); // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for // resize events on the window to ensure that its children are informed of // possible size changes. RootLayoutPanel rp = RootLayoutPanel.get(); rp.add(p);// w w w. j ava 2s . co m }
From source file:com.google.gwt.sample.showcase.client.content.panels.CwSplitLayoutPanel.java
License:Apache License
/** * Initialize this example.//from ww w . j ava 2 s . c o m */ @ShowcaseSource @Override public Widget onInitialize() { // Create a Split Panel SplitLayoutPanel splitPanel = new SplitLayoutPanel(5); splitPanel.ensureDebugId("cwSplitLayoutPanel"); 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; }
From source file:com.google.gwt.sample.stockwatcher.client.Panels.java
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);//w w w .ja va2 s .c o m return p; }
From source file:com.mashery.examples.api.client.EtsyExample.java
License:Open Source License
public EtsyExample(final PopupMapWidget mapWidget) { AbsolutePanel rootPanel = new AbsolutePanel(); rootPanel.setSize("100%", "100%"); SplitLayoutPanel panel = new SplitLayoutPanel(); rootPanel.add(panel);//ww w . jav a 2s.c o m panel.setHeight("100%"); FlowPanel topPanel = new FlowPanel(); panel.addNorth(topPanel, 250d); topPanel.add(new HTML("<h1>Featured Listings</h1>")); dragController = new PickupDragController(rootPanel, false); dragController.setBehaviorDragProxy(true); dragController.setBehaviorMultipleSelection(false); dragController.setBehaviorDragStartSensitivity(2); featuredListingsTable = new FeaturedListingsTable(20); topPanel.add(new ScrollPanel(featuredListingsTable)); DockLayoutPanel bottomPanelContainer = new DockLayoutPanel(Unit.PX); panel.add(bottomPanelContainer); bottomPanelContainer.addNorth(new HTML("<h1>Favorite Listings</h1>"), 50d); bottomPanel = new DeckPanel(); bottomPanelContainer.add(bottomPanel); bottomPanel.add(new HTML("Obtaining your Etsy account information...")); favoriteListingsTable = new FavoriteListingsTable(20); dropController = new SimpleDropController(favoriteListingsTable) { public void onDrop(DragContext context) { Image img = (Image) context.draggable; String id = img.getElement().getId(); if (id != null && id.startsWith("listing_")) { try { int listingId = Integer.parseInt(id.substring("listing_".length())); favoriteListingsTable.createUserFavoriteListing(listingId); } catch (NumberFormatException e) { GWT.log("Unable to parse listing id.", e); } } } }; dragController.registerDropController(dropController); FlowPanel userPanel = new FlowPanel(); userPanel.add(userLabel = new InlineHTML()); userPanel.add(new InlineHTML(" ")); Anchor disconnectLink = new Anchor("Disconnect", "#"); userPanel.add(disconnectLink); disconnectLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); disconnectEtsyAccount(); } }); userPanel.add(new InlineHTML(" | ")); Anchor mapProfileLink = new Anchor("Map Profile", "#"); userPanel.add(mapProfileLink); mapProfileLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); if (user != null) { UserProfile profile = user.getProfile(); if (profile != null) { MarkerOptions opt = new MarkerOptions(); opt.setTitle(profile.getLoginName()); opt.setPosition(new LatLng(profile.getLat(), profile.getLon())); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } } } }); mapWidget.addAutoHidePartner(mapProfileLink.getElement()); userPanel.add(new HTML()); userPanel.add(favoriteListingsTable); bottomPanel.add(new ScrollPanel(userPanel)); bottomPanel.add(new HTML("You must be logged in in order to manage your favorite listings.")); bottomPanel.add(createOAuthPanel()); etsySvc = GWT.create(EtsyService.class); infoPanel = new PopupPanel(true); infoPanel.setAutoHideOnHistoryEventsEnabled(true); infoGrid = new Grid(2, 1); infoPanel.setWidget(infoGrid); infoGrid.setWidth("240px"); mapListingLink = new Anchor("Map", "#"); mapListingLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); if (selectedListing == null) return; Shop shop = selectedListing.getShop(); if (shop == null) { Window.alert("No shop information available."); return; } if (!shop.hasLatLon()) { Window.alert("No location information available."); return; } MarkerOptions opt = new MarkerOptions(); opt.setTitle(shop.getShopName()); opt.setPosition(new LatLng(shop.getLat(), shop.getLon())); opt.setClickable(true); opt.setVisible(true); mapWidget.show(new Marker(opt)); } }); mapWidget.addAutoHidePartner(mapListingLink.getElement()); deleteFavListingLink = new Anchor("Delete", "#"); deleteFavListingLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { event.preventDefault(); favoriteListingsTable.deleteUserFavoriteListing(selectedListing.getListingId()); infoPanel.hide(); } }); initWidget(rootPanel); bottomPanel.showWidget(0); }
From source file:org.apache.luke.client.LukeInspector.java
License:Apache License
public void onModuleLoad() { final RootPanel rootPanel = RootPanel.get(); CaptionPanel cptnpnlNewPanel = new CaptionPanel("New panel"); cptnpnlNewPanel.setCaptionHTML("Luke version 5.0"); rootPanel.add(cptnpnlNewPanel, 10, 10); cptnpnlNewPanel.setSize("959px", "652px"); TabPanel tabPanel = new TabPanel(); cptnpnlNewPanel.setContentWidget(tabPanel); tabPanel.setSize("5cm", "636px"); //LuceneIndexLoader.loadIndex(pName, this); SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel(); tabPanel.add(splitLayoutPanel, "Index overview", false); tabPanel.setVisible(true);/*from ww w.j av a 2 s . com*/ splitLayoutPanel.setSize("652px", "590px"); SplitLayoutPanel splitLayoutPanel_1 = new SplitLayoutPanel(); splitLayoutPanel.addNorth(splitLayoutPanel_1, 288.0); Label lblIndexStatistics = new Label("Index statistics"); lblIndexStatistics.setDirectionEstimator(true); lblIndexStatistics.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); splitLayoutPanel_1.addNorth(lblIndexStatistics, 26.0); VerticalPanel verticalPanel = new VerticalPanel(); splitLayoutPanel_1.addWest(verticalPanel, 125.0); Label lblTest = new Label("Index name:"); verticalPanel.add(lblTest); lblTest.setWidth("109px"); Label lblTest_1 = new Label("# fields:"); verticalPanel.add(lblTest_1); Label lblNumber = new Label("# documents:"); verticalPanel.add(lblNumber); lblNumber.setWidth("101px"); Label lblTerms = new Label("# terms:"); verticalPanel.add(lblTerms); Label lblHasDeletions = new Label("Has deletions?"); verticalPanel.add(lblHasDeletions); Label lblNewLabel = new Label("Optimised?"); verticalPanel.add(lblNewLabel); Label lblIndexVersion = new Label("Index version:"); verticalPanel.add(lblIndexVersion); SplitLayoutPanel splitLayoutPanel_2 = new SplitLayoutPanel(); splitLayoutPanel.addWest(splitLayoutPanel_2, 240.0); // Create name column. TextColumn<Field> nameColumn = new TextColumn<Field>() { @Override public String getValue(Field field) { return field.getName(); } }; // Make the name column sortable. nameColumn.setSortable(true); // Create termCount column. TextColumn<Field> termCountColumn = new TextColumn<Field>() { @Override public String getValue(Field contact) { return contact.getTermCount(); } }; // Create decoder column. TextColumn<Field> decoderColumn = new TextColumn<Field>() { @Override public String getValue(Field contact) { return contact.getDecoder(); } }; final CellTable<Field> cellTable = new CellTable<Field>(); cellTable.addColumn(nameColumn, "Name"); cellTable.addColumn(termCountColumn, "Term count"); cellTable.addColumn(decoderColumn, "Decoder"); cellTable.setRowCount(FieldsDummyData.Fields.size(), true); // Set the range to display. In this case, our visible range is smaller than // the data set. cellTable.setVisibleRange(0, 3); // Create a data provider. AsyncDataProvider<Field> dataProvider = new AsyncDataProvider<Field>() { @Override protected void onRangeChanged(HasData<Field> display) { final Range range = display.getVisibleRange(); // Get the ColumnSortInfo from the table. final ColumnSortList sortList = cellTable.getColumnSortList(); // This timer is here to illustrate the asynchronous nature of this data // provider. In practice, you would use an asynchronous RPC call to // request data in the specified range. new Timer() { @Override public void run() { int start = range.getStart(); int end = start + range.getLength(); // This sorting code is here so the example works. In practice, you // would sort on the server. Collections.sort(FieldsDummyData.Fields, new Comparator<Field>() { public int compare(Field o1, Field o2) { if (o1 == o2) { return 0; } // Compare the name columns. int diff = -1; if (o1 != null) { diff = (o2 != null) ? o1.getName().compareTo(o2.getName()) : 1; } return sortList.get(0).isAscending() ? diff : -diff; } }); List<Field> dataInRange = FieldsDummyData.Fields.subList(start, end); // Push the data back into the list. cellTable.setRowData(start, dataInRange); } }.schedule(2000); } }; // Connect the list to the data provider. dataProvider.addDataDisplay(cellTable); // Add a ColumnSortEvent.AsyncHandler to connect sorting to the // AsyncDataPRrovider. AsyncHandler columnSortHandler = new AsyncHandler(cellTable); cellTable.addColumnSortHandler(columnSortHandler); // We know that the data is sorted alphabetically by default. cellTable.getColumnSortList().push(nameColumn); splitLayoutPanel_2.add(cellTable); SplitLayoutPanel splitLayoutPanel_3 = new SplitLayoutPanel(); splitLayoutPanel.addEast(splitLayoutPanel_3, 215.0); StackPanel stackPanel = new StackPanel(); rootPanel.add(stackPanel, 714, 184); stackPanel.setSize("259px", "239px"); FlowPanel flowPanel = new FlowPanel(); stackPanel.add(flowPanel, "Open index", false); flowPanel.setSize("100%", "100%"); TextBox textBox = new TextBox(); flowPanel.add(textBox); Button btnNewButton = new Button("..."); btnNewButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { DirectoryLister directoryLister = new DirectoryLister(); directoryLister.setPopupPosition(rootPanel.getAbsoluteLeft() + rootPanel.getOffsetWidth() / 2, rootPanel.getAbsoluteTop() + rootPanel.getOffsetHeight() / 2); directoryLister.show(); } }); flowPanel.add(btnNewButton); // exception handling // credits: http://code.google.com/p/mgwt/source/browse/src/main/java/com/googlecode/mgwt/examples/showcase/client/ShowCaseEntryPoint.java?repo=showcase GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override public void onUncaughtException(Throwable e) { Window.alert("uncaught: " + e.getMessage()); String s = buildStackTrace(e, "RuntimeExceotion:\n"); Window.alert(s); e.printStackTrace(); } }); }
From source file:org.hudsonci.maven.plugin.ui.gwt.configure.documents.internal.DocumentMasterViewImpl.java
License:Open Source License
@Inject public DocumentMasterViewImpl(final MessagesResource messages, final SilkIcons icons) { this.messages = checkNotNull(messages); checkNotNull(icons);//from w w w . j a v a 2s . c om DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.EM); initWidget(dockPanel); ensureDebugId("document-master-view"); // Toolbar ToolBar toolBar = new ToolBar(); toolBar.setSize("100%", "100%"); dockPanel.addNorth(toolBar, 2.5); refreshButton = new ImageTextButton(icons.arrow_refresh(), messages.refresh()); refreshButton.setTitle(messages.refresh()); // FIXME: Use sep message for tool-tip refreshButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { presenter.doRefresh(); } }); toolBar.add(refreshButton); addButton = new ImageTextButton(icons.add(), messages.add()); addButton.setTitle(messages.add()); // FIXME: Use sep message for tool-tip addButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { presenter.doAdd(); } }); toolBar.add(addButton); removeButton = new ImageTextButton(icons.delete(), messages.remove()); removeButton.setTitle(messages.remove()); // FIXME: Use sep message for tool-tip removeButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { presenter.doRemove(); } }); removeButton.setEnabled(false); toolBar.add(removeButton); // Content SplitLayoutPanel splitPanel = new SplitLayoutPanel(); dockPanel.add(splitPanel); // Documents table // FIXME: Only 100 records will be shown, then lost due to assumption of a pager being used documentsTable = new MaximizedCellTable<Document>(100, Document.KEY_PROVIDER); documentsTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); ImageResourceColumn<Document> iconColumn = new ImageResourceColumn<Document>() { @Override public ImageResource getValue(final Document document) { return document.getIcon(); } }; documentsTable.addColumn(iconColumn); // TODO: Once everything is happy working, might want to not display the ID column // TODO: ... its not really important to the user to know what this is here, but still show on detail page for ref // TODO: ... this may need to wait until we have form validation to help ensure that a document name is always configured. TextColumn<Document> idColumn = new TextColumn<Document>() { @Override public String getValue(final Document document) { return document.getId(); } }; documentsTable.addColumn(idColumn, messages.id()); TextColumn<Document> typeColumn = new TextColumn<Document>() { @Override public String getValue(final Document document) { return document.getType().toString(); } }; documentsTable.addColumn(typeColumn, messages.type()); TextColumn<Document> nameColumn = new TextColumn<Document>() { @Override public String getValue(final Document document) { return document.getName(); } }; documentsTable.addColumn(nameColumn, messages.name()); documentsTableScroller = new ScrollPanel(); documentsTableScroller.setSize("100%", "100%"); documentsTableScroller.setWidget(documentsTable); splitPanel.addNorth(documentsTableScroller, 200); //px // Detail detailContainer = new TogglePanel(); detailContainer.setSize("100%", "100%"); detailContainer.setSummary(messages.detailSummary()); splitPanel.add(detailContainer); }
From source file:org.restlet.example.book.restlet.ch09.client.Mail_BinderImpl.java
License:Open Source License
public com.google.gwt.user.client.ui.DockLayoutPanel createAndBindUi( final org.restlet.example.book.restlet.ch09.client.Mail owner) { org.restlet.example.book.restlet.ch09.client.Mail_BinderImpl_GenBundle clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay = (org.restlet.example.book.restlet.ch09.client.Mail_BinderImpl_GenBundle) GWT .create(org.restlet.example.book.restlet.ch09.client.Mail_BinderImpl_GenBundle.class); org.restlet.example.book.restlet.ch09.client.TopPanel topPanel = (org.restlet.example.book.restlet.ch09.client.TopPanel) GWT .create(org.restlet.example.book.restlet.ch09.client.TopPanel.class); org.restlet.example.book.restlet.ch09.client.Shortcuts shortcuts = (org.restlet.example.book.restlet.ch09.client.Shortcuts) GWT .create(org.restlet.example.book.restlet.ch09.client.Shortcuts.class); org.restlet.example.book.restlet.ch09.client.MailList mailList = (org.restlet.example.book.restlet.ch09.client.MailList) GWT .create(org.restlet.example.book.restlet.ch09.client.MailList.class); org.restlet.example.book.restlet.ch09.client.MailDetail mailDetail = (org.restlet.example.book.restlet.ch09.client.MailDetail) GWT .create(org.restlet.example.book.restlet.ch09.client.MailDetail.class); com.google.gwt.user.client.ui.SplitLayoutPanel f_SplitLayoutPanel2 = (com.google.gwt.user.client.ui.SplitLayoutPanel) GWT .create(com.google.gwt.user.client.ui.SplitLayoutPanel.class); com.google.gwt.user.client.ui.DockLayoutPanel f_DockLayoutPanel1 = new com.google.gwt.user.client.ui.DockLayoutPanel( com.google.gwt.dom.client.Style.Unit.EM); f_DockLayoutPanel1.addNorth(topPanel, 5); f_SplitLayoutPanel2.addWest(shortcuts, 192); f_SplitLayoutPanel2.addNorth(mailList, 200); f_SplitLayoutPanel2.add(mailDetail); f_DockLayoutPanel1.add(f_SplitLayoutPanel2); owner.mailDetail = mailDetail;//ww w. j a v a2 s.c o m owner.mailList = mailList; owner.shortcuts = shortcuts; owner.topPanel = topPanel; return f_DockLayoutPanel1; }
From source file:org.simpledbm.samples.forum.client.SimpleForum.java
License:Open Source License
/** * This is the entry point method./*from ww w . j a v a 2 s .com*/ */ public void onModuleLoad() { DockLayoutPanel outer = new DockLayoutPanel(Unit.EM); outer.addNorth(topPanel, 5); SplitLayoutPanel p = new SplitLayoutPanel(); p.addWest(forums, 192); p.addNorth(topics, 200); p.add(posts); outer.add(p); RootLayoutPanel root = RootLayoutPanel.get(); root.add(outer); requestProcessor.getForums(); }