List of usage examples for com.google.gwt.user.client Window setMargin
public static void setMargin(String size)
From source file:eu.gaetan.grigis.mail.client.gui.Mail.java
License:Apache License
public void displayWebMail(String mail) { // Inject global styles. GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected(); // Create the UI defined in Mail.ui.xml. DockLayoutPanel outer = binder.createAndBindUi(this); setMail(mail);// w ww . ja va 2 s .co m // Get rid of scrollbars, and clear out the window's built-in margin, // because we want to take advantage of the entire client area. Window.enableScrolling(false); Window.setMargin("0px"); // Special-case stuff to make topPanel overhang a bit. Element topElem = outer.getWidgetContainerElement(topPanel); topElem.getStyle().setZIndex(2); topElem.getStyle().setOverflow(Overflow.VISIBLE); // Listen for item selection, displaying the currently-selected item in // the detail area. mailList.setListener(new MailList.Listener() { public void onItemSelected(MailItem item) { mailDetail.setItem(item); } }); // Add the outer panel to the RootLayoutPanel, so that it will be // displayed. RootLayoutPanel root = RootLayoutPanel.get(); root.clear();//remove everything before root.add(outer); reloadMails(); }
From source file:info.vstour.dbdoc.client.DbDoc.java
License:Apache License
public void onModuleLoad() { Window.enableScrolling(false); Window.setMargin("0" + UNIT); final VerticalPanel bodyVPanel = new VerticalPanel(); bodyVPanel.setWidth("100%"); final HorizontalPanel bodyHPanel = new HorizontalPanel(); bodyHPanel.setSpacing(3);//from w ww . j a va 2s . co m final HTML doc = new HTML(); final ScrollPanel docWrapper = new ScrollPanel(doc); objectsTree = new DbObjectsPanel(docService); final MenuPanel menuPanel = new MenuPanel(docService, eventBus); menuPanel.ownerChangeHandlers().addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { objectsTree.clearDbObjects(); doc.setHTML(""); objectsTree.initDbObjects(Filter.get().getDbObjects()); } }); eventBus.addHandler(MenuUpdateEvent.TYPE, new MenuUpdateEvent.Handler() { @Override public void onMenuUpdate(MenuUpdateEvent event) { if (event.isNewConn()) { objectsTree.clear(); doc.setHTML(""); } else { objectsTree.clearDbObjects(); } objectsTree.initDbObjects(Filter.get().getDbObjects()); } }); objectsTree.getTreeOpenHandler().addOpenHandler(new OpenHandler<TreeItem>() { public void onOpen(OpenEvent<TreeItem> event) { final TreeItem treeItem = event.getTarget(); if (treeItem.getChild(0).getText().isEmpty()) { doc.setHTML(new Image(Resources.INSTANCE.processing()).toString()); docService.getTreeItems(Filter.get().getConnName(), Filter.get().getOwner(), treeItem.getText(), Filter.get().getFilter(), new AsyncCallback<List<String>>() { @Override public void onSuccess(List<String> items) { doc.setHTML(""); for (String item : items) { treeItem.addItem(item); } } @Override public void onFailure(Throwable caught) { doc.setHTML(""); } }); // Remove the temporary item when we finish loading treeItem.getChild(0).remove(); } } }); // Handler that gets documentation SelectionHandler<TreeItem> sHandler = new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { final TreeItem treeItem = event.getSelectedItem(); if (treeItem.getParentItem() != null) { final String parent = treeItem.getParentItem().getText(); final String child = treeItem.getText(); doc.setHTML(new Image(Resources.INSTANCE.processing()).toString()); docService.getDoc(Filter.get().getConnName(), Filter.get().getOwner(), parent, child, new AsyncCallback<String>() { public void onFailure(Throwable caught) { doc.setHTML(caught.toString()); } public void onSuccess(String result) { objectsTree.cacheDoc(Filter.get().getOwner() + "." + child, result); doc.setHTML(result); } }); } } }; objectsTree.getTreeSelectionHandler().addSelectionHandler(sHandler); objectsTree.getCacheTreeSelectionHandler().addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { doc.setHTML(objectsTree.getCachedDoc(event.getSelectedItem().getText())); } }); bodyHPanel.add(objectsTree); bodyHPanel.add(docWrapper); bodyVPanel.add(menuPanel); bodyVPanel.add(bodyHPanel); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { int height = event.getHeight(); int width = event.getWidth(); bodyVPanel.setHeight(height + UNIT); docWrapper.setHeight(height - docWrapper.getAbsoluteTop() + UNIT); docWrapper.setWidth(width - docWrapper.getAbsoluteLeft() + UNIT); objectsTree.setHeight(height); } }); RootPanel.get().add(bodyVPanel); objectsTree.setHeight(Window.getClientHeight()); docWrapper.setHeight(Window.getClientHeight() - docWrapper.getAbsoluteTop() + UNIT); docWrapper.setWidth(Window.getClientWidth() - docWrapper.getAbsoluteLeft() + UNIT); }
From source file:nz.org.winters.appspot.acrareporter.client.ViewErrorReports.java
License:Apache License
public void onModuleLoad() { DOM.removeChild(RootPanel.getBodyElement(), DOM.getElementById("loading")); LoginServiceAsync loginService = GWT.create(LoginService.class); Window.enableScrolling(false); Window.setMargin("0px"); // this little trick ensures that when using the debug instance locally that // the/*from w w w. j ava2 s .com*/ // login redirects work correctly.. String baseUrl = getBaseURL(); loginService.login(baseUrl, new AsyncCallback<LoginInfo>() { public void onFailure(Throwable error) { GWT.log("login onFailure: " + error.getMessage()); handleError(error); } public void onSuccess(LoginInfo result) { loginInfo = result; // GWT.log("login url = " + loginInfo.getLoginUrl()); if (loginInfo.isLoggedIn()) { boolean signup = false; if (Configuration.appUserMode == Configuration.UserMode.umMultipleSeperate) { Storage stockStore = Storage.getLocalStorageIfSupported(); if (stockStore != null) { if (stockStore.getItem("signup") != null) { signup = stockStore.getItem("signup").equals(Boolean.toString(true)); stockStore.removeItem("signup"); } } } if (signup) { loadSignup(); } else if (loginInfo.getAppUserShared() != null) { loadConsole(); } else { Window.alert("Not a valid user"); Window.Location.replace(loginInfo.getLogoutUrl()); } } else if (Configuration.appUserMode == Configuration.UserMode.umMultipleSeperate) { loadFrontPage(); } else { loadLogin(false); } } }); }
From source file:org.clevermore.monitor.client.AbstractEntryPoint.java
License:Apache License
/** * This is the entry point method.//w w w. jav a 2 s . c o m */ public void onModuleLoad() { Log.debug("Starting monitoring client."); Window.setMargin("0px"); RootPanel.get().clear(); RootPanel.get().add(loginWidget); refreshImg.getElement().setAttribute("state", "1"); alertImg.getElement().setAttribute("state", "1"); refreshImg.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String attribute = refreshImg.getElement().getAttribute("state"); if ("1".equals(attribute)) { refreshImg.getElement().setAttribute("state", "2"); refresh = false; refreshImg.setResource(resources.continueRefresh()); refreshImg.setTitle("Start Refresh"); for (IMonitoringWidget widget : widgets) { widget.setRefresh(false); } } else { refreshImg.getElement().setAttribute("state", "1"); refresh = true; refresh(); refreshImg.setTitle("Stop Refresh"); refreshImg.setResource(resources.stopRefresh()); } } }); alertImg.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String attribute = alertImg.getElement().getAttribute("state"); alertButtonClicked(attribute, 0); alertsService.stopAlerts("2".equals(attribute), new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { } @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } }); } }); mainHeader.setStyleName("mainHeader"); Style style = refProg.getElement().getStyle(); style.setWidth(20, Unit.PX); style.setFloat(Float.LEFT); mainHeader.add(refProg); refreshImg.addStyleName("settings"); refreshImg.setTitle("Stop Refresh"); mainHeader.add(refreshImg); alertImg.addStyleName("settings"); mainHeader.add(alertImg); Image settings = new Image(resources.settingsSmall()); settings.addStyleName("settings"); settings.setTitle("Settings"); settings.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { SettingsPopup sp = new SettingsPopup(service); sp.center(); } }); mainHeader.add(settings); Image logout = new Image(resources.logout()); logout.addStyleName("settings"); logout.setTitle("Logout"); logout.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { service.logout(new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { closeClient(); } @Override public void onFailure(Throwable caught) { closeClient(); } }); } }); mainHeader.add(logout); mainHeader.add(mainHeaderLabel); mainPanel.add(mainHeader); }
From source file:org.gss_project.gss.web.client.GSS.java
License:Open Source License
@Override public void onModuleLoad() { // Initialize the singleton before calling the constructors of the // various widgets that might call GSS.get(). singleton = this; parseUserCredentials();//from w ww . j a v a 2 s . c om topPanel = new TopPanel(GSS.images); topPanel.setWidth("100%"); messagePanel.setWidth("100%"); messagePanel.setVisible(false); search = new Search(images); searchStatus.add(search, DockPanel.WEST); searchStatus.add(userDetailsPanel, DockPanel.EAST); searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT); searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE); searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE); searchStatus.setWidth("100%"); fileList = new FileList(images); searchResults = new SearchResults(images); // Inner contains the various lists. inner.sinkEvents(Event.ONCONTEXTMENU); inner.setAnimationEnabled(true); inner.getTabBar().addStyleName("gss-MainTabBar"); inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom"); inner.add(fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true); inner.add(groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true); inner.add(searchResults, createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"), true); //inner.add(new CellTreeView(images), createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true); inner.setWidth("100%"); inner.selectTab(0); inner.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int tabIndex = event.getSelectedItem(); // TreeItem treeItem = GSS.get().getFolders().getCurrent(); switch (tabIndex) { case 0: // Files tab selected //fileList.clearSelectedRows(); fileList.updateCurrentlyShowingStats(); break; case 1: // Groups tab selected groups.updateCurrentlyShowingStats(); updateHistory("Groups"); break; case 2: // Search tab selected searchResults.clearSelectedRows(); searchResults.updateCurrentlyShowingStats(); updateHistory("Search"); break; } } }); // If the application starts with no history token, redirect to a new "Files" state String initToken = History.getToken(); if (initToken.length() == 0) History.newItem("Files"); // Add history listener to handle any history events History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String tokenInput = event.getValue(); String historyToken = handleSpecialFolderNames(tokenInput); try { if (historyToken.equals("Search")) inner.selectTab(2); else if (historyToken.equals("Groups")) inner.selectTab(1); else if (historyToken.equals("Files") || historyToken.length() == 0) inner.selectTab(0); else { /*TODO: CELLTREE PopupTree popupTree = GSS.get().getFolders().getPopupTree(); TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken); SelectionEvent.fire(popupTree, treeObj); */ } } catch (IndexOutOfBoundsException e) { inner.selectTab(0); } } }); // Add the left and right panels to the split panel. splitPanel.setLeftWidget(treeView); splitPanel.setRightWidget(inner); splitPanel.setSplitPosition("25%"); splitPanel.setSize("100%", "100%"); splitPanel.addStyleName("gss-splitPanel"); // Create a dock panel that will contain the menu bar at the top, // the shortcuts to the left, the status bar at the bottom and the // right panel taking the rest. VerticalPanel outer = new VerticalPanel(); outer.add(topPanel); outer.add(searchStatus); outer.add(messagePanel); outer.add(splitPanel); outer.add(statusPanel); outer.setWidth("100%"); outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER); outer.setSpacing(4); // Hook the window resize event, so that we can adjust the UI. Window.addResizeHandler(this); // Clear out the window's built-in margin, because we want to take // advantage of the entire client area. Window.setMargin("0px"); // Finally, add the outer panel to the RootPanel, so that it will be // displayed. RootPanel.get().add(outer); // Call the window resized handler to get the initial sizes setup. Doing // this in a deferred command causes it to occur after all widgets' // sizes have been computed by the browser. DeferredCommand.addCommand(new Command() { @Override public void execute() { onWindowResized(Window.getClientHeight()); } }); }
From source file:org.nsesa.editor.gwt.editor.client.Editor.java
License:EUPL
/** * Perform the basic layout calls after the initialization. * In this case, we simply remove the margin, but this can be overridden by subclasses. *///from w w w . j a v a 2 s . c o m protected void doLayout() { // remove the margin Window.setMargin("0px"); }
From source file:org.opennms.features.poller.remote.gwt.client.DefaultApplicationView.java
License:Open Source License
private void setupWindow() { Window.setTitle("OpenNMS - Remote Monitor"); Window.enableScrolling(false); Window.setMargin("0px"); Window.addResizeHandler(this); }
From source file:org.openxdata.designer.client.FormDesignerEntryPoint.java
/** * Sets up the form designer./*from ww w .jav a2 s. c om*/ */ public void onModuleLoadDeffered() { try { RootPanel rootPanel = RootPanel.get("formtoolsdesigner"); if (rootPanel == null) { FormUtil.dlg.hide(); return; } FormUtil.setupUncaughtExceptionHandler(); FormDesignerUtil.setDesignerTitle(); String s = FormUtil.getDivValue("allowBindEdit"); if (s != null && (s.equals("0") || s.equals("false"))) Context.setAllowBindEdit(false); FormUtil.retrieveUserDivParameters(); Context.setOfflineModeStatus(); // Get rid of scrollbars, and clear out the window's built-in margin, // because we want to take advantage of the entire client area. Window.enableScrolling(false); Window.setMargin("0" + OpenXdataConstants.UNITS); // Different themes use different background colors for the body // element, but IE only changes the background of the visible content // on the page instead of changing the background color of the entire // page. By changing the display style on the body element, we force // IE to redraw the background correctly. RootPanel.getBodyElement().getStyle().setProperty("display", "none"); RootPanel.getBodyElement().getStyle().setProperty("display", ""); loadLocales(); designer = new FormDesignerWidget(true, true, true); // Finally, add the designer widget to the RootPanel, so that it will be displayed. rootPanel.add(designer); updateTabs(); //If a form id has been specified in the html host page, load the form //with that id in the designer. s = FormUtil.getFormId(); if (s != null) designer.loadForm(Integer.parseInt(s)); // Call the window resized handler to get the initial sizes setup. Doing // this in a deferred command causes it to occur after all widgets' sizes // have been computed by the browser. Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { designer.onWindowResized(Window.getClientWidth(), Window.getClientHeight()); String id = FormUtil.getFormId(); if (id == null || id.equals("-1")) FormUtil.dlg.hide(); } }); // Hook the window resize event, so that we can adjust the UI. Window.addResizeHandler(this); } catch (Exception ex) { FormUtil.displayException(ex); } }
From source file:org.otalo.ao.client.Messages.java
License:Apache License
public void loadRest() { topPanel = new TopPanel(line, moderator, images); topPanel.setWidth("100%"); fora = new Fora(images); messageList = new MessageList(images); messageList.setWidth("100%"); // Create the right panel, containing the email list & details. rightPanel.add(messageList);//from w w w .j av a 2 s .c o m if (!canManage()) { searchResultMsgList = new SearchResultMsgList(); searchResultMsgList.setWidth("100%"); searchResultMsgList.setVisible(false); rightPanel.add(searchResultMsgList); } if (line.bcastingAllowed()) { broadcastIface = new BroadcastInterface(images); bcasts = new Broadcasts(images); rightPanel.add(broadcastIface); } if (line.hasSMSConfig()) { smsList = new SMSList(images); smsList.setWidth("100%"); smsIface = new SMSInterface(images); smss = new SMSs(images); rightPanel.add(smsIface); rightPanel.add(smsList); } shortcuts = new Shortcuts(images, fora, bcasts, smss, search); shortcuts.setWidth("100%"); rightPanel.setWidth("100%"); if (canManage()) { groupsIface = new ManageGroups(images); rightPanel.add(groupsIface); //showing help if its stream String helpHtmlStr = "<div id='help_tab' class='help-tab-right'>" + "<a href='http://awaaz.de/blog/2013/09/awaaz-de-streams-start-up-guide-and-glossary/' target=_blank id='help-link'>" + "<span>H</span>" + "<span>E</span>" + "<span>L</span>" + "<span>P</span></a></div>"; HTML helpHtml = new HTML(helpHtmlStr); RootPanel.get().add(helpHtml); } else { messageDetail = new MessageDetail(); messageDetail.setWidth("100%"); rightPanel.add(messageDetail); search = new SearchFilterPanel(searchResultMsgList); searchShortCut = new Shortcuts(images, null, null, null, search); searchShortCut.setWidth("100%"); searchShortCut.setVisible(false); } displayForumPanel(); // creating a loader loaderImage = new HTML(AbstractImagePrototype.create(images.loader()).getHTML()); loaderImage.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loaderImage.addStyleName("loader-img"); showLoader(false); rightPanel.add(loaderImage); // Create a dock panel that will contain the menu bar at the top, // the shortcuts to the left, and the mail list & details taking the rest. DockPanel outer = new DockPanel(); //DockLayoutPanel outer = new DockLayoutPanel(Unit.PCT); outer.add(topPanel, DockPanel.NORTH); outer.add(shortcuts, DockPanel.WEST); if (!canManage()) { if (searchShortCut.isVisible()) searchShortCut.setVisible(false); outer.add(searchShortCut, DockPanel.WEST); } //outer.addWest(shortcuts, 100); outer.add(rightPanel, DockPanel.CENTER); //outer.add(rightPanel); outer.setWidth("100%"); outer.setSpacing(4); outer.setCellWidth(rightPanel, "100%"); // Hook the window resize event, so that we can adjust the UI. Window.addResizeHandler(this); // Get rid of scrollbars, and clear out the window's built-in margin, // because we want to take advantage of the entire client area. //Window.enableScrolling(false); Window.setMargin("0px"); // Finally, add the outer panel to the RootPanel, so that it will be // displayed. RootPanel.get().add(outer); // Call the window resized handler to get the initial sizes setup. Doing // this in a deferred command causes it to occur after all widgets' sizes // have been computed by the browser. Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { public void execute() { onWindowResized(Window.getClientWidth(), Window.getClientHeight()); } }); onWindowResized(Window.getClientWidth(), Window.getClientHeight()); }
From source file:org.rstudio.studio.client.application.ui.ApplicationWindow.java
License:Open Source License
@Inject public ApplicationWindow(ApplicationHeader applicationHeader, GlobalDisplay globalDisplay, Provider<CodeSearch> pCodeSearch) { globalDisplay_ = globalDisplay;//from ww w. j ava 2 s . c o m pCodeSearch_ = pCodeSearch; // occupy full client area of the window Window.enableScrolling(false); Window.setMargin("0px"); // app ui contained within a vertical panel applicationPanel_ = new LayoutPanel(); // header bar applicationHeader_ = applicationHeader; Widget applicationHeaderWidget = applicationHeader_.asWidget(); applicationHeaderWidget.setWidth("100%"); applicationPanel_.add(applicationHeader_); updateHeaderTopBottom(); applicationHeaderWidget.setVisible(false); // main view container initWidget(applicationPanel_); }