/** * Instantiates a new ImageTextButton. */ public ImageTextButton(ImageResource imageResource, String text, ClickHandler clickHandler) { super(); if (clickHandler != null) { addClickHandler(clickHandler); } String definedStyles = getElement().getAttribute("style"); getElement().setAttribute("style", definedStyles + "; vertical-align:middle;"); this.text = text; Element span = DOM.createElement("span"); span.setInnerText(text); DOM.insertChild(getElement(), span, 0); Element imageSpan = DOM.createElement("span"); int spacing; if (this.text == null || this.text.trim().equals("")) { spacing = 0; } else { spacing = 16; } if (imageResource != null) { updateImageElementFromImageResource(imageSpan, imageResource, spacing); } DOM.insertBefore(getElement(), imageSpan, DOM.getFirstChild(getElement())); }
Element textElement = DOM.createElement("span"); textElement.setInnerText(text + " "); DOM.insertChild(getElement(), textElement, 0); Element caretSpan = DOM.createElement("span"); caretSpan.setClassName(Utils.kaaAdminStyle.caret());
/** * Inserts a new cell into the specified row. * * @param row the row into which the new cell will be inserted * @param column the column before which the cell will be inserted * @throws IndexOutOfBoundsException */ protected void insertCell(int row, int column) { Element tr = rowFormatter.getRow(bodyElem, row); Element td = createCell(); DOM.insertChild(tr, td, column); }
/** * Physically add the td element of a {@link MenuItem} or * {@link MenuItemSeparator} to this {@link MenuBar}. * * @param beforeIndex the index where the separator should be inserted * @param tdElem the td element to be added */ private void addItemElement(int beforeIndex, Element tdElem) { if (vertical) { Element tr = DOM.createTR(); DOM.insertChild(body, tr, beforeIndex); DOM.appendChild(tr, tdElem); } else { Element tr = DOM.getChild(body, 0); DOM.insertChild(tr, tdElem, beforeIndex); } }
/** * Inserts a number of cells before the specified cell. * * @param row the row into which the new cells will be inserted * @param column the column before which the new cells will be inserted * @param count number of cells to be inserted * @throws IndexOutOfBoundsException */ protected void insertCells(int row, int column, int count) { Element tr = rowFormatter.getRow(bodyElem, row); for (int i = column; i < column + count; i++) { Element td = createCell(); DOM.insertChild(tr, td, i); } }
public void insert(Widget w, int beforeIndex) { checkIndexBoundsForInsertion(beforeIndex); /* * 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. */ Element td = createAlignedTd(); DOM.insertChild(tableRow, td, beforeIndex); insert(w, td, beforeIndex, false); }
/** * 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")); } } }
/** * Inserts a new row into the table. * * @param beforeRow the index before which the new row will be inserted * @return the index of the newly-created row * @throws IndexOutOfBoundsException */ protected int insertRow(int beforeRow) { // Specifically allow the row count as an insert position. if (beforeRow != getRowCount()) { checkRowBounds(beforeRow); } Element tr = DOM.createTR(); DOM.insertChild(bodyElem, tr, beforeRow); return beforeRow; }
public void insert(Widget w, int beforeIndex) { Element container = createWidgetContainer(); DOM.insertChild(getElement(), container, beforeIndex); // See add(Widget) for important comments insert(w, container, beforeIndex, true); finishWidgetInitialization(container, w); }
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); }
/** * @deprecated Call and override {@link insert(Widget, Element, int, boolean)} instead. */ @Deprecated protected void insert(Widget child, com.google.gwt.user.client.Element container, int beforeIndex, boolean domInsert) { // Validate index; adjust if the widget is already a child of this panel. beforeIndex = adjustIndex(child, beforeIndex); // Detach new child. child.removeFromParent(); // Logical attach. getChildren().insert(child, beforeIndex); // Physical attach. if (domInsert) { DOM.insertChild(container, child.getElement(), beforeIndex); } else { DOM.appendChild(container, child.getElement()); } // Adopt. adopt(child); }
DOM.insertChild(rows[northRow].tr, td, rows[northRow].center); DOM.appendChild(td, child.getElement()); td.setPropertyInt("colSpan", logicalRightCol - logicalLeftCol + 1); ++northRow; } else if (layout.direction == SOUTH) { DOM.insertChild(rows[southRow].tr, td, rows[southRow].center); DOM.appendChild(td, child.getElement()); td.setPropertyInt("colSpan", logicalRightCol - logicalLeftCol + 1); } else if (shouldAddToLogicalLeftOfTable(layout.direction)) { TmpRow row = rows[northRow]; DOM.insertChild(row.tr, td, row.center++); DOM.appendChild(td, child.getElement()); td.setPropertyInt("rowSpan", southRow - northRow + 1); } else if (shouldAddToLogicalRightOfTable(layout.direction)) { TmpRow row = rows[northRow]; DOM.insertChild(row.tr, td, row.center); DOM.appendChild(td, child.getElement()); td.setPropertyInt("rowSpan", southRow - northRow + 1); DOM.insertChild(row.tr, centerTd, row.center); DOM.appendChild(centerTd, center.getElement());
DOM.insertChild(body, trb, effectiveIndex); DOM.insertChild(body, trh, effectiveIndex);
/** * Adopt a table into this {@link AbstractScrollTable} within its wrapper. * * @param table the table to adopt * @param wrapper the wrapper element * @param index the index to insert the wrapper in the main element */ private void adoptTable(Widget table, Element wrapper, int index) { DOM.insertChild(absoluteElem, wrapper, index); add(table, wrapper); }
@Override protected void applySort(Element[] trElems) { // Move the rows to their new positions Element bodyElem = getBodyElement(); for (int i = trElems.length - 1; i >= 0; i--) { if (trElems[i] != null) { DOM.removeChild(bodyElem, trElems[i]); // Need to insert below the ghost row DOM.insertChild(bodyElem, trElems[i], 1); } } }
public void insert(Widget w, int beforeIndex) { Element container = createWidgetContainer(); DOM.insertChild(getElement(), container, beforeIndex); // See add(Widget) for important comments insert(w, container, beforeIndex, true); finishWidgetInitialization(container, w); }
@Override public void setIconUri(String iconUri, ApplicationConnection client) { if (icon != null) { captionNode.removeChild(icon.getElement()); } icon = client.getIcon(iconUri); if (icon != null) { DOM.insertChild(captionNode, icon.getElement(), 1); } }
public void moveCol(int oldIndex, int newIndex) { // loop all rows and move given index to its new place for (Widget w : this) { final VScrollTableRow row = (VScrollTableRow) w; final Element td = DOM.getChild(row.getElement(), oldIndex); if (td != null) { DOM.removeChild(row.getElement(), td); DOM.insertChild(row.getElement(), td, newIndex); } } }
/** * Unwraps the child element. * * @param bounds the original bounds */ public El unwrap(Element child, Rectangle bounds) { El.fly(child, "_internal").setLeftTop(bounds.x, bounds.y); Element p = dom.getParentElement().cast(); int pos = DOM.getChildIndex(p, dom); p.removeChild(dom); DOM.insertChild(p, child, pos); return this; }
public CubaScrollTableHead() { Element iconElement = presentationsEditIcon.getElement(); iconElement.setClassName("c-table-prefs-icon"); iconElement.getStyle().setDisplay(Style.Display.NONE); Element columnSelector = (Element) getElement().getLastChild(); DOM.insertChild(getElement(), iconElement, DOM.getChildIndex(getElement(), columnSelector)); DOM.sinkEvents(iconElement, Event.ONCLICK); }