List of usage examples for com.google.gwt.user.client.ui Widget getOffsetWidth
@Override public int getOffsetWidth()
From source file:com.gwtplatform.carstore.client.application.widget.header.HeaderMobileView.java
License:Apache License
@UiHandler("menu") void onMenuClicked(ClickEvent event) { final Widget widget = (Widget) event.getSource(); userInfoPopup.setPopupPositionAndShow(new PopupPanel.PositionCallback() { @Override//from w w w .ja v a2 s .c o m public void setPosition(int offsetWidth, int offsetHeight) { int left = widget.getAbsoluteLeft() - (userInfoPopup.getOffsetWidth() - widget.getOffsetWidth()); int top = widget.getAbsoluteTop() + widget.getOffsetHeight() + 10; userInfoPopup.setPopupPosition(left, top); } }); }
From source file:com.ikon.extension.frontend.client.widget.dropbox.Status.java
License:Open Source License
/** * Refreshing the panel//www . j a v a 2 s.c om */ public void refresh() { if (flag_exporting || flag_importing || flag_search || flag_getChilds) { Widget widgetBaseToCenter = Main.get().mainPanel; if (flag_getChilds && widget != null) { widgetBaseToCenter = widget; } int left = widgetBaseToCenter.getAbsoluteLeft() + (widgetBaseToCenter.getOffsetWidth() - 200) / 2; int top = widgetBaseToCenter.getAbsoluteTop() + (widgetBaseToCenter.getOffsetHeight() - 40) / 2; if (left > 0 && top > 0) { setPopupPosition(left, top); super.show(); } } else { super.hide(); } }
From source file:com.ikon.extension.frontend.client.widget.macros.Status.java
License:Open Source License
/** * Refreshing the panel/*from www . ja va 2s. c o m*/ */ public void refresh() { if (flag_executeAction) { Widget tab = Main.get().mainPanel; int left = tab.getAbsoluteLeft() + (tab.getOffsetWidth() - 200) / 2; int top = tab.getAbsoluteTop() + (tab.getOffsetHeight() - 40) / 2; if (left > 0 && top > 0) { setPopupPosition(left, top); super.show(); } } else { super.hide(); } }
From source file:com.kk_electronic.kkportal.core.dnd.MousePanel.java
License:Open Source License
public void attachWidgetToMouse(MouseDownEvent event, Widget w, MouseMoveHandler mouseMoveHandler, MouseUpHandler mouseUpHandler) { this.mouseMoveHandler = mouseMoveHandler; this.mouseUpHandler = mouseUpHandler; if (widget == w) return;//from ww w. j a va 2s .c o m clearWidgetFromMouse(); widget = w; if (widget != null) { height = w.getOffsetHeight(); width = w.getOffsetWidth(); offsetX = event.getRelativeX(w.getElement()); offsetY = event.getRelativeY(w.getElement()); parent.add(widget); parent.setWidgetTopHeight(widget, event.getClientY() - offsetY, Unit.PX, height, Unit.PX); parent.setWidgetLeftWidth(widget, event.getClientX() - offsetX, Unit.PX, width, Unit.PX); attachHandlers(); } }
From source file:com.kk_electronic.kkportal.core.ui.Canvas.java
License:Open Source License
@Override public void onElementDrop(double x, int y, ModuleWindow element) { Widget p = element.getParent(); x = 100.0 * (double) ((element.getAbsoluteLeft() - p.getAbsoluteLeft() + element.getOffsetWidth() / 2)) / p.getOffsetWidth(); y = (element.getAbsoluteTop() - p.getAbsoluteTop() + element.getOffsetHeight() / 2); GWT.log("Before move" + groupedModuleWindows.toString()); for (List<ModuleWindow> moduleWindows : groupedModuleWindows) { if (moduleWindows.remove(element)) break; }/*from w w w. j a va 2s . com*/ List<ModuleWindow> column = findColumn(x); int index = findIndex(column, y); column.add(index, element); List<List<ModuleWindow>> newgroupedModuleWindows = new ArrayList<List<ModuleWindow>>(); for (List<ModuleWindow> moduleWindows : groupedModuleWindows) { if (!moduleWindows.isEmpty()) newgroupedModuleWindows.add(moduleWindows); } groupedModuleWindows = newgroupedModuleWindows; element.setFirstColumn(column == groupedModuleWindows.get(0)); GWT.log("After move" + groupedModuleWindows.toString()); tabsModel.setModuleIds(tabInfo, getIds(groupedModuleWindows)); }
From source file:com.kk_electronic.kkportal.core.ui.GroupDisplay.java
License:Open Source License
@Override public boolean Drop(MouseUpEvent event, final T element) { Widget widget = element.asWidget(); int height = widget.getOffsetHeight(); event.setRelativeElement(canvas.getElement()); final int x = event.getX(); final int y = event.getY(); /*//from w w w . j av a 2 s .c om * Note must be 100.0 and not 100 since the later would result in * integer division which most likely would be 0 */ double width = (100.0 * widget.getOffsetWidth()) / canvas.getOffsetWidth(); final int top = widget.getAbsoluteTop() - canvas.getAbsoluteTop(); final double left = (100.0 * (widget.getAbsoluteLeft() - canvas.getAbsoluteLeft())) / canvas.getOffsetWidth(); final double xpct = 100.0 * x / canvas.getOffsetWidth(); canvas.add(widget); canvas.getWidgetContainerElement(widget).getStyle().clearOverflow(); canvas.setWidgetTopHeight(widget, top, Unit.PX, height, Unit.PX); canvas.setWidgetLeftWidth(widget, left, Unit.PCT, width, Unit.PCT); if (handler != null) { Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { handler.onElementDrop(xpct, y, element); } }); return true; } return false; }
From source file:com.kk_electronic.kkportal.core.ui.Placeholder.java
License:Open Source License
public void copysize(Widget widget) { this.setPixelSize(widget.getOffsetWidth(), widget.getOffsetHeight()); }
From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java
License:Open Source License
/** * Show popup./*from w w w . ja va 2s .com*/ * * @param attacheElement the attache element * @param w the w */ private void showPopup(Widget attacheElement, Widget w) { back_widget = attacheElement; if (w == null) { w = new HTMLPanel(""); w.setSize("100px", "100px"); m_ap_content.clear(); m_ap_content.add(w); } else { m_ap_content.clear(); m_ap_content.add(w); } m_ap_content.setVisible(true); m_ap_shadow.setVisible(true); m_ap_line.setVisible(true); int aleft = attacheElement.getAbsoluteLeft(); int atop = attacheElement.getAbsoluteTop(); int aw = attacheElement.getOffsetWidth(); int ah = attacheElement.getOffsetHeight(); int width = m_ap_content.getOffsetWidth(); int height = m_ap_content.getOffsetHeight(); int lbx = aleft; int lby = atop + ah; int rbx = lbx + aw; int rby = lby; Style style = m_ap_content.getElement().getStyle(); style.setLeft(rbx - width, Unit.PX); style.setTop(lby - 1, Unit.PX); style = m_ap_shadow.getElement().getStyle(); style.setLeft(rbx - width + 3, Unit.PX); style.setTop(lby + 2, Unit.PX); style.setWidth(width, Unit.PX); style.setHeight(height, Unit.PX); style = m_ap_line.getElement().getStyle(); style.setLeft(lbx + 1, Unit.PX); style.setTop(lby - 1, Unit.PX); style.setWidth(aw - 2, Unit.PX); back_css = attacheElement.getStyleName(); attacheElement.setStyleName("toolbar_over"); m_ap_content.getElement().focus(); m_b_show_popup = true; }
From source file:com.openkm.extension.frontend.client.widget.dropbox.Status.java
License:Open Source License
/** * Refreshing the panel/*from ww w. j ava 2 s .com*/ */ public void refresh() { if (flag_exporting || flag_importing || flag_search || flag_getChildren) { Widget widgetBaseToCenter = Main.get().mainPanel; if (flag_getChildren && widget != null) { widgetBaseToCenter = widget; } int left = widgetBaseToCenter.getAbsoluteLeft() + (widgetBaseToCenter.getOffsetWidth() - 200) / 2; int top = widgetBaseToCenter.getAbsoluteTop() + (widgetBaseToCenter.getOffsetHeight() - 40) / 2; if (left > 0 && top > 0) { setPopupPosition(left, top); super.show(); } } else { super.hide(); } }
From source file:com.ponysdk.ui.terminal.ui.PTWidget.java
License:Apache License
protected void triggerOnClick(final PTInstruction addHandler, final Widget widget, final int domHandlerType, final UIService uiService, final ClickEvent event) { final PTInstruction eventInstruction = buildEventInstruction(addHandler, domHandlerType); eventInstruction.put(PROPERTY.CLIENT_X, event.getClientX()); eventInstruction.put(PROPERTY.CLIENT_Y, event.getClientY()); eventInstruction.put(PROPERTY.SOURCE_ABSOLUTE_LEFT, widget.getAbsoluteLeft()); eventInstruction.put(PROPERTY.SOURCE_ABSOLUTE_TOP, widget.getAbsoluteTop()); eventInstruction.put(PROPERTY.SOURCE_OFFSET_HEIGHT, widget.getOffsetHeight()); eventInstruction.put(PROPERTY.SOURCE_OFFSET_WIDTH, widget.getOffsetWidth()); uiService.triggerEvent(eventInstruction); }