List of usage examples for com.google.gwt.dom.client Style setPropertyPx
public void setPropertyPx(String name, int value)
From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java
License:Apache License
private void setPopupPositionStyle(int left, int top) { Style style = getElement().getStyle(); style.setPropertyPx("left", left); style.setPropertyPx("top", top); }
From source file:org.cruxframework.crux.widgets.client.promobanner.BannerImpl.java
License:Apache License
protected void addBanner(ImageResource image, String title, String text, String styleName, String buttonLabel, final SelectHandler selectHandler) { SimplePanel panel = new SimplePanel(); Style style = panel.getElement().getStyle(); style.setProperty("background", "url(" + Screen.rewriteUrl(image.getSafeUri().asString()) + ") no-repeat " + (-image.getLeft() + "px ") + (-image.getTop() + "px")); style.setPropertyPx("width", image.getWidth()); style.setPropertyPx("height", image.getHeight()); doAddBanner(title, text, styleName, buttonLabel, selectHandler, panel); }
From source file:org.dashbuilder.client.gallery.GalleryTreeViewImpl.java
License:Apache License
@PostConstruct private void initUI() { initWidget(mainPanel);//from w w w . j av a 2s . c o m Tree tree = initNavigationTree(); tree.setWidth("150px"); Style leftStyle = mainPanel.getElement().getStyle(); leftStyle.setPropertyPx("margin", 5); mainPanel.add(tree); }
From source file:org.eclipse.che.ide.ui.smartTree.Tree.java
License:Open Source License
private void ensureFocusElement() { if (focusEl != null) { focusEl.removeFromParent();/*from w w w .j ava 2 s .c o m*/ } focusEl = getElement().appendChild(focusImpl.createFocusable()); focusEl.addClassName(treeStyles.styles().noFocusOutline()); if (focusEl.hasChildNodes()) { focusEl.getFirstChildElement().addClassName(treeStyles.styles().noFocusOutline()); Style focusElStyle = focusEl.getFirstChildElement().getStyle(); focusElStyle.setBorderWidth(0, Style.Unit.PX); focusElStyle.setFontSize(1, Style.Unit.PX); focusElStyle.setPropertyPx("lineHeight", 1); } focusEl.getStyle().setLeft(0, Style.Unit.PX); focusEl.getStyle().setTop(0, Style.Unit.PX); focusEl.getStyle().setPosition(Style.Position.ABSOLUTE); //subscribe for Event.FOCUSEVENTS int bits = DOM.getEventsSunk((Element) focusEl.cast()); //do not remove redundant cast, GWT tests will fail DOM.sinkEvents((Element) focusEl.cast(), bits | Event.FOCUSEVENTS); }
From source file:org.rstudio.core.client.theme.ShadowBorder.java
License:Open Source License
private DivElement addPanel(String styleName, int halign, int valign) { DivElement div = Document.get().createDivElement(); div.setClassName(styleName);//from w ww . j av a 2s .co m Style style = div.getStyle(); style.setPosition(Style.Position.ABSOLUTE); switch (halign) { case LEFT: style.setPropertyPx("left", 0); style.setPropertyPx("width", 10); break; case CENTER: style.setPropertyPx("left", 10); style.setPropertyPx("right", 10); break; case RIGHT: style.setPropertyPx("right", 0); style.setPropertyPx("width", 10); break; } switch (valign) { case TOP: style.setPropertyPx("top", 0); style.setPropertyPx("height", 26); break; case MIDDLE: style.setPropertyPx("top", 26); style.setPropertyPx("bottom", 26); break; case BOTTOM: style.setPropertyPx("bottom", 0); style.setPropertyPx("height", 26); } layout_.getElement().appendChild(div); return div; }
From source file:org.thechiselgroup.biomixer.client.core.ui.popup.DefaultPopup.java
License:Apache License
private void attachPopup() { NEffectPanel effectPanel = getEffectPanel(); Style style = effectPanel.getElement().getStyle(); /*//from w w w .j av a 2 s .c o m * INFO: position is fixed, not absolute, because there are problems * with absolute positioning when the window is scrolled. */ style.setProperty(CSS.POSITION, CSS.FIXED); style.setProperty(CSS.Z_INDEX, Integer.toString(zIndex)); style.setPropertyPx(CSS.LEFT, location.getX()); style.setPropertyPx(CSS.TOP, location.getY()); rootPanel.add(effectPanel); }
From source file:org.thechiselgroup.biomixer.client.core.ui.popup.DefaultPopup.java
License:Apache License
@Override public void setLocation(Point location) { if (this.location.equals(location)) { return;/*w w w .j av a 2 s. com*/ } this.location = location; if (isAttached()) { Style style = getEffectPanel().getElement().getStyle(); style.setPropertyPx(CSS.LEFT, location.getX()); style.setPropertyPx(CSS.TOP, location.getY()); } }
From source file:org.thechiselgroup.biomixer.client.dnd.resources.DefaultResourceSetAvatarDragController.java
License:Apache License
private void moveDragProxy() { Style style = dragProxy.getElement().getStyle(); style.setPropertyPx(CSS.LEFT, getDesiredLeft()); style.setPropertyPx(CSS.TOP, getDesiredTop()); }
From source file:org.vaadin.addon.gwtgraphics.client.impl.SVGImpl.java
License:Apache License
protected int measureTextSize(Element element, boolean measureWidth) { String text = getText(element); if (text == null || "".equals(text)) { return 0; }//from w ww .j ava 2 s. co m DivElement measureElement = Document.get().createDivElement(); Style style = measureElement.getStyle(); style.setProperty("visibility", "hidden"); style.setProperty("display", "inline"); style.setProperty("whiteSpace", "nowrap"); style.setProperty("fontFamily", getTextFontFamily(element)); style.setPropertyPx("fontSize", getTextFontSize(element)); measureElement.setInnerText(text); RootPanel.getBodyElement().appendChild(measureElement); int measurement; if (measureWidth) { measurement = measureElement.getOffsetWidth(); } else { measurement = measureElement.getOffsetHeight(); } RootPanel.getBodyElement().removeChild(measureElement); return measurement; }
From source file:org.waveprotocol.wave.client.wavepanel.view.dom.DomUtil.java
License:Apache License
/** * Fixes element's height with the given value. *//* www.ja va 2 s. co m*/ public static void fixElementHeight(Element element, int fixedHeight) { Style style = element.getStyle(); style.setPropertyPx(STYLE_MIN_HEIGHT_PROPERTY, fixedHeight); style.setPropertyPx(STYLE_MAX_HEIGHT_PROPERTY, fixedHeight); }