Java Code Examples for com.google.gwt.user.client.Window#getClientHeight()

The following examples show how to use com.google.gwt.user.client.Window#getClientHeight() . 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: ListPopupPanel2.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * This method checks whether the limit of displayed items reached.<p/>
 * It takes into account different aspects including setting of the widget, geometrical size of the
 * drop down list and selected value that must be displayed.<p/>
 * This method optimally chooses a number of items to display.
 *
 * @param previouslyRenderedRows is a number of rows previously loaded in the list
 *                               (items count before filling the list).
 * @return a result of check.
 */
protected boolean isRenderingLimitReached(int previouslyRenderedRows) {
  ListDataModel model = getComboBox().getModel();
  int previousHeight = 0;

  if (previouslyRenderedRows > 0) {
    Widget last = getItem(previouslyRenderedRows - 1);
    Widget first = getItem(0);

    previousHeight = last.getOffsetHeight() + last.getAbsoluteTop() - first.getAbsoluteTop();
  }

  return model.getCount() <= 0 // no data
         // OR a selected value has already been displayed
         || getItemCount() > getComboBox().getSelectedIndex()
            // AND one of the following conditions is true:
            && (getItemCount() >= model.getCount() //no items any more
                // OR no limit but there are too many items
                || isLazyRenderingEnabled() && getVisibleRows() <= 0
                   && getList().getOffsetHeight() - previousHeight >= Window.getClientHeight() * 0.6
                // OR visible rows number is limited and there was a new page rendered excepting the first page
                // since two pages may be displayed if the list is rendered first time
                || isLazyRenderingEnabled() && getVisibleRows() > 0 && getItemCount() - previouslyRenderedRows > 0
                   && (getItemCount() - previouslyRenderedRows) % getVisibleRows() == 0
                   && (getItemCount() - previouslyRenderedRows) / getVisibleRows() != 1);
}
 
Example 2
Source File: AddMeetingsDialog.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void recenter() {
	GwtHint.getInstance().hide();
	
	iScrollRooms.getElement().getStyle().clearHeight();
	if (getElement().getClientHeight() > Window.getClientHeight() - 100)
		iScrollRooms.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX);
	
	iScrollDates.getElement().getStyle().clearHeight();
	if (getElement().getClientHeight() > Window.getClientHeight() - 100) {
		iScrollDates.getElement().getStyle().setHeight(Window.getClientHeight() - 200, Unit.PX);
	}

	int left = (Window.getClientWidth() - getOffsetWidth()) >> 1;
    int top = (Window.getClientHeight() - getOffsetHeight()) >> 1;
	setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max( Window.getScrollTop() + top, 0));
}
 
Example 3
Source File: LogoutPopup.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * OKM Logout
 */
public void logout() {
	button.setEnabled(false);
	int left = (Window.getClientWidth() - 300) / 2;
	int top = (Window.getClientHeight() - 200) / 2;
	setPopupPosition(left, top);
	setText(Main.i18n("logout.label"));
	show();
	Log.debug("Logout()");

	if (Main.get().mainPanel.bottomPanel.userInfo.isConnectedToChat()) {
		text.setText(Main.i18n("chat.logout"));
		disconnectChat();
	} else {
		text.setText(Main.i18n("logout.logout"));
		authService.logout(callbackLogout);
		Log.debug("Logout: void");
	}
}
 
Example 4
Source File: FuturamaWalking.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Evaluate
 */
public void evaluate(String name) {
	if (name.equals("futurama")) {
		left = -180;
		top = Window.getClientHeight() - 80 - 21;
		show();
		setPopupPosition(left, top);

		move = new Timer() {
			public void run() {
				left += 2;
				setPopupPosition(left, top);

				if (left < Window.getClientWidth() + 180) {
					move.schedule(40);
				} else {
					move.cancel();
					hide();
				}
			}
		};

		move.schedule(40);
	}
}
 
Example 5
Source File: FilterBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
private void position(final UIObject relativeObject, int offsetWidth, int offsetHeight) {
	int textBoxOffsetWidth = relativeObject.getOffsetWidth();
	int offsetWidthDiff = offsetWidth - textBoxOffsetWidth;
	int left = relativeObject.getAbsoluteLeft();
	if (offsetWidthDiff > 0) {
		int windowRight = Window.getClientWidth() + Window.getScrollLeft();
		int windowLeft = Window.getScrollLeft();
		int distanceToWindowRight = windowRight - left;
		int distanceFromWindowLeft = left - windowLeft;
		if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) {
			left -= offsetWidthDiff;
		}
	}
	int top = relativeObject.getAbsoluteTop();
	int windowTop = Window.getScrollTop();
	int windowBottom = Window.getScrollTop() + Window.getClientHeight();
	int distanceFromWindowTop = top - windowTop;
	int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());
	if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
		top -= offsetHeight;
	} else {
		top += relativeObject.getOffsetHeight();
	}
	setPopupPosition(left, top);
}
 
Example 6
Source File: FolderSelectPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup 
 */
public void show() {
	initButtons();
	status.setVisible(false);
	int left = (Window.getClientWidth() - 450) / 2;
	int top = (Window.getClientHeight() - 440) / 2;
	setPopupPosition(left, top);
	setText(Main.i18n("trash.directory.select.label"));

	// Resets to initial tree value
	folderSelectTree.reset();
	super.show();
}
 
Example 7
Source File: FindSimilarDocumentSelectPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup 
 */
public void show() {
	initButtons();
	int left = (Window.getClientWidth() - 700) / 2;
	int top = (Window.getClientHeight() - 350) / 2;
	setPopupPosition(left, top);
	setText(Main.i18n("search.similar.document"));

	// Resets to initial tree value
	removeAllRows();
	evaluateEnableAction();
	super.show();
}
 
Example 8
Source File: WorkflowPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Show the popup error
 *
 * @param msg Error message
 */
public void show() {
	setText(Main.i18n("workflow.label"));
	findLatestProcessDefinitions(); // Gets all groups
	listBox.setVisible(true);
	addButton.setEnabled(false);
	workflowWidget = null;
	listBox.setVisible(true);
	sp.setVisible(false);
	sp.clear();
	int left = (Window.getClientWidth() - 300) / 2;
	int top = (Window.getClientHeight() - 100) / 2;
	setPopupPosition(left, top);
	super.show();
}
 
Example 9
Source File: ErrorPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Show the popup error
 *
 * @param msg Error message
 */
public void show(String msg) {
	//TODO: aqui pueden haber problemas de concurrencia al ser llamado simultaneamente este método
	// cabe la posibilidad de perder algun mensaje de error.
	if (!text.getHTML().equals("")) {
		text.setHTML(text.getHTML() + "<br><br>" + msg);
	} else {
		text.setHTML(msg);
	}
	setText(Main.i18n("error.label"));
	int left = (Window.getClientWidth() - 380) / 2;
	int top = (Window.getClientHeight() - 200) / 2;
	setPopupPosition(left, top);
	super.show();
}
 
Example 10
Source File: ThesaurusSelectPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup 
 */
public void show(int selectedFrom) {
	this.selectedFrom = selectedFrom;
	initButtons();
	int left = (Window.getClientWidth() - 400) / 2;
	int top = (Window.getClientHeight() - 325) / 2;
	setPopupPosition(left, top);
	setText(Main.i18n("thesaurus.directory.select.label"));

	// Resets to initial tree value
	thesaurusPanel.reset();

	center();
}
 
Example 11
Source File: ConfirmPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows de popup
 */
public void show() {
	setText(Main.i18n("confirm.label"));
	int left = (Window.getClientWidth() - 300) / 2;
	int top = (Window.getClientHeight() - 125) / 2;
	setPopupPosition(left, top);
	super.show();
}
 
Example 12
Source File: GwtVerticalSplitLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected int getElementSize(Widget widget) {
  int offsetHeight = widget.getOffsetHeight();
  if(offsetHeight == 0) {
    offsetHeight = Window.getClientHeight();
  }
  return offsetHeight;
}
 
Example 13
Source File: FindFolderSelectPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup 
 */
public void show() {
	initButtons();
	int left = (Window.getClientWidth() - 700) / 2;
	int top = (Window.getClientHeight() - 350) / 2;
	setPopupPosition(left, top);
	setText(GeneralComunicator.i18n("search.folder.filter"));

	// Resets to initial tree value
	removeAllRows();
	keyword.setText("");
	evaluateEnableAction();
	super.show();
	keyword.setFocus(true);
}
 
Example 14
Source File: ConfirmPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows de popup
 */
public void show() {
	setText(GeneralComunicator.i18n("confirm.label"));
	int left = (Window.getClientWidth() - 300) / 2;
	int top = (Window.getClientHeight() - 125) / 2;
	setPopupPosition(left, top);
	super.show();
}
 
Example 15
Source File: RichTextPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows de popup
 */
public void show() {
	url.setText("http://");
	int left = (Window.getClientWidth() - 300) / 2;
	int top = (Window.getClientHeight() - 125) / 2;
	setPopupPosition(left, top);
	super.show();
}
 
Example 16
Source File: FindFolderSelectPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup 
 */
public void show() {
	initButtons();
	int left = (Window.getClientWidth() - 700) / 2;
	int top = (Window.getClientHeight() - 350) / 2;
	setPopupPosition(left, top);
	setText(GeneralComunicator.i18n("search.folder.filter"));

	// Resets to initial tree value
	removeAllRows();
	keyword.setText("");
	evaluateEnableAction();
	super.show();
	keyword.setFocus(true);
}
 
Example 17
Source File: FindFolderSelectPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Shows the popup 
 */
public void show() {
	initButtons();
	int left = (Window.getClientWidth() - 700) / 2;
	int top = (Window.getClientHeight() - 350) / 2;
	setPopupPosition(left, top);
	setText(Main.i18n("search.folder.filter"));

	// Resets to initial tree value
	removeAllRows();
	keyword.setText("");
	evaluateEnableAction();
	super.show();
	keyword.setFocus(true);
}
 
Example 18
Source File: StartUpPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
public StartUpPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	vPanel = new VerticalPanel();
	status = new VerticalPanel();
	table = new FlexTable();
	button = new Button(Main.i18n("button.close"), this);
	scrollPanel = new ScrollPanel(status);
	scrollPanel.setAlwaysShowScrollBars(false);
	scrollPanel.setSize("490px", "160px");
	scrollPanel.setStyleName("okm-Input");

	status.setWidth("" + (490 - IE_SIZE_RECTIFICATION) + "px");

	vPanel.add(new HTML("&nbsp;"));
	vPanel.add(scrollPanel);
	vPanel.add(new HTML("&nbsp;"));
	vPanel.add(table);
	vPanel.add(button);
	vPanel.add(new HTML("&nbsp;"));

	button.setVisible(false);
	button.setStyleName("okm-YesButton");

	vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(table, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);
	vPanel.setCellVerticalAlignment(scrollPanel, HasAlignment.ALIGN_MIDDLE);

	int left = (Window.getClientWidth() - 510) / 2;
	int top = (Window.getClientHeight() - 220) / 2;
	vPanel.setWidth("510px");
	vPanel.setHeight("220px");

	for (int i = 0; i < StartUp.STARTUP_LOADING_HISTORY_SEARCH; i++) {
		table.setWidget(0, i, new Image(OKMBundleResources.INSTANCE.loadedDisabledIcon()));
	}

	setText(Main.i18n("startup.openkm"));
	setPopupPosition(left, top);
	setWidget(vPanel);
}
 
Example 19
Source File: UiHelper.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public static int calculateSpaceToBottom(Widget widget) {
    return Window.getClientHeight() - widget.getAbsoluteTop() - widget.getOffsetHeight();
}
 
Example 20
Source File: AboutPopup.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * About popup
 */
public AboutPopup() {
	// Establishes auto-close when click outside
	super(false, true);

	futurama = new Futurama();
	int left = (Window.getClientWidth() - 300) / 2;
	int top = (Window.getClientHeight() - 280) / 2;

	vPanel = new VerticalPanel();
	text = new HTML();
	button = new Button(Main.i18n("button.close"), this);
	logo = new Image("img/logo_openkm.gif");

	vPanel.setWidth("300px");
	vPanel.setHeight("195px");
	button.setStyleName("okm-YesButton");

	text.setHTML(msg);

	vPanel.add(new HTML("<br>"));
	vPanel.add(logo);
	htmlAppVersion = new HTML(appVersion);
	vPanel.add(htmlAppVersion);
	htmlExtVersion = new HTML(extVersion);
	vPanel.add(htmlExtVersion);
	vPanel.add(new HTML("<br>"));
	vPanel.add(text);
	HTML htmlWeb = new HTML(web);
	vPanel.add(htmlWeb);
	HTML htmlTeam = new HTML(team);
	vPanel.add(htmlTeam);
	HTML htmlCopy = new HTML(copy);
	vPanel.add(htmlCopy);
	vPanel.add(button);
	vPanel.add(new HTML("<br>"));

	vPanel.setCellHorizontalAlignment(logo, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(htmlAppVersion, HasAlignment.ALIGN_RIGHT);
	vPanel.setCellHorizontalAlignment(htmlExtVersion, HasAlignment.ALIGN_RIGHT);
	vPanel.setCellHorizontalAlignment(text, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(htmlWeb, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(htmlTeam, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(htmlCopy, HasAlignment.ALIGN_CENTER);
	vPanel.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);

	setPopupPosition(left, top);

	super.hide();
	setWidget(vPanel);
}