List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteTop
public int getAbsoluteTop()
From source file:org.openelis.gwt.widget.table.PopupTable.java
License:Open Source License
public void showTable(Widget wid) { showingOptions = true;//from w w w . j a v a2 s . co m popup.setPopupPosition(wid.getAbsoluteLeft(), wid.getAbsoluteTop() + wid.getOffsetHeight() - 1); popup.show(); DeferredCommand.addCommand(new Command() { public void execute() { if (view.header != null) view.header.sizeHeader(); scrollToSelection(); } }); focused = true; }
From source file:org.openelis.gwt.widget.table.TableHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *//*from w w w . j ava 2 s . c om*/ public void onMouseDown(MouseDownEvent event) { Widget sender = (Widget) event.getSource(); // TODO Auto-generated method stub resizing = true; startx = sender.getAbsoluteLeft(); resizeColumn1 = headers.indexOf(sender.getParent()); tableCol1 = resizeColumn1; if (columns.get(tableCol1).getFixedWidth()) { resizing = false; resizeColumn1 = -1; tableCol1 = -1; return; } if (pop.isShowing()) { pop.hide(); menuItem = null; } //menuItem.removeFromParent(); FocusPanel bar = new FocusPanel(); bar.addMouseUpHandler(this); bar.addMouseDownHandler(this); bar.addMouseMoveHandler(this); bar.setHeight((controller.view.cellView.getOffsetHeight() + 17) + "px"); bar.setWidth("1px"); DOM.setStyleAttribute(bar.getElement(), "background", "red"); DOM.setStyleAttribute(bar.getElement(), "position", "absolute"); DOM.setStyleAttribute(bar.getElement(), "left", sender.getAbsoluteLeft() + "px"); DOM.setStyleAttribute(bar.getElement(), "top", sender.getAbsoluteTop() + "px"); RootPanel.get().add(bar); DOM.setCapture(bar.getElement()); DOM.setStyleAttribute(bar.getElement(), "zIndex", "1000"); }
From source file:org.openelis.gwt.widget.tree.TreeHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *///from w ww . j av a 2s. com public void onMouseDown(MouseDownEvent event) { Widget sender = (Widget) event.getSource(); // TODO Auto-generated method stub resizing = true; startx = sender.getAbsoluteLeft(); resizeColumn1 = headers.indexOf(sender.getParent()); tableCol1 = resizeColumn1; if (columns.get(tableCol1).getFixedWidth()) { resizing = false; resizeColumn1 = -1; tableCol1 = -1; return; } if (pop.isShowing()) { pop.hide(); menuItem = null; } FocusPanel bar = new FocusPanel(); bar.addMouseUpHandler(this); bar.addMouseDownHandler(this); bar.addMouseMoveHandler(this); bar.setHeight((controller.view.table.getOffsetHeight() + 17) + "px"); bar.setWidth("1px"); DOM.setStyleAttribute(bar.getElement(), "background", "red"); DOM.setStyleAttribute(bar.getElement(), "position", "absolute"); DOM.setStyleAttribute(bar.getElement(), "left", sender.getAbsoluteLeft() + "px"); DOM.setStyleAttribute(bar.getElement(), "top", sender.getAbsoluteTop() + "px"); RootPanel.get().add(bar); DOM.setCapture(bar.getElement()); DOM.setStyleAttribute(bar.getElement(), "zIndex", "1000"); }
From source file:org.openremote.web.console.event.press.PressMoveReleaseHandlerImpl.java
License:Open Source License
public boolean isMovementWithinWidgetBounds(Widget pressedWidget) { boolean result = true; //Check horizontal limits result = pressedWidget.getAbsoluteLeft() > pressStartEvent.getClientX() ? false : true; result = (pressedWidget.getAbsoluteLeft() + pressedWidget.getOffsetWidth()) < pressStartEvent.getClientX() ? false//from www . j a v a2s .c om : true; result = pressedWidget.getAbsoluteLeft() > pressMoveEvent.getClientX() ? false : true; result = (pressedWidget.getAbsoluteLeft() + pressedWidget.getOffsetWidth()) < pressMoveEvent.getClientX() ? false : true; // Check vertical limits result = pressedWidget.getAbsoluteTop() > pressStartEvent.getClientY() ? false : true; result = (pressedWidget.getAbsoluteTop() + pressedWidget.getOffsetHeight()) < pressStartEvent.getClientY() ? false : true; result = pressedWidget.getAbsoluteTop() > pressMoveEvent.getClientY() ? false : true; result = (pressedWidget.getAbsoluteTop() + pressedWidget.getOffsetHeight()) < pressMoveEvent.getClientY() ? false : true; return result; }
From source file:org.openxdata.designer.client.controller.FormDesignerDragController.java
@Override public void dragStart() { if (context.draggable instanceof DesignWidgetWrapper && "100%".equals(((DesignWidgetWrapper) context.draggable).getWidth())) { context.draggable = context.draggable; }//from w w w .ja va 2 s .c o m super.dragStart(); if (dragDropListener != null) dragDropListener.onDragStart(context.draggable); WidgetLocation currentDraggableLocation = new WidgetLocation(context.draggable, context.boundaryPanel); if (getBehaviorDragProxy()) { movablePanel = newDragProxy(context); context.boundaryPanel.add(movablePanel, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop()); checkGWTIssue1813(movablePanel, context.boundaryPanel); } else { saveSelectedWidgetsLocationAndStyle(); AbsolutePanel container = new AbsolutePanel(); container.getElement().getStyle().setProperty("overflow", "visible"); container.setPixelSize(context.draggable.getOffsetWidth(), context.draggable.getOffsetHeight()); context.boundaryPanel.add(container, currentDraggableLocation.getLeft(), currentDraggableLocation.getTop()); checkGWTIssue1813(container, context.boundaryPanel); int draggableAbsoluteLeft = context.draggable.getAbsoluteLeft(); int draggableAbsoluteTop = context.draggable.getAbsoluteTop(); HashMap<Widget, CoordinateLocation> widgetLocation = new HashMap<Widget, CoordinateLocation>(); for (Widget widget : context.selectedWidgets) { widgetLocation.put(widget, new CoordinateLocation(widget.getAbsoluteLeft(), widget.getAbsoluteTop())); } context.dropController = getIntersectDropController(context.mouseX, context.mouseY); if (context.dropController != null) { context.dropController.onEnter(context); } for (Widget widget : context.selectedWidgets) { Location location = widgetLocation.get(widget); int relativeX = (widget instanceof PaletteWidget) ? (context.mouseX - widget.getAbsoluteLeft()) : location.getLeft() - draggableAbsoluteLeft; int relativeY = (widget instanceof PaletteWidget) ? (context.mouseY - widget.getAbsoluteTop()) : location.getTop() - draggableAbsoluteTop; if (widget instanceof DesignWidgetWrapper) container.add(widget, relativeX, relativeY); else container.add(new Label("+"), relativeX, relativeY); } movablePanel = container; } movablePanel.addStyleName(PRIVATE_CSS_MOVABLE_PANEL); // one time calculation of boundary panel location for efficiency during // dragging Location widgetLocation = new WidgetLocation(context.boundaryPanel, null); boundaryOffsetX = widgetLocation.getLeft() + DOMUtil.getBorderLeft(context.boundaryPanel.getElement()); boundaryOffsetY = widgetLocation.getTop() + DOMUtil.getBorderTop(context.boundaryPanel.getElement()); dropTargetClientWidth = DOMUtil.getClientWidth(context.boundaryPanel.getElement()); dropTargetClientHeight = DOMUtil.getClientHeight(context.boundaryPanel.getElement()); }
From source file:org.openxdata.designer.client.controller.FormDesignerDropController.java
@Override public void onEnter(DragContext context) { assert draggableList.size() == 0; dropTargetClientWidth = DOMUtil.getClientWidth(dropTarget.getElement()); dropTargetClientHeight = DOMUtil.getClientHeight(dropTarget.getElement()); WidgetLocation dropTargetLocation = new WidgetLocation(dropTarget, null); dropTargetOffsetX = dropTargetLocation.getLeft() + DOMUtil.getBorderLeft(dropTarget.getElement()); dropTargetOffsetY = dropTargetLocation.getTop() + DOMUtil.getBorderTop(dropTarget.getElement()); int draggableAbsoluteLeft = context.draggable.getAbsoluteLeft(); int draggableAbsoluteTop = context.draggable.getAbsoluteTop(); for (Widget widget : context.selectedWidgets) { Draggable draggable = new Draggable(widget); draggable.positioner = makePositioner(widget); draggable.relativeX = widget.getAbsoluteLeft() - draggableAbsoluteLeft; draggable.relativeY = widget.getAbsoluteTop() - draggableAbsoluteTop; draggableList.add(draggable);/*ww w . ja v a 2 s . co m*/ } }
From source file:org.openxdata.designer.client.view.DesignSurfaceView.java
/** * Gets the y coordinate of the lowest widget on the currently selected page. * //from w ww.j ava 2 s . co m * @return the y coordinate in pixels. */ private int getLowestWidgetYPos() { int lowestYPos = 0; for (int index = 0; index < selectedPanel.getWidgetCount(); index++) { Widget widget = selectedPanel.getWidget(index); int y = widget.getAbsoluteTop() + widget.getOffsetHeight(); if (y > lowestYPos) lowestYPos = y; } if (lowestYPos > 0) lowestYPos -= selectedPanel.getAbsoluteTop(); return lowestYPos; }
From source file:org.pentaho.gwt.widgets.client.toolbar.ToolbarComboButton.java
License:Open Source License
@Override protected void addStyleMouseListener() { // a click listener is more appropriate here to fire the click events // rather than a mouse-up because the focus panel can (and does) sometimes // receive mouse up events if a widget 'above' it has been clicked and // dismissed (on mouse-down). The ensures that only a true click will // fire a button's command eventWrapper.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (!enabled) { return; }// w ww . j av a 2 s .c om popup.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop() + sender.getOffsetHeight()); popup.show(); } }); eventWrapper.addMouseListener(new MouseListener() { public void onMouseDown(Widget w, int x, int y) { } public void onMouseEnter(Widget w) { if (!enabled) { return; } button.addStyleName(stylePrimaryName + "-hovering"); //$NON-NLS-1$ } public void onMouseLeave(Widget w) { if (!enabled) { return; } button.removeStyleName(stylePrimaryName + "-hovering"); //$NON-NLS-1$ } public void onMouseUp(Widget w, int x, int y) { if (!enabled) { return; } popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop() + w.getOffsetHeight()); } public void onMouseMove(Widget w, int x, int y) { } }); }
From source file:org.pentaho.pac.client.common.ui.toolbar.ToolbarComboButton.java
License:Open Source License
@Override protected void addStyleMouseListener() { eventWrapper.addMouseListener(new MouseListener() { private PopupPanel popup; public void onMouseDown(Widget w, int x, int y) { if (!enabled) { return; }/*w w w .j a v a 2s .c o m*/ if (this.popup != null) { popup.hide(); popup.removeFromParent(); } this.popup = createPopup(); popup.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop() + w.getOffsetHeight()); popup.show(); } public void onMouseEnter(Widget w) { button.addStyleName(stylePrimaryName + "-hovering"); //$NON-NLS-1$ } public void onMouseLeave(Widget w) { button.removeStyleName(stylePrimaryName + "-hovering"); //$NON-NLS-1$ } public void onMouseUp(Widget w, int x, int y) { } public void onMouseMove(Widget w, int x, int y) { } }); }
From source file:org.pentaho.pat.client.ui.widgets.MeasureLabel.java
License:Open Source License
public MeasureLabel(final String uniquename, final String caption, final ObjectType lType, FastTreeItem parentNode, boolean isuniquename) { super();//from w w w . j a v a2s .com this.setParentNode(parentNode); if (isuniquename) { text.setText(uniquename); } else { text.setText(caption); } this.setIsUniqueName(isuniquename); HorizontalPanel container = new HorizontalPanel(); container.add(text); final MeasureLabelSelectionModeMenu selectionMenu = new MeasureLabelSelectionModeMenu(this.getType()); image = Pat.IMAGES.downbutton().createImage(); image.addClickListener(new ClickListener() { public void onClick(Widget sender) { selectionMenu.showContextMenu(MeasureLabel.this); final int left = sender.getAbsoluteLeft() + 10; final int top = sender.getAbsoluteTop() + 10; selectionMenu.setPopupPositionAndShow(new PositionCallback() { public void setPosition(final int offsetWidth, final int offsetHeight) { selectionMenu.setPopupPosition(left, top); } }); } }); image.setVisible(false); container.add(image); this.add(container); this.setActualName(uniquename); this.setCaption(caption); setStylePrimaryName(TABLE_DRAG_WIDGET); this.setType(lType); EventFactory.getLabelInstance().addLabelListener(MeasureLabel.this); }