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

The following examples show how to use com.google.gwt.event.logical.shared.ResizeEvent. 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
Source Project: gwt-material   Source File: DefaultViewPortResizeHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void load(Functions.Func1<ResizeEvent> callback) {
    // Optimize Window Resizing by just executing the callback once resizing is done.
    Timer timer = new Timer() {
        @Override
        public void run() {
            callback.call(event);
        }
    };

    resize = Window.addResizeHandler(event -> {
        this.event = event;

        timer.schedule(resizingDelayMillis);

        // Optimize the Resizing by turning of the animation
        RootPanel.get().addStyleName(RESIZE_ANIMATION_STOPPER);
        Scheduler.get().scheduleFixedDelay(() -> {
            RootPanel.get().removeStyleName(RESIZE_ANIMATION_STOPPER);
            return false;
        }, 400);
    });
}
 
Example 2
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 3
Source Project: gdx-vfx   Source File: HtmlLauncher.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onResize(ResizeEvent event) {
    int width = event.getWidth() - PADDING;
    int height = event.getHeight() - PADDING;
    getRootPanel().setSize(width + "px", height + "px");
    getApplicationListener().resize(width, height);
    Gdx.graphics.setWindowedMode(width, height);
}
 
Example 4
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 5
Source Project: unitime   Source File: StudentSectioningWidget.java    License: Apache License 2.0 5 votes vote down vote up
public void prev() {
	iPanel.remove(iAssignmentDock);
	iPanel.insert(iCourseRequests, 1);
	iRequests.setVisible(false); iRequests.setEnabled(false);
	iReset.setVisible(false); iReset.setEnabled(false);
	iQuickAdd.setVisible(false); iQuickAdd.setEnabled(false);
	iEnroll.setVisible(false); iEnroll.setEnabled(false);
	iChangeGradeModes.setVisible(false); iChangeGradeModes.setEnabled(false);
	iSubmitSpecReg.setVisible(false); iSubmitSpecReg.setEnabled(false);
	if (iCustomCheckbox != null) {
		iCustomCheckbox.setVisible(false); iCustomCheckbox.setEnabled(false);
	}
	iPrint.setVisible(false); iPrint.setEnabled(false);
	if (iExport != null) {
		iExport.setVisible(false); iExport.setEnabled(false);
	}
	iSchedule.setVisible(iMode.isSectioning()); iSchedule.setEnabled(iMode.isSectioning());
	iSave.setVisible(!iMode.isSectioning()); iSave.setEnabled(!iMode.isSectioning() && iEligibilityCheck != null && iEligibilityCheck.hasFlag(EligibilityFlag.CAN_REGISTER));
	if (iEligibilityCheck != null && iEligibilityCheck.hasFlag(EligibilityFlag.DEGREE_PLANS)) {
		iDegreePlan.setVisible(true); iDegreePlan.setEnabled(true);
	}
	if (iEligibilityCheck != null && iEligibilityCheck.hasFlag(EligibilityFlag.HAS_ADVISOR_REQUESTS)) {
		iAdvisorReqs.setVisible(true); iAdvisorReqs.setEnabled(true);
	}
	clearMessage();
	ResizeEvent.fire(this, getOffsetWidth(), getOffsetHeight());
	AriaStatus.getInstance().setHTML(ARIA.courseRequests());
	updateScheduleChangedNoteIfNeeded();
}
 
Example 6
Source Project: consulo   Source File: ListPopupPanel2.java    License: Apache License 2.0 5 votes vote down vote up
/** See class docs */
@Override
public void onResize(ResizeEvent resizeEvent) {
  if (!isShowing()) {
    return;
  }

  int delta = getElement().getOffsetWidth() - getElement().getClientWidth();
  getScrollPanel().setWidth((getComboBox().getOffsetWidth() - delta) + "px");
  adjustSize();
}
 
Example 7
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 8
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 9
/**
 * 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 10
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 11
@Override
public void onResize(final ResizeEvent event) {
  attachToWidget(widget);
}
 
Example 12
Source Project: gwt-traction   Source File: AutoSizingTextArea.java    License: Apache License 2.0 4 votes vote down vote up
@Override
   public void onResize(ResizeEvent event) {
	matchStyles("width");
adjustSize();
   }
 
Example 13
@Override
public void onResize(ResizeEvent event) {
	resizeTimer.cancel();
	resizeTimer.schedule(100);
}
 
Example 14
@Override
public void onResize(ResizeEvent event) {
	ScrollPanel.this.reset();
}
 
Example 15
Source Project: lumongo   Source File: QueryView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onResize(ResizeEvent event) {
	splitPanel.setHeight(Math.max(600, Window.getClientHeight() - 102) + "px");
	leftScrollPanel.setHeight(Math.max(600, Window.getClientHeight() - 130) + "px");
	rightScrollPanel.setHeight(Math.max(600, Window.getClientHeight() - 130) + "px");
}
 
Example 16
Source Project: consulo   Source File: GwtSplitLayoutImplConnector.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onResize(ResizeEvent event) {
  getWidget().updateOnResize();
}
 
Example 17
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 18
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();
                }
            });
        }
    });
}
 
Example 19
Source Project: gwt-material   Source File: ViewPortResizeHandler.java    License: Apache License 2.0 votes vote down vote up
void load(Functions.Func1<ResizeEvent> callback);