List of usage examples for com.google.gwt.dom.client Style setTop
public void setTop(double value, Unit unit)
From source file:org.rstudio.studio.client.workbench.views.presentation.zoom.PresentationZoomPopup.java
License:Open Source License
public static void show() { Label mainWidget = new Label("mainWidget"); mainWidget.setSize("100%", "100%"); LayoutPanel layoutPanel = new LayoutPanel(); layoutPanel.setSize("100%", "100%"); layoutPanel.add(mainWidget);/*w ww . j ava2 s . com*/ layoutPanel.setWidgetLeftRight(mainWidget, 0, Unit.PX, 0, Unit.PX); layoutPanel.setWidgetTopBottom(mainWidget, 0, Unit.PX, 0, Unit.PX); ModalPopupPanel popup = new ModalPopupPanel(false, false, true); Resources res = GWT.<Resources>create(Resources.class); NineUpBorder border = new NineUpBorder(res, 32, 20, 17, 20); addCloseButton(popup, border); border.setSize("100%", "100%"); border.setFillColor("white"); border.setWidget(layoutPanel); popup.setWidget(border); popup.setGlassEnabled(true); Style popupStyle = popup.getElement().getStyle(); popupStyle.setZIndex(1001); popupStyle.setPosition(Style.Position.ABSOLUTE); popupStyle.setTop(0, Unit.PX); popupStyle.setBottom(0, Unit.PX); popupStyle.setLeft(0, Unit.PX); popupStyle.setRight(0, Unit.PX); Style contentStyle = ((Element) popup.getElement().getFirstChild()).getStyle(); contentStyle.setWidth(100, Unit.PCT); contentStyle.setHeight(100, Unit.PCT); popup.center(); }
From source file:org.thechiselgroup.choosel.protovis.client.ProtovisWidgetWithAnnotations.java
License:Apache License
protected Element addDescriptionElement(int topPx, int leftPx, String html, String cssClass) { Element div = DOM.createDiv(); div.setInnerHTML(html);/*from w w w . j av a2 s .c om*/ Style style = div.getStyle(); style.setTop(topPx, Unit.PX); style.setLeft(leftPx, Unit.PX); style.setPosition(Position.ABSOLUTE); if (cssClass != null) { div.setClassName(cssClass); } getElement().appendChild(div); return div; }
From source file:org.uberfire.client.util.Layouts.java
License:Apache License
/** * Sets the CSS on the given widget so it automatically fills the available space, rather than being sized based on * the amount of space required by its contents. This tends to be useful when building a UI that always fills the * available space on the screen, as most desktop application windows do. * <p>/* w ww . j a v a 2 s . com*/ * To achieve this, the element is given relative positioning with top and left set to 0px and width and height set * to 100%. This makes the widget fill its nearest ancestor which has relative or absolute positioning. This * technique is compatible with GWT's LayoutPanel system. Note that, like LayoutPanels, this only works if the host * page is in standards mode (has a {@code <!DOCTYPE html>} header). * @param w the widget that should always fill its available space, rather than being sized to fit its contents. */ public static void setToFillParent(Widget w) { Element e = w.getElement(); Style s = e.getStyle(); s.setPosition(Position.RELATIVE); s.setTop(0.0, Unit.PX); s.setLeft(0.0, Unit.PX); s.setWidth(100.0, Unit.PCT); s.setHeight(100.0, Unit.PCT); }
From source file:org.uberfire.client.workbench.WorkbenchLayoutImpl.java
License:Apache License
private void updateMaximizedPanelSizes() { for (Widget w : maximizedWidgetOriginalStyles.keySet()) { Style style = w.getElement().getStyle(); style.setTop(perspectiveRootContainer.getAbsoluteTop(), Unit.PX); style.setLeft(perspectiveRootContainer.getAbsoluteLeft(), Unit.PX); style.setWidth(perspectiveRootContainer.getOffsetWidth(), Unit.PX); style.setHeight(perspectiveRootContainer.getOffsetHeight(), Unit.PX); if (w instanceof RequiresResize) { ((RequiresResize) w).onResize(); }//from w w w .j a v a 2 s. c o m } }
From source file:org.uberfire.ext.widgets.table.client.ResizableMovableHeader.java
License:Apache License
private static void setLine(final Style style, final int width, final int top, final int height, final String color) { style.setPosition(Position.ABSOLUTE); style.setTop(top, PX); style.setHeight(height, PX);//from ww w.ja va2s . co m style.setWidth(width, PX); style.setBackgroundColor(color); style.setZIndex(Integer.MAX_VALUE); }
From source file:org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement.java
License:Apache License
/** * Transform the DOMElement based on the render context, such as scale and position. * @param context/* www . java 2 s . com*/ */ protected void transform(final GridBodyCellRenderContext context) { final Transform transform = context.getTransform(); final double width = context.getCellWidth(); final double height = context.getCellHeight(); final Style style = widgetContainer.getElement().getStyle(); //Copy across GridWidget's opacity to DOMElements style.setOpacity(gridWidget.getAlpha()); //Reposition and transform the DOM Element style.setLeft((context.getAbsoluteCellX() * transform.getScaleX()) + transform.getTranslateX(), Style.Unit.PX); style.setTop((context.getAbsoluteCellY() * transform.getScaleY()) + transform.getTranslateY(), Style.Unit.PX); style.setWidth(width, Style.Unit.PX); style.setHeight(height, Style.Unit.PX); //If the DOMElement overlaps a fixed header clip content style.clearProperty("clip"); final double top = context.getAbsoluteCellY() + transform.getTranslateY(); final double left = context.getAbsoluteCellX() + transform.getTranslateX(); final boolean isFloating = context.isFloating(); boolean clip = false; double ct = 0.0; double cr = width; double cb = height; double cl = 0.0; final Group header = gridWidget.getHeader(); final double clipMinY = context.getClipMinY() + transform.getTranslateY(); final double clipMinX = context.getClipMinX() + transform.getTranslateX(); if (header != null) { if (top < clipMinY) { ct = clipMinY - top; clip = true; } } if (!isFloating && left < clipMinX) { cl = clipMinX - left; clip = true; } if (clip) { style.setProperty("clip", "rect(" + (int) ct + "px," + (int) cr + "px," + (int) cb + "px," + (int) cl + "px)"); } // --- Workaround for BS2 --- style.setProperty("WebkitBoxSizing", "border-box"); style.setProperty("MozBoxSizing", "border-box"); style.setProperty("boxSizing", "border-box"); style.setProperty("lineHeight", "normal"); // --- End workaround --- if (MathUtilities.isOne(transform.getScaleX()) && MathUtilities.isOne(transform.getScaleY())) { style.clearProperty("WebkitTransform"); style.clearProperty("MozTransform"); style.clearProperty("Transform"); style.clearProperty("MsTransform"); return; } final String scale = "scale(" + FORMAT.format(transform.getScaleX()) + ", " + FORMAT.format(transform.getScaleY()) + ")"; final String translate = "translate(" + FORMAT.format(((width - width * transform.getScaleX()) / -2.0)) + "px, " + FORMAT.format(((height - height * transform.getScaleY()) / -2.0)) + "px)"; style.setProperty("WebkitTransform", translate + " " + scale); style.setProperty("MozTransform", translate + " " + scale); style.setProperty("Transform", translate + " " + scale); style.setProperty("MsTransform", translate + " " + scale); }
From source file:org.uberfire.ext.wires.core.grids.client.widget.dom.impl.CheckBoxDOMElement.java
License:Apache License
@Override public void initialise(final GridBodyCellRenderContext context) { final Style style = widget.getElement().getStyle(); style.setLeft((context.getCellWidth() - SIZE) / 2, Style.Unit.PX); style.setTop((context.getCellHeight() - SIZE) / 2, Style.Unit.PX); transform(context);//from ww w .j a va 2 s .com }
From source file:org.vaadin.alump.fancylayouts.gwt.client.GwtFancyPanel.java
License:Apache License
/** * Set wrapper to hard coded position on the screen * /*www . java 2s . co m*/ * @param wrapper */ private void setWrapperTransitionPosition(Element wrapper) { Style style = wrapper.getStyle(); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); style.setHeight(100, Unit.PCT); style.setPosition(Position.ABSOLUTE); style.setOverflow(Overflow.HIDDEN); }
From source file:org.vectomatic.svg.edit.client.command.DndCommandFactory.java
License:Open Source License
/** * Returns true if the drag start event comes from a valid drag source * @param event a drag start event/* w ww. jav a 2 s .c o m*/ * @return true if the drag start event comes from a valid drag source */ public boolean isValidSource(DNDEvent event, List<SVGElementModel> sourceElements) { targetElement = null; validTarget = false; this.sourceElements = sourceElements; for (IDndHandler handler : handlers) { if (handler.isValidSource(event, sourceElements)) { dndGhost = new DNDGhost(sourceElements, event); proxy = event.getStatus(); proxy.update(dndGhost.getElement()); targetElement = null; setHandler(handler); /* * The drag and drop elements in GXT are positionned as follows: * div container (x-dd-drag-proxy) * div icon (x-dd-drop-icon) * div proxy (x-dd-drag-ghost) * div ghost (custom ghost) * * x-dd-drag-ghost needs to be altered to be made absolute * in order to support custom ghost with absolute positioning */ Style proxyStyle = dndGhost.getElement().getParentElement().getStyle(); proxyStyle.setPosition(Position.ABSOLUTE); proxyStyle.setLeft(0, Unit.PX); proxyStyle.setRight(0, Unit.PX); proxyStyle.setTop(0, Unit.PX); proxyStyle.setBottom(0, Unit.PX); return true; } } return false; }
From source file:org.waveprotocol.wave.client.editor.debug.DebugPopupFactory.java
License:Apache License
/** * Create a debug popup./*from w w w .j a v a 2s .co m*/ * @param editorImpl */ public static UniversalPopup create(EditorImpl editorImpl) { final DebugDialog debugDialog = new DebugDialog(editorImpl); RelativePopupPositioner positioner = new RelativePopupPositioner() { public void setPopupPositionAndMakeVisible(Element reference, Element popup) { com.google.gwt.dom.client.Style popupStyle = popup.getStyle(); popupStyle.setTop(50, Unit.PX); popupStyle.setLeft(50, Unit.PX); popupStyle.setVisibility(Visibility.VISIBLE); popupStyle.setPosition(Position.FIXED); } }; PopupEventListener listener = new PopupEventListener() { public void onHide(PopupEventSourcer source) { debugDialog.onHide(); } public void onShow(PopupEventSourcer source) { debugDialog.onShow(); } }; final UniversalPopup popup = EditorStaticDeps.createPopup(null, positioner, false, true, debugDialog, listener); if (popup.getTitleBar() != null) { popup.getTitleBar().setTitleText("Editor Debug"); popup.getTitleBar().addButton(new Button(" X ", new ClickHandler() { public void onClick(ClickEvent event) { popup.hide(); } })); } return popup; }