Java Code Examples for com.google.gwt.user.client.Window#addResizeHandler()
The following examples show how to use
com.google.gwt.user.client.Window#addResizeHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventPreviewAutoHiderRegistrar.java From swellrt with Apache License 2.0 | 6 votes |
@Override public void registerAutoHider(final AutoHider autoHider) { autoHider.setRegistered(true); autoHiders.add(autoHider); if (eventPreviewRegistration == null) { eventPreviewRegistration = Event.addNativePreviewHandler(this); } if (onResizeRegistration == null) { onResizeRegistration = Window.addResizeHandler(this); } if (onHistoryRegistration == null) { onHistoryRegistration = History.addValueChangeHandler(this); } }
Example 2
Source File: AutoSizingTextArea.java From gwt-traction with Apache License 2.0 | 6 votes |
@Override protected void onLoad() { Element boxElement = box.getElement(); int lineHeight = MiscUtils.getComputedStyleInt(boxElement, "lineHeight"); setExtraSize(lineHeight); setMinFromCss("minHeight"); setMaxFromCss("maxHeight"); // we also need to make sure the widths are the same. matchStyles("width"); // don't let the shadow have any size shadow.setHeight("0"); divExtra = 0; divExtra += MiscUtils.getComputedStyleInt(boxElement, "paddingTop"); divExtra += MiscUtils.getComputedStyleInt(boxElement, "paddingBottom"); resizeRegistration = Window.addResizeHandler(this); super.onLoad(); }
Example 3
Source File: DocumentationDisplay.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
public DocumentationDisplay() { this.initWidget(Binder.BINDER.createAndBindUi(this)); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { DocumentationDisplay.this.redraw(false); } }); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { DocumentationDisplay.this.redraw(true); } }); }
Example 4
Source File: EventPreviewAutoHiderRegistrar.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
@Override public void registerAutoHider(final AutoHider autoHider) { autoHider.setRegistered(true); autoHiders.add(autoHider); if (eventPreviewRegistration == null) { eventPreviewRegistration = Event.addNativePreviewHandler(this); } if (onResizeRegistration == null) { onResizeRegistration = Window.addResizeHandler(this); } if (onHistoryRegistration == null) { onHistoryRegistration = History.addValueChangeHandler(this); } }
Example 5
Source File: HtmlLauncher.java From gdx-vfx with Apache License 2.0 | 5 votes |
@Override public GwtApplicationConfiguration getConfig() { Window.enableScrolling(false); Window.setMargin("0"); Window.addResizeHandler(new ResizeListener()); int w = Window.getClientWidth() - PADDING; int h = Window.getClientHeight() - PADDING; cfg = new GwtApplicationConfiguration(w, h); cfg.preferFlash = false; cfg.disableAudio = true; // cfg.useDebugGL = true; //TODO Remove it. return cfg; }
Example 6
Source File: FilterBox.java From unitime with Apache License 2.0 | 5 votes |
@Override protected void onAttach() { super.onAttach(); resizeFilterIfNeeded(); iResizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { resizeFilterIfNeeded(); } }); }
Example 7
Source File: Djvu_html5.java From djvu-html5 with GNU General Public License v2.0 | 5 votes |
private Widget prepareCanvas() { canvas = Canvas.createIfSupported(); if (canvas == null) { // TODO throw new RuntimeException("Canvas not supported!"); } canvas.setTabIndex(0); final SimplePanel panel = new SimplePanel(canvas); panel.setStyleName("content"); Window.addResizeHandler(e -> resizeCanvas()); Scheduler.get().scheduleFinally(() -> resizeCanvas()); return panel; }
Example 8
Source File: AttachedContextPanel.java From bitcoin-transaction-explorer with MIT License | 5 votes |
@Override public void show() { super.show(); if(resizeRegistration != null) { resizeRegistration.removeHandler(); } resizeRegistration = Window.addResizeHandler(this); }
Example 9
Source File: GuidedTourHelper.java From core with GNU Lesser General Public License v2.1 | 5 votes |
static void init(BootstrapContext bootstrapContext) { String locale = Preferences.get(Preferences.Key.LOCALE, "en"); String url = bootstrapContext.getProperty(ApplicationProperties.GUIDED_TOUR) + "/" + (bootstrapContext.isStandalone() ? "standalone" : "domain") + "/step1.html?setLng=" + locale; Frame tourFrame = new Frame(url); tourFrame.setWidth("100%"); tourFrame.setHeight("100%"); guidedTour = new PopupPanel(true, true) { { Window.addResizeHandler(resizeEvent -> { if (isShowing()) { center(); } }); } @Override protected void onPreviewNativeEvent(Event.NativePreviewEvent event) { if (Event.ONKEYUP == event.getTypeInt()) { if (event.getNativeEvent().getKeyCode() == KeyboardEvent.KeyCode.ESC) { hide(); } } } }; guidedTour.setGlassEnabled(true); guidedTour.setAnimationEnabled(false); guidedTour.setWidget(tourFrame); guidedTour.setWidth("1120px"); guidedTour.setHeight("800px"); guidedTour.setStyleName("default-window"); exportCloseMethod(); }
Example 10
Source File: ToolsPresenter.java From core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void onBind() { Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { Scheduler.get().scheduleDeferred(() -> browserWindow=null); } }); }
Example 11
Source File: YaBlocksEditor.java From appinventor-extensions with Apache License 2.0 | 4 votes |
YaBlocksEditor(YaProjectEditor projectEditor, YoungAndroidBlocksNode blocksNode) { super(projectEditor, blocksNode); this.blocksNode = blocksNode; COMPONENT_DATABASE = SimpleComponentDatabase.getInstance(getProjectId()); fullFormName = blocksNode.getProjectId() + "_" + blocksNode.getFormName(); formToBlocksEditor.put(fullFormName, this); blocksArea = new BlocklyPanel(this, fullFormName); // [lyn, 2014/10/28] pass in editor so can extract form json from it blocksArea.setWidth("100%"); // This code seems to be using a rather old layout, so we cannot simply pass 100% for height. // Instead, it needs to be calculated from the client's window, and a listener added to Window // We use VIEWER_WINDOW_OFFSET as an approximation of the size of the top navigation bar // New layouts don't need all this messing; see comments on selected answer at: // http://stackoverflow.com/questions/86901/creating-a-fluid-panel-in-gwt-to-fill-the-page blocksArea.setHeight(Window.getClientHeight() - VIEWER_WINDOW_OFFSET + "px"); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { int height = event.getHeight(); blocksArea.setHeight(height - VIEWER_WINDOW_OFFSET + "px"); } }); initWidget(blocksArea); blocksArea.populateComponentTypes(COMPONENT_DATABASE.getComponentsJSONString()); // Get references to the source structure explorer sourceStructureExplorer = BlockSelectorBox.getBlockSelectorBox().getSourceStructureExplorer(); // Listen for selection events for built-in drawers BlockSelectorBox.getBlockSelectorBox().addBlockDrawerSelectionListener(this); // Create palettePanel, which will be used as the content of the PaletteBox. myFormEditor = projectEditor.getFormFileEditor(blocksNode.getFormName()); if (myFormEditor != null) { palettePanel = new YoungAndroidPalettePanel(myFormEditor); palettePanel.loadComponents(new DropTargetProvider() { // TODO(sharon): make the tree in the BlockSelectorBox a drop target @Override public DropTarget[] getDropTargets() { return new DropTarget[0]; } }); palettePanel.setSize("100%", "100%"); } else { palettePanel = null; OdeLog.wlog("Can't get form editor for blocks: " + getFileId()); } }
Example 12
Source File: ExtendedDockPanel.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * Extended dock panel */ public ExtendedDockPanel() { dockPanel = new DockLayoutPanel(Unit.PX); folderSelectPopup = new FolderSelectPopup(); enableKeyShorcuts(); // Object initialization topPanel = new TopPanel(); leftBorderPanel = new VerticalBorderPanel(); rightBorderPanel = new VerticalBorderPanel(); bottomPanel = new BottomPanel(); // Desktop panels initialization desktop = new Desktop(); // Search panels initialization search = new Search(); // Dashboard panel initialization dashboard = new Dashboard(); // Administration panel initialization administration = new Administration(); // set inner component's size setWidgetsSize(); actualView = UIDockPanelConstants.DESKTOP; // Creates the dockPanel dockPanel.addNorth(topPanel, TopPanel.PANEL_HEIGHT); dockPanel.addSouth(bottomPanel, BottomPanel.PANEL_HEIGHT); dockPanel.addWest(leftBorderPanel, VERTICAL_BORDER_PANEL_WIDTH); dockPanel.addEast(rightBorderPanel, VERTICAL_BORDER_PANEL_WIDTH); dockPanel.add(desktop); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { setWidgetsSize(); Main.get().mainPanel.topPanel.toolBar.windowResized(); // splitter changes } }); initWidget(dockPanel); }
Example 13
Source File: GwtSplitLayoutImplConnector.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void init() { super.init(); myCloseRegister = Window.addResizeHandler(this); }
Example 14
Source File: DefaultPopup.java From core with GNU Lesser General Public License v2.1 | 4 votes |
public DefaultPopup(Arrow arrow, boolean isTooltip) { super(true); this.arrow = arrow; getElement().setAttribute("role", "alert"); getElement().setAttribute("aria-live", "assertive"); this.sinkEvents(Event.ONKEYDOWN); addStyleName("default-popup"); if(isTooltip) addStyleName("tooltip"); String baseCss = isTooltip ? "tooltip-triangle-border": "triangle-border"; if(Arrow.TOP.equals(arrow)) { addStyleName(baseCss); addStyleName("top"); } else if(Arrow.TOPLEFT.equals(arrow)) { addStyleName(baseCss); addStyleName("top-left"); } else if(Arrow.BOTTOM.equals(arrow)) { addStyleName(baseCss); } else if(Arrow.RIGHT.equals(arrow)) { addStyleName(baseCss); addStyleName("right"); } else if(Arrow.RIGHTTOP.equals(arrow)) { addStyleName(baseCss); addStyleName("right-top"); } Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent resizeEvent) { hide(); } }); setAutoHideEnabled(true); setAutoHideOnHistoryEventsEnabled(true); }
Example 15
Source File: ColumnManager.java From core with GNU Lesser General Public License v2.1 | 4 votes |
public ColumnManager(SplitLayoutPanel delegate, FinderColumn.FinderId finderId) { this.splitlayout = delegate; this.finderId = finderId; this.eventBus = Console.MODULES.getPlaceManager(); this.initialized = false; // default state if(null==totalColumnsVisible.get(finderId)) totalColumnsVisible.put(finderId, 0); this.splitlayout.addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if(!event.isAttached()) { //System.out.println("Detach finder"); decreaseTotalVisibleBy(ColumnManager.this.visibleColumns.size()); assertVisibleColumns(); } else { // skip the first attach event if(initialized) { // System.out.println("Attach finder"); if (visibleColumns.size() > 0) { increaseTotalVisibleBy(ColumnManager.this.visibleColumns.size()); assertVisibleColumns(); } } else { initialized = true; } scrollIfNecessary(); } } }); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent resizeEvent) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { scrollIfNecessary(); } }); } }); }
Example 16
Source File: ListPopupPanel2.java From consulo with Apache License 2.0 | 3 votes |
/** * Creates an instance of this class and sets the parent combo box value. * * @param selectionTextBox is a selection box value. */ protected ListPopupPanel2(WidgetComboBox selectionTextBox) { super(false, false); this.comboBox = selectionTextBox; setStyleName("advanced-ListPopupPanel"); setWidget(getScrollPanel()); getList().setStyleName("list"); Window.addResizeHandler(new ListWindowResizeHandler()); }