List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteLeft
public int getAbsoluteLeft()
From source file:com.threerings.gwt.ui.Popups.java
License:Open Source License
/** * Shows the supplied popup in the specified position relative to the specified target widget. */// www . j a va 2 s .c o m public static <T extends PopupPanel> T show(T popup, Position pos, Widget target) { popup.setVisible(false); popup.show(); int left, top; switch (pos) { case RIGHT: left = target.getAbsoluteLeft() + target.getOffsetWidth() + NEAR_GAP; break; default: left = target.getAbsoluteLeft(); break; } if (left + popup.getOffsetWidth() > Window.getClientWidth()) { left = Math.max(0, Window.getClientWidth() - popup.getOffsetWidth()); } switch (pos) { case ABOVE: top = target.getAbsoluteTop() - popup.getOffsetHeight() - NEAR_GAP; break; case OVER: top = target.getAbsoluteTop(); break; case RIGHT: top = target.getAbsoluteTop() + (target.getOffsetHeight() - popup.getOffsetHeight()) / 2; break; default: case BELOW: top = target.getAbsoluteTop() + target.getOffsetHeight() + NEAR_GAP; break; } popup.setPopupPosition(left, top); popup.setVisible(true); return popup; }
From source file:com.totsp.gwittir.client.ui.table.GridForm.java
License:Open Source License
private void render() { if (this.binding.getChildren().size() > 0) { this.binding.unbind(); this.binding.getChildren().clear(); }/*from w w w . j av a 2 s . c o m*/ int row = 0; for (int i = 0; i < this.fields.length;) { for (int col = 0; (col < this.columns) && (i < fields.length); col++) { final Field field = this.fields[i]; if (field == null) { i++; continue; } Widget widget = (Widget) this.createWidget(this.binding, field, (SourcesPropertyChangeEvents) this.getValue()); Label label = new Label(field.getLabel()); this.base.setWidget(row, col * 2, label); this.base.getCellFormatter().setStyleName(row, col * 2, "label"); this.base.setWidget(row, (col * 2) + 1, widget); this.base.getCellFormatter().setStyleName(row, (col * 2) + 1, "field"); if (field.getHelpText() != null) { label.addClickListener(new ClickListener() { public void onClick(Widget widget) { final PopupPanel p = new PopupPanel(true); p.setStyleName("gwittir-GridForm-Help"); p.setWidget(new HTML(field.getHelpText())); p.setPopupPosition(widget.getAbsoluteLeft(), widget.getAbsoluteTop() + widget.getOffsetHeight()); p.show(); } }); } i++; } row++; } }
From source file:com.totsp.gwittir.client.validator.PopupValidationFeedback.java
License:Open Source License
public void handleException(Object source, ValidationException exception) { final Widget w = (Widget) source; final PopupPanel p = new PopupPanel(false); popups.put(source, p);/*from w ww. j av a 2 s. c o m*/ p.setStyleName("gwittir-ValidationPopup"); p.setWidget(new Label(this.getMessage(exception))); p.setPopupPosition(-5000, -5000); p.show(); if (this.position == BOTTOM) { p.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop() + w.getOffsetHeight()); } else if (this.position == RIGHT) { p.setPopupPosition(w.getAbsoluteLeft() + w.getOffsetWidth(), w.getAbsoluteTop()); } else if (this.position == LEFT) { p.setPopupPosition(w.getAbsoluteLeft() - p.getOffsetWidth(), w.getAbsoluteTop()); } else if (this.position == TOP) { p.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop() - p.getOffsetHeight()); } if (w instanceof SourcesPropertyChangeEvents) { GWT.log("is PCE", null); PropertyChangeListener attachListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { if (((Boolean) propertyChangeEvent.getNewValue()).booleanValue()) { p.setVisible(true); } else { p.setVisible(false); } } }; listeners.put(w, attachListener); ((SourcesPropertyChangeEvents) w).addPropertyChangeListener("attached", attachListener); ((SourcesPropertyChangeEvents) w).addPropertyChangeListener("visible", attachListener); } }
From source file:com.vaadin.client.VUIDLBrowser.java
License:Apache License
static void highlight(ComponentConnector paintable) { if (paintable != null) { Widget w = paintable.getWidget(); Style style = highlight.getStyle(); style.setTop(w.getAbsoluteTop(), Unit.PX); style.setLeft(w.getAbsoluteLeft(), Unit.PX); style.setWidth(w.getOffsetWidth(), Unit.PX); style.setHeight(w.getOffsetHeight(), Unit.PX); RootPanel.getBodyElement().appendChild(highlight); }/*from w w w. j a v a2 s. c o m*/ }
From source file:com.vaadin.terminal.gwt.client.VUIDLBrowser.java
License:Open Source License
static void highlight(Paintable paintable) { Widget w = (Widget) paintable; if (w != null) { Style style = highlight.getStyle(); style.setTop(w.getAbsoluteTop(), Unit.PX); style.setLeft(w.getAbsoluteLeft(), Unit.PX); style.setWidth(w.getOffsetWidth(), Unit.PX); style.setHeight(w.getOffsetHeight(), Unit.PX); RootPanel.getBodyElement().appendChild(highlight); }//ww w. jav a 2 s . c o m }
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 w w .j av a 2s. c om }
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;/* w w w . j a v a 2s . c o m*/ if (limit != 0) timer.schedule(delay); }
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 ww w . j a v a2 s . c o m }
From source file:edu.caltech.ipac.firefly.ui.background.BackgroundManager.java
private void animationIconCSS(int mills, int startX, int startY) { Image icon = new Image(ONE_GEAR_ICON_LARGE); final PopupPanel popup = new PopupPanel(); popup.setStyleName(""); popup.addStyleName("animationLevel"); popup.setAnimationEnabled(false);/*w ww .ja v a2 s.co m*/ popup.setWidget(icon); Widget w = button.getIcon() != null ? button.getIcon() : button; int endX = w.getAbsoluteLeft(); int endY = w.getAbsoluteTop(); setupCssAnimation(startX, startY, endX, endY); int extra = 35; CssAnimation.setAnimationStyle(popup, "iconAnimate " + (mills + extra) + "ms ease-in-out 1 normal"); popup.setPopupPosition(endX, endY); popup.show(); Timer t = new Timer() { @Override public void run() { popup.hide(); } }; t.schedule(mills); }