/** Create a progress bar within the given range starting at the specified progress amount. * * @param minProgress the minimum progress * @param maxProgress the maximum progress * @param curProgress the current progress * @param textFormatter the text formatter */ public ProgressBar (double minProgress, double maxProgress, double curProgress, TextFormatter textFormatter) { this.minProgress = minProgress; this.maxProgress = maxProgress; this.curProgress = curProgress; setTextFormatter(textFormatter); // Create the outer shell setElement(DOM.createDiv()); DOM.setStyleAttribute(getElement(), "position", "relative"); setStyleName("gwt-ProgressBar-shell"); // Create the bar element barElement = DOM.createDiv(); DOM.appendChild(getElement(), barElement); DOM.setStyleAttribute(barElement, "height", "100%"); setBarStyleName("gwt-ProgressBar-bar"); // Create the text element textElement = DOM.createDiv(); DOM.appendChild(getElement(), textElement); DOM.setStyleAttribute(textElement, "position", "absolute"); DOM.setStyleAttribute(textElement, "top", "0px"); // Set the current progress setProgress(curProgress); }
/** Create a progress bar within the given range starting at the specified progress amount. * * @param minProgress the minimum progress * @param maxProgress the maximum progress * @param curProgress the current progress * @param textFormatter the text formatter */ public ProgressBar (double minProgress, double maxProgress, double curProgress, TextFormatter textFormatter) { this.minProgress = minProgress; this.maxProgress = maxProgress; this.curProgress = curProgress; setTextFormatter(textFormatter); // Create the outer shell setElement(DOM.createDiv()); DOM.setStyleAttribute(getElement(), "position", "relative"); setStyleName("gwt-ProgressBar-shell"); // Create the bar element barElement = DOM.createDiv(); DOM.appendChild(getElement(), barElement); DOM.setStyleAttribute(barElement, "height", "100%"); setBarStyleName("gwt-ProgressBar-bar"); // Create the text element textElement = DOM.createDiv(); DOM.appendChild(getElement(), textElement); DOM.setStyleAttribute(textElement, "position", "absolute"); DOM.setStyleAttribute(textElement, "top", "0px"); // Set the current progress setProgress(curProgress); }
/** * Creates an empty panel that uses a DIV for its contents. */ public SimplePanel() { this(DOM.createDiv()); }
/** * Returns a header element. */ Element createHeaderElem() { return DOM.createDiv(); }
/** * Creates an empty hyperlink. */ public Hyperlink() { this(DOM.createDiv()); }
/** * Creates an empty deck panel. */ public DeckPanel() { setElement(DOM.createDiv()); }
/** * Gets the contents associated with this face. */ private Element getFace() { if (face == null) { if (delegateTo == null) { // provide a default face as none was supplied. face = DOM.createDiv(); return face; } else { return delegateTo.getFace(); } } else { return face; } }
private VerticalSplitPanel(AbstractImagePrototype thumbImage) { super(DOM.createDiv(), DOM.createDiv(), preventBoxStyles(DOM.createDiv()), preventBoxStyles(DOM.createDiv())); container = preventBoxStyles(DOM.createDiv()); buildDOM(thumbImage); setStyleName("gwt-VerticalSplitPanel"); impl.init(this); setSplitPosition("50%"); }
private HorizontalSplitPanel(AbstractImagePrototype thumbImage) { super(DOM.createDiv(), DOM.createDiv(), preventBoxStyles(DOM.createDiv()), preventBoxStyles(DOM.createDiv())); container = preventBoxStyles(DOM.createDiv()); buildDOM(thumbImage); setStyleName("gwt-HorizontalSplitPanel"); impl.init(this); // By default, the panel will fill its parent vertically and horizontally. // The horizontal case is covered by the fact that the top level div is // block display. setHeight("100%"); }
/** * 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"); }
/** * Sets the face's contents as text. * * @param text text to set as face's contents */ @Override public final void setText(String text) { face = DOM.createDiv(); UIObject.setStyleName(face, STYLENAME_HTML_FACE, true); face.setInnerText(text); updateButtonFace(); }
void initChildren() { convertToFullNode(); childSpanElem = DOM.createDiv(); DOM.appendChild(getElement(), childSpanElem); childSpanElem.getStyle().setProperty("whiteSpace", "nowrap"); children = new ArrayList<TreeItem>(); }
/** * Creates an HTML IFRAME element with a name. * * @param name the name of the frame, which must contain at least one * non-whitespace character and must not contain reserved HTML markup * characters such as '<code><</code>', '<code>></code>', * or '<code>&</code>' * @return the newly-created element * @throws IllegalArgumentException if the supplied name is not allowed */ private static IFrameElement createIFrame(String name) { if (name == null || !isValidName(name.trim())) { throw new IllegalArgumentException( "expecting one or more non-whitespace chars with no '<', '>', or '&'"); } // Use innerHTML to implicitly create the <iframe>. This is necessary // because most browsers will not respect a dynamically-set iframe name. Element div = DOM.createDiv(); div.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(name)); return div.getFirstChild().cast(); }
/** * Set the face's contents as html. * * @param html html to set as face's contents html * */ @Override public void setHTML(@IsSafeHtml String html) { face = DOM.createDiv(); UIObject.setStyleName(face, STYLENAME_HTML_FACE, true); face.setInnerHTML(html); updateButtonFace(); }
/** * Create a new table cell with a specific style name. * * @param styleName the style name * @return the new cell {@link Element} */ private static Element createTD(String styleName) { Element tdElem = DOM.createTD(); Element inner = DOM.createDiv(); DOM.appendChild(tdElem, inner); setStyleName(tdElem, styleName); setStyleName(inner, styleName + "Inner"); return tdElem; }
/** * Constructs a new {@link MenuItemSeparator}. */ public MenuItemSeparator() { setElement(DOM.createTD()); setStyleName(STYLENAME_DEFAULT); // Add an inner element for styling purposes Element div = DOM.createDiv(); DOM.appendChild(getElement(), div); setStyleName(div, "menuSeparatorInner"); }
/** * Setup the container around the widget. */ private Element createWidgetContainer() { Element container = DOM.createDiv(); container.getStyle().setProperty("width", "100%"); container.getStyle().setProperty("height", "0px"); container.getStyle().setProperty("padding", "0px"); container.getStyle().setProperty("margin", "0px"); return container; }
@Override @SuppressIsSafeHtmlCastCheck public void uninitElement() { isReady = false; // Issue 1897: initElement uses a timeout, so its possible to call this // method after calling initElement, but before the event system is in // place. if (initializing) { initializing = false; return; } // Unhook all custom event handlers when the element is detached. unhookEvents(); // Recreate the placeholder element and store the iframe's contents and the // enabled status in it. This is necessary because some browsers will wipe // the iframe's contents when it is removed from the DOM. @IsSafeHtml String html = getHTML(); // TODO: mXSS boolean enabled = isEnabled(); beforeInitPlaceholder = DOM.createDiv(); beforeInitPlaceholder.setInnerHTML(html); setEnabled(enabled); }
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); }
/** * Setup clonable elements. */ void initializeClonableElements() { if (GWT.isClient()) { // Create the base table element that will be cloned. BASE_INTERNAL_ELEM = DOM.createTable(); Element contentElem = DOM.createDiv(); Element tbody = DOM.createTBody(), tr = DOM.createTR(); Element tdImg = DOM.createTD(), tdContent = DOM.createTD(); DOM.appendChild(BASE_INTERNAL_ELEM, tbody); DOM.appendChild(tbody, tr); DOM.appendChild(tr, tdImg); DOM.appendChild(tr, tdContent); tdImg.getStyle().setProperty("verticalAlign", "middle"); tdContent.getStyle().setProperty("verticalAlign", "middle"); DOM.appendChild(tdContent, contentElem); contentElem.getStyle().setProperty("display", "inline"); setStyleName(contentElem, "gwt-TreeItem"); BASE_INTERNAL_ELEM.getStyle().setProperty("whiteSpace", "nowrap"); // Create the base element that will be cloned BASE_BARE_ELEM = DOM.createDiv(); // Simulates padding from table element. BASE_BARE_ELEM.getStyle().setProperty("padding", "3px"); DOM.appendChild(BASE_BARE_ELEM, contentElem); Roles.getTreeitemRole().set(contentElem); } } }