com.google.gwt.dom.client.Element.getClassName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(303)

本文整理了Java中com.google.gwt.dom.client.Element.getClassName()方法的一些代码示例,展示了Element.getClassName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getClassName()方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getClassName

Element.getClassName介绍

[英]The class attribute of the element. This attribute has been renamed due to conflicts with the "class" keyword exposed by many languages.
[中]元素的class属性。由于与许多语言公开的“class”关键字冲突,此属性已重命名。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets all of the element's style names, as a space-separated list.
  3. *
  4. * @param elem the element whose style is to be retrieved
  5. * @return the objects's space-separated style names
  6. */
  7. protected static String getStyleName(Element elem) {
  8. return elem.getClassName();
  9. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Checks if this element's class property contains specified class name.
  3. *
  4. * @param className the class name to be added
  5. * @return <code>true</code> if this element has the specified class name
  6. */
  7. public final boolean hasClassName(String className) {
  8. className = trimClassName(className);
  9. int idx = indexOfName(getClassName(), className);
  10. return idx != -1;
  11. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. String oldStyle = getClassName();
  2. int idx = indexOfName(oldStyle, className);

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Adds a name to this element's class property. If the name is already
  3. * present, this method has no effect.
  4. *
  5. * @param className the class name to be added
  6. * @return <code>true</code> if this element did not already have the specified class name
  7. * @see #setClassName(String)
  8. */
  9. public final boolean addClassName(String className) {
  10. className = trimClassName(className);
  11. // Get the current style string.
  12. String oldClassName = getClassName();
  13. int idx = indexOfName(oldClassName, className);
  14. // Only add the style if it's not already present.
  15. if (idx == -1) {
  16. if (oldClassName.length() > 0) {
  17. setClassName(oldClassName + " " + className);
  18. } else {
  19. setClassName(className);
  20. }
  21. return true;
  22. }
  23. return false;
  24. }

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

  1. private static boolean elementIsRow(Element e) {
  2. String className = e.getClassName() == null ? "" : e.getClassName();
  3. if (className.contains("v-formlayout-row")) {
  4. return true;
  5. }
  6. return false;
  7. }

代码示例来源:origin: org.vaadin.addons/dragdroplayouts

  1. private static boolean elementIsRow(Element e) {
  2. String className = e.getClassName() == null ? "" : e.getClassName();
  3. if (className.contains("v-formlayout-row")) {
  4. return true;
  5. }
  6. return false;
  7. }

代码示例来源:origin: gwtbootstrap/gwt-bootstrap

  1. /**
  2. * is the element search-query style?
  3. * @param elem target element.
  4. * @return true:has search-query css-class/false:has no search-query cass-class.
  5. */
  6. public static boolean isSearchQuery(Element elem) {
  7. return elem.getClassName().contains(Constants.SEARCH_QUERY);
  8. }

代码示例来源:origin: com.extjs/gxt

  1. /**
  2. * Returns true if the group is expanded.
  3. *
  4. * @param group the group
  5. * @return true if expanded
  6. */
  7. public boolean isExpanded(Element group) {
  8. return group.getClassName().indexOf("x-grid-group-collapsed") == -1;
  9. }

代码示例来源:origin: org.vaadin.addons/dragdroplayouts

  1. private boolean isElementNotDraggable(Element targetElement) {
  2. // do not try to drag tabsheet close button it breaks close on touch devices
  3. return targetElement.getClassName().contains("v-tabsheet-caption-close")
  4. || (targetElement.getClassName().contains("v-caption") &&
  5. targetElement.getParentElement().getClassName().contains("v-tabsheet-tabitem"));
  6. }

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

  1. @Override
  2. public boolean isDisabled( final Element element ) {
  3. final List<String> classNames = Arrays.asList( element.getClassName().split( "\\s" ) );
  4. return classNames.contains( Styles.DISABLED );
  5. }

代码示例来源:origin: com.extjs/gxt

  1. protected boolean hasRows() {
  2. if (mainBody == null) {
  3. return false;
  4. }
  5. Element e = mainBody.dom.getFirstChildElement();
  6. return e != null && !"x-grid-empty".equals(e.getClassName());
  7. }

代码示例来源:origin: org.dashbuilder/dashbuilder-navigation-client

  1. @Override
  2. protected void setSelectedEnabled(boolean enabled) {
  3. String cname = selectedItem.getClassName();
  4. if (!cname.equals("uf-navtree-widget-non-clickable")) {
  5. if (enabled) {
  6. selectedItem.setClassName("uf-navtree-widget-clicked");
  7. } else {
  8. selectedItem.setClassName("uf-navtree-widget-non-clicked");
  9. }
  10. }
  11. }

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

  1. public void removeClassName(int optionIndex) {
  2. Element option = getOptionElement(optionIndex);
  3. String className = option.getClassName();
  4. if (className != null && !className.isEmpty()) {
  5. option.removeClassName(className);
  6. }
  7. }

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

  1. @Override
  2. protected void updateCellStyleNames(TableCellElement td, String primaryStyleName) {
  3. Element container = td.getFirstChild().cast();
  4. boolean isWidget = container.getClassName() != null
  5. && container.getClassName().contains(WIDGET_CELL_CLASSNAME);
  6. super.updateCellStyleNames(td, primaryStyleName);
  7. if (isWidget) {
  8. container.addClassName(WIDGET_CELL_CLASSNAME);
  9. }
  10. }

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

  1. @Override
  2. protected void updateCellStyleNames(TableCellElement td, String primaryStyleName) {
  3. Element container = td.getFirstChild().cast();
  4. boolean isWidget = container.getClassName() != null
  5. && container.getClassName().contains(WIDGET_CELL_CLASSNAME);
  6. super.updateCellStyleNames(td, primaryStyleName);
  7. if (isWidget) {
  8. container.addClassName(WIDGET_CELL_CLASSNAME);
  9. }
  10. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Checks if this element's class property contains specified class name.
  3. *
  4. * @param className the class name to be added
  5. * @return <code>true</code> if this element has the specified class name
  6. */
  7. public final boolean hasClassName(String className) {
  8. className = trimClassName(className);
  9. int idx = indexOfName(getClassName(), className);
  10. return idx != -1;
  11. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Checks if this element's class property contains specified class name.
  3. *
  4. * @param className the class name to be added
  5. * @return <code>true</code> if this element has the specified class name
  6. */
  7. public final boolean hasClassName(String className) {
  8. className = trimClassName(className);
  9. int idx = indexOfName(getClassName(), className);
  10. return idx != -1;
  11. }

代码示例来源:origin: GwtMaterialDesign/gwt-material

  1. protected void clearActiveClass(HasWidgets widget) {
  2. for (Widget child : widget) {
  3. Element element = child.getElement();
  4. if (StyleHelper.containsStyle(element.getClassName(), CssName.ACTIVE)) {
  5. element.removeClassName(CssName.ACTIVE);
  6. }
  7. if (child instanceof HasWidgets) {
  8. clearActiveClass((HasWidgets) child);
  9. }
  10. }
  11. }

代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material

  1. protected void clearActiveClass(HasWidgets widget) {
  2. for (Widget child : widget) {
  3. Element element = child.getElement();
  4. if (StyleHelper.containsStyle(element.getClassName(), CssName.ACTIVE)) {
  5. element.removeClassName(CssName.ACTIVE);
  6. }
  7. if (child instanceof HasWidgets) {
  8. clearActiveClass((HasWidgets) child);
  9. }
  10. }
  11. }

代码示例来源:origin: org.jboss.ballroom/widgets

  1. private void scrollSelectedItemIntoView() {
  2. NodeList<Node> items = getSuggestionMenu().getElement().getChild(1).getChild(0).getChildNodes();
  3. for (int i = 0; i < items.getLength(); i++) {
  4. Element element = (Element) items.getItem(i);
  5. if (((Element) element.getChild(0)).getClassName().equals("item item-selected")) {
  6. element.scrollIntoView();
  7. break;
  8. }
  9. }
  10. }
  11. }

相关文章

Element类方法