List of usage examples for com.google.gwt.user.client.ui Widget getOffsetWidth
@Override public int getOffsetWidth()
From source file:org.uberfire.client.workbench.panels.impl.HorizontalSplitterPanel.java
License:Apache License
@Override public void onResize() { //It is possible that the SplitterPanel is removed from the DOM before the resize is called if (isAttached()) { final Widget parent = getParent(); setPixelSize(parent.getOffsetWidth(), parent.getOffsetHeight()); super.onResize(); }// w w w . j a v a 2 s . c o m }
From source file:org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelView.java
License:Apache License
@Override public void onResize() { final Widget parent = getParent(); if (parent != null) { final int width = parent.getOffsetWidth(); final int height = parent.getOffsetHeight(); if (width == 0 && height == 0) { resizeParent(parent);/*from www .j a va 2s.c om*/ return; } setPixelSize(width, height); presenter.onResize(width, height); listBar.onResize(); resizeSuper(); } }
From source file:org.uberfire.client.workbench.part.WorkbenchPartView.java
License:Apache License
@Override public void onResize() { final Widget parent = getParent(); if (parent != null) { sp.setPixelSize(parent.getOffsetWidth(), parent.getOffsetHeight()); }//from www.ja v a 2s. c o m super.onResize(); }
From source file:org.uberfire.client.workbench.widgets.dnd.CompassWidget.java
License:Apache License
private void showDropTarget(final DragContext context, final Position p) { int x = 0;/*from w w w. j a va 2 s . c o m*/ int y = 0; int width = 0; int height = 0; final Widget dropTargetParent = context.dropController.getDropTarget(); switch (p) { case SELF: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = dropTargetParent.getOffsetWidth(); height = dropTargetParent.getOffsetHeight(); showDropTarget(x, y, width, height); break; case NORTH: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = dropTargetParent.getOffsetWidth(); height = (int) (dropTargetParent.getOffsetHeight() * 0.50); showDropTarget(x, y, width, height); break; case SOUTH: x = dropTargetParent.getAbsoluteLeft(); height = (int) (dropTargetParent.getOffsetHeight() * 0.50); y = dropTargetParent.getOffsetHeight() + dropTargetParent.getAbsoluteTop() - height; width = dropTargetParent.getOffsetWidth(); showDropTarget(x, y, width, height); break; case EAST: width = (int) (dropTargetParent.getOffsetWidth() * 0.50); x = dropTargetParent.getOffsetWidth() + dropTargetParent.getAbsoluteLeft() - width; y = dropTargetParent.getAbsoluteTop(); height = dropTargetParent.getOffsetHeight(); showDropTarget(x, y, width, height); break; case WEST: x = dropTargetParent.getAbsoluteLeft(); y = dropTargetParent.getAbsoluteTop(); width = (int) (dropTargetParent.getOffsetWidth() * 0.50); height = dropTargetParent.getOffsetHeight(); showDropTarget(x, y, width, height); break; default: hideDropTarget(); } }
From source file:org.vaadin.henrik.drawer.widgetset.client.ui.VDrawer.java
License:Apache License
public RenderSpace getAllocatedSpace(final Widget child) { final int childHeight = child.getOffsetHeight(); final int childWidth = child.getOffsetWidth(); final int myWidth = getOffsetWidth(); // final int myHeight = getOffsetHeight(); final int captionWidth = captionPanel.getOffsetWidth(); final int finalHeight; final int finalWidth; if (calculateCaptionWidth) { finalWidth = Math.max(childWidth, Math.max(myWidth, captionWidth)); } else {//from w w w.j a v a2s . c o m finalWidth = captionWidth; } if (calculateDrawerHeight) { finalHeight = Math.max(childHeight, drawerHeight); } else { finalHeight = drawerHeight; } return new RenderSpace(finalWidth, finalHeight); }
From source file:org.wwarn.mapcore.client.panel.Tooltip.java
License:Open Source License
private boolean isMouseOutOfWidget(MouseEvent<?> event, Widget widget) { int x = event.getClientX(); int y = event.getClientY(); return x <= widget.getAbsoluteLeft() || x >= widget.getAbsoluteLeft() + widget.getOffsetWidth() || y <= widget.getAbsoluteTop() || y >= widget.getAbsoluteTop() + widget.getOffsetHeight(); }
From source file:org.xwiki.gwt.user.client.ui.LoadingPanel.java
License:Open Source License
/** * Shows the loading animation.//from w ww. j av a2s. com * * @param widget the widget whose loading state will be indicated */ public void startLoading(Widget widget) { if (widget.isAttached()) { stopLoading(); getElement().getStyle().setWidth(widget.getOffsetWidth(), Unit.PX); getElement().getStyle().setHeight(widget.getOffsetHeight(), Unit.PX); widget.getElement().getParentNode().insertBefore(getElement(), widget.getElement()); } }
From source file:rocket.widget.client.slider.FloatingSlider.java
License:Apache License
protected void onBackgroundMouseDown(final MouseDownEvent event) { Checker.notNull("parameter:event", event); final Widget handle = this.getHandle(); final Element widget = this.getElement(); final int mouseX = event.getPageX() - DOM.getAbsoluteLeft(widget) - handle.getOffsetWidth() / 2; final int mouseY = event.getPageY() - DOM.getAbsoluteTop(widget) - handle.getOffsetHeight() / 2; this.onBackgroundMouseDown(mouseX, mouseY); final HandleSlidingTimer timer = this.getTimer(); timer.setMouseX(mouseX);/*w w w . j a va2s.c om*/ timer.setMouseY(mouseY); }
From source file:rocket.widget.client.slider.FloatingSlider.java
License:Apache License
protected void onHandleMouseMove(final MouseMoveEvent event) { Checker.notNull("parameter:event", event); final Element sliderElement = this.getElement(); final int widgetX = sliderElement.getAbsoluteLeft(); final int widgetY = sliderElement.getAbsoluteTop(); final int sliderWidth = this.getOffsetWidth(); final int sliderHeight = this.getOffsetHeight(); final Widget handle = this.getHandle(); final Element handleElement = handle.getElement(); final InlineStyle handleInlineStyle = InlineStyle.getInlineStyle(handleElement); final int handleWidth = handle.getOffsetWidth(); final int handleHeight = handle.getOffsetHeight(); // make mouse coordinates relative to top/left of slider. int mouseX = event.getPageX() - widgetX; mouseX = Math.max(0, Math.min(mouseX, sliderWidth - handleWidth / 2)); final int newX = this.updateSliderValue(mouseX, this.getMaximumXValue(), sliderWidth, handleWidth); this.setXValue(newX); int left = mouseX - handleWidth / 2; handleInlineStyle.setInteger(Css.LEFT, left, CssUnit.PX); int mouseY = event.getPageY() - widgetY; mouseY = Math.max(0, Math.min(mouseY, sliderHeight - handleHeight / 2)); final int newY = this.updateSliderValue(mouseY, this.getMaximumYValue(), sliderHeight, handleHeight); this.setYValue(newY); final int top = mouseY - handleHeight / 2; handleInlineStyle.setInteger(Css.TOP, top, CssUnit.PX); event.cancelBubble(true);// w w w . j a va 2 s. co m event.stop();// stops text selection in Opera }
From source file:rocket.widget.client.slider.FloatingSlider.java
License:Apache License
public void setXValue(final int xValue) { final int maximumValue = this.getMaximumXValue(); Checker.between("parameter:xValue", xValue, 0, maximumValue + 1); this.xValue = xValue; final Widget handle = this.getHandle(); final int sliderLength = this.getOffsetWidth() - handle.getOffsetWidth(); final int newLeft = Math.round(1.0f * this.getXValue() * sliderLength / this.getMaximumXValue()); final InlineStyle handleInlineStyle = InlineStyle.getInlineStyle(handle.getElement()); handleInlineStyle.setString(Css.POSITION, "absolute"); handleInlineStyle.setInteger(Css.LEFT, newLeft, CssUnit.PX); this.getEventListenerDispatcher().getChangeEventListeners().fireChange(this); }