List of usage examples for com.google.gwt.user.client.ui Widget getOffsetWidth
@Override public int getOffsetWidth()
From source file:edu.caltech.ipac.firefly.ui.catalog.CatalogSearchDialog.java
private void performSearch(List<Param> params, final AsyncCallback<String> cb) { CatalogRequest req = new CatalogRequest(CatalogRequest.RequestType.GATOR_QUERY); req.setParams(params);/* ww w . jav a 2s . c o m*/ req.setUse(CatalogRequest.Use.CATALOG_OVERLAY); Widget w = getDialogWidget(); int cX = w.getAbsoluteLeft() + w.getOffsetWidth() / 2; int cY = w.getAbsoluteTop() + w.getOffsetHeight() / 2; IrsaCatalogTask.getCatalog(this.getDialogWidget(), req, new CatalogSearchResponse() { public void showNoRowsReturned() { PopupUtil.showError(_prop.getTitle("noRowsReturned"), _prop.getError("noRowsReturned")); } public void status(RequestStatus requestStatus) { cb.onSuccess("ok"); } }, cX, cY, panel.getTitle()); }
From source file:edu.caltech.ipac.firefly.ui.catalog.CatalogSearchDropDown.java
private void performSearch(List<Param> params) { CatalogRequest req = new CatalogRequest(CatalogRequest.RequestType.GATOR_QUERY); req.setParams(params);/*from ww w . j a va 2 s.c om*/ req.setUse(CatalogRequest.Use.CATALOG_OVERLAY); if (useSearchAdmin) { hide(); String title = req.getParam(CatalogRequest.CATALOG_PROJECT) == null ? "" : req.getParam(CatalogRequest.CATALOG_PROJECT) + "-"; title = title + req.getQueryCatName(); SearchAdmin.getInstance().submitSearch(req, title); } else { Widget w = _mainPanel.getParent(); int cX = w.getAbsoluteLeft() + w.getOffsetWidth() / 2; int cY = w.getAbsoluteTop() + w.getOffsetHeight() / 2; IrsaCatalogTask.getCatalog(_mainPanel, req, new CatalogSearchResponse() { public void showNoRowsReturned() { PopupUtil.showError(_prop.getTitle("noRowsReturned"), _prop.getError("noRowsReturned")); } public void status(RequestStatus requestStatus) { hide(); } }, cX, cY, _catalogPanel.getTitle()); } }
From source file:edu.caltech.ipac.firefly.ui.catalog.CatddPanel.java
public void onResize() { Widget parent = getParent(); if (panel != null && html != null && formType != null) { int fixedHeight = panel.getOffsetHeight() + html.getOffsetHeight() + formType.getOffsetHeight(); int h = parent.getOffsetHeight() - fixedHeight; int w = (parent.getOffsetWidth() - 15); if (w > 0 && h > 0) { table.setSize(w + "px", h + "px"); }//from ww w . j a va 2 s . c o m } }
From source file:edu.caltech.ipac.firefly.ui.DynDownloadSelectionDialog.java
private void startPackaging() { TitleRet title = buildTitle();//from w w w . j av a 2s. c om String emailStr = null; if (_useEmail.getValue() && !StringUtils.isEmpty(_emailField.getValue())) { emailStr = _emailField.getValue(); Preferences.set(BackgroundManager.EMAIL_PREF, emailStr); } DownloadRequest dataRequest = getDownloadRequest(); LayoutManager lman = Application.getInstance().getLayoutManager(); dataRequest.setBaseFileName(title.getFileName()); dataRequest.setTitle(title.getTitle()); dataRequest.setEmail(emailStr); dataRequest.setDataSource(DynRequestHandler.getCurrentProject()); // set options into request List<InputField> ifs = Form.searchForFields(_optionsPanel); for (InputField i : ifs) { if (GwtUtil.isOnDisplay(i) || i instanceof HiddenField) { dataRequest.setParam(i.getFieldDef().getName(), i.getValue()); } } Widget maskW = lman.getRegion(LayoutManager.RESULT_REGION).getDisplay(); Widget w = getDialogWidget(); int cX = w.getAbsoluteLeft() + w.getOffsetWidth() / 2; int cY = w.getAbsoluteTop() + w.getOffsetHeight() / 2; PackageTask.preparePackage(maskW, cX, cY, dataRequest); }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
/** * return true if this component is visible and occupy space * * @param widget the widget to test//from w ww. j a va 2 s . com * @return true if is on the display */ public static boolean isOnDisplay(Widget widget) { if (widget != null) { boolean val = (widget.getOffsetHeight() * widget.getOffsetWidth() > 0) && isVisible(widget.getElement()); return val; } return false; }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
public static ScreenPt getCenterPos(Widget w) { if (w == null) return new ScreenPt(-1, -1); int x = w.getOffsetWidth() / 2 + w.getAbsoluteLeft(); int y = w.getOffsetHeight() / 2 + w.getAbsoluteTop(); return new ScreenPt(x, y); }
From source file:edu.caltech.ipac.firefly.ui.imageGrid.BasicImageGrid.java
protected int getResizedWidth() { int px = 64; // min width should be no less than min plot width Widget parent = mainPanel; if (parent != null) { px = parent.getOffsetWidth() / columns; px = px > 74 ? px - 10 : 64;//from w w w. jav a 2 s . c o m } return px; }
From source file:edu.caltech.ipac.firefly.ui.PopoutControlsUI.java
public Dimension getGridDimension(int rows, int cols) { final int margin = 4; final int panelMargin = 14; Widget p = _expandGrid.getParent(); if (!GwtUtil.isOnDisplay(p)) return null; int w = (p.getOffsetWidth() - panelMargin) / cols - margin; int h = (p.getOffsetHeight() - panelMargin) / rows - margin; return new Dimension(w, h); }
From source file:edu.caltech.ipac.firefly.ui.PopupPane.java
/** * Determine where the place the popup. This is a huge and central method to PopupPane - it needs come cleaning up * @param xoffset offset x added to alignment * @param yoffset offset y added to alignment *///from w ww . j ava 2s.c o m private void alignPopup(final int xoffset, final int yoffset) { int x, y; if (popup != null) GwtUtil.setStyle(popup, "clip", "auto"); if (firstAlign) { optimalWidth = content.getOffsetWidth(); optimalHeight = content.getOffsetHeight(); DeferredCommand.addCommand(new Command() { public void execute() { adjustResizable(); } }); } firstAlign = false; locateMask(); PointerDir dir = PointerDir.NONE; if (alignAt == Align.DISABLE) { if (_pointerPopup) alignPointer(PointerDir.NORTH); return; } Widget alignWidget = this.alignWidget; if (alignWidget == null) alignWidget = RootPanel.get(); int popupHeight = popup.getOffsetHeight(); int popupWidth = popup.getOffsetWidth(); int rootHeight = Window.getClientHeight(); int rootWidth = Window.getClientWidth(); int alignX = alignWidget.getAbsoluteLeft(); int alignY = alignWidget.getAbsoluteTop(); int alignWidth = alignWidget.getOffsetWidth(); int alignHeight = alignWidget.getOffsetHeight(); if (alignAt == Align.BOTTOM_LEFT) { x = alignX + xoffset; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.BOTTOM_RIGHT) { x = alignX + alignWidth + xoffset; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.AUTO_POINTER) { dir = PointerDir.NORTH; definePointerDirection(dir); x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight + yoffset; if (y + popupHeight > Window.getClientHeight()) { dir = PointerDir.SOUTH_WEST; definePointerDirection(dir); x = alignX + alignWidth + xoffset; if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = (alignY - popupHeight + 5) - yoffset; } } else if (alignAt == Align.BOTTOM_CENTER) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight + yoffset; } else if (alignAt == Align.VISIBLE_BOTTOM) { //todo rootHeight = Window.getClientHeight(); x = Window.getScrollLeft() + xoffset; y = Window.getScrollTop() + Window.getClientHeight() - popupHeight + yoffset; } else if (alignAt == Align.BOTTOM_CENTER_POPUP_BOTTOM) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = alignY + alignHeight - popupHeight + yoffset; } else if (alignAt == Align.TOP_CENTER) { x = alignX + (alignWidth / 2) - (popupWidth >> 1); if (_pointerPopup) x += HOR_PTR_IMAGE_OFFSET; y = (alignY - popupHeight) - yoffset; } else if (alignAt == Align.TOP_RIGHT) { x = alignX + alignWidth + xoffset - popupWidth; y = alignY + yoffset; } else if (alignAt == Align.TOP_RIGHT_POPUP_RIGHT) { x = alignX + alignWidth + xoffset; y = alignY + yoffset; } else if (alignAt == Align.CENTER) { if (alignWidget == null) { int left = (Window.getClientWidth() - popupWidth) >> 1; int top = (Window.getClientHeight() - popupHeight) >> 1; x = Window.getScrollLeft() + left; y = Window.getScrollTop() + top; } else { int width = content.getOffsetWidth(); int height = content.getOffsetHeight(); x = alignX + alignWidth / 2; x = x - width / 2 + xoffset; y = alignY + alignHeight / 2; y = y - height / 2 + yoffset; } if (y < 0) y = 10; if (x < 0) x = 10; } else if (alignAt == Align.TOP_LEFT_POPUP_RIGHT) { x = alignX + xoffset - popupWidth; if (x < 0) x = 0; y = alignY + yoffset; } else if (alignAt == Align.TOP_LEFT_POPUP_BOTTOM) { x = alignX + xoffset; if (x < 0) x = 0; y = alignY + yoffset - popupHeight; } else if (alignAt == Align.TOP_RIGHT_OR_LEFT) { if (Window.getClientWidth() < (alignWidth + popupWidth)) { x = Window.getClientWidth() - ((xoffset + 35) + popupWidth); if (x < 0) x = 0; y = alignY + yoffset; } else { x = alignX + alignWidth + xoffset; y = alignY + yoffset; } } else { // default to TOP_LEFT x = 1 + xoffset; y = 1 + yoffset; } //---- // Now adjust the popup to fit in the viewable area //---- if (x + popupWidth > rootWidth) { x = x - ((x + popupWidth) - rootWidth); // move if over by the amount it is off the side } if (y + popupHeight > rootHeight && rootHeight > 10) { //if bottom of dialog is off the bottom, if root height is near 0 then don't adjust y = y - ((y + popupHeight) - rootHeight); // move if up by the amount it is off the bottom } if (y < Window.getScrollTop()) y = Window.getScrollTop() + 1; // if it is off the top set it to the top +1 if (x < Window.getScrollLeft()) x = Window.getScrollLeft() + 1;// if it is off the left set it to the left +1 if (_doAlign) _doAlign = _autoAlign; alignPointer(dir); if (popup.isVisible()) { if (popup.getAbsoluteLeft() != x || popup.getAbsoluteTop() != y) { popup.setPopupPosition(x, y); } } }
From source file:edu.caltech.ipac.firefly.ui.PopupUtil.java
public static void showMinimalError(Widget anchor, String msg) { final PopupPanel p = new PopupPanel(true); p.setAnimationEnabled(true);// w ww. j a v a2 s .c o m p.addStyleName("onTopDialog"); p.setWidget(new HTML(msg)); p.setPopupPosition(anchor.getAbsoluteLeft() + anchor.getOffsetWidth(), anchor.getAbsoluteTop() + anchor.getOffsetHeight()); p.show(); new Timer() { public void run() { p.hide(); } }.schedule(4000); }