Java Code Examples for com.google.gwt.event.logical.shared.ResizeHandler

The following examples show how to use com.google.gwt.event.logical.shared.ResizeHandler. These examples are extracted from open source projects. 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
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 2
Source Project: unitime   Source File: FilterBox.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onAttach() {
	super.onAttach();
	resizeFilterIfNeeded();
	iResizeHandler = Window.addResizeHandler(new ResizeHandler() {
		@Override
		public void onResize(ResizeEvent event) {
			resizeFilterIfNeeded();
		}
	});
}
 
Example 3
Source Project: gwt-traction   Source File: TractionDialogBox.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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.
 */
public void adjustGlassSize() {
    if (isGlassEnabled()) {
        ResizeHandler handler = getGlassResizer();
        if (handler != null) handler.onResize(null);
    }
}
 
Example 4
Source Project: core   Source File: ToolsPresenter.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void onBind() {
    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            Scheduler.get().scheduleDeferred(() -> browserWindow=null);
        }
    });
}
 
Example 5
Source Project: appinventor-extensions   Source File: YaBlocksEditor.java    License: Apache License 2.0 4 votes vote down vote up
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 6
/**
 * 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 7
Source Project: gwt-material   Source File: Window.java    License: Apache License 2.0 4 votes vote down vote up
public static HandlerRegistration addResizeHandler(ResizeHandler handler) {
    return com.google.gwt.user.client.Window.addResizeHandler(handler);
}
 
Example 8
Source Project: unitime   Source File: StudentSectioningWidget.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addResizeHandler(ResizeHandler handler) {
	return addHandler(handler, ResizeEvent.getType());
}
 
Example 9
Source Project: gwt-traction   Source File: TractionDialogBox.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Bypass "private" on glassResizer
 */
private native ResizeHandler getGlassResizer() /*-{
    return [email protected]::glassResizer;
}-*/;
 
Example 10
Source Project: core   Source File: DefaultPopup.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
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 11
Source Project: core   Source File: ColumnManager.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
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();
                }
            });
        }
    });
}