List of usage examples for com.google.gwt.user.client.ui Widget getAbsoluteLeft
public int getAbsoluteLeft()
From source file:org.openelis.gwt.widget.tree.TreeHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *//* w w w. j ava 2 s.co m*/ 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.openelis.gwt.widget.tree.TreeHeaderBar.java
License:Open Source License
/** * Catches mouses Events for resizing columns. *//*ww w. ja v a 2s . com*/ public void onMouseUp(MouseUpEvent event) { Widget sender = (Widget) event.getSource(); if (resizing) { DOM.releaseCapture(sender.getElement()); int colWidth = columns.get(tableCol1).getCurrentWidth() + (sender.getAbsoluteLeft() - startx); int scrollWidth = 0; for (int i = 0; i < headers.size(); i++) { if (tableCol1 != i) scrollWidth += columns.get(i).getCurrentWidth(); } if (scrollWidth + colWidth < controller.getTreeWidth()) colWidth = controller.getTreeWidth() - scrollWidth; columns.get(tableCol1).setCurrentWidth(colWidth); resizing = false; RootPanel.get().remove(sender); DeferredCommand.addCommand(new Command() { public void execute() { sizeHeader(); for (int j = 0; j < controller.view.table.getRowCount(); j++) { for (int i = 0; i < columns.size(); i++) { controller.view.table.getFlexCellFormatter().setWidth(j, i, (columns.get(i).getCurrentWidth()) + "px"); if (!(controller.columns.get(controller.getRow(j).leafType).get(i) .getColumnWidget() instanceof CheckBox)) controller.view.table.getWidget(j, i) .setWidth((columns.get(i).getCurrentWidth()) + "px"); } } } }); } }
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/* www . ja v a2s. co m*/ : 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 . j a v a2 s. c om*/ 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);/*from w w w . j a v a 2s . c o m*/ } }
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; }//www. j a v a 2s. 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; }/*from ww 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 va2 s.c o m*/ 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); }
From source file:org.pepstock.jem.gwt.client.Sizes.java
License:Open Source License
/** * Returns <code>true</code> if native event is on passed widget, otherwise <code>false</code>. * @param event fired event/*w w w. j a v a 2 s. com*/ * @param widget widget to check if event is on it * @return <code>true</code> if native event is on passed widget, otherwise <code>false</code> */ public static boolean isEventInsideWidget(NativeEvent event, Widget widget) { int x = event.getClientX(); int y = event.getClientY(); int top = widget.getAbsoluteTop(); int bottom = top + widget.getOffsetHeight(); int left = widget.getAbsoluteLeft(); int right = left + widget.getOffsetWidth(); if (x < left || x > right) { return false; } else if (y < top || y > bottom) { return false; } return true; }
From source file:org.seamless.gwt.component.client.suggest.PopupSelectViewImpl.java
License:Open Source License
protected void showPopup() { Widget source = button; int left = source.getAbsoluteLeft() + 10; int top = source.getAbsoluteTop() + 10; if (top + heightPixel > Window.getClientHeight() - 20) { top = source.getAbsoluteTop() - 10 - heightPixel; }/*w w w . j a v a 2 s . c o m*/ popupPanel.setPopupPosition(left, top); popupPanel.show(); }