/** * Checks that the parent of {@code rendered} has a single child. */ private static boolean isRenderedElementSingleChild(Element rendered) { return GWT.isProdMode() || rendered.getParentElement().getChildCount() == 1; }
/** * 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; }
@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; }
/** * Resize the column group element. * * @param columns the number of columns * @param growOnly true to only grow, false to shrink if needed */ void resizeColumnGroup(int columns, boolean growOnly) { // The colgroup should always have at least one element. See // prepareColumnGroup() for more details. columns = Math.max(columns, 1); int num = columnGroup.getChildCount(); if (num < columns) { for (int i = num; i < columns; i++) { columnGroup.appendChild(Document.get().createColElement()); } } else if (!growOnly && num > columns) { for (int i = num; i > columns; i--) { columnGroup.removeChild(columnGroup.getLastChild()); } } }
int start, SafeHtml html) { int childCount = childContainer.getChildCount(); Element toReplace = null; if (start < childCount) { int count = newChildren.getChildCount(); for (int i = 0; i < count; i++) { if (toReplace == null) {
/** * 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; }
/** * Animate a {@link CellTreeNodeView} into its new state. * * @param node the {@link CellTreeNodeView} to animate * @param isAnimationEnabled true to animate */ @Override void animate(CellTreeNodeView<?> node, boolean isAnimationEnabled) { // Cancel any pending animations. cancel(); // Initialize the fields. this.opening = node.isOpen(); animFrame = node.ensureAnimationFrame(); contentContainer = node.ensureContentContainer(); childContainer = node.ensureChildContainer(); if (isAnimationEnabled) { // Animated. int duration = getDuration(); int childCount = childContainer.getChildCount(); if (childCount < 4) { // Reduce the duration if there are less than four items or it will // look really slow. duration = (int) ((childCount / 4.0) * duration); } run(duration); } else { // Non animated. cleanup(); } }
/** * 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); } }
private void ensureHeaderCell( int col ) { ensureHeader(); while( thead.getChildCount() <= col ) thead.appendChild( DOM.createTH() ); }
private static void storeId(Widget widget, Element element) { String id = element.getId(); if ((widget.getElement() == element || WidgetUtils.getWidget(element) == widget) && id != null && !id.isEmpty()) { INSTANCE.indexedObjectFinder.mapById.put(id, widget); for (int i = 0; i < element.getChildCount(); i++) { if (element.getChild(i) instanceof Element) { storeId(widget, (Element) element.getChild(i)); } } } }
private void cleanUpLI() { Element elt = getElement(); for (int i = elt.getChildCount() - 1; i >= 0; i--) { elt.removeChild(elt.getChild(i)); } setStyleName("jqm4gwt-listitem"); }
private void resetCellWrapperDivsDisplayProperty( VScrollTableRow row) { Element tr = row.getElement(); for (int ix = 0; ix < tr.getChildCount(); ix++) { getWrapperDiv(tr, ix).getStyle().clearProperty("display"); } }
private void cleanUpLI() { Element elt = getElement(); for (int i = elt.getChildCount() - 1; i >= 0; i--) { elt.removeChild(elt.getChild(i)); } setStyleName("jqm4gwt-listitem"); }
public double getRealCellWidth(int colIdx) { if (colIdx >= tr.getChildCount()) { return -1; } Element cell = DOM.getChild(tr, colIdx); ComputedStyle cs = new ComputedStyle(cell); return cs.getWidth() + cs.getPaddingWidth() + cs.getBorderWidth(); }
public VDDTabSheet() { super(); newTab.setClassName(CLASSNAME_NEW_TAB); // Get the tabBar tabBar = (ComplexPanel) getChildren().get(0); // Get the content tabPanel = (VTabsheetPanel) getChildren().get(1); // Get the spacer Element tBody = tabBar.getElement(); spacer = tBody.getChild(tBody.getChildCount() - 1).getChild(0) .getChild(0).cast(); }
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"); } } }
public void testToastWithStyling() { MaterialToast.fireToast("test", "rounded"); 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); assertTrue(toastElement.hasClassName("rounded")); toastContainer.setInnerHTML(""); }
public void testToastWithStyling() { MaterialToast.fireToast("test", "rounded"); 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); assertTrue(toastElement.hasClassName("rounded")); toastContainer.setInnerHTML(""); }
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 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(""); } }