本文整理汇总了Java中gwt.material.design.client.ui.html.ListItem类的典型用法代码示例。如果您正苦于以下问题:Java ListItem类的具体用法?Java ListItem怎么用?Java ListItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListItem类属于gwt.material.design.client.ui.html包,在下文中一共展示了ListItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
@Override
public void add(final Widget child) {
if (child instanceof UnorderedList) {
for (Widget w : (UnorderedList) child) {
if (w instanceof ListItem) {
w.getElement().getStyle().setDisplay(Style.Display.BLOCK);
provideActiveClickHandler(w);
}
}
} else if (child instanceof ListItem) {
child.getElement().getStyle().setDisplay(Style.Display.BLOCK);
provideActiveClickHandler(child);
}
super.add(child);
}
示例2: checkActiveState
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
/**
* Checks if this child holds the current active state.
* If the child is or contains the active state it is applied.
*/
protected void checkActiveState(Widget child) {
// Check if this widget has a valid href
String href = child.getElement().getAttribute("href");
String url = Window.Location.getHref();
int pos = url.indexOf("#");
String location = pos >= 0 ? url.substring(pos, url.length()) : "";
if (!href.isEmpty() && location.startsWith(href)) {
ListItem li = findListItemParent(child);
if (li != null) {
makeActive(li);
}
} else if (child instanceof HasWidgets) {
// Recursive check
for (Widget w : (HasWidgets) child) {
checkActiveState(w);
}
}
}
示例3: testAddLinks
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
public void testAddLinks() {
// given
MaterialNavSection navSection = getWidget();
MaterialNavBar navBar = MaterialNavBarTest.constructAndAttach();
// when / then
for (int i = 1; i <= 5; i++) {
navSection.add(new MaterialLink("Nav Link " + i));
}
for (Widget w : navSection.getChildren()) {
assertTrue(w instanceof ListItem);
ListItem item = (ListItem) w;
assertTrue(item.getWidget(0) instanceof MaterialLink);
}
navBar.add(navSection);
assertEquals(5, navSection.getChildren().size());
}
示例4: onInsertColumn
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
@Override
public void onInsertColumn(InsertColumnEvent<T> event) {
int beforeIndex = event.getBeforeIndex();
Column<T, ?> column = event.getColumn();
String header = event.getHeader();
SetupHandler handler = e -> {
int index = beforeIndex + getView().getColumnOffset();
String ref = getView().getId() + "-col" + index;
MaterialCheckBox toggleBox = new MaterialCheckBox(new ListItem().getElement());
JQueryElement input = $(toggleBox).find("input");
input.attr("id", ref);
JQueryElement label = $(toggleBox).find("label");
label.text(column.getName());
label.attr("for", ref);
toggleBox.setValue(true);
menu.add(toggleBox);
// We will hide the empty header menu items
if (header.isEmpty()) {
toggleBox.setVisible(false);
}
setupMenu();
reindexToggles();
};
if(getView().isSetup()) {
handler.onSetup(null);
} else {
addSetupHandler(handler);
}
}
示例5: setHeader
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
/**
* Sets the header of the collection component.
*/
public void setHeader(String header) {
headerLabel.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(header));
addStyleName(CssName.WITH_HEADER);
ListItem item = new ListItem(headerLabel);
UiHelper.addMousePressedHandlers(item);
item.setStyleName(CssName.COLLECTION_HEADER);
insert(item, 0);
}
示例6: registerDropdownItemHandlers
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
protected void registerDropdownItemHandlers() {
getChildren().forEach(widget -> {
if (widget instanceof ListItem) {
ListItem item = (ListItem) widget;
if (item.getWidget(0) instanceof MaterialWidget) {
MaterialWidget child = (MaterialWidget) item.getWidget(0);
registerHandler(child.addDomHandler(event -> {
SelectionEvent.fire(MaterialDropDown.this, child);
}, ClickEvent.getType()));
}
}
});
}
示例7: add
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
@Override
public void add(final Widget child) {
String tagName = child.getElement().getTagName();
if (child instanceof ListItem || tagName.toLowerCase().startsWith("li")) {
child.getElement().getStyle().setDisplay(Style.Display.BLOCK);
add(child, (Element) getElement());
} else {
ListItem li = new ListItem(child);
// Checks if there are sub dropdown components
if (child instanceof MaterialLink) {
MaterialLink link = (MaterialLink) child;
for (int i = 0; i < link.getWidgetCount(); i++) {
if (link.getWidget(i) instanceof MaterialDropDown) {
registerHandler(link.addClickHandler(DomEvent::stopPropagation));
link.stopTouchStartEvent();
}
}
}
if (child instanceof HasWaves) {
li.setWaves(((HasWaves) child).getWaves());
((HasWaves) child).setWaves(null);
}
li.getElement().getStyle().setDisplay(Style.Display.BLOCK);
add(li, (Element) getElement());
}
}
示例8: clearActiveState
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
public void clearActiveState() {
getChildren().forEach(widget -> {
if (widget instanceof ListItem) {
ListItem item = (ListItem) widget;
if (item.getWidgetCount() > 0 && item.getWidget(0) != null) {
item.getWidget(0).removeStyleName(CssName.ACTIVE);
}
}
});
}
示例9: onLoad
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
@Override
protected void onLoad() {
super.onLoad();
for (Widget widget : getChildren()) {
if (widget instanceof ListItem) {
registerHandler(((ListItem) widget).addClickHandler(clickEvent -> SelectionEvent.fire(this, getWidgetIndex(widget))));
}
}
}
示例10: findListItemParent
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
protected ListItem findListItemParent(Widget widget) {
if (widget != null) {
if (widget instanceof ListItem) {
return (ListItem) widget;
} else {
return findListItemParent(widget.getParent());
}
}
return null;
}
示例11: add
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
@Override
public void add(Widget child) {
if (child instanceof UnorderedList) {
for (Widget w : (UnorderedList) child) {
if (w instanceof ListItem) {
w.getElement().getStyle().setDisplay(Style.Display.BLOCK);
}
}
} else if (child instanceof ListItem) {
child.getElement().getStyle().setDisplay(Style.Display.BLOCK);
}
super.add(child);
}
示例12: testFABItems
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
public void testFABItems() {
// given
MaterialFAB fab = getWidget();
MaterialFABList fabList = (MaterialFABList) fab.getWidget(1);
for (Widget w : fabList.getChildren()) {
// given
assertTrue(w instanceof ListItem);
ListItem item = (ListItem) w;
// when / then
assertNotNull(item.getWidget(0));
assertTrue(item.getWidget(0) instanceof MaterialButton);
}
}
示例13: testSelection
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
public void testSelection() {
// given
MaterialDropDown dropdown = populateDropDown(getWidget());
// when / then
assertTrue(dropdown.getWidget(0) instanceof ListItem);
ListItem item = (ListItem) dropdown.getWidget(0);
assertTrue(item.getWidget(0) instanceof MaterialLink);
MaterialLink link = (MaterialLink) item.getWidget(0);
checkSelectionHandler(dropdown, link);
}
示例14: populateDropDown
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
protected MaterialDropDown populateDropDown(MaterialDropDown dropdown) {
for (int i = 1; i <= 5; i++) {
MaterialLink item = new MaterialLink("Item" + i);
dropdown.add(item);
assertTrue(dropdown.getWidget(i - 1) instanceof ListItem);
ListItem li = (ListItem) dropdown.getWidget(0);
assertTrue(li.getWidget(0) instanceof MaterialLink);
}
return dropdown;
}
示例15: createDivider
import gwt.material.design.client.ui.html.ListItem; //导入依赖的package包/类
private ListItem createDivider() {
ListItem listItem = new ListItem();
listItem.getElement().setClassName(DIVIDER_CSS_CLASS_NAME);
return listItem;
}