/** * Gets all of the element's style names, as a space-separated list. * * @param elem the element whose style is to be retrieved * @return the objects's space-separated style names */ protected static String getStyleName(Element elem) { return elem.getClassName(); }
/** * Checks if this element's class property contains specified class name. * * @param className the class name to be added * @return <code>true</code> if this element has the specified class name */ public final boolean hasClassName(String className) { className = trimClassName(className); int idx = indexOfName(getClassName(), className); return idx != -1; }
String oldStyle = getClassName(); int idx = indexOfName(oldStyle, className);
/** * Adds a name to this element's class property. If the name is already * present, this method has no effect. * * @param className the class name to be added * @return <code>true</code> if this element did not already have the specified class name * @see #setClassName(String) */ public final boolean addClassName(String className) { className = trimClassName(className); // Get the current style string. String oldClassName = getClassName(); int idx = indexOfName(oldClassName, className); // Only add the style if it's not already present. if (idx == -1) { if (oldClassName.length() > 0) { setClassName(oldClassName + " " + className); } else { setClassName(className); } return true; } return false; }
private static boolean elementIsRow(Element e) { String className = e.getClassName() == null ? "" : e.getClassName(); if (className.contains("v-formlayout-row")) { return true; } return false; }
private static boolean elementIsRow(Element e) { String className = e.getClassName() == null ? "" : e.getClassName(); if (className.contains("v-formlayout-row")) { return true; } return false; }
/** * is the element search-query style? * @param elem target element. * @return true:has search-query css-class/false:has no search-query cass-class. */ public static boolean isSearchQuery(Element elem) { return elem.getClassName().contains(Constants.SEARCH_QUERY); }
/** * Returns true if the group is expanded. * * @param group the group * @return true if expanded */ public boolean isExpanded(Element group) { return group.getClassName().indexOf("x-grid-group-collapsed") == -1; }
private boolean isElementNotDraggable(Element targetElement) { // do not try to drag tabsheet close button it breaks close on touch devices return targetElement.getClassName().contains("v-tabsheet-caption-close") || (targetElement.getClassName().contains("v-caption") && targetElement.getParentElement().getClassName().contains("v-tabsheet-tabitem")); }
@Override public boolean isDisabled( final Element element ) { final List<String> classNames = Arrays.asList( element.getClassName().split( "\\s" ) ); return classNames.contains( Styles.DISABLED ); }
protected boolean hasRows() { if (mainBody == null) { return false; } Element e = mainBody.dom.getFirstChildElement(); return e != null && !"x-grid-empty".equals(e.getClassName()); }
@Override protected void setSelectedEnabled(boolean enabled) { String cname = selectedItem.getClassName(); if (!cname.equals("uf-navtree-widget-non-clickable")) { if (enabled) { selectedItem.setClassName("uf-navtree-widget-clicked"); } else { selectedItem.setClassName("uf-navtree-widget-non-clicked"); } } }
public void removeClassName(int optionIndex) { Element option = getOptionElement(optionIndex); String className = option.getClassName(); if (className != null && !className.isEmpty()) { option.removeClassName(className); } }
@Override protected void updateCellStyleNames(TableCellElement td, String primaryStyleName) { Element container = td.getFirstChild().cast(); boolean isWidget = container.getClassName() != null && container.getClassName().contains(WIDGET_CELL_CLASSNAME); super.updateCellStyleNames(td, primaryStyleName); if (isWidget) { container.addClassName(WIDGET_CELL_CLASSNAME); } }
@Override protected void updateCellStyleNames(TableCellElement td, String primaryStyleName) { Element container = td.getFirstChild().cast(); boolean isWidget = container.getClassName() != null && container.getClassName().contains(WIDGET_CELL_CLASSNAME); super.updateCellStyleNames(td, primaryStyleName); if (isWidget) { container.addClassName(WIDGET_CELL_CLASSNAME); } }
/** * Checks if this element's class property contains specified class name. * * @param className the class name to be added * @return <code>true</code> if this element has the specified class name */ public final boolean hasClassName(String className) { className = trimClassName(className); int idx = indexOfName(getClassName(), className); return idx != -1; }
/** * Checks if this element's class property contains specified class name. * * @param className the class name to be added * @return <code>true</code> if this element has the specified class name */ public final boolean hasClassName(String className) { className = trimClassName(className); int idx = indexOfName(getClassName(), className); return idx != -1; }
protected void clearActiveClass(HasWidgets widget) { for (Widget child : widget) { Element element = child.getElement(); if (StyleHelper.containsStyle(element.getClassName(), CssName.ACTIVE)) { element.removeClassName(CssName.ACTIVE); } if (child instanceof HasWidgets) { clearActiveClass((HasWidgets) child); } } }
protected void clearActiveClass(HasWidgets widget) { for (Widget child : widget) { Element element = child.getElement(); if (StyleHelper.containsStyle(element.getClassName(), CssName.ACTIVE)) { element.removeClassName(CssName.ACTIVE); } if (child instanceof HasWidgets) { clearActiveClass((HasWidgets) child); } } }
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; } } } }