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

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

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

Element.indexOfName介绍

[英]Returns the index of the first occurrence of name in a space-separated list of names, or -1 if not found.
[中]返回名称列表中第一次出现的名称的索引,如果未找到,则返回-1。

代码示例

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

/**
 * 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;
}

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

int idx = indexOfName(oldStyle, className);

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

/**
 * 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;
}

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

/**
 * 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;
}

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

/**
 * 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;
}

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

int idx = indexOfName(oldStyle, className);

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

int idx = indexOfName(oldStyle, className);

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

/**
 * 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;
}

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

/**
 * 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;
}

相关文章

微信公众号

最新文章

更多

Element类方法