List of usage examples for com.google.gwt.dom.client Style setPosition
public void setPosition(Position value)
From source file:fr.putnami.pwt.core.widget.client.base.AbstractHover.java
License:Open Source License
private void resetPosition(Element toPositionedElement, Widget relativeTo, Placement placement) { Element relativeElement = relativeTo.getElement(); com.google.gwt.dom.client.Style elementStyle = toPositionedElement.getStyle(); int tooltipWidth = toPositionedElement.getOffsetWidth(); int tooltipHeight = toPositionedElement.getOffsetHeight(); int targetWidth = relativeElement.getOffsetWidth(); int targetHeight = relativeElement.getOffsetHeight(); int targetTop = relativeElement.getOffsetTop(); int targetLeft = relativeElement.getOffsetLeft(); elementStyle.setPosition(Position.ABSOLUTE); switch (placement) { case TOP://from w w w.j a v a2 s .c o m elementStyle.setLeft(targetLeft + targetWidth / 2 - tooltipWidth / 2, Unit.PX); elementStyle.setTop(targetTop - tooltipHeight, Unit.PX); break; case BOTTOM: elementStyle.setLeft(targetLeft + targetWidth / 2 - tooltipWidth / 2, Unit.PX); elementStyle.setTop(targetTop + targetHeight, Unit.PX); break; case LEFT: elementStyle.setLeft(targetLeft - tooltipWidth, Unit.PX); elementStyle.setTop(targetTop + targetHeight / 2 - tooltipHeight / 2, Unit.PX); break; case RIGHT: elementStyle.setLeft(targetLeft + targetWidth, Unit.PX); elementStyle.setTop(targetTop + targetHeight / 2 - tooltipHeight / 2, Unit.PX); break; default: break; } }
From source file:fr.putnami.pwt.core.widget.client.InputDatePicker.java
License:Open Source License
public void popup(Widget container, Widget relativeTo) { this.setVisible(true); StyleUtils.addStyle(this, InputDatePicker.STYLE_POPUP); RootPanel.get().add(this); Element positioningElement = this.getElement(); Element relativeElement = relativeTo.getElement(); int targetHeight = relativeElement.getOffsetHeight(); int targetTop = relativeElement.getAbsoluteTop(); int positioningWidth = positioningElement.getOffsetWidth(); int targetRight = relativeElement.getAbsoluteRight(); Style elementStyle = positioningElement.getStyle(); elementStyle.setPosition(Position.ABSOLUTE); elementStyle.setLeft(targetRight - positioningWidth, Unit.PX); elementStyle.setTop(targetTop + targetHeight, Unit.PX); StyleUtils.addStyle(this, InputDatePicker.STYLE_FADE); StyleUtils.addStyle(this, InputDatePicker.STYLE_SHOW); this.setFocus(true); if (this.popupBlurHandler == null) { this.popupBlurHandler = this.addBlurHandler(new BlurHandler() { @Override/*from w ww . j a va2 s .c om*/ public void onBlur(BlurEvent event) { InputDatePicker.this.hide(); } }); } }
From source file:geogebra.web.gui.app.docklayout.LayoutImpl.java
License:Apache License
protected static DivElement createRuler(Unit widthUnit, Unit heightUnit) { DivElement ruler = Document.get().createDivElement(); ruler.setInnerHTML(" "); Style style = ruler.getStyle(); style.setPosition(Position.ABSOLUTE); style.setZIndex(-32767);/*from w w w . j a v a 2s . c om*/ // Position the ruler off the top edge, double the size just to be // extra sure it doesn't show up on the screen. style.setTop(-20, heightUnit); // Note that we are making the ruler element 10x10, because some browsers // generate non-integral ratios (e.g., 1em == 13.3px), so we need a little // extra precision. style.setWidth(10, widthUnit); style.setHeight(10, heightUnit); style.setVisibility(Visibility.HIDDEN); State.HIDDEN.set(ruler, true); return ruler; }
From source file:geogebra.web.gui.app.docklayout.LayoutImpl.java
License:Apache License
public void fillParent(Element elem) { Style style = elem.getStyle(); style.setPosition(Position.ABSOLUTE); style.setLeft(0, PX);/*from w w w.j a v a2 s . c o m*/ style.setTop(0, PX); style.setRight(0, PX); style.setBottom(0, PX); }
From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java
License:Apache License
protected void setCutOutStyle() { Style style = getElement().getStyle(); style.setWidth(100, Unit.PCT);/*from ww w .java2 s .c om*/ style.setHeight(100, Unit.PCT); style.setPosition(Position.FIXED); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); style.setZIndex(10000); focusElement.setClassName(AddinsCssName.MATERIAL_CUTOUT_FOCUS); style = focusElement.getStyle(); style.setProperty("content", "\'\'"); style.setPosition(Position.ABSOLUTE); style.setZIndex(-1); }
From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java
License:Apache License
/** * Gets the computed background color, based on the backgroundColor CSS * class./*w ww . j a va 2 s .c o m*/ */ protected void setupComputedBackgroundColor() { // temp is just a widget created to evaluate the computed background // color MaterialWidget temp = new MaterialWidget(Document.get().createDivElement()); temp.setBackgroundColor(backgroundColor); // setting a style to make it invisible for the user Style style = temp.getElement().getStyle(); style.setPosition(Position.FIXED); style.setWidth(1, Unit.PX); style.setHeight(1, Unit.PX); style.setLeft(-10, Unit.PX); style.setTop(-10, Unit.PX); style.setZIndex(-10000); // adding it to the body (on Chrome the component must be added to the // DOM before getting computed values). String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor); // convert rgb to rgba, considering the opacity field if (opacity < 1 && computed.startsWith("rgb(")) { computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")"); } computedBackgroundColor = computed; }
From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java
License:Apache License
public MaterialCutOut() { super(Document.get().createDivElement()); focus = Document.get().createDivElement(); getElement().appendChild(focus);//from www. j av a2 s. c o m setStyleName("material-cutout"); Style style = getElement().getStyle(); style.setWidth(100, Unit.PCT); style.setHeight(100, Unit.PCT); style.setPosition(Position.FIXED); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); style.setOverflow(Overflow.HIDDEN); style.setZIndex(10000); style.setDisplay(Display.NONE); focus.setClassName("material-cutout-focus"); style = focus.getStyle(); style.setProperty("content", "\'\'"); style.setPosition(Position.ABSOLUTE); style.setZIndex(-1); }
From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java
License:Apache License
/** * Gets the computed background color, based on the backgroundColor CSS * class.//w ww.j ava 2 s.c o m */ private void setupComputedBackgroundColor() { // temp is just a widget created to evaluate the computed background // color MaterialWidget temp = new MaterialWidget(Document.get().createDivElement()); temp.setBackgroundColor(backgroundColor); // setting a style to make it invisible for the user Style style = temp.getElement().getStyle(); style.setPosition(Position.FIXED); style.setWidth(1, Unit.PX); style.setHeight(1, Unit.PX); style.setLeft(-10, Unit.PX); style.setTop(-10, Unit.PX); style.setZIndex(-10000); // adding it to the body (on Chrome the component must be added to the // DOM before getting computed values). String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor); // convert rgb to rgba, considering the opacity field if (opacity < 1 && computed.startsWith("rgb(")) { computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")"); } computedBackgroundColor = computed; }
From source file:info.magnolia.ui.vaadin.gwt.client.richtext.TextAreaStretcherConnector.java
License:Open Source License
private void updateSize() { if (!getState().isCollapsed) { stretchControl.replaceClassName("icon-open-fullscreen-2", "icon-close-fullscreen-2"); stretchControl.replaceClassName(COLLAPSED, STRETCHED); form.asWidget().addStyleName("textarea-stretched"); Style style = textWidget.getElement().getStyle(); style.setPosition(Style.Position.ABSOLUTE); Element header = getDialogHeaderElement(); ComputedStyle headerCS = new ComputedStyle(header); int top = form.getAbsoluteTop() - dialog.getAbsoluteTop(); top = isOverlay ? top : top + headerCS.getPadding()[0] + headerCS.getPadding()[2]; int left = isOverlay ? 0 : form.getAbsoluteLeft(); style.setLeft(left, Style.Unit.PX); style.setTop(top, Style.Unit.PX); stretchTextArea(style);//from ww w . j a va2s . c o m style.setZIndex(5); if (!isOverlay && !isRichTextEditor) { stretchControl.getStyle().setTop(top + 5, Style.Unit.PX); stretchControl.getStyle().setLeft( left + textWidget.getOffsetWidth() - stretchControl.getOffsetWidth() - 5, Style.Unit.PX); } hideOtherStretchers(); } else { stretchControl.replaceClassName(STRETCHED, COLLAPSED); stretchControl.replaceClassName("icon-close-fullscreen-2", "icon-open-fullscreen-2"); form.asWidget().removeStyleName(TEXTAREA_STRETCHED); clearTraces(); } }
From source file:info.magnolia.ui.vaadin.gwt.client.tabsheet.widget.MagnoliaTabSheetViewImpl.java
License:Open Source License
@Override public void setMaxHeight(int height) { int tabBarHeight = getOffsetHeight() - scroller.getOffsetHeight(); height -= tabBarHeight;//from w ww . j a va 2 s .c o m final Style scrollerStyle = scroller.getElement().getStyle(); ; scrollerStyle.setPosition(Position.ABSOLUTE); scrollerStyle.setOverflow(Style.Overflow.AUTO); scrollerStyle.setProperty("zoom", "1"); scrollerStyle.setProperty("maxHeight", height + "px"); }