本文整理汇总了Java中com.google.gwt.dom.client.Style.HasCssName方法的典型用法代码示例。如果您正苦于以下问题:Java Style.HasCssName方法的具体用法?Java Style.HasCssName怎么用?Java Style.HasCssName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.dom.client.Style
的用法示例。
在下文中一共展示了Style.HasCssName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
* Returns first enum constant found in at space-separated list of style names.
*
* @param styleName Space-separated list of styles
* @param enumClass Type of enum
* @param defaultValue Default value of no match was found
* @return First enum constant found or default value
*/
@SuppressWarnings("unchecked")
public static <E extends Enum<? extends Style.HasCssName>> E fromStyleName(final String styleName,
final Class<E> enumClass,
final E defaultValue,
final boolean ignoreSpaces) {
if (styleName == null || enumClass == null) {
return defaultValue;
}
for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) {
final Style.HasCssName anEnum = (Style.HasCssName) constant;
final String cssClass = anEnum.getCssName();
if(cssClass != null) {
boolean contains;
if (ignoreSpaces) {
contains = styleName.equals(cssClass);
} else {
contains = StyleHelper.containsStyle(styleName, cssClass);
}
if (contains) {
return (E) anEnum;
}
}
}
return defaultValue;
}
示例2: addUniqueEnumStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
* Convenience method for first removing all enum style constants and then adding the single one.
*
* @see #removeEnumStyleNames(UIObject, Class)
* @see #addEnumStyleName(UIObject, Style.HasCssName)
*/
public static <E extends Style.HasCssName, F extends Enum<? extends Style.HasCssName>> void addUniqueEnumStyleName(final UIObject uiObject,
final Class<F> enumClass,
final E style) {
removeEnumStyleNames(uiObject, enumClass);
addEnumStyleName(uiObject, style);
}
示例3: removeEnumStyleNames
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
* Removes all CSS style names specified by an enum that implements {@link Style.HasCssName} from an UIObject.
*
* @param uiObject Object to remove CSS class names from
* @param enumClass Enum representing CSS class names
* @param <E> Enum type implementing {@link Style.HasCssName}
*/
public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final UIObject uiObject,
final Class<E> enumClass) {
for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) {
final String cssClass = ((Style.HasCssName) constant).getCssName();
if (cssClass != null && !cssClass.isEmpty()) {
uiObject.removeStyleName(cssClass);
}
}
}
示例4: addEnumStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
* Adds enum value style name to UIObject unless style is {@code null}.
*
* @param uiObject Object to add style to
* @param style Style name
*/
public static <E extends Style.HasCssName> void addEnumStyleName(final UIObject uiObject,
final E style) {
if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {
uiObject.addStyleName(style.getCssName());
}
}
示例5: removeEnumStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
* Removes enum value style name from UIObject unless style is {@code null}.
*
* @param uiObject Object to remove style from
* @param style Style name
*/
public static <E extends Style.HasCssName> void removeEnumStyleName(final UIObject uiObject,
final E style) {
if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {
uiObject.removeStyleName(style.getCssName());
}
}
示例6: setOption
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
protected void setOption(String option, MultiTypeOption value) {
Object foundType = value.get();
if(foundType instanceof Style.HasCssName) {
setOption(option, (Style.HasCssName) foundType);
} else if(foundType instanceof IsJavaScriptObject) {
setOption(option, (IsJavaScriptObject) foundType);
} else {
setNativeOption(getElement(), option, value.get());
}
}
示例7: addUniqueEnumStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
public static <E extends Style.HasCssName, F extends Enum<? extends Style.HasCssName>> void addUniqueEnumStyleName(final Element element,
final Class<F> enumClass,
final E style) {
removeEnumStyleNames(element,
enumClass);
addEnumStyleName(element,
style);
}
示例8: removeEnumStyleNames
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final Element element,
final Class<E> enumClass) {
for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) {
final String cssClass = ((Style.HasCssName) constant).getCssName();
if (cssClass != null && !cssClass.isEmpty()) {
element.removeClassName(cssClass);
}
}
}
示例9: addEnumStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
public static <E extends Style.HasCssName> void addEnumStyleName(final Element element,
final E style) {
if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {
element.addClassName(style.getCssName());
}
}
示例10: removeEnumStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
public static <E extends Style.HasCssName> void removeEnumStyleName(final Element element,
final E style) {
if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {
element.removeClassName(style.getCssName());
}
}
示例11: fromStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
public static <F extends Enum<? extends Style.HasCssName>> F fromStyleName(final Class<F> enumClass,
final Style.HasCssName styleName) {
return EnumHelper.fromStyleName(styleName.getCssName(), enumClass, null);
}
示例12: setOption
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
protected void setOption(String option, Style.HasCssName value) {
setOption(getElement(), option, value.getCssName());
}
示例13: fromStyleName
import com.google.gwt.dom.client.Style; //导入方法依赖的package包/类
/**
* Returns first enum constant found..
*
* @param styleName Space-separated list of styles
* @param enumClass Type of enum
* @param defaultValue Default value of no match was found
* @return First enum constant found or default value
*/
public static <E extends Enum<? extends Style.HasCssName>> E fromStyleName(final String styleName,
final Class<E> enumClass,
final E defaultValue) {
return EnumHelper.fromStyleName(styleName, enumClass, defaultValue, true);
}