List of usage examples for com.google.gwt.user.client.ui Widget getOffsetWidth
@Override public int getOffsetWidth()
From source file:com.xpn.xwiki.watch.client.ui.UserInterface.java
License:Open Source License
public int getFeedTreeWidth() { Widget w = (Widget) widgetMap.get("feedtree"); return (w == null) ? 0 : w.getOffsetWidth(); }
From source file:com.xpn.xwiki.watch.client.ui.UserInterface.java
License:Open Source License
public int getFilterBarWidth() { Widget w = (Widget) widgetMap.get("filterbar"); return (w == null) ? 0 : w.getOffsetWidth(); }
From source file:com.xpn.xwiki.watch.client.ui.utils.LoadingWidget.java
License:Open Source License
/** * Overrides {@link DeckPanel#showWidget(int)} to set the size of this Widget by its main widget and resize all the * other panels to match the size of the main panel. The main panel is considered to be the panel at index 0. *///from w w w . jav a2s. c o m public void showWidget(int index) { String widthString = ""; String heightString = ""; // if we don't show main widget we inherit width and height otherwise we set it to none so that it resizes if (index != 0 && this.getVisibleWidget() >= 0) { Widget visibleWidget = this.getWidget(this.getVisibleWidget()); widthString = visibleWidget.getOffsetWidth() + "px"; heightString = visibleWidget.getOffsetHeight() + "px"; } super.showWidget(index); this.getWidget(index).setWidth(widthString); this.getWidget(index).setHeight(heightString); }
From source file:com.youtube.statistics.client.RecentQueriesPanel.java
License:Apache License
public RecentQueriesPanel(Widget parent) { panel = new VerticalPanel(); panel.addStyleName("recentQueriesPanel"); // Calculate the position to be twice the width of the button, and align // with the right hand edge of the parent, allowing for a margin. int margin = 2; int width = 2 * parent.getOffsetWidth(); int top = parent.getAbsoluteTop() + parent.getOffsetHeight() + margin; int right = parent.getAbsoluteLeft() + parent.getOffsetWidth() - margin; int left = right - width; panel.getElement().getStyle().setPropertyPx("left", left); panel.getElement().getStyle().setPropertyPx("top", top); panel.getElement().getStyle().setPropertyPx("width", width); panel.setVisible(false);/*from w ww . j ava 2 s. c o m*/ }
From source file:de.eckhartarnold.client.GalleryWidget.java
License:Apache License
@Override public void onResized() { Widget parent = getParent(); if (parent == null) return;/*from ww w. j a v a2 s . c o m*/ int width = parent.getOffsetWidth(); HorizontalPanel row = null; int columns = (width - paddingH) / (edgeWidth + paddingH); if (columns <= 0) columns = 1; int rows = thumbnails.size() / columns; if (thumbnails.size() % columns != 0) rows++; if (imageRows != null) { if (rows == imageRows.length && imageRows[0].getWidgetCount() == columns) { return; // layout did not change! } for (HorizontalPanel p : imageRows) { panel.remove(p); } } imageRows = new HorizontalPanel[rows]; for (int i = 0; i < thumbnails.size(); i++) { if (i % columns == 0) { row = new HorizontalPanel(); row.setStyleName("galleryRow"); //row.setSpacing(paddingV); row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); imageRows[i / columns] = row; } Image img = thumbnails.get(i); if (captions[i].asString().length() > 0) { Tooltip.addToWidget(new Tooltip(captions[i]), img); // sometimes wrong tooltip position!? } row.add(img); //int delta = 0; //if (paddingH > paddingV) delta = 2*(paddingH-paddingV); row.setCellWidth(img, edgeWidth + 2 * paddingH + "px"); row.setCellHeight(img, edgeHeight + 2 * paddingV + "px"); } for (HorizontalPanel r : imageRows) { panel.add(r); } }
From source file:de.eckhartarnold.client.MovablePopupPanel.java
License:Apache License
private boolean isTargetChildWidget(NativeEvent event) { Widget child = getWidget(); Element target = Element.as(event.getEventTarget()); int x = child.getAbsoluteLeft(); int y = child.getAbsoluteTop(); int w = child.getOffsetWidth(); int h = Toolbox.getOffsetHeight(child); int ex = event.getClientX(); int ey = event.getClientY(); return (ex >= x && ey >= y && ex < x + w && ey < y + h) || this.getWidget().getElement().isOrHasChild(target); }
From source file:de.eckhartarnold.client.Tooltip.java
License:Apache License
public void onMouseOver(MouseOverEvent event) { Widget sender = (Widget) event.getSource(); timer.posX = sender.getAbsoluteLeft() + sender.getOffsetWidth() - X_OFFSET; timer.posY = sender.getAbsoluteTop() + Toolbox.getOffsetHeight(sender) - Y_OFFSET; timerExpired = false;// ww w . j a v a2 s. c o m if (limit != 0) timer.schedule(delay); }
From source file:de.gmino.geobase.client.map.OpenLayersSmartLayer.java
public void clickedPoi(long poiId) { System.out.println("Clicked POI, entering try-block."); try {//from ww w.j av a 2s . com final PoiInterface poi = pois.get(poiId); Entity oAsEntity = (Entity) poi; GwtPopupCreator<PoiInterface> creator = popupCreatorMap.get(oAsEntity.getType()); if (creator == null) throw new RuntimeException("No PopupCreator for tyoe " + oAsEntity.getType().toString()); final Widget widget = creator.createPopup(poi); if (currentPopup != null) { currentPopup.removeFromParent(); currentPopup = null; } // TODO: This div will never be removed, but because of its size it // doesn't really matter. DivElement div = mapView.createPopup(poi.getLocation(), poi.getId() + "", 1, 1); HTMLPanel.wrap(div).add(widget); currentPopup = widget; // the popup width is not always computeted correctly the first time and simple deferring doesn't help. Therefore, we ask for the width until it seems about right before using ist. Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { int offsetWidth = widget.getOffsetWidth(); int offsetHeight = widget.getOffsetHeight(); if (offsetWidth < 160) return true; mapView.panRectIntoMap(poi.getLocation(), offsetWidth, offsetHeight, 22, 38, true); return false; } }, 100); System.out.println("Clicked POI, finished try-block."); } catch (Throwable e) { Log.exception("Handling clickedPoi", e); System.err.println("#####"); e.printStackTrace(); } }
From source file:edu.caltech.ipac.firefly.ui.background.BackgroundGroupsDialog.java
private void animateHide() { Widget w = getDialogWidget(); int cX = w.getAbsoluteLeft() + w.getOffsetWidth() / 2; int cY = w.getAbsoluteTop() + w.getOffsetHeight() / 2; if (getVisibleCnt() > 0) { Application.getInstance().getBackgroundManager().animateToManager(cX, cY, 500); }/*from w ww .j a v a 2s . co m*/ }
From source file:edu.caltech.ipac.firefly.ui.catalog.CatalogPanel.java
private void setTargetCard(int card) { if (card == TARGET_PANEL && _targetPanelHolder.getWidget() == null) { _targetPanelHolder.setWidget(_targetPanel); }/*from w w w. j a va2 s. c o m*/ if (card == TARGET_DESC) updateTargetDesc(); if (card == TARGET_HIDDEN && _targetCards.getVisibleWidget() == TARGET_DESC) { Widget desc = _targetCards.getWidget(TARGET_DESC); Widget hidden = _targetCards.getWidget(TARGET_HIDDEN); hidden.setSize(desc.getOffsetWidth() + "px", desc.getOffsetHeight() + "px"); } _targetCards.showWidget(card); }