Refine search
private void updateImageElementFromImageResource(Element imageSpan, ImageResource res, int spacing) { SafeUri url = res.getSafeUri(); int width = res.getWidth(); int height = res.getHeight(); int paddingRight = width + spacing; String style = "url(\"" + url.asString() + "\") no-repeat scroll left center"; imageSpan.getStyle().setProperty("background", style); imageSpan.getStyle().setPropertyPx("width", width); imageSpan.getStyle().setPropertyPx("height", height); imageSpan.getStyle().setPropertyPx("paddingRight", paddingRight); }
messageLabel.getElement().getStyle().setWhiteSpace(WhiteSpace.PRE_WRAP); messageLabel.getElement().getStyle().setProperty("maxHeight", "400px"); messageLabel.getElement().getStyle() .setProperty("maxWidth", Window.getClientWidth() * 2 / 3 + "px"); messageLabel.getElement().getStyle().setOverflowY(Overflow.AUTO); messageLabel.setMessage(message);
/** * Convenience method to set the left offset of an element. * * @param elem the element * @param left a CSS length value for left */ static final void setLeft(Element elem, String left) { elem.getStyle().setProperty("left", left); }
/** * Sets whether this object is visible. This method just sets the * <code>visibility</code> style attribute. You need to call {@link #show()} * to actually attached/detach the {@link PopupPanel} to the page. * * @param visible <code>true</code> to show the object, <code>false</code> to * hide it * @see #show() * @see #hide() */ @Override public void setVisible(boolean visible) { // We use visibility here instead of UIObject's default of display // Because the panel is absolutely positioned, this will not create // "holes" in displayed contents and it allows normal layout passes // to occur so the size of the PopupPanel can be reliably determined. getElement().getStyle().setProperty("visibility", visible ? "visible" : "hidden"); // If the PopupImpl creates an iframe shim, it's also necessary to hide it // as well. if (glass != null) { glass.getStyle().setProperty("visibility", visible ? "visible" : "hidden"); } }
public void adjust(Element img, SafeUri url, int left, int top, int width, int height) { String style = "url(\"" + url.asString() + "\") no-repeat " + (-left + "px ") + (-top + "px"); img.getStyle().setProperty("background", style); img.getStyle().setPropertyPx("width", width); img.getStyle().setPropertyPx("height", height); }
/** * @deprecated Call and override {@link #setCellVerticalAlignment(Element, * VerticalAlignmentConstant)} instead. */ @Deprecated protected void setCellVerticalAlignment(com.google.gwt.user.client.Element td, VerticalAlignmentConstant align) { td.getStyle().setProperty("verticalAlign", align.getVerticalAlignString()); }
/** * Convenience method to set the height of an element. * * @param elem the element * @param height a CSS length value for the height */ static final void setHeight(Element elem, String height) { elem.getStyle().setProperty("height", height); }
/** * Set the minimum width of the tables in this widget. If the widget become * narrower than the minimum width, a horizontal scrollbar will appear so the * user can scroll horizontally. * * <p> * Note that this method is not supported in IE6 and earlier versions of IE. * </p> * * @param value the width * @param unit the unit of the width * @see #setTableWidth(double, Unit) */ public void setMinimumTableWidth(double value, Unit unit) { /* * The min-width style attribute doesn't apply to tables, so we set the * min-width of the element that contains the table instead. The table width * is fixed at 100%. */ tableHeaderContainer.getElement().getStyle().setProperty("minWidth", value, unit); tableFooterContainer.getElement().getStyle().setProperty("minWidth", value, unit); tableDataContainer.getStyle().setProperty("minWidth", value, unit); }
/** * Creates an empty absolute panel. */ public AbsolutePanel() { this(DOM.createDiv()); // Setting the panel's position style to 'relative' causes it to be treated // as a new positioning context for its children. getElement().getStyle().setProperty("position", "relative"); getElement().getStyle().setProperty("overflow", "hidden"); }
/** * Convenience method to set the right offset of an element. * * @param elem the element * @param right a CSS length value for right */ static final void setRight(Element elem, String right) { elem.getStyle().setProperty("right", right); }
public void init(VerticalSplitPanel panel) { this.panel = panel; panel.getElement().getStyle().setProperty("position", "relative"); final Element topElem = panel.getElement(TOP); final Element bottomElem = panel.getElement(BOTTOM); expandToFitParentHorizontally(topElem); expandToFitParentHorizontally(bottomElem); expandToFitParentHorizontally(panel.getSplitElement()); expandToFitParentUsingCssOffsets(panel.container); // Snap the bottom wrapper to the bottom side. bottomElem.getStyle().setProperty("bottom", "0"); }
/** * Sets the object's height. This height does not include decorations such as * border, margin, and padding. * * @param height the object's new height, in CSS units (e.g. "10px", "1em") */ public void setHeight(String height) { // This exists to deal with an inconsistency in IE's implementation where // it won't accept negative numbers in length measurements assert extractLengthValue(height.trim().toLowerCase(Locale.ROOT)) >= 0 : "CSS heights should not be negative"; getElement().getStyle().setProperty("height", height); }
/** * @param popup the popup * @param rect the clip rect */ public void setClip(Element popup, String rect) { popup.getStyle().setProperty("clip", rect); } }
private void init(ImageAdapter images, boolean useLeafImages) { setImages(images, useLeafImages); setElement(DOM.createDiv()); getElement().getStyle().setProperty("position", "relative"); // Fix rendering problem with relatively-positioned elements and their // children by // forcing the element that is positioned relatively to 'have layout' getElement().getStyle().setProperty("zoom", "1"); focusable = FocusPanel.impl.createFocusable(); focusable.getStyle().setProperty("fontSize", "0"); focusable.getStyle().setProperty("position", "absolute"); // Hide focus outline in Mozilla/Webkit focusable.getStyle().setProperty("outline", "0px"); // Hide focus outline in IE 6/7 focusable.setAttribute("hideFocus", "true"); DOM.setIntStyleAttribute(focusable, "zIndex", -1); DOM.appendChild(getElement(), focusable); sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS); DOM.sinkEvents(focusable, Event.FOCUSEVENTS); // The 'root' item is invisible and serves only as a container // for all top-level items. root = new TreeItem(true); root.setTree(this); setStyleName("gwt-Tree"); // Add a11y role "tree" Roles.getTreeRole().set(focusable); }
/** * Sets the object's width. This width does not include decorations such as * border, margin, and padding. * * @param width the object's new width, in CSS units (e.g. "10px", "1em") */ public void setWidth(String width) { // This exists to deal with an inconsistency in IE's implementation where // it won't accept negative numbers in length measurements assert extractLengthValue(width.trim().toLowerCase(Locale.ROOT)) >= 0 : "CSS widths should not be negative"; getElement().getStyle().setProperty("width", width); }
/** * Changes a DOM element's positioning to static. * * @param elem the DOM element */ private static void changeToStaticPositioning(Element elem) { elem.getStyle().setProperty("left", ""); elem.getStyle().setProperty("top", ""); elem.getStyle().setProperty("position", ""); }
@Override protected void onUpdate(double progress) { int scrollHeight = curPanel.contentWrapper.getElement().getPropertyInt("scrollHeight"); int height = (int) (progress * scrollHeight); if (!opening) { height = scrollHeight - height; } height = Math.max(height, 1); curPanel.contentWrapper.getElement().getStyle().setProperty("height", height + "px"); curPanel.contentWrapper.getElement().getStyle().setProperty("width", "auto"); } }
/** * Adds clipping to an element. * * @param elem the element */ static final void addClipping(final Element elem) { elem.getStyle().setProperty("overflow", "hidden"); }
@Override public void setHorizontalAlignment(HorizontalAlignmentConstant align) { horzAlign = align; getElement().getStyle().setProperty("textAlign", align.getTextAlignString()); }
/** * Adds as-needed scrolling to an element. * * @param elem the element */ static final void addScrolling(final Element elem) { elem.getStyle().setProperty("overflow", "auto"); }