/** 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); }
Element caretSpan = DOM.createElement("span"); caretSpan.setClassName(Utils.kaaAdminStyle.caret()); DOM.appendChild(getElement(), caretSpan);
@Override public void add(Widget w) { Element tr = DOM.createTR(); Element td = createAlignedTd(); DOM.appendChild(tr, td); DOM.appendChild(getBody(), tr); add(w, td); }
@Override public void add(Widget w) { Element td = createAlignedTd(); DOM.appendChild(tableRow, td); add(w, td); }
/** * Create a new empty HTML Table. */ public HTMLTable() { tableElem = DOM.createTable(); bodyElem = DOM.createTBody(); DOM.appendChild(tableElem, bodyElem); setElement(tableElem); }
public CellPanel() { table = DOM.createTable(); body = DOM.createTBody(); DOM.appendChild(table, body); setElement(table); }
private void setCurrentFaceElement(Element newFaceElement) { if (curFaceElement != newFaceElement) { if (curFaceElement != null) { getElement().removeChild(curFaceElement); } curFaceElement = newFaceElement; DOM.appendChild(getElement(), curFaceElement); } }
/** * Prepare the colgroup tag for the first time, guaranteeing that it exists * and has at least one col tag in it. This method corrects a Mozilla issue * where the col tag will affect the wrong column if a col tag doesn't exist * when the element is attached to the page. */ private void prepareColumnGroup() { if (columnGroup == null) { columnGroup = DOM.createElement("colgroup"); DOM.insertChild(tableElem, columnGroup, 0); DOM.appendChild(columnGroup, DOM.createElement("col")); } } }
void convertToFullNode(TreeItem item) { if (item.imageHolder == null) { // Extract the Elements from the object Element itemTable = DOM.clone(BASE_INTERNAL_ELEM, true); DOM.appendChild(item.getElement(), itemTable); Element tr = DOM.getFirstChild(DOM.getFirstChild(itemTable)); Element tdImg = DOM.getFirstChild(tr); Element tdContent = DOM.getNextSibling(tdImg); // Undoes padding from table element. item.getElement().getStyle().setProperty("padding", "0px"); DOM.appendChild(tdContent, item.contentElem); item.imageHolder = tdImg; } }
void initChildren() { convertToFullNode(); childSpanElem = DOM.createDiv(); DOM.appendChild(getElement(), childSpanElem); childSpanElem.getStyle().setProperty("whiteSpace", "nowrap"); children = new ArrayList<TreeItem>(); }
/** * @deprecated Call and override {@link #add(Widget, Element)} instead. */ @Deprecated protected void add(Widget child, com.google.gwt.user.client.Element container) { // Detach new child. child.removeFromParent(); // Logical attach. getChildren().add(child); // Physical attach. DOM.appendChild(container, child.getElement()); // Adopt. adopt(child); }
/** * 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; }
@Override public void add(Widget w) { Element container = createWidgetContainer(); DOM.appendChild(getElement(), container); // The order of these methods is very important. In order to preserve // backward compatibility, the offsetWidth and offsetHeight of the child // widget should be defined (greater than zero) when w.onLoad() is called. // As a result, we first initialize the container with a height of 0px, then // we attach the child widget to the container. See Issue 2321 for more // details. super.add(w, container); // After w.onLoad is called, it is safe to make the container invisible and // set the height of the container and widget to 100%. finishWidgetInitialization(container, w); }
private void showImage(TreeItem treeItem, AbstractImagePrototype proto) { Element holder = treeItem.getImageHolderElement(); Element child = DOM.getFirstChild(holder); if (child == null) { // If no image element has been created yet, create one from the // prototype. DOM.appendChild(holder, proto.createElement().<Element> cast()); } else { // Otherwise, simply apply the prototype to the existing element. proto.applyTo(child.<ImagePrototypeElement> cast()); } }
protected Hyperlink(Element elem) { if (elem == null) { setElement(anchorElem); } else { setElement(elem); DOM.appendChild(getElement(), anchorElem); } sinkEvents(Event.ONCLICK); setStyleName("gwt-Hyperlink"); directionalTextHelper = new DirectionalTextHelper(anchorElem, /* is inline */ true); }
/** * Creates an empty horizontal panel. */ public HorizontalPanel() { tableRow = DOM.createTR(); DOM.appendChild(getBody(), tableRow); getTable().setPropertyString("cellSpacing", "0"); getTable().setPropertyString("cellPadding", "0"); }
/** * 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"); }
public void insert(Widget w, int beforeIndex) { checkIndexBoundsForInsertion(beforeIndex); Element tr = DOM.createTR(); Element td = createAlignedTd(); DOM.appendChild(tr, td); /* * The case where we reinsert an already existing child is tricky. * * For the WIDGET, it ultimately removes first and inserts second, so we * have to adjust the index within ComplexPanel.insert(). But for the DOM, * we insert first and remove second, which means we DON'T need to adjust * the index. */ DOM.insertChild(getBody(), tr, beforeIndex); insert(w, td, beforeIndex, false); }
/** * Creates an empty stack panel. */ public StackPanel() { Element table = DOM.createTable(); setElement(table); body = DOM.createTBody(); DOM.appendChild(table, body); table.setPropertyInt("cellSpacing", 0); table.setPropertyInt("cellPadding", 0); DOM.sinkEvents(table, Event.ONCLICK); setStyleName(DEFAULT_STYLENAME); }