List of usage examples for com.google.gwt.event.logical.shared ResizeHandler onResize
void onResize(ResizeEvent event);
From source file:com.tractionsoftware.gwt.user.client.ui.TractionDialogBox.java
License:Apache License
/** * This can be called to adjust the size of the dialog glass. It * is implemented using JSNI to bypass the "private" keyword on * the glassResizer./* w w w . j a va 2s . c o m*/ */ public void adjustGlassSize() { if (isGlassEnabled()) { ResizeHandler handler = getGlassResizer(); if (handler != null) handler.onResize(null); } }
From source file:org.cruxframework.crux.core.client.screen.views.View.java
License:Apache License
/** * // w w w . ja v a2 s. c om * @param event */ protected void fireResizeEvent(ResizeEvent event) { for (int i = 0; i < resizeHandlers.size(); i++) { ResizeHandler handler = resizeHandlers.get(i); handler.onResize(event); } }
From source file:org.cruxframework.crux.core.client.screen.views.ViewHandlers.java
License:Apache License
/** * @param handler//from www. j a v a 2s . c om * @return */ private static HandlerRegistration addWindowResizeHandler(final ResizeHandler handler, final boolean lazyCheck) { ResizeHandler resizeHandler = new ResizeHandler() { public void onResize(ResizeEvent event) { if (!lazyCheck) { handler.onResize(event); return; } final ResizeBeginEndExecutor executor = new ResizeBeginEndExecutor(100, event) { private int clientHeight = Window.getClientHeight(); private int clientWidth = Window.getClientWidth(); @Override protected void doEndAction() { if (!Screen.getCurrentDevice().equals(Device.largeDisplayMouse)) { int newClientHeight = Window.getClientHeight(); int newClientWidth = Window.getClientWidth(); if (this.clientHeight != newClientHeight || clientWidth != newClientWidth || Screen.isIos()) { handler.onResize(getResizeEvent()); } clientHeight = newClientHeight; clientWidth = newClientWidth; } else { handler.onResize(getResizeEvent()); } } @Override protected void doBeginAction() { // nothing } }; executor.execute(); } }; final HandlerRegistration resizeHandlerRegistration = Window.addResizeHandler(resizeHandler); return new HandlerRegistration() { public void removeHandler() { if (resizeHandlerRegistration != null) { resizeHandlerRegistration.removeHandler(); } } }; }
From source file:org.vectomatic.svg.edu.client.Intro.java
License:Open Source License
public void onModuleLoad2() { CommonBundle.INSTANCE.css().ensureInjected(); final FlexTable table = new FlexTable(); table.setBorderWidth(0);/* w w w . j a v a2 s . c o m*/ table.setCellSpacing(5); table.setStyleName(css.gameTable()); table.setWidget(0, 0, Game.DOTS.getImage()); table.setWidget(1, 0, Game.DOTS.getRule()); table.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.setWidget(0, 1, Game.MAZE.getImage()); table.setWidget(1, 1, Game.MAZE.getRule()); table.getCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getCellFormatter().setAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.setWidget(2, 0, Game.PUSH.getImage()); table.setWidget(3, 0, Game.PUSH.getRule()); table.getCellFormatter().setAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getCellFormatter().setAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.setWidget(2, 1, Game.PUZZLE.getImage()); table.setWidget(3, 1, Game.PUZZLE.getRule()); table.getCellFormatter().setAlignment(2, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getCellFormatter().setAlignment(3, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); final LicenseBox licenseBox = new LicenseBox(); Anchor licenseAnchor = new Anchor(); licenseAnchor.setText(EduConstants.INSTANCE.license()); licenseAnchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { licenseBox.box.center(); licenseBox.box.show(); } }); table.setWidget(4, 0, licenseAnchor); table.getFlexCellFormatter().setColSpan(4, 0, 2); table.getCellFormatter().setAlignment(4, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); ResizeHandler resizeHandler = new ResizeHandler() { @Override public void onResize(ResizeEvent event) { float w = Window.getClientWidth() * 0.45f; float h = Window.getClientHeight() * 0.3f; for (int i = 0; i < 4; i += 2) { for (int j = 0; j < 2; j++) { SVGImage svgImage = (SVGImage) table.getWidget(i, j); svgImage.getSvgElement().getStyle().setSVGProperty("width", Float.toString(w)); svgImage.getSvgElement().getStyle().setSVGProperty("height", Float.toString(h)); } } GWT.log(w + "x" + h); } }; Window.addResizeHandler(resizeHandler); resizeHandler.onResize(null); RootPanel.get(ID_UIROOT).add(table); confirmBox = ConfirmBox.createConfirmBox(table); }