本文整理匯總了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);
}