List of usage examples for com.google.gwt.user.client Window addResizeHandler
public static HandlerRegistration addResizeHandler(ResizeHandler handler)
From source file:org.parallax3d.parallax.platforms.gwt.GwtRenderingContext.java
License:Open Source License
public GwtRenderingContext(Panel root, GwtAppConfiguration config) throws ParallaxRuntimeException { this.root = root; root.clear();/* w w w . j a v a2s . co m*/ Canvas canvasWidget = Canvas.createIfSupported(); if (canvasWidget == null) throw new ParallaxRuntimeException("Canvas not supported"); int width = root.getOffsetWidth(); int height = root.getOffsetHeight(); if (width == 0 || height == 0) new ParallaxRuntimeException("Width or Height of the Panel is 0"); lastWidth = width; lastHeight = height; canvas = canvasWidget.getCanvasElement(); root.add(canvasWidget); canvas.setWidth(width); canvas.setHeight(height); this.config = config; WebGLContextAttributes attributes = WebGLContextAttributes.create(); attributes.setAntialias(config.antialiasing); attributes.setStencil(config.stencil); attributes.setAlpha(config.alpha); attributes.setPremultipliedAlpha(config.premultipliedAlpha); attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer); context = WebGLRenderingContext.getContext(canvas, attributes); context.viewport(0, 0, width, height); gl = new GwtGL20(context); renderer = new GLRenderer(gl, width, height); input = new GwtInput(canvas); addEventListeners(); Window.addResizeHandler(this); }
From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel.java
License:Open Source License
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);// ww w . jav a 2 s . c o m 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); }
From source file:org.pentaho.ui.xul.gwt.util.FrameCover.java
License:Open Source License
public FrameCover() { Window.addResizeHandler(new ResizeHandler() { @Override/*from w w w . j a v a 2 s . c om*/ public void onResize(ResizeEvent event) { setFrameSize(); } }); }
From source file:org.pepstock.jem.gwt.client.Main.java
License:Open Source License
private void showHome() { if (ROOT_TABLE_CENTER_PANEL.getWidgetIndex(LOGIN_APPLICATION_PANEL) > -1) { ROOT_TABLE_CENTER_PANEL.remove(LOGIN_APPLICATION_PANEL); }// ww w .j a v a 2 s.c o m if (ROOT_TABLE_CENTER_PANEL.getWidgetIndex(homeApplicationPanel) < 0) { ROOT_TABLE_CENTER_PANEL.add(homeApplicationPanel); homeApplicationPanel.onResize(); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { homeApplicationPanel.onResize(event.getWidth(), event.getHeight()); } }); } LOGIN_APPLICATION_PANEL.setVisible(false); }
From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java
License:Apache License
/** * This is the entry point method.//from w ww .jav a 2s.c om */ public void onModuleLoad() { try { //Set the number formatter (had to be decoupled since GWT doesn't work with DecimalFormat) DoubleValue.setFormatter(new GwtDecimalFormatter(DoubleValue.defaultFormatPattern)); resizeRequiredExtraHeight = Integer.parseInt(CONSTANTS.HeaderHeight()); //Listen for page content object selection changes selectionManager.addListener(this); //Initialisations imageLoader = new DocumentImageLoader(); pageLayout = new PageLayoutC(); pageSync = new PageSyncManager(null, pageLayout); pageView = new PageScrollView(pageLayout, imageLoader, selectionManager, true, false); pageContentRendererPlugin = new PageContentRendererPlugin(); pageView.getRenderer().addPlugin(pageContentRendererPlugin); pageContentRendererPlugin.setFill(false); pageView.getRenderer().addPlugin(selectionRendererPlugin = new ContentSelectionRendererPlugin()); pageView.addZoomListener(this); pageView.setMinZoom(0.05); pageSync.addListener(pageView); pageSync.addListener(this); imageLoader.addListener(pageView); imageLoader.addListener(this); //Main panel (child panels vertically arranged) mainPanel = new VerticalPanel(); mainPanel.setSize("99.8%", (Window.getClientHeight() - 1) + "px"); //Focus panel (required for keyboard handler) focusPanel = new FocusPanel(mainPanel); focusPanel.setSize("99.8%", (Window.getClientHeight() - 1) + "px"); focusPanel.addKeyPressHandler(this); focusPanel.addKeyDownHandler(this); focusPanel.getElement().getStyle().setOutlineWidth(0, Unit.PX); RootPanel.get().add(focusPanel); focusPanel.setFocus(true); //Header panel at the top FlexTable header = new FlexTable(); header.addStyleName("headerPanel"); mainPanel.add(header); documentTitle = new Label(CONSTANTS.LoadingDocument()); header.setWidget(0, 0, documentTitle); documentTitle.addStyleName("documentTitle"); //Centre panel (with toolbar, page view, and region labels) HorizontalPanel centerPanel = new HorizontalPanel(); mainPanel.add(centerPanel); centerPanel.setSize("99.8%", (Window.getClientHeight() - resizeRequiredExtraHeight) + "px"); //Toolbar panel at the left toolbar = createToolbar(); centerPanel.add(toolbar); centerPanel.setCellWidth(toolbar, "1%"); //Split panel with page view and region labels splitPanel = new SplitLayoutPanel(); centerPanel.add(splitPanel); splitPanel.setSize("99.8%", (Window.getClientHeight() - resizeRequiredExtraHeight) + "px"); splitPanel.addStyleName("contentPanel"); //Region labels VerticalPanel rightPanel = new VerticalPanel(); rightPanel.setWidth("100%"); splitPanel.addEast(rightPanel, Integer.parseInt(CONSTANTS.IntitialRegionLabelPanelWidth())); //Right // Headline regionTypeEditorHeading = new Label(CONSTANTS.LabelEditorHeadingCreateRegion()); regionTypeEditorHeading.addStyleName("regionTypeEditorHeading"); rightPanel.add(regionTypeEditorHeading); // Editor regionTypeEditor = new SimpleRegionTypeEditor(selectionManager); regionTypeEditor.addRegionTypeSelectionListener(this); selectionManager.addListener(regionTypeEditor); regionTypeEditor.getWidget().addStyleName("regionTypeEditor"); rightPanel.add(regionTypeEditor.getWidget()); //Page view splitPanel.add(pageView); //Centre pageView.asWidget().addStyleName("pageView"); //Text content dialogue createTextDialog(); //Resize handler (browser window resize events) Window.addResizeHandler(this); //Add tool icons to page view addToolIconsToPageView(); //Authenticate user userManager.addListener(this); userManager.logOn(Window.Location.getParameter("Appid"), Window.Location.getParameter("Did"), Window.Location.getParameter("Aid"), Window.Location.getParameter("a")); //Get the virtual keyboard layout from the server loadVirtualKeyboardLayout(); logManager.logInfo(0, "onModuleLoad() finished"); } catch (Exception exc) { logManager.logError(ERROR_ON_MODULE_LOAD, "Error in onModuleLoad()"); exc.printStackTrace(); } }
From source file:org.rstudio.studio.client.workbench.views.help.HelpPane.java
License:Open Source License
@Inject public HelpPane(Provider<HelpSearch> searchProvider, GlobalDisplay globalDisplay, Commands commands) { super("Help"); searchProvider_ = searchProvider;/* ww w . j a v a 2s . c om*/ globalDisplay_ = globalDisplay; commands_ = commands; MenuItem clear = commands.clearHelpHistory().createMenuItem(false); history_ = new ToolbarLinkMenu(12, true, null, new MenuItem[] { clear }); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { history_.getMenu().hide(); } }); ensureWidget(); }
From source file:org.sigmah.client.ui.view.contact.ContactHistoryView.java
License:Open Source License
@Override public void initialize() { contactHistoryGrid = new Grid<ContactHistory>(new ListStore<ContactHistory>(), buildColumnModel()); contactHistoryGrid.getView().setForceFit(true); contactHistoryGrid.setAutoHeight(true); contactHistoryGrid.addListener(Events.ViewReady, new Listener<BaseEvent>() { @Override//from w ww .j a v a 2 s . c o m public void handleEvent(BaseEvent be) { resizeGrid(contactHistoryGrid, container, true); } }); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { resizeGrid(contactHistoryGrid, container, false); } }); container = Panels.content(null, false, Layouts.vBoxLayout(VBoxLayout.VBoxLayoutAlign.STRETCH, new Layouts.LayoutOptions(new Padding(10))), "x-border-layout-ct"); container.setScrollMode(Style.Scroll.AUTOY); container.add(contactHistoryGrid); add(container); }
From source file:org.sigmah.client.ui.view.contact.ContactRelationshipsView.java
License:Open Source License
@Override public void reloadView(ContactDTO contactDTO, ContactRelationshipsPresenter.AnchorHandler anchorHandler) { container.remove(buttonsContainer);//from w w w .j a va2 s. c om container.remove(grid); container.layout(); outboundToggleButton = new ToggleButton(I18N.CONSTANTS.contactRelationshipOwnedByToggleButtonLabel()); inboundToggleButton = new ToggleButton(I18N.CONSTANTS.contactRelationshipOwnerOfToggleButtonLabel()); buttonsContainer = Layouts.hBox(HBoxLayout.HBoxLayoutAlign.MIDDLE); buttonsContainer.add(outboundToggleButton); buttonsContainer.add(inboundToggleButton); buttonsContainer.setHeight(BUTTONS_PANEL_HEIGHT); grid = new Grid<ContactRelationship>(new ListStore<ContactRelationship>(), generateColumnModel(contactDTO, anchorHandler)); grid.getView().setForceFit(true); grid.setAutoHeight(true); grid.addListener(Events.ViewReady, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { resizeGrid(grid, container, true); } }); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { resizeGrid(grid, container, false); } }); container.add(buttonsContainer); container.add(grid); container.layout(); }
From source file:org.sigmah.client.ui.view.contact.ContactView.java
License:Open Source License
@Override public void addTab(String tabTitle, final Widget tabView) { final TabItem tabItem = new TabItem(tabTitle); tabItem.addListener(Events.Select, new Listener<ComponentEvent>() { @Override// w ww.j ava 2 s . c om public void handleEvent(ComponentEvent be) { fixTabViewHeight(tabView, tabItem); } }); tabItem.add(tabView); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { fixTabViewHeight(tabView, tabItem); } }); fixTabViewHeight(tabView, tabItem); tabPanel.add(tabItem); }
From source file:org.silverpeas.mobile.client.SpMobil.java
License:Open Source License
/** * Init. spmobile.//w w w. ja v a2 s.com */ public void onModuleLoad() { instance = this; shortcutAppId = Window.Location.getParameter("shortcutAppId"); shortcutContentType = Window.Location.getParameter("shortcutContentType"); shortcutContentId = Window.Location.getParameter("shortcutContentId"); msg = GWT.create(ApplicationMessages.class); EventBus.getInstance().addHandler(ExceptionEvent.TYPE, new ErrorManager()); EventBus.getInstance().addHandler(AbstractAuthenticationErrorEvent.TYPE, this); loadIds(null); NodeList<Element> tags = Document.get().getElementsByTagName("meta"); for (int i = 0; i < tags.getLength(); i++) { MetaElement metaTag = ((MetaElement) tags.getItem(i)); if (metaTag.getName().equals("viewport")) { viewport = metaTag.getContent(); } } orientation = MobilUtils.getOrientation(); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(final ResizeEvent resizeEvent) { if (!MobilUtils.getOrientation().equals(orientation)) { orientation = MobilUtils.getOrientation(); EventBus.getInstance().fireEvent(new OrientationChangeEvent(orientation)); } } }); // Instanciate apps apps.add(new DocumentsApp()); apps.add(new MediaApp()); apps.add(new NewsApp()); apps.add(new NavigationApp()); apps.add(new TasksApp()); apps.add(new FavoritesApp()); apps.add(new WebPageApp()); apps.add(new BlogApp()); apps.add(new WorkflowApp()); apps.add(new HyperLinkApp()); apps.add(new AgendaApp()); }