List of usage examples for com.google.gwt.user.client Window addWindowClosingHandler
public static HandlerRegistration addWindowClosingHandler(final ClosingHandler handler)
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
private void initializeUi() { BlocklyPanel.initUi();//from ww w .j a v a 2 s . c om rpcStatusPopup = new RpcStatusPopup(); // Register services with RPC status popup rpcStatusPopup.register((ExtendedServiceProxy<?>) helpService); rpcStatusPopup.register((ExtendedServiceProxy<?>) projectService); rpcStatusPopup.register((ExtendedServiceProxy<?>) galleryService); rpcStatusPopup.register((ExtendedServiceProxy<?>) userInfoService); Window.setTitle(MESSAGES.titleYoungAndroid()); Window.enableScrolling(true); topPanel = new TopPanel(); statusPanel = new StatusPanel(); DockPanel mainPanel = new DockPanel(); mainPanel.add(topPanel, DockPanel.NORTH); // Create tab panel for subsequent tabs deckPanel = new DeckPanel() { @Override public final void onBrowserEvent(Event event) { switch (event.getTypeInt()) { case Event.ONCONTEXTMENU: event.preventDefault(); break; } } }; deckPanel.setAnimationEnabled(true); deckPanel.sinkEvents(Event.ONCONTEXTMENU); deckPanel.setStyleName("ode-DeckPanel"); // Projects tab VerticalPanel pVertPanel = new VerticalPanel(); pVertPanel.setWidth("100%"); pVertPanel.setSpacing(0); HorizontalPanel projectListPanel = new HorizontalPanel(); projectListPanel.setWidth("100%"); projectToolbar = new ProjectToolbar(); projectListPanel.add(ProjectListBox.getProjectListBox()); pVertPanel.add(projectToolbar); pVertPanel.add(projectListPanel); projectsTabIndex = deckPanel.getWidgetCount(); deckPanel.add(pVertPanel); // Design tab VerticalPanel dVertPanel = new VerticalPanel(); dVertPanel.setWidth("100%"); dVertPanel.setHeight("100%"); // Add the Code Navigation arrow // switchToBlocksButton = new VerticalPanel(); // switchToBlocksButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); // switchToBlocksButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); // switchToBlocksButton.setStyleName("ode-NavArrow"); // switchToBlocksButton.add(new Image(RIGHT_ARROW_IMAGE_URL)); // switchToBlocksButton.setWidth("25px"); // switchToBlocksButton.setHeight("100%"); // Add the Code Navigation arrow // switchToDesignerButton = new VerticalPanel(); // switchToDesignerButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); // switchToDesignerButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); // switchToDesignerButton.setStyleName("ode-NavArrow"); // switchToDesignerButton.add(new Image(LEFT_ARROW_IMAGE_URL)); // switchToDesignerButton.setWidth("25px"); // switchToDesignerButton.setHeight("100%"); designToolbar = new DesignToolbar(); dVertPanel.add(designToolbar); workColumns = new HorizontalPanel(); workColumns.setWidth("100%"); //workColumns.add(switchToDesignerButton); Box palletebox = PaletteBox.getPaletteBox(); palletebox.setWidth("222px"); workColumns.add(palletebox); Box viewerbox = ViewerBox.getViewerBox(); workColumns.add(viewerbox); workColumns.setCellWidth(viewerbox, "97%"); workColumns.setCellHeight(viewerbox, "97%"); structureAndAssets = new VerticalPanel(); structureAndAssets.setVerticalAlignment(VerticalPanel.ALIGN_TOP); // Only one of the SourceStructureBox and the BlockSelectorBox is visible // at any given time, according to whether we are showing the form editor // or the blocks editor. They share the same screen real estate. structureAndAssets.add(SourceStructureBox.getSourceStructureBox()); structureAndAssets.add(BlockSelectorBox.getBlockSelectorBox()); // initially not visible structureAndAssets.add(AssetListBox.getAssetListBox()); workColumns.add(structureAndAssets); Box propertiesbox = PropertiesBox.getPropertiesBox(); propertiesbox.setWidth("222px"); workColumns.add(propertiesbox); //switchToBlocksButton.setHeight("650px"); //workColumns.add(switchToBlocksButton); dVertPanel.add(workColumns); designTabIndex = deckPanel.getWidgetCount(); deckPanel.add(dVertPanel); // Gallery list tab VerticalPanel gVertPanel = new VerticalPanel(); gVertPanel.setWidth("100%"); gVertPanel.setSpacing(0); galleryListToolbar = new GalleryToolbar(); gVertPanel.add(galleryListToolbar); HorizontalPanel appListPanel = new HorizontalPanel(); appListPanel.setWidth("100%"); appListPanel.add(GalleryListBox.getGalleryListBox()); gVertPanel.add(appListPanel); galleryTabIndex = deckPanel.getWidgetCount(); deckPanel.add(gVertPanel); // Gallery app tab VerticalPanel aVertPanel = new VerticalPanel(); aVertPanel.setWidth("100%"); aVertPanel.setSpacing(0); galleryPageToolbar = new GalleryToolbar(); aVertPanel.add(galleryPageToolbar); HorizontalPanel appPanel = new HorizontalPanel(); appPanel.setWidth("100%"); appPanel.add(GalleryAppBox.getGalleryAppBox()); aVertPanel.add(appPanel); galleryAppTabIndex = deckPanel.getWidgetCount(); deckPanel.add(aVertPanel); // User Admin Panel VerticalPanel uaVertPanel = new VerticalPanel(); uaVertPanel.setWidth("100%"); uaVertPanel.setSpacing(0); HorizontalPanel adminUserListPanel = new HorizontalPanel(); adminUserListPanel.setWidth("100%"); adminUserListPanel.add(AdminUserListBox.getAdminUserListBox()); uaVertPanel.add(adminUserListPanel); userAdminTabIndex = deckPanel.getWidgetCount(); deckPanel.add(uaVertPanel); // KM: DEBUGGING BEGIN // User profile tab VerticalPanel uVertPanel = new VerticalPanel(); uVertPanel.setWidth("100%"); uVertPanel.setSpacing(0); HorizontalPanel userProfilePanel = new HorizontalPanel(); userProfilePanel.setWidth("100%"); userProfilePanel.add(ProfileBox.getUserProfileBox()); uVertPanel.add(userProfilePanel); userProfileTabIndex = deckPanel.getWidgetCount(); deckPanel.add(uVertPanel); // KM: DEBUGGING END // Private User Profile TabPanel VerticalPanel ppVertPanel = new VerticalPanel(); ppVertPanel.setWidth("100%"); ppVertPanel.setSpacing(0); HorizontalPanel privateUserProfileTabPanel = new HorizontalPanel(); privateUserProfileTabPanel.setWidth("100%"); privateUserProfileTabPanel.add(PrivateUserProfileTabPanel.getPrivateUserProfileTabPanel()); ppVertPanel.add(privateUserProfileTabPanel); privateUserProfileIndex = deckPanel.getWidgetCount(); deckPanel.add(ppVertPanel); // Moderation Page tab VerticalPanel mPVertPanel = new VerticalPanel(); mPVertPanel.setWidth("100%"); mPVertPanel.setSpacing(0); HorizontalPanel moderationPagePanel = new HorizontalPanel(); moderationPagePanel.setWidth("100%"); moderationPagePanel.add(ModerationPageBox.getModerationPageBox()); mPVertPanel.add(moderationPagePanel); moderationPageTabIndex = deckPanel.getWidgetCount(); deckPanel.add(mPVertPanel); // Debugging tab if (AppInventorFeatures.hasDebuggingView()) { Button dismissButton = new Button(MESSAGES.dismissButton()); dismissButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (currentView == DESIGNER) switchToDesignView(); else switchToProjectsView(); } }); ColumnLayout defaultLayout = new ColumnLayout("Default"); Column column = defaultLayout.addColumn(100); column.add(MessagesOutputBox.class, 300, false); column.add(OdeLogBox.class, 300, false); final WorkAreaPanel debuggingTab = new WorkAreaPanel(new OdeBoxRegistry(), defaultLayout); debuggingTab.add(dismissButton); debuggingTabIndex = deckPanel.getWidgetCount(); deckPanel.add(debuggingTab); // Hook the window resize event, so that we can adjust the UI. Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { resizeWorkArea(debuggingTab); } }); // 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() { resizeWorkArea(debuggingTab); } }); resizeWorkArea(debuggingTab); } // We do not select the designer tab here because at this point there is no current project. // Instead, we select the projects tab. If the user has a previously opened project, we will // open it and switch to the designer after the user settings are loaded. // Remember, the user may not have any projects at all yet. // Or, the user may have deleted their previously opened project. // ***** THE DESIGNER TAB DOES NOT DISPLAY CORRECTLY IF THERE IS NO CURRENT PROJECT. ***** deckPanel.showWidget(projectsTabIndex); mainPanel.add(deckPanel, DockPanel.CENTER); mainPanel.setCellHeight(deckPanel, "100%"); mainPanel.setCellWidth(deckPanel, "100%"); // mainPanel.add(switchToDesignerButton, DockPanel.WEST); // mainPanel.add(switchToBlocksButton, DockPanel.EAST); //Commenting out for now to gain more space for the blocks editor mainPanel.add(statusPanel, DockPanel.SOUTH); mainPanel.setSize("100%", "100%"); RootPanel.get().add(mainPanel); // Add a handler to the RootPanel to keep track of Google Chrome Pinch Zooming and // handle relevant bugs. Chrome maps a Pinch Zoom to a MouseWheelEvent with the // control key pressed. RootPanel.get().addDomHandler(new MouseWheelHandler() { @Override public void onMouseWheel(MouseWheelEvent event) { if (event.isControlKeyDown()) { // Trip the appropriate flag in PZAwarePositionCallback when the page // is Pinch Zoomed. Note that this flag does not need to be removed when // the browser is un-zoomed because the patched function for determining // absolute position works in all circumstances. PZAwarePositionCallback.setPinchZoomed(true); } } }, MouseWheelEvent.getType()); // There is no sure-fire way of preventing people from accidentally navigating away from ODE // (e.g. by hitting the Backspace key). What we do need though is to make sure that people will // not lose any work because of this. We hook into the window closing event to detect the // situation. Window.addWindowClosingHandler(new Window.ClosingHandler() { @Override public void onWindowClosing(Window.ClosingEvent event) { onClosing(); } }); setupMotd(); }
From source file:com.google.gerrit.client.editor.EditScreen.java
License:Apache License
@Override public void onShowView() { super.onShowView(); Window.enableScrolling(false); JumpKeys.enable(false);//w w w.j a v a2 s . co m if (prefs.hideTopMenu()) { Gerrit.setHeaderVisible(false); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { adjustHeight(); } }); closeHandler = Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { if (!cmEdit.isClean(generation)) { event.setMessage(EditConstants.I.closeUnsavedChanges()); } } }); generation = cmEdit.changeGeneration(true); setClean(true); cmEdit.on(new ChangesHandler() { @Override public void handle(CodeMirror cm) { setClean(cm.isClean(generation)); } }); adjustHeight(); cmEdit.on("cursorActivity", updateCursorPosition()); setShowTabs(prefs.showTabs()); setLineLength(prefs.lineLength()); cmEdit.refresh(); cmEdit.focus(); if (startLine > 0) { cmEdit.scrollToLine(startLine); } updateActiveLine(); editPrefsAction = new EditPreferencesAction(this, prefs); }
From source file:com.google.gwt.sample.dynatablemvp.client.BrowserManager.java
@Override public void addWindowClosingHandler(ClosingHandler handler) { Window.addWindowClosingHandler(handler); }
From source file:com.google.gwt.sample.dynatablerf.client.FavoritesManager.java
License:Apache License
public FavoritesManager(final RequestFactory requestFactory) { String cookie = Cookies.getCookie(COOKIE_NAME); if (cookie != null) { try {/*from ww w . ja v a 2s . c om*/ for (String fragment : cookie.split(",")) { if (fragment.length() == 0) { continue; } EntityProxyId<PersonProxy> id = requestFactory.getProxyId(fragment); if (id != null) { favoriteIds.add(id); } } } catch (NumberFormatException e) { // Not a big deal, start up without favorites favoriteIds.clear(); } } Window.addWindowClosingHandler(new ClosingHandler() { public void onWindowClosing(ClosingEvent event) { StringBuilder sb = new StringBuilder(); for (EntityProxyId<PersonProxy> id : favoriteIds) { sb.append(requestFactory.getHistoryToken(id)).append(","); } Cookies.setCookie(COOKIE_NAME, sb.toString()); } }); }
From source file:com.gwos.client.ui.desktop.GwosDesktop.java
License:Apache License
private void setBrowserClosingHandler() { Window.addWindowClosingHandler(new Window.ClosingHandler() { @Override/* w w w .j a v a2s .co m*/ public void onWindowClosing(ClosingEvent event) { if (SessionManager.getInstance().isUserLogged() == false) { return; } // Request confirmation to the user when he close his browser event.setMessage("Changes on your session will be lost. Are you sure ?"); } }); Window.addCloseHandler(new CloseHandler<Window>() { @Override public void onClose(CloseEvent<Window> event) { if (SessionManager.getInstance().isUserLogged() == false) { return; } // Before the browser is closed, save the session ! SessionManager.getInstance().logout(); } }); }
From source file:com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.java
License:Apache License
@Override public void setOnLeaveConfirmation(String question) { if (question == null && onLeaveQuestion == null) { return;/*from ww w . java 2 s .co m*/ } if (question != null && onLeaveQuestion == null) { windowClosingHandlerRegistration = Window.addWindowClosingHandler(this); } if (question == null && onLeaveQuestion != null) { windowClosingHandlerRegistration.removeHandler(); } onLeaveQuestion = question; }
From source file:com.ikon.frontend.client.Main.java
License:Open Source License
/** * onModuleLoad2// w ww. jav a 2 s.c om */ public void onModuleLoad2() { // Initialize workspace properties workspaceUserProperties = new WorkspaceUserProperties(); // Initialize user home userHome = new GWTUserConfig(); // Initialize panels mainPanel = new ExtendedDockPanel(); // Loading popup startUpPopup = new StartUpPopup(); startUpPopup.setWidth("100px"); startUpPopup.setHeight("50px"); startUpPopup.setStyleName("okm-Popup"); startUpPopup.addStyleName("okm-DisableSelect"); // Initialize general panels fileUpload = new FileUploadPopup(); fileUpload.setStyleName("okm-Popup"); errorPopup = new ErrorPopup(false); errorPopup.setStyleName("okm-Popup-Error"); errorPopup.setWidth("100px"); errorPopup.setHeight("50px"); errorPopupServer = new ErrorPopup(); errorPopupServer.setStyleName("okm-Popup-Error"); errorPopupServer.setWidth("100px"); errorPopupServer.setHeight("50px"); errorPopupLogout = new ErrorPopup(true); errorPopupLogout.setStyleName("okm-Popup-Error"); errorPopupLogout.setWidth("100px"); errorPopupLogout.setHeight("50px"); msgPopup = new MsgPopup(); msgPopup.setStyleName("okm-Popup"); msgPopup.setWidth("300px"); msgPopup.setHeight("205px"); externalURLPopup = new ExternalURLPopup(); externalURLPopup.setStyleName("okm-Popup"); logoutPopup = new LogoutPopup(); logoutPopup.setWidth("250"); logoutPopup.setHeight("110"); logoutPopup.setStyleName("okm-Popup"); logoutPopup.addStyleName("okm-DisableSelect"); securityPopup = new SecurityPopup(); securityPopup.setWidth("600"); securityPopup.setHeight("400"); securityPopup.setStyleName("okm-Popup"); securityPopup.addStyleName("okm-DisableSelect"); aboutPopup = new AboutPopup(); aboutPopup.setWidth("300px"); aboutPopup.setHeight("220px"); aboutPopup.setStyleName("okm-Popup"); aboutPopup.addStyleName("okm-DisableSelect"); userPopup = new UserPopup(); userPopup.setWidth("470px"); userPopup.setHeight("220px"); userPopup.setStyleName("okm-Popup"); // userPopup.addStyleName("okm-DisableSelect"); confirmPopup = new ConfirmPopup(); confirmPopup.setWidth("300px"); confirmPopup.setHeight("125px"); confirmPopup.setStyleName("okm-Popup"); confirmPopup.addStyleName("okm-DisableSelect"); dragable = new Dragable(); propertyGroupPopup = new PropertyGroupPopup(); propertyGroupPopup.setWidth("300px"); propertyGroupPopup.setHeight("50px"); propertyGroupPopup.setStyleName("okm-Popup"); propertyGroupPopup.addStyleName("okm-DisableSelect"); workflowPopup = new WorkflowPopup(); workflowPopup.setWidth("300px"); workflowPopup.setHeight("100px"); workflowPopup.setStyleName("okm-Popup"); workflowPopup.addStyleName("okm-DisableSelect"); notifyPopup = new NotifyPopup(); notifyPopup.setWidth("400px"); notifyPopup.setHeight("100px"); notifyPopup.setStyleName("okm-Popup"); debugConsolePopup = new DebugConsolePopup(); debugConsolePopup.setWidth("300px"); debugConsolePopup.setHeight("100px"); debugConsolePopup.setStyleName("okm-Popup"); debugConsolePopup.addStyleName("okm-DisableSelect"); findFolderSelectPopup = new FindFolderSelectPopup(); findFolderSelectPopup.setWidth("700px"); findFolderSelectPopup.setHeight("390px"); findFolderSelectPopup.setStyleName("okm-Popup"); findFolderSelectPopup.addStyleName("okm-DisableSelect"); findDocumentSelectPopup = new FindDocumentSelectPopup(); findDocumentSelectPopup.setWidth("700px"); findDocumentSelectPopup.setHeight("390px"); findDocumentSelectPopup.setStyleName("okm-Popup"); findDocumentSelectPopup.addStyleName("okm-DisableSelect"); wizardPopup = new WizardPopup(); wizardPopup.setWidth("400px"); wizardPopup.setHeight("40px"); wizardPopup.setStyleName("okm-Popup"); wizardPopup.addStyleName("okm-DisableSelect"); reportPopup = new ReportPopup(); reportPopup.setWidth("250px"); reportPopup.setHeight("40px"); reportPopup.setStyleName("okm-Popup"); reportPopup.addStyleName("okm-DisableSelect"); templateWizardPopup = new TemplateWizardPopup(); templateWizardPopup.setWidth("400px"); templateWizardPopup.setHeight("40px"); templateWizardPopup.setStyleName("okm-Popup"); templateWizardPopup.addStyleName("okm-DisableSelect"); onlineUsersPopup = new OnlineUsersPopup(); onlineUsersPopup.setWidth("250px"); onlineUsersPopup.setHeight("350px"); onlineUsersPopup.setStyleName("okm-Popup"); onlineUsersPopup.addStyleName("okm-DisableSelect"); testPopup = new TestPopup(); testPopup.setWidth("600px"); testPopup.setHeight("500px"); testPopup.setStyleName("okm-Popup"); notesPopup = new NotesPopup(); notesPopup.setWidth("470px"); notesPopup.setHeight("220px"); notesPopup.setStyleName("okm-Popup"); categoriesPopup = new CategoriesPopup(); categoriesPopup.setWidth("470px"); categoriesPopup.setHeight("220px"); categoriesPopup.setStyleName("okm-Popup"); keywordsPopup = new KeywordsPopup(); keywordsPopup.setWidth("470px"); keywordsPopup.setHeight("100px"); keywordsPopup.setStyleName("okm-Popup"); templatePopup = new TemplatePopup(); templatePopup.setWidth("350px"); templatePopup.setHeight("75px"); templatePopup.setStyleName("okm-Popup"); conversionStatus = new ConversionStatus(); omrPopup = new OmrPopup(); omrPopup.setWidth("150px"); omrPopup.setHeight("75px"); omrPopup.setStyleName("okm-Popup"); registerPFXPopup = new RegisterPFXPopup(); registerPFXPopup.setStyleName("okm-Popup"); previewPopup = new PreviewPopup(); previewPopup.setStyleName("okm-Popup"); retentionPolicyPopup = new RetentionPolicyPopup(); stampPopup = new StampPopup(); // Get grid 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"); //RootPanel.get().add(new Test()); //RootPanel.get().add(new Test2()); //RootPanel.get().add(new Test3()); RootPanel.get().add(mainPanel); RootPanel.get().add(dragable); Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { Main.get().windowClosing = true; startUp.keepAlive.cancel(); if (Main.get().mainPanel.bottomPanel.userInfo.isConnectedToChat()) { Main.get().mainPanel.bottomPanel.userInfo.logoutChat(); } } }); // Sets the active folder tree, it'll be used to store the active folder // every time switching stack panel activeFolderTree = mainPanel.desktop.navigator.taxonomyTree; // Initialize on startup when all objects are created sequentially startUpPopup.show(); startUp = new StartUp(); startUp.init(); // Auto-publish the method into JS when the GWT module loads. initJavaScriptApi(); mainPanel.topPanel.toolBar.initJavaScriptApi(mainPanel.topPanel.toolBar); fileUpload.initJavaScriptApi(); new NavigatorComunicator().initJavaScriptApi(); // Initialize commonUI public js api CommonUI commonUI = new CommonUI(); commonUI.initJavaScriptApi(commonUI); }
From source file:com.openkm.frontend.client.Main.java
License:Open Source License
/** * onModuleLoad2/*from w w w . ja v a2 s . c o m*/ */ public void onModuleLoad2() { // Initialize workspace properties workspaceUserProperties = new WorkspaceUserProperties(); // Initialize user home userHome = new GWTUserConfig(); // Initialize panels mainPanel = new ExtendedDockPanel(); // Loading popup startUpPopup = new StartUpPopup(); startUpPopup.setWidth("300px"); startUpPopup.setHeight("220px"); startUpPopup.setStyleName("okm-Popup"); startUpPopup.addStyleName("okm-DisableSelect"); // Initialize general panels fileUpload = new FileUploadPopup(); fileUpload.setStyleName("okm-Popup"); errorPopup = new ErrorPopup(false); errorPopup.setStyleName("okm-Popup-Error"); errorPopup.setWidth("380px"); errorPopup.setHeight("205px"); errorPopupLogout = new ErrorPopup(true); errorPopupLogout.setStyleName("okm-Popup-Error"); errorPopupLogout.setWidth("300px"); errorPopupLogout.setHeight("205px"); msgPopup = new MsgPopup(); msgPopup.setStyleName("okm-Popup"); msgPopup.setWidth("550px"); msgPopup.setHeight("290px"); externalURLPopup = new ExternalURLPopup(); externalURLPopup.setStyleName("okm-Popup"); logoutPopup = new LogoutPopup(); logoutPopup.setWidth("250"); logoutPopup.setHeight("110"); logoutPopup.setStyleName("okm-Popup"); logoutPopup.addStyleName("okm-DisableSelect"); securityPopup = new SecurityPopup(); securityPopup.setWidth("600"); securityPopup.setHeight("400"); securityPopup.setStyleName("okm-Popup"); securityPopup.addStyleName("okm-DisableSelect"); aboutPopup = new AboutPopup(); aboutPopup.setWidth("300px"); aboutPopup.setHeight("220px"); aboutPopup.setStyleName("okm-Popup"); aboutPopup.addStyleName("okm-DisableSelect"); userPopup = new UserPopup(); userPopup.setWidth("470px"); userPopup.setHeight("220px"); userPopup.setStyleName("okm-Popup"); // userPopup.addStyleName("okm-DisableSelect"); confirmPopup = new ConfirmPopup(); confirmPopup.setWidth("300px"); confirmPopup.setHeight("125px"); confirmPopup.setStyleName("okm-Popup"); confirmPopup.addStyleName("okm-DisableSelect"); dragable = new Dragable(); propertyGroupPopup = new PropertyGroupPopup(); propertyGroupPopup.setWidth("300px"); propertyGroupPopup.setHeight("50px"); propertyGroupPopup.setStyleName("okm-Popup"); propertyGroupPopup.addStyleName("okm-DisableSelect"); workflowPopup = new WorkflowPopup(); workflowPopup.setWidth("300px"); workflowPopup.setHeight("100px"); workflowPopup.setStyleName("okm-Popup"); workflowPopup.addStyleName("okm-DisableSelect"); notifyPopup = new NotifyPopup(); notifyPopup.setWidth("400px"); notifyPopup.setHeight("100px"); notifyPopup.setStyleName("okm-Popup"); debugConsolePopup = new DebugConsolePopup(); debugConsolePopup.setWidth("300px"); debugConsolePopup.setHeight("100px"); debugConsolePopup.setStyleName("okm-Popup"); debugConsolePopup.addStyleName("okm-DisableSelect"); findFolderSelectPopup = new FindFolderSelectPopup(); findFolderSelectPopup.setWidth("700px"); findFolderSelectPopup.setHeight("390px"); findFolderSelectPopup.setStyleName("okm-Popup"); findFolderSelectPopup.addStyleName("okm-DisableSelect"); findDocumentSelectPopup = new FindDocumentSelectPopup(); findDocumentSelectPopup.setWidth("700px"); findDocumentSelectPopup.setHeight("390px"); findDocumentSelectPopup.setStyleName("okm-Popup"); findDocumentSelectPopup.addStyleName("okm-DisableSelect"); findSimilarDocumentSelectPopup = new FindSimilarDocumentSelectPopup(); findSimilarDocumentSelectPopup.setWidth("700px"); findSimilarDocumentSelectPopup.setHeight("390px"); findSimilarDocumentSelectPopup.setStyleName("okm-Popup"); findSimilarDocumentSelectPopup.addStyleName("okm-DisableSelect"); wizardPopup = new WizardPopup(); wizardPopup.setWidth("400px"); wizardPopup.setHeight("40px"); wizardPopup.setStyleName("okm-Popup"); wizardPopup.addStyleName("okm-DisableSelect"); reportPopup = new ReportPopup(); reportPopup.setWidth("250px"); reportPopup.setHeight("40px"); reportPopup.setStyleName("okm-Popup"); reportPopup.addStyleName("okm-DisableSelect"); templateWizardPopup = new TemplateWizardPopup(); templateWizardPopup.setWidth("400px"); templateWizardPopup.setHeight("40px"); templateWizardPopup.setStyleName("okm-Popup"); templateWizardPopup.addStyleName("okm-DisableSelect"); onlineUsersPopup = new OnlineUsersPopup(); onlineUsersPopup.setWidth("250px"); onlineUsersPopup.setHeight("350px"); onlineUsersPopup.setStyleName("okm-Popup"); onlineUsersPopup.addStyleName("okm-DisableSelect"); testPopup = new TestPopup(); testPopup.setWidth("600px"); testPopup.setHeight("500px"); testPopup.setStyleName("okm-Popup"); notesPopup = new NotesPopup(); notesPopup.setWidth("470px"); notesPopup.setHeight("220px"); notesPopup.setStyleName("okm-Popup"); categoriesPopup = new CategoriesPopup(); categoriesPopup.setWidth("470px"); categoriesPopup.setHeight("220px"); categoriesPopup.setStyleName("okm-Popup"); keywordsPopup = new KeywordsPopup(); keywordsPopup.setWidth("470px"); keywordsPopup.setHeight("100px"); keywordsPopup.setStyleName("okm-Popup"); pdfMergePopup = new PdfMergePopup(); pdfMergePopup.setWidth("400px"); pdfMergePopup.setHeight("75px"); pdfMergePopup.setStyleName("okm-Popup"); templatePopup = new TemplatePopup(); templatePopup.setWidth("350px"); templatePopup.setHeight("75px"); templatePopup.setStyleName("okm-Popup"); conversionStatus = new ConversionStatus(); updatePropertyGroupPopup = new UpdatePropertyGroupPopup(); updatePropertyGroupPopup.setWidth("250px"); updatePropertyGroupPopup.setHeight("50px"); updatePropertyGroupPopup.setStyleName("okm-Popup"); convertPopup = new ConvertPopup(); convertPopup.setWidth("150px"); convertPopup.setHeight("50px"); convertPopup.setStyleName("okm-Popup"); // Get grid 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"); RootPanel.get().add(mainPanel); RootPanel.get().add(dragable); Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { Main.get().windowClosing = true; startUp.keepAlive.cancel(); if (Main.get().mainPanel.bottomPanel.userInfo.isConnectedToChat()) { Main.get().mainPanel.bottomPanel.userInfo.logoutChat(); } } }); // Sets the active folder tree, it'll be used to store the active folder // every time switching stack panel activeFolderTree = mainPanel.desktop.navigator.taxonomyTree; // Initialize on startup when all objects are created sequentially startUpPopup.show(); startUp = new StartUp(); startUp.init(); // Auto-publish the method into JS when the GWT module loads. initJavaScriptApi(); mainPanel.topPanel.toolBar.initJavaScriptApi(mainPanel.topPanel.toolBar); fileUpload.initJavaScriptApi(); new NavigatorComunicator().initJavaScriptApi(); // Initialize commonUI public js api CommonUI commonUI = new CommonUI(); commonUI.initJavaScriptApi(commonUI); }
From source file:com.qualogy.qafe.gwt.client.QAFEGWTWeb.java
License:Apache License
@Override public void onModuleLoad() { JSNIUtil.exportQafeFunctions();/*from w w w . ja va2 s . c om*/ rootPanelValue = JSNIUtil.getScriptParameter(GWT.getModuleName(), JSNIUtil.ROOT_PANEL_PARAM); // inject default qafe-gwt.css Resources.INSTANCE.css().ensureInjected(); // This is same as StyleInjector.inject(Resources.INSTANCE.css().getText()); // now inject the custom css. injectGeneratedCSS(); buildUI(); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { moveWidgets(); } }); Window.addWindowClosingHandler(new Window.ClosingHandler() { @Override public void onWindowClosing(Window.ClosingEvent closingEvent) { closingEvent.setMessage(WINDOW_CLOSING_MESSAGE); } }); // For reloading of the CSS Element styleElement = DOM.createElement("style"); ClientApplicationContext.getInstance().setStyleElement(styleElement); // workaround for GWT issue 1813 // http://code.google.com/p/google-web-toolkit/issues/detail?id=1813 RootPanel.get(rootPanelValue).getElement().getStyle().setProperty("position", "relative"); // set uncaught exception handler GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { @Override public void onUncaughtException(Throwable throwable) { Throwable tempThrowable = throwable; StringBuffer text = new StringBuffer("Uncaught exception: " + throwable.getMessage()); while (tempThrowable != null) { StackTraceElement[] stackTraceElements = tempThrowable.getStackTrace(); text.append(tempThrowable.toString() + "\n"); for (StackTraceElement element : stackTraceElements) { text.append(" at " + element + "\n"); } tempThrowable = tempThrowable.getCause(); if (tempThrowable != null) { text.append("Caused by: " + tempThrowable.getCause()); } } ClientApplicationContext.getInstance().log("Uncaught exception: " + throwable.getMessage(), text.toString(), true, true, throwable); } }); }
From source file:com.surevine.chat.view.client.ChatClientPresenter.java
License:Open Source License
/** * Constructor, setting up the handlers. * /*from w w w. j ava 2 s. co m*/ * @param view * The <code>ChateClientView</code> */ @Inject public ChatClientPresenter(final ChatClientView view, final XmppSession session) { this.view = view; this.session = session; session.addSessionStateChangedHandler(true, new StateChangedHandler() { @Override public void onStateChanged(final StateChangedEvent event) { showState(session.getSessionState()); } }); Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(final ClosingEvent event) { autoLogin = false; session.logout(); } }); }