本文整理了Java中com.google.gwt.dom.client.Element.addClassName()
方法的一些代码示例,展示了Element.addClassName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.addClassName()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:addClassName
[英]Adds a name to this element's class property. If the name is already present, this method has no effect.
[中]将名称添加到此元素的类属性。如果名称已存在,则此方法无效。
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Replace one class name with another.
*
* @param oldClassName the class name to be replaced
* @param newClassName the class name to replace it
*/
public final void replaceClassName(String oldClassName, String newClassName) {
removeClassName(oldClassName);
addClassName(newClassName);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Add the class name if it doesn't exist or removes it if does.
*
* @param className the class name to be toggled
*/
public final void toggleClassName(String className) {
boolean added = addClassName(className);
if (!added) {
removeClassName(className);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* This convenience method adds or removes a style name for a given element.
* This method is typically used to add and remove secondary style names, but
* it can be used to remove primary stylenames as well, but that is not
* recommended. See {@link #setStyleName(String)} for a description of how
* primary and secondary style names are used.
*
* @param elem the element whose style is to be modified
* @param style the secondary style name to be added or removed
* @param add <code>true</code> to add the given style, <code>false</code> to
* remove it
*/
protected static void setStyleName(Element elem, String style, boolean add) {
if (elem == null) {
throw new RuntimeException(NULL_HANDLE_MSG);
}
style = style.trim();
if (style.length() == 0) {
throw new IllegalArgumentException(EMPTY_STYLENAME_MSG);
}
if (add) {
elem.addClassName(style);
} else {
elem.removeClassName(style);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void onPush(Element parent) {
parent.getFirstChildElement().addClassName(style.buttonCellBasePushing());
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void setDisabled(boolean isDisabled) {
if (this.disabled == isDisabled) {
return;
}
this.disabled = isDisabled;
if (disabled) {
setResource(resDisabled);
getElement().getParentElement().addClassName(styleDisabled);
} else {
setResource(resEnabled);
getElement().getParentElement().removeClassName(styleDisabled);
}
Roles.getButtonRole().setAriaDisabledState(getElement(), disabled);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Enable or disable the fast forward button.
*
* @param disabled true to disable, false to enable
*/
private void setFastForwardDisabled(boolean disabled) {
if (fastForward == null) {
return;
}
if (disabled) {
fastForward.setResource(resources.simplePagerFastForwardDisabled());
fastForward.getElement().getParentElement().addClassName(
style.disabledButton());
} else {
fastForward.setResource(resources.simplePagerFastForward());
fastForward.getElement().getParentElement().removeClassName(
style.disabledButton());
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Construct a new {@link NativeHorizontalScrollbar}.
*
* @param resources the resources used by this widget
*/
public NativeHorizontalScrollbar(Resources resources) {
setElement(uiBinder.createAndBindUi(this));
getElement().addClassName(CommonResources.getInlineBlockStyle());
setHeight(getNativeHeight() + "px");
// Apply the styles.
Style style = resources.nativeHorizontalScrollbarStyle();
style.ensureInjected();
getScrollableElement().addClassName(style.nativeHorizontalScrollbar());
// Initialize the implementation.
ScrollImpl.get().initialize(scrollable, contentDiv);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Construct a new {@link NativeVerticalScrollbar}.
*
* @param resources the resources used by this widget
*/
public NativeVerticalScrollbar(Resources resources) {
setElement(uiBinder.createAndBindUi(this));
getElement().addClassName(CommonResources.getInlineBlockStyle());
setWidth(getNativeWidth() + "px");
// Apply the styles.
Style style = resources.nativeVerticalScrollbarStyle();
style.ensureInjected();
getScrollableElement().addClassName(style.nativeVerticalScrollbar());
// inject style used in uibinder
UiBinderBundle.INSTANCE.nativeVerticalScrollbarUi().ensureInjected();
// Initialize the implementation.
ScrollImpl.get().initialize(scrollable, contentDiv);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
firstPage.getElement().getParentElement().addClassName(style.button());
prevPage.getElement().getParentElement().addClassName(style.button());
label.getElement().getParentElement().addClassName(style.pageDetails());
nextPage.getElement().getParentElement().addClassName(style.button());
if (showFastForwardButton) {
fastForward.getElement().getParentElement().addClassName(style.button());
lastPage.getElement().getParentElement().addClassName(style.button());
代码示例来源:origin: com.google.gwt/gwt-servlet
cornerElem.addClassName(style.customScrollPanelCorner());
cornerLayer = layout.attachChild(cornerElem);
代码示例来源:origin: gwtbootstrap3/gwtbootstrap3
/**
* This constructor may be used by subclasses to explicitly use an existing
* element. This element must be a <textarea> element.
*
* @param element the element to be used
*/
protected TextArea(final Element element) {
super(element.<Element>cast());
TextAreaElement.as(element);
element.addClassName(Styles.FORM_CONTROL);
}
代码示例来源:origin: com.googlecode.mgwt/mgwt
@Override
public void run() {
node.addClassName(CellList.this.appearance.css().selected());
}
};
代码示例来源:origin: org.uberfire/uberfire-widgets-commons
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());
}
}
代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3
/**
* @return a new icon element. We only create this when {@link #iconElement}
* is null or the {@link #iconType} has changed.
*/
protected Element createIconElement() {
Element e = Document.get().createElement(ElementTags.I);
e.addClassName(Styles.FONT_AWESOME_BASE);
e.addClassName(iconType.getCssName());
e.getStyle().setPaddingRight(5, Unit.PX);
return e;
}
代码示例来源:origin: gwtbootstrap3/gwtbootstrap3
private void addToDataGrid(final TableType tableType) {
getTableHeadElement().getParentElement().addClassName(tableType.getCssName());
getTableBodyElement().getParentElement().addClassName(tableType.getCssName());
getTableFootElement().getParentElement().addClassName(tableType.getCssName());
}
代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3
/**
* Constructs a table with the given page size with the specified
* {@link Resources}.
*
* @param pageSize the page size
* @param resources the resources to use for this widget
*/
public DataGrid(final int pageSize, final DataGrid.Resources resources) {
super(pageSize, resources, null);
getTableBodyElement().getParentElement().addClassName(TableType.DEFAULT.getCssName());
}
代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3
private void addToDataGrid(final TableType tableType) {
getTableHeadElement().getParentElement().addClassName(tableType.getCssName());
getTableBodyElement().getParentElement().addClassName(tableType.getCssName());
getTableFootElement().getParentElement().addClassName(tableType.getCssName());
}
代码示例来源:origin: gwtbootstrap3/gwtbootstrap3
/**
* Constructs a table with the given page size and the given
* {@link ProvidesKey key provider}.
*
* @param pageSize the page size
* @param keyProvider an instance of ProvidesKey, or null if the record
* object should act as its own key
*/
public DataGrid(final int pageSize, final ProvidesKey<T> keyProvider) {
super(pageSize, getDefaultResources(), keyProvider);
getTableBodyElement().getParentElement().addClassName(TableType.DEFAULT.getCssName());
}
代码示例来源:origin: org.jboss.ballroom/widgets
@Override
public void onRowOver(int rowNum) {
if(!table.isEnabled()) return;
// toggle rollover tools
if(rowNum<provider.getList().size())
{
TableCellElement rollOverItem = table.getRowElement(rowNum).getCells().getItem(2);
rollOverItem.getFirstChildElement().getFirstChildElement().addClassName("row-tools-enabled");
}
}
代码示例来源:origin: gwtbootstrap/gwt-bootstrap
private void applyTableStyle(boolean striped, TableType type) {
if(striped) {
getTableHeadElement().getParentElement().addClassName(type.get());
getTableBodyElement().getParentElement().addClassName(type.get());
getTableFootElement().getParentElement().addClassName(type.get());
} else {
getTableHeadElement().getParentElement().removeClassName(type.get());
getTableBodyElement().getParentElement().removeClassName(type.get());
getTableFootElement().getParentElement().removeClassName(type.get());
}
}
内容来源于网络,如有侵权,请联系作者删除!