本文整理了Java中com.google.gwt.dom.client.Element.hasClassName()
方法的一些代码示例,展示了Element.hasClassName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.hasClassName()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:hasClassName
[英]Checks if this element's class property contains specified class name.
[中]检查此元素的类属性是否包含指定的类名。
代码示例来源:origin: org.uberfire/uberfire-preferences-ui-client
@Override
public void select() {
if (!label.hasClassName("selected")) {
presenter.select();
}
}
代码示例来源:origin: org.uberfire/uberfire-preferences-ui-client
@Override
public void select() {
if (!label.hasClassName("selected")) {
presenter.select();
}
}
代码示例来源:origin: kiegroup/appformer
@Override
public void select() {
if (!label.hasClassName("selected")) {
presenter.select();
}
}
代码示例来源:origin: kiegroup/appformer
@Override
public void select() {
if (!label.hasClassName("selected")) {
presenter.select();
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets
private void clearThumbnail(Element thumbnail) {
if (!thumbnail.hasClassName(THUMBNAIL_PLACEHOLDER_STYLE_NAME)) {
flyweight.clear(thumbnail);
floatingThumbnails.push(thumbnail);
}
thumbnail.removeFromParent();
}
代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit
protected boolean isCubaTableClickableCell(Event event) {
Element eventTarget = event.getEventTarget().cast();
Element elementTdOrTr = getElementTdOrTr(eventTarget);
if (elementTdOrTr != null
&& "td".equalsIgnoreCase(elementTdOrTr.getTagName())
&& !elementTdOrTr.hasClassName(CUBA_TABLE_CLICKABLE_TEXT_STYLE)) {
// found <td>
if ("span".equalsIgnoreCase(eventTarget.getTagName())
&& eventTarget.hasClassName(CUBA_TABLE_CLICKABLE_CELL_STYLE)) {
// found <span class="c-table-clickable-cell">
return true;
}
}
return false;
}
代码示例来源:origin: fr.putnami.pwt/pwt
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);
}
}
}
}
代码示例来源:origin: Putnami/putnami-web-toolkit
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);
}
}
}
}
代码示例来源:origin: fr.putnami.pwt/pwt
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);
}
}
代码示例来源:origin: Putnami/putnami-web-toolkit
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);
}
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material-addins
public void testShowHide() {
Alert alert = getWidget();
Element element = alert.getElement();
alert.open();
assertTrue(element.hasClassName(CssName.OPEN));
alert.close();
assertFalse(element.hasClassName(CssName.OPEN));
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public static <H extends UIObject & HasColors> void checkColor(H hasColors) {
final Element element = hasColors.getElement();
hasColors.setTextColor(Color.WHITE);
assertTrue(element.hasClassName(Color.WHITE.getCssName() + "-text"));
hasColors.setBackgroundColor(Color.BLACK);
assertTrue(element.hasClassName(Color.BLACK.getCssName()));
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material
public static <H extends UIObject & HasColors> void checkColor(H hasColors) {
final Element element = hasColors.getElement();
hasColors.setTextColor(Color.WHITE);
assertTrue(element.hasClassName(Color.WHITE.getCssName() + "-text"));
hasColors.setBackgroundColor(Color.BLACK);
assertTrue(element.hasClassName(Color.BLACK.getCssName()));
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public void testShadow() {
// UiBinder
// given
T widget = getWidget(false);
// when / then
widget.setShadow(1);
assertEquals(1, widget.getShadow());
// Standard
// given
attachWidget();
// when / then
final Element element = widget.getElement();
widget.setShadow(1);
assertTrue(element.hasClassName(CssName.Z_DEPTH_1));
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material
public void testShadow() {
// UiBinder
// given
T widget = getWidget(false);
// when / then
widget.setShadow(1);
assertEquals(1, widget.getShadow());
// Standard
// given
attachWidget();
// when / then
final Element element = widget.getElement();
widget.setShadow(1);
assertTrue(element.hasClassName(CssName.Z_DEPTH_1));
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public void testCenterOn() {
// UiBinder
// given
T widget = getWidget(false);
// when / then
widget.setCenterOn(CenterOn.CENTER_ON_SMALL);
assertEquals(CenterOn.CENTER_ON_SMALL, widget.getCenterOn());
// Standard
// given
attachWidget();
// when / then
final Element element = widget.getElement();
widget.setCenterOn(CenterOn.CENTER_ON_SMALL);
assertTrue(element.hasClassName(CenterOn.CENTER_ON_SMALL.getCssName()));
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material
public void testCenterOn() {
// UiBinder
// given
T widget = getWidget(false);
// when / then
widget.setCenterOn(CenterOn.CENTER_ON_SMALL);
assertEquals(CenterOn.CENTER_ON_SMALL, widget.getCenterOn());
// Standard
// given
attachWidget();
// when / then
final Element element = widget.getElement();
widget.setCenterOn(CenterOn.CENTER_ON_SMALL);
assertTrue(element.hasClassName(CenterOn.CENTER_ON_SMALL.getCssName()));
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
public void testScrollspy() {
// UiBinder
// given
T widget = getWidget(false);
// when / then
widget.setScrollspy("scrollspy-1");
assertEquals("scrollspy-1", widget.getId());
assertEquals("scrollspy-1", widget.getScrollspy());
// Standard
// given
attachWidget();
// when / then
final Element element = widget.getElement();
widget.setScrollspy("scrollspy-1");
assertTrue(element.hasClassName(CssName.SECTION + " " + CssName.SCROLLSPY));
}
代码示例来源:origin: GwtMaterialDesign/gwt-material
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("");
}
代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material
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("");
}
内容来源于网络,如有侵权,请联系作者删除!