List of usage examples for com.google.gwt.user.client Window addResizeHandler
public static HandlerRegistration addResizeHandler(ResizeHandler handler)
From source file:org.ssgwt.client.ui.popup.GenericPopup.java
License:Apache License
/** * Class constructor sets the widget to display in popup * /*ww w .j a v a2 s . c o m*/ * @param popupContentWidget - The widget to display in the popup * @param lockBackground - Whether to lock the background * @param closeOnMouseOut - Whether to close the popup on mouse out * @param useArrow - Whether to use a arrow on the popup * @param resource The resource to be used for the GenericPopup * * @author Ruan Naude <naudeuran777@gmail.com> * @since 15 July 2013 */ public GenericPopup(IGenericPopupContentWidget popupContentWidget, boolean lockBackground, final boolean closeOnMouseOut, boolean useArrow, GenericPopupResource resource) { super(!lockBackground); setGlassEnabled(lockBackground); setGlassStyleName("generalPopupOpacity"); this.resource = resource; this.closeOnMouseOut = closeOnMouseOut; this.useArrow = useArrow; this.popupContentWidget = popupContentWidget; popupContentWidget.setParent(this); this.resource.genericPopupStyle().ensureInjected(); this.setWidget(mainFlowPanel); //add the loader and content panels loaderImage = new Image(resource.loaderImage()); loaderFlowPanel.add(loaderImage); loaderFlowPanel.setVisible(false); popupContent.add(popupContentWidget.asWidget()); mainFlowPanel.add(popupContent); mainFlowPanel.add(loaderFlowPanel); //set the styles on the popup innerArrow.addStyleName(resource.genericPopupStyle().ssHoverPopupInnerArrow()); outerArrow.addStyleName(resource.genericPopupStyle().ssHoverPopupOuterArrow()); this.setStyleName(resource.genericPopupStyle().ssHoverPopupContainer()); loaderImage.addStyleName(resource.genericPopupStyle().ssPopupLoaderImage()); //This will listen to the browser resize event and update the popup location Window.addResizeHandler(new ResizeHandler() { /** * Will handle the logic on the resize of the browser * * @author Ruan Naude <naudeuran777@gmail.com> * @since 15 July 2013 */ @Override public void onResize(ResizeEvent event) { if (isShowing()) { calculatePopupPosition(); } } }); //add mouse out handler to the popup this.addDomHandler(new MouseOutHandler() { /** * Handles what happens when the mouse leaves the popup * * @author Ruan Naude <naudeuran777@gmail.com> * @since 15 July 2013 */ @Override public void onMouseOut(MouseOutEvent event) { handelMouseOutEvent(); } }, MouseOutEvent.getType()); //add mouse over handler to the popup this.addDomHandler(new MouseOverHandler() { /** * Handles what happens when the mouse enters the popup * * @author Ruan Naude <naudeuran777@gmail.com> * @since 15 July 2013 */ @Override public void onMouseOver(MouseOverEvent event) { //clear timer if there was one if (mouseOutTimer != null) { mouseOutTimer.cancel(); mouseOutTimer = null; } } }, MouseOverEvent.getType()); }
From source file:org.thechiselgroup.biomixer.client.workbench.embed.EmbedContainer.java
License:Apache License
public void init() { Window.enableScrolling(false); Window.addResizeHandler(new ResizeHandler() { @Override// ww w . jav a 2 s . c om public void onResize(ResizeEvent event) { if (widget != null) { updateWidgetSize(widget); } } }); informationLabel = new Label(); }
From source file:org.thechiselgroup.biomixer.client.workbench.init.WorkbenchInitializer.java
License:Apache License
private void initDesktop(DockPanel mainPanel) { /*/*w w w. j a va2s .c o m*/ * Absolute root panel required for drag & drop into windows using * Firefox */ desktop.asWidget().setPixelSize(Window.getClientWidth(), Window.getClientHeight() - ActionBar.ACTION_BAR_HEIGHT_PX); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { desktop.asWidget().setPixelSize(event.getWidth(), event.getHeight() - ActionBar.ACTION_BAR_HEIGHT_PX); // TODO windows need to be moved if they are out of the // range } }); mainPanel.add(desktop.asWidget(), DockPanel.CENTER); }
From source file:org.thechiselgroup.choosel.example.components.client.ComponentExampleEntryPoint.java
License:Apache License
private void setupLayout() { Window.enableScrolling(false); layout();/*from w ww .ja v a 2 s. c o m*/ Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { layout(); } }); }
From source file:org.thechiselgroup.choosel.workbench.client.embed.EmbedContainer.java
License:Apache License
public void setWidget(final Widget widget) { assert widget != null; // XXX allow for multiple calls rootPanel.remove(informationLabel);/* ww w . ja va 2 s .com*/ rootPanel.add(widget); updateWidgetSize(widget); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { updateWidgetSize(widget); } }); }
From source file:org.uberfire.client.workbench.Workbench.java
License:Apache License
private void bootstrap() { logger.info("Starting workbench..."); ((SessionInfoImpl) currentSession()).setId(((ClientMessageBusImpl) bus).getSessionId()); layout.setMarginWidgets(isStandaloneMode, headersToKeep); layout.onBootstrap();// w w w.j a v a 2s .c o m addLayoutToRootPanel(layout); //Lookup PerspectiveProviders and if present launch it to set-up the Workbench if (!isStandaloneMode) { final PerspectiveActivity homePerspective = getHomePerspectiveActivity(); if (homePerspective != null) { appReady.fire(new ApplicationReadyEvent()); placeManager.goTo(new DefaultPlaceRequest(homePerspective.getIdentifier())); } else { logger.error("No home perspective available!"); } } else { handleStandaloneMode(Window.Location.getParameterMap()); } // Ensure orderly shutdown when Window is closed (eg. saves workbench state) Window.addWindowClosingHandler(new ClosingHandler() { @Override public void onWindowClosing(ClosingEvent event) { workbenchCloseHandler.onWindowClose(workbenchCloseCommand); } }); // Resizing the Window should resize everything Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { layout.resizeTo(event.getWidth(), event.getHeight()); } }); // Defer the initial resize call until widgets are rendered and sizes are available Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { layout.onResize(); } }); }
From source file:org.unitime.timetable.gwt.client.page.UniTimeMenuBar.java
License:Apache License
public UniTimeMenuBar(boolean absolute) { iMenu = new MenuBar(); iMenu.addStyleName("unitime-NoPrint"); iMenu.addStyleName("unitime-Menu"); initWidget(iMenu);/*from w w w. j a va2s . c o m*/ if (absolute) { iMenu.getElement().getStyle().setPosition(Position.ABSOLUTE); move(false); iMoveTimer = new Timer() { @Override public void run() { move(true); } }; Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { delayedMove(); } }); Window.addWindowScrollHandler(new Window.ScrollHandler() { @Override public void onWindowScroll(ScrollEvent event) { delayedMove(); } }); Client.addGwtPageChangedHandler(new GwtPageChangedHandler() { @Override public void onChange(GwtPageChangeEvent event) { delayedMove(); } }); iSimple = new SimplePanel(); iSimple.getElement().getStyle().setHeight(23, Unit.PX); new Timer() { @Override public void run() { delayedMove(); } }.scheduleRepeating(5000); } }
From source file:org.utgenome.gwt.utgb.client.UTGBEntryPointBase.java
License:Apache License
public void onModuleLoad() { RPCServiceManager.initServices();//from w w w . j a v a2s .c o m queryParam = BrowserInfo.getURLQueryRequestParameters(); RootPanel.get().setStyleName("utgb"); basePanel.add(trackQueue, DockPanel.CENTER); History.addValueChangeHandler(new HistoryChangeHandler()); Event.addNativePreviewHandler(new KeyboardShortcut()); // add window size change listener Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent e) { adjustTrackWidth(); } }); // invoke main method main(); if (BrowserInfo.isIE()) { showErrorMessage( "IE does not support canvas feature in HTML5 for drawing grpahics in the browser, so we strongly recommend you to use another browser supporting HTML5, e.g., Google Chrome, Firefox, Safari, Opera, etc."); } }
From source file:org.vaadin.alump.distributionbar.gwt.client.GwtDistributionBar.java
License:Apache License
public void onAttach() { super.onAttach(); updateParts(); connectClickHandlingIfNeeded(); windowResizeReg = Window.addResizeHandler(resizeHandler); }
From source file:org.vaadin.chronographer.gwt.client.ChronoGrapherWidget.java
License:Apache License
public void init(String w, String h, boolean horizontal, boolean serverCallOnEventClickEnabled, boolean mouseOverShowsPopUp, Date timelineStart, Date timelineStop, List<TimelineBandInfo> bandInfos, List<TimelineTheme> timelineThemes, String eventsJson) { if (!inited) { extractPixelWidthAndHeights(w, h); Window.addResizeHandler(this); setHorizontalOrientation(horizontal); setServerCallOnEventClickEnabled(serverCallOnEventClickEnabled); setMouseOverPopEnabled(mouseOverShowsPopUp); Theme theme = Theme.create();/*from w w w . j a v a 2 s . c om*/ if (timelineStart != null) { theme.setTimelineStart(timelineStart); } if (timelineStop != null) { theme.setTimelineStop(timelineStop); } setStructure(bandInfos, theme); setThemes(timelineThemes); initialise(width, height); inited = true; } if (eventsJson != null) { setEventsJson(eventsJson); } onResize(true); }