List of usage examples for com.google.gwt.user.client Window addResizeHandler
public static HandlerRegistration addResizeHandler(ResizeHandler handler)
From source file:edu.caltech.ipac.firefly.ui.searchui.CatddEnhancedPanel.java
public CatddEnhancedPanel(String ddSearchProcessor, String catalogName, final String cols, final String reqCols, final String cons, final String ddform, boolean defSelect) throws Exception { DockLayoutPanel mainPanel = new DockLayoutPanel(Style.Unit.PX); initWidget(mainPanel);// w w w .j av a 2 s .c o m FlowPanel topArea = new FlowPanel(); mainPanel.addSouth(topArea, 30); GwtUtil.setPadding(topArea, 5, 0, 0, 0); mainPanel.add(tableWrapper); mainPanel.setSize("100%", "100%"); GwtUtil.setPadding(tableWrapper, 0, 15, 0, 20); //CatalogRequest req = new CatalogRequest(CatalogRequest.RequestType.GATOR_DD); //req.setRequestId(ddSearchProcessor); //req.setQueryCatName(catalogName); TableServerRequest req = new TableServerRequest(ddSearchProcessor); req.setParam(CatalogRequest.CATALOG, catalogName); reqParams = req.getParams(); columns = cols; reqColumns = reqCols; reqColumnsList = StringUtils.asList(reqCols, ","); constraints = cons; if (!StringUtils.isEmpty(ddform)) formToSelect = ddform; _defSelect = defSelect; // GwtUtil.setStyle(mainPanel, "paddingLeft", "20px"); try { if (!formToSelect.equals("none")) { HorizontalPanel formType = new HorizontalPanel(); formType.add(new HTML("<b>Please select Long or Short Form display:<b> ")); formType.add(createListBox()); formType.add(new HTML("<br><br>")); topArea.add(formType); } buildPanel(formToSelect); } catch (Exception e) { throw new Exception(e.getMessage()); } Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (table != null && GwtUtil.isOnDisplay(table)) { table.onResize(); } } }); }
From source file:edu.caltech.ipac.firefly.visualize.AllPlots.java
void initAllPlots() { if (!initialized) { WebEventManager.getAppEvManager().addListener(Name.SEARCH_RESULT_START, new TearDownListen()); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { getVisMenuBar().updateLayout(); }//from w ww . j ava2s. c o m }); loadVisCommands(_commandMap); initialized = true; _pvListener = new MPWListener(); layout(); } }
From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadout.java
public WebMouseReadout(boolean wide) { super();//from w w w . j a v a 2s . c o m this.wide = wide; HorizontalPanel hp = new HorizontalPanel(); _popupPanel = new PopupPane(null, hp, PopupType.STANDARD, false, false, false, PopupPane.HeaderType.NONE); _popupPanel.alignTo(null, PopupPane.Align.DISABLE); _popupPanel.setRolldownAnimation(true); _popupPanel.setAnimateDown(true); _popupPanel.setAnimationEnabled(true); _lockIcon = new Image(VisIconCreator.Creator.getInstance().getLocked()); _unlockIcon = new Image(VisIconCreator.Creator.getInstance().getUnlocked()); hp.addDomHandler(new TouchStartHandler() { public void onTouchStart(TouchStartEvent event) { lockDialogOnce(); } }, TouchStartEvent.getType()); _lockButton = GwtUtil.makeImageButton(_unlockIcon, "Lock readout area to stay showing", new ClickHandler() { public void onClick(ClickEvent event) { if (_dialogLockedUp) unlockDialog(); else lockDialog(); } }); _lockButton.setSize("20px", "20px"); _lockMouCheckBox.setTitle("Click on an image to lock the display at that point."); _lockMouCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> lock) { setClickLock(lock.getValue()); } }); VerticalPanel fixedDisplay = new VerticalPanel(); fixedDisplay.setSpacing(2); GwtUtil.setStyle(titleLabel, "whiteSpace", "nowrap"); VerticalPanel wideControlArea = null; addMouseHandlers(_popupPanel.getPopupPanel(), true); addMouseHandlers(hp, true); addMouseHandlers(_grid, true); addMouseHandlers(gridWide, true); addMouseHandlers(fixedDisplay, true); if (wide) { wideControlArea = new VerticalPanel(); wideControlArea.add(_lockButton); wideControlArea.add(titleLabel); GwtUtil.setStyles(titleLabel, "padding", "13px 0 10px 0", "width", "160px"); if (!BrowserUtil.isTouchInput()) { wideControlArea.add(_lockMouCheckBox); GwtUtil.setStyles(_lockMouCheckBox, "paddingTop", "15px"); } fixedDisplay.add(_filePix); fixedDisplay.add(_screenPix); fixedDisplay.add(_zoomLevel); GwtUtil.setStyles(fixedDisplay, "width", "100px"); } else { fixedDisplay.add(_lockButton); fixedDisplay.add(_filePix); fixedDisplay.add(_screenPix); fixedDisplay.add(_zoomLevel); if (!BrowserUtil.isTouchInput()) fixedDisplay.add(_lockMouCheckBox); GwtUtil.setStyles(_lockMouCheckBox, "paddingRight", "10px"); } if (wide) { GwtUtil.setStyles(_filePix, "marginTop", "3px", "paddingLeft", "1px", "fontSize", "10px", "textAlign", "left"); GwtUtil.setStyles(_screenPix, "padding", "1px 12px 0px 1px", "fontSize", "10px", "textAlign", "left"); GwtUtil.setStyles(_zoomLevel, "padding", "12px 0 3px 0", "textAlign", "center", "color", "green", "fontSize", "9pt"); } else { GwtUtil.setStyles(_filePix, "marginTop", "-7px", "fontSize", "10px", "textAlign", "center"); GwtUtil.setStyles(_screenPix, "paddingTop", "5px", "fontSize", "10px", "textAlign", "center"); GwtUtil.setStyles(_zoomLevel, "padding", "2px 0 3px 0", "textAlign", "center", "color", "green", "fontSize", "9pt"); } _lockMouCheckBox.addStyleName("lock-click"); _filePix.addStyleName("title-font-family"); _screenPix.addStyleName("title-font-family"); _zoomLevel.addStyleName("title-font-family"); GwtUtil.setStyles(_grid, "lineHeight", "1", "marginLeft", "-8px"); if (wide) { GwtUtil.setStyles(gridWide, "lineHeight", "1"); } VerticalPanel imagePanel = new VerticalPanel(); if (wide) hp.add(wideControlArea); hp.add(fixedDisplay); hp.add(_grid); hp.add(imagePanel); HorizontalPanel decPanel = new HorizontalPanel(); decPanel.add(_thumbDeck); decPanel.setSpacing(2); decPanel.add(_magDeck); imagePanel.add(decPanel); if (wide) { hp.add(gridWide); } else { arrowDesc.addStyleName("title-font-family"); GwtUtil.setStyles(arrowDesc, "fontSize", "10px", "padding", "0 0 0 35px"); imagePanel.add(arrowDesc); } GwtUtil.setStyle(_magDeck, "paddingLeft", "5px"); if (wide) { _magDeck.setSize("70px", "70px"); } else { _magDeck.setSize("100px", "100px"); } WebEventManager.getAppEvManager().addListener(Name.REGION_CHANGE, new WebEventListener() { public void eventNotify(WebEvent ev) { hideMouseReadout(); } }); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (BrowserUtil.isTouchInput()) hideMouseReadout(); // tablet resizing only } }); }
From source file:edu.caltech.ipac.firefly.visualize.WebMouseReadoutPerm.java
public WebMouseReadoutPerm() { super();/* www .jav a 2 s .co m*/ HorizontalPanel hp = new HorizontalPanel(); _lockMouCheckBox.setTitle("Click on an image to lock the display at that point."); _lockMouCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> lock) { setClickLock(lock.getValue()); } }); GwtUtil.setStyle(titleLabel, "whiteSpace", "nowrap"); VerticalPanel titleArea = new VerticalPanel(); titleArea.add(titleLabel); GwtUtil.setStyles(titleLabel, "padding", "0 0 3px 10px", "width", "120px", "height", "1em", "textOverflow", "ellipsis", "overflow", "hidden", "color", "white"); if (!BrowserUtil.isTouchInput()) { titleArea.add(_lockMouCheckBox); GwtUtil.setStyles(_lockMouCheckBox, "padding", "15px 0 0 10px", "color", "white"); } _lockMouCheckBox.setVisible(false); _lockMouCheckBox.addStyleName("lock-click"); if (ALIGN_RIGHT) { hp.add(gridPanel); hp.add(titleArea); } else { hp.add(titleArea); hp.add(gridPanel); } GwtUtil.setStyles(hp, "whiteSpace", "nowrap"); readoutWrapper = new SimplePanel(hp); GwtUtil.setStyles(readoutWrapper, "paddingTop", "4px"); GwtUtil.setStyles(hp, "marginLeft", "140px"); if (ALIGN_RIGHT) { hp.addStyleName("right-floating"); } GwtUtil.setStyle(imagePanel, "paddingTop", "1px"); FlowPanel decPanel = new FlowPanel(); decPanel.add(_thumbDeck); imagePanel.add(decPanel); decPanel.add(_magDeck); GwtUtil.setStyles(_thumbDeck, "display", "inline-block", "border", "1px solid #BBBBBB"); GwtUtil.setStyles(_magDeck, "border", "1px solid #BBBBBB", "display", "inline-block", "marginLeft", "2px"); _magDeck.setSize("70px", "70px"); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { // todo } }); WebEventManager.getAppEvManager().addListener(Name.REGION_CHANGE, new WebEventListener() { public void eventNotify(WebEvent ev) { hideMouseReadout(); } }); WebEventManager.getAppEvManager().addListener(Name.DROPDOWN_OPEN, new WebEventListener() { public void eventNotify(WebEvent ev) { hideMouseReadout(); } }); }
From source file:edu.kit.ipd.sonar.client.Timeline.java
License:Open Source License
/** * Creates the TimeLine object.//from w ww. j a va 2 s. c om * The TimeLine will register itself for all interesting events with * the event handler. */ public Timeline() { initWidget(vpanel); HTML slider = new HTML("<div id='" + TIMELINE_ID + "'></div>"); vpanel.add(slider); vpanel.setCellWidth(slider, "100%"); canvas = new HTML("<canvas class='" + CANVAS_CLASS + "' id='" + CANVAS_ID + "' height='" + yresolution + "px' " + "width='" + xresolution + "px' " + ">a</canvas>"); vpanel.add(canvas); //get new timeboundarys on login EventBus.getHandlerManager().addHandler(SuccessfulAuthenticationEvent.TYPE, new SuccessfulAuthenticationEventHandler() { public void onSuccessfulAuthentication(final SuccessfulAuthenticationEvent e) { isLoading = true; EventBus.getHandlerManager().fireEvent(new StartLoadingEvent()); EventBus.getHandlerManager().fireEvent(new AvailableTimeBoundaryRequestEvent()); }; }); //listen for new timeline EventBus.getHandlerManager().addHandler(AvailableTimeBoundaryArrivedEvent.TYPE, new AvailableTimeBoundaryArrivedEventHandler() { public void onAvailableTimeBoundaryArrived(final AvailableTimeBoundaryArrivedEvent e) { if (injected) { updateTimeline(e.getTimeBoundary()); } else { timeboundary = e.getTimeBoundary(); } if (isLoading) { isLoading = false; EventBus.getHandlerManager().fireEvent(new FinishLoadingEvent()); } }; }); DeferredCommand.addCommand(new Command() { public void execute() { injectSlider(); } }); Window.addResizeHandler(new ResizeHandler() { public void onResize(final ResizeEvent event) { updateCanvasScaling(); } }); }
From source file:edu.ucla.loni.pipeline.client.Charts.LineChartPanel.java
License:Open Source License
private void initialize(String mt) { monitorType = mt;//from w w w .j a v a2 s.c o m if (monitorType.equals("Memory")) { initializeMemory(); } else if (monitorType.equals("Thread")) { initializeThread(); } else { System.err.println( "Incorrect monitorType provided. Check initialize() in LineChartPanel.java for errors."); return; } // set up chart ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART); chartLoader.loadApi(new Runnable() { @Override public void run() { // Create and attach the chart chart = new LineChart(); int height = Window.getClientHeight() - 330; int width = Window.getClientWidth() - 75; chart.setSize(width + "px", height + "px"); // listen to resize events Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { int height = event.getHeight() - 330; int width = event.getWidth() - 75; chart.setHeight(height + "px"); chart.setWidth(width + "px"); draw(); } }); addChild(chart); draw(); } }); }
From source file:edu.ucsc.robot.client.MainScreen.java
License:Apache License
@Override public void onModuleLoad() { screenWidth = Window.getClientWidth(); screenHeight = Window.getClientHeight(); setupRenderer();//www . ja v a 2 s .com setupWebGLCanvas(renderer); RootLayoutPanel.get().add(canvas); setupScene(); setupCamera(); rootGroup = THREE.Object3D(); scene.add(rootGroup); backgroundContainer = THREE.Object3D(); rootGroup.add(backgroundContainer); final Geometry geo = THREE.PlaneGeometry(100, 100, 20, 20); final Mesh mesh = THREE.Mesh(geo, THREE.MeshBasicMaterial().color(0x666666).wireFrame(true).build()); mesh.setRotation(Math.toRadians(-90), 0, 0); backgroundContainer.add(mesh); setupUpdater(); dialog = new PopupPanel(); setupDialogRoot(); createPlayer(main); dialog.show(); Util.rightTop(dialog); Window.addResizeHandler(new IndexResizeHandler(this)); HTMLPanel html = new HTMLPanel(getHtml()); html.setWidth("100%"); html.setHeight("20px"); html.setStyleName("text"); htmlDialog = new PopupPanel(); htmlDialog.add(html); htmlDialog.setPopupPosition(150, 30); htmlDialog.setWidth("100%"); htmlDialog.setStyleName("transparent"); htmlDialog.show(); }
From source file:edu.ycp.cs.netcoder.client.NetCoder_GWT2.java
License:Open Source License
/** * This is the entry point method./*from w w w . j av a2 s . c om*/ */ public void onModuleLoad() { // Create session session = new Session(); session.add(new WindowResizeNotifier()); // Create a SubscriptionRegistrar subscriptionRegistrar = new DefaultSubscriptionRegistrar(); // Observe Session changes session.subscribe(Session.Event.LOGIN, this, subscriptionRegistrar); session.subscribe(Session.Event.LOGOUT, this, subscriptionRegistrar); session.subscribe(Session.Event.PROBLEM_CHOSEN, this, subscriptionRegistrar); // Get window ResizeEvents so we can publish them to views Window.addResizeHandler(this); changeView(new LoginView(session)); }
From source file:eml.studio.client.IndexPage.java
License:Open Source License
/** * IndexPage module load method//from w w w.j a v a 2s. c om */ @Override public void onModuleLoad() { init(); loginPanel.addGuestLoginHandler(new GuestLoginHandler()); loginPanel.addSignInHandler(new SignInHandler()); loginPanel.addSignUpHandler(new SignUpHandler()); loginPanel.addForgetPwdHandler(new ForgetPwdHandler()); loginPanel.addDomHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == 13) { enterLogin(); } } }, KeyUpEvent.getType()); Element elem = DOM.getElementById("bda-login-a"); loginAnchor = Anchor.wrap(elem); loginAnchor.setText(Constants.logUIMsg.login()); DOM.sinkEvents(elem, Event.ONCLICK); DOM.setEventListener(elem, new EventListener() { @Override public void onBrowserEvent(Event event) { if (Event.ONCLICK == event.getTypeInt()) { registerPanel.hide(); forgetPwdPanel.hide(); if (loginPanel.isShowing()) loginPanel.hide(); else { loginPanel.showRelativeTo(loginAnchor); } } } }); elem = DOM.getElementById("bda-logout-a"); elem.setInnerText(Constants.logUIMsg.logout()); DOM.sinkEvents(elem, Event.ONCLICK); DOM.setEventListener(elem, new EventListener() { @Override public void onBrowserEvent(Event event) { if (Event.ONCLICK == event.getTypeInt()) { accountSrv.logout(new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.Location.reload(); } @Override public void onSuccess(Void result) { Window.Location.reload(); } }); } } }); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { if (loginPanel.isShowing()) loginPanel.showRelativeTo(loginAnchor); if (registerPanel.isShowing()) registerPanel.showRelativeTo(loginAnchor); } }); }
From source file:es.deusto.weblab.client.lab.ui.themes.es.deusto.weblab.defaultweb.AllowedExperimentsWindow.java
License:Open Source License
AllowedExperimentsWindow(IConfigurationManager configurationManager, User user, ExperimentAllowed[] experimentsAllowed, IAllowedExperimentsWindowCallback callback) { super(configurationManager); this.user = user; this.callback = callback; loadExperimentsAllowedConfigurations(experimentsAllowed); this.loadWidgets(); if (RESIZE_HANDLER != null) RESIZE_HANDLER.removeHandler();/*from www . ja v a2 s . c om*/ RESIZE_HANDLER = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { System.out.println("Resizing. New width: " + event.getWidth()); AllowedExperimentsWindow.this.experimentsTable.clear(); while (AllowedExperimentsWindow.this.experimentsTable.getRowCount() > 0) AllowedExperimentsWindow.this.experimentsTable.removeRow(0); loadExperimentsTable(); } }); }