/** * Get the element that represents the specified index. * * @param index the index of the row value * @return the child element, or null if it does not exist */ protected Element getChildElement(int index) { Element childContainer = getChildContainer(); int childCount = childContainer.getChildCount(); return (index < childCount) ? childContainer.getChild(index).<Element> cast() : null; }
/** * Get the parent element of the decorated cell. * * @param parent the parent of this cell * @return the decorated cell's parent */ private Element getCellParent(Element parent) { return parent.getFirstChildElement().getChild(1).cast(); } }
@Override protected Element getKeyboardSelectedElement() { // Do not use getRowElement() because that will flush the presenter. int rowIndex = getKeyboardSelectedRow(); if (rowIndex >= 0 && childContainer.getChildCount() > rowIndex) { return childContainer.getChild(rowIndex).cast(); } return null; }
/** * Returns the element that parents the cell contents of the node. * * @param nodeElem the element that represents the node * @return the cell parent within the node */ private static Element getCellParent(Element nodeElem) { return getSelectionElement(nodeElem).getFirstChildElement().getChild(1).cast(); }
Element toReplace = null; if (start < childCount) { toReplace = childContainer.getChild(start).cast(); if (toReplace == null) { childContainer.appendChild(newChildren.getChild(0)); } else { Element nextSibling = toReplace.getNextSiblingElement(); childContainer.replaceChild(newChildren.getChild(0), toReplace); toReplace = nextSibling;
private Element ensureColumn(int col) { prepareColumn(col); prepareColumnGroup(); resizeColumnGroup(col + 1, true); return columnGroup.getChild(col).cast(); }
/** * Get the {@link Element} for the specified index. If the element has not * been created, null is returned. * * @param indexOnPage the index on the page * @return the element, or null if it doesn't exists * @throws IndexOutOfBoundsException if the index is outside of the current * page */ public Element getRowElement(int indexOnPage) { getPresenter().flush(); checkRowBounds(indexOnPage); if (childContainer.getChildCount() > indexOnPage) { return childContainer.getChild(indexOnPage).cast(); } return null; }
@Override public void onBrowserEvent(Context context, Element parent, String value, NativeEvent event, ValueUpdater<String> valueUpdater) { // The loading indicator can fire its own load or error event, so we check // that the event actually occurred on the main image. String type = event.getType(); if (BrowserEvents.LOAD.equals(type) && eventOccurredOnImage(event, parent)) { // Remove the loading indicator. parent.getFirstChildElement().getStyle().setDisplay(Display.NONE); // Show the image. Element imgWrapper = parent.getChild(1).cast(); imgWrapper.getStyle().setProperty("height", "auto"); imgWrapper.getStyle().setProperty("width", "auto"); imgWrapper.getStyle().setProperty("overflow", "auto"); } else if (BrowserEvents.ERROR.equals(type) && eventOccurredOnImage(event, parent)) { // Replace the loading indicator with an error message. parent.getFirstChildElement().setInnerSafeHtml(errorRenderer.render(value)); } }
/** * Moves all children of "from" element onto "to" element. */ public static void moveChildren(Element from, Element to) { if (from == null || to == null || from == to) return; for (int k = from.getChildCount() - 1; k >= 0; k--) { Node node = from.getChild(k); from.removeChild(node); to.insertFirst(node); } }
/** * Get the parent element of the decorated cell. * * @param parent the parent of this cell * @return the decorated cell's parent */ private Element getCellParent(Element parent) { return parent.getFirstChildElement().getChild(1).cast(); } }
private void cleanUpLI() { Element elt = getElement(); for (int i = elt.getChildCount() - 1; i >= 0; i--) { elt.removeChild(elt.getChild(i)); } setStyleName("jqm4gwt-listitem"); }
public CubaScrollTableHeaderCell(String colId, String headerText) { super(colId, headerText); Element sortIndicator = td.getChild(1).cast(); DOM.sinkEvents(sortIndicator, Event.ONCONTEXTMENU | DOM.getEventsSunk(sortIndicator)); Element captionContainer = td.getChild(2).cast(); DOM.sinkEvents(captionContainer, Event.ONCONTEXTMENU | DOM.getEventsSunk(captionContainer)); }
private void restoreStyleForTDsInRow(VScrollTableRow row) { Element tr = row.getElement(); for (int ix = 0; ix < tr.getChildCount(); ix++) { Element td = tr.getChild(ix).cast(); td.getStyle().clearProperty("backgroundAttachment"); td.getStyle().clearProperty("backgroundClip"); td.getStyle().clearProperty("backgroundColor"); td.getStyle().clearProperty("backgroundImage"); td.getStyle().clearProperty("backgroundOrigin"); } } }
/** * Returns the element that parents the cell contents of the node. * * @param nodeElem the element that represents the node * @return the cell parent within the node */ private static Element getCellParent(Element nodeElem) { return getSelectionElement(nodeElem).getFirstChildElement().getChild(1).cast(); }
public void testToastStructure() { MaterialToast.fireToast("test"); Element toastContainer = $("body").find("#toast-container").asElement(); assertNotNull(toastContainer); assertEquals(toastContainer.getChildCount(), 1); assertNotNull(toastContainer.getChild(0)); assertTrue(toastContainer.getChild(0) instanceof Element); Element toastElement = (Element) toastContainer.getChild(0); assertEquals(toastElement.getInnerHTML(), "test"); toastContainer.setInnerHTML(""); } }
public void setHdrText( int col, String text ) { ensureHeaderCell( col ); Element th = Element.as( thead.getChild( col ) ); clearTH( th, false ); th.setInnerText( text ); }
public void testToastStructure() { MaterialToast.fireToast("test"); Element toastContainer = $("body").find("#toast-container").asElement(); assertNotNull(toastContainer); assertEquals(toastContainer.getChildCount(), 1); assertNotNull(toastContainer.getChild(0)); assertTrue(toastContainer.getChild(0) instanceof Element); Element toastElement = (Element) toastContainer.getChild(0); assertEquals(toastElement.getInnerHTML(), "test"); toastContainer.setInnerHTML(""); } }
private Element ensureColumn(int col) { prepareColumn(col); prepareColumnGroup(); resizeColumnGroup(col + 1, true); return columnGroup.getChild(col).cast(); }
public CubaGroupBoxWidget(String primaryStyleName) { setStylePrimaryName(primaryStyleName); setStyleName(primaryStyleName); captionWrap = captionNode.getParentElement().cast(); captionTextNode = (Element) captionNode.getChild(0); }
private void scrollSelectedItemIntoView() { NodeList<Node> items = getSuggestionMenu().getElement().getChild(1).getChild(0).getChildNodes(); for (int i = 0; i < items.getLength(); i++) { Element element = (Element) items.getItem(i); if (((Element) element.getChild(0)).getClassName().equals("item item-selected")) { element.scrollIntoView(); break; } } } }