List of usage examples for com.google.gwt.user.client WindowResizeListener WindowResizeListener
WindowResizeListener
From source file:com.flatown.client.GBox.java
License:Apache License
private GBox() { this.add(FavoritesPanel.Singleton, "Favorites"); this.add(SearchPanel.Singleton, "Search"); this.add(BookmarksPanel.Singleton, "Bookmarks"); this.add(SharePanel.Singleton, "Share"); this.add(HelpPanel.Singleton, "Help"); insertSpacer(5, 2);/*from ww w.java 2s . com*/ insertSpacer(5, 4); insertSpacer(5, 6); insertSpacer(5, 8); Prefs = new GadgetPrefs(); Prefs.updateLastLogin(); this.selectTab(Prefs.loadFavorites() ? 0 : 4); Prefs.loadBookmarks(); Window.addWindowResizeListener(new WindowResizeListener() { public void onWindowResized(int width, int height) { DOM.setStyleAttribute(FavoritesPanel.Singleton.getElement(), "maxHeight", height - 40 + "px"); DOM.setStyleAttribute(SearchPanel.Singleton.getElement(), "maxHeight", height - 40 + "px"); DOM.setStyleAttribute(BookmarksPanel.Singleton.getElement(), "maxHeight", height - 40 + "px"); DOM.setStyleAttribute(HelpPanel.Singleton.getElement(), "maxHeight", height - 40 + "px"); } }); }
From source file:com.google.appinventor.client.RpcStatusPopup.java
License:Open Source License
/** * Initializes the LoadingPopup.//from w ww . ja v a 2s .co m */ public RpcStatusPopup() { super(/* autoHide = */ false); setStyleName("ode-RpcStatusMessage"); setWidget(label); // Re-center the loading message when the window is resized. // TODO(halabelson): Replace the deprecated methods Window.addWindowResizeListener(new WindowResizeListener() { @Override public void onWindowResized(int width, int height) { positionPopup(getOffsetWidth()); } }); // Reposition the message to the top of the screen when the // window is scrolled // TODO(halabelson): get rid of the flashing on vertical scrolling Window.addWindowScrollListener(new WindowScrollListener() { @Override public void onWindowScrolled(int scrollLeft, int scrollTop) { positionPopup(getOffsetWidth()); } }); // Position the popup before showing it to prevent flashing. setPopupPositionAndShow(new PopupPanel.PositionCallback() { @Override public void setPosition(int offsetWidth, int offsetHeight) { positionPopup(offsetWidth); } }); }
From source file:com.google.mobile.trippy.web.client.view.BaseHeaderView.java
License:Apache License
public BaseHeaderView() { initWidget(uiBinder.createAndBindUi(this)); btnNavigate.setText(Constants.ITINERARY_STR); Window.addWindowResizeListener(new WindowResizeListener() { @Override// w w w . j ava2 s . c om public void onWindowResized(int width, int height) { final int txtTitleWidth = width - Constants.NAVIGATION_WIDTH - Constants.OPTIONS_PANEL_WIDTH; btnTitle.setWidth(Math.max(txtTitleWidth, 5) + "px"); } }); }
From source file:com.google.mobile.trippy.web.client.view.CommentListItemView.java
License:Apache License
public CommentListItemView() { initWidget(uiBinder.createAndBindUi(this)); Window.addWindowResizeListener(new WindowResizeListener() { @Override/* ww w . j a va 2 s .c o m*/ public void onWindowResized(int width, int height) { int txtTitleWidth = width - 100; user.setWidth(txtTitleWidth + "px"); date.setWidth(60 + "px"); } }); }
From source file:com.google.mobile.trippy.web.client.view.TripListItemView.java
License:Apache License
/** * Creates Trip Panel.//from www . j a v a 2 s. c om */ @SuppressWarnings("deprecation") public TripListItemView() { super(); initWidget(uiBinder.createAndBindUi(this)); //TODO :Its just remove the tabindex from DOM. But need to find //the alternative approach. container.getElement().getChild(container.getTabIndex()).removeFromParent(); Window.addWindowResizeListener(new WindowResizeListener() { @Override public void onWindowResized(int width, int height) { int txtTitleWidth = width - 40; lblName.setWidth(txtTitleWidth + "px"); } }); }
From source file:com.google.mobile.trippy.web.client.view.UpcomingTripView.java
License:Apache License
public UpcomingTripView() { initWidget(uiBinder.createAndBindUi(this)); //TODO: Use good approach if available. Window.addWindowResizeListener(new WindowResizeListener() { @Override/*w w w . jav a 2 s . com*/ public void onWindowResized(int width, int height) { int txtTitleWidth = width - TRIP_NAME_PADDING; lblName.setWidth(txtTitleWidth + "px"); } }); //TODO :Its just remove the tabindex from DOM. But need to find //the alternative approach. container.getElement().getChild(container.getTabIndex()).removeFromParent(); }
From source file:org.apache.servicemix.gshellweb.client.Console.java
License:Apache License
public Console() { addStyleName("console"); addStyleName("console-pro"); setAnimationEnabled(true);/* ww w. j ava 2 s .c o m*/ FlowPanel panel = new FlowPanel(); add(panel); // Setup the output area. output = new HTML(); output.setStyleName("output"); panel.add(output); // Setup the prompt Area.. prompt = new HTML(); prompt.setStyleName("prompt"); input = new TextBox(); input.setStyleName("input"); Grid promptTable = new Grid(1, 2); promptTable.setWidget(0, 0, prompt); promptTable.getCellFormatter().setStyleName(0, 0, "prompt"); promptTable.setWidget(0, 1, input); promptTable.getCellFormatter().setStyleName(0, 1, "input"); panel.add(promptTable); input.addKeyboardListener(new KeyboardListenerAdapter() { public void onKeyPress(Widget sender, char keyCode, int modifiers) { switch (keyCode) { case KEY_TAB: onTab(); input.cancelKey(); break; case KEY_UP: onUpHistory(); input.cancelKey(); break; case KEY_DOWN: onDownHistroy(); input.cancelKey(); break; case KEY_ENTER: onEnter(); input.cancelKey(); break; } } }); getElement().getStyle().setProperty("margin", "20px"); getElement().getStyle().setProperty("minWidth", (Window.getClientWidth() - 100) + "px"); getElement().getStyle().setProperty("minHeight", (Window.getClientHeight() - 100) + "px"); Window.addWindowResizeListener(new WindowResizeListener() { public void onWindowResized(int width, int height) { getElement().getStyle().setProperty("minWidth", (Window.getClientWidth() - 100) + "px"); getElement().getStyle().setProperty("minHeight", (Window.getClientHeight() - 100) + "px"); input.getElement().scrollIntoView(); } }); }
From source file:pl.touk.tola.gwt.client.widgets.AutosizeWindow.java
License:Apache License
@Override protected void afterRender() { super.afterRender(); com.google.gwt.user.client.Window.addWindowResizeListener(new WindowResizeListener() { public void onWindowResized(int width, int height) { arrangeWindow();//from w ww .j av a 2 s . c om } }); if (isOnEsc()) { new KeyNav<ComponentEvent>(this) { @Override public void onEsc(ComponentEvent ce) { super.onEsc(ce); hide(); } }; } }