Java Code Examples for com.google.gwt.dom.client.Element#getClassName()

The following examples show how to use com.google.gwt.dom.client.Element#getClassName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaDateCell.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected String getSlotNumberStyle(Element element) {
    for (int i = 0; i < slots.size(); i++) {
        String className = element.getClassName();
        String slotNumberStyle = SLOT_NUMBER_STYLENAME + "-" + i;

        if (containsSlotNumber(className, slotNumberStyle)) {
            return slotNumberStyle;
        }
    }

    return null;
}
 
Example 2
Source File: CubaTwinColSelectWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void removeClassName(int optionIndex) {
    Element option = getOptionElement(optionIndex);
    String className = option.getClassName();
    if (className != null && !className.isEmpty()) {
        option.removeClassName(className);
    }
}
 
Example 3
Source File: CubaTreeTableWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 4
Source File: Tools.java    From cuba with Apache License 2.0 5 votes vote down vote up
public static void replaceClassNames(Element element, String from, String to) {
    String className = element.getClassName();
    String newClassName = "";
    String[] classNames = className.split(" ");
    for (String classNamePart : classNames) {
        if (classNamePart.startsWith(from + "-")) {
            classNamePart = classNamePart.replace(from + "-", to + "-");
        } else if (classNamePart.equals(from)) {
            classNamePart = to;
        }

        newClassName = newClassName + " " + classNamePart;
    }
    element.setClassName(newClassName.trim());
}
 
Example 5
Source File: VDDFormLayout.java    From cuba with Apache License 2.0 5 votes vote down vote up
private static boolean elementIsRow(Element e) {
    String className = e.getClassName() == null ? "" : e.getClassName();
    if (className.contains("v-formlayout-row")) {
        return true;
    }
    return false;
}
 
Example 6
Source File: StyleUtils.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static <S extends CssStyle> void removeStyle(Element e, S style) {
	if (e == null) {
		return;
	}
	if (style instanceof Enum) {
		StyleUtils.cleanEnumStyle(e, style.getClass());
	}
	String styleName = StyleUtils.getStyle(style);
	String currentClassName = e.getClassName();
	if (styleName != null && currentClassName != null && e.hasClassName(styleName)) {
		e.removeClassName(styleName);
	}
}
 
Example 7
Source File: StyleUtils.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void cleanEnumStyle(Element e, Class<?> enumClass) {
	if (enumClass == null) {
		return;
	}
	for (Object enumValue : enumClass.getEnumConstants()) {
		if (enumValue instanceof CssStyle) {
			String currentClassName = e.getClassName();
			String styleName = ((CssStyle) enumValue).get();
			if (styleName != null && currentClassName != null && e.hasClassName(styleName)) {
				e.removeClassName(styleName);
			}
		}
	}
}
 
Example 8
Source File: HtmlViewImpl.java    From swellrt with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
public String getAttribute(Element element, String name) {
  return name.equals("class") ? element.getClassName() : element.getAttribute(name);
}
 
Example 9
Source File: HtmlViewImpl.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
public String getAttribute(Element element, String name) {
  return name.equals("class") ? element.getClassName() : element.getAttribute(name);
}
 
Example 10
Source File: HTMLPretty.java    From swellrt with Apache License 2.0 2 votes vote down vote up
/**
 * @param e
 * @return attribute string of e's class attribute: " class='...'"
 * (Note, IE doesn't seem to treat this as a regular attribute)
 */
private static String styleName(Element e) {
  String name = e.getClassName();
  return name.length() > 0 ? " class='" + e.getClassName() + "'" : "";
}
 
Example 11
Source File: HTMLPretty.java    From incubator-retired-wave with Apache License 2.0 2 votes vote down vote up
/**
 * @param e
 * @return attribute string of e's class attribute: " class='...'"
 * (Note, IE doesn't seem to treat this as a regular attribute)
 */
private static String styleName(Element e) {
  String name = e.getClassName();
  return name.length() > 0 ? " class='" + e.getClassName() + "'" : "";
}