本文整理汇总了Java中com.vaadin.ui.TextField.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setIcon方法的具体用法?Java TextField.setIcon怎么用?Java TextField.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.TextField
的用法示例。
在下文中一共展示了TextField.setIcon方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFields
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private Component buildFields() {
HorizontalLayout fields = new HorizontalLayout();
fields.setSpacing(true);
fields.addStyleName("fields");
final TextField username = new TextField("Username");
username.setIcon(FontAwesome.USER);
username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
final PasswordField password = new PasswordField("Password");
password.setIcon(FontAwesome.LOCK);
password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
final Button signin = new Button("Sign In");
signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
signin.setClickShortcut(KeyCode.ENTER);
signin.focus();
fields.addComponents(username, password, signin);
fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);
signin.addClickListener(new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
DashboardEventBus.post(new UserLoginRequestedEvent(username
.getValue(), password.getValue()));
}
});
return fields;
}
示例2: addTextFieldValues
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private static TextField addTextFieldValues(final TextField textField, final Resource icon,
final Validator validator) {
textField.setIcon(icon);
textField.setRequired(true);
if (validator != null) {
textField.addValidator(validator);
}
return textField;
}
示例3: createSearchBar
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private MHorizontalLayout createSearchBar() {
Label header = new Label("Bookery");
header.addStyleName(ValoTheme.LABEL_BOLD);
header.setSizeUndefined();
header.addStyleName(ValoTheme.LABEL_H3);
searchText = new TextField();
searchText.setIcon(FontAwesome.SEARCH);
searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE);
searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
searchText.setWidth(100, Unit.PERCENTAGE);
searchText.setInputPrompt("hier einfach suchen..");
Button searchButton = new Button("such!", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
Navigator navigator = ((App)UI.getCurrent()).getNavigator();
if (navigator.getState().contains("search")) {
navigator.navigateTo(navigator.getState());
}
else {
navigator.navigateTo(SearchView.id);
}
}
});
searchButton.addStyleName(ValoTheme.BUTTON_LARGE);
searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER));
MHorizontalLayout layout = new MHorizontalLayout(header,searchText,searchButton);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setExpandRatio(searchText, 1.0f);
return layout;
}
示例4: buildUserField
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private void buildUserField() {
username = new TextField(i18n.getMessage("label.login.username"));
username.setIcon(FontAwesome.USER);
username.addStyleName(
ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
username.setId("login-username");
}
示例5: buildTenantField
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private void buildTenantField() {
if (multiTenancyIndicator.isMultiTenancySupported()) {
tenant = new TextField(i18n.getMessage("label.login.tenant"));
tenant.setIcon(FontAwesome.DATABASE);
tenant.addStyleName(
ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
tenant.addStyleName("uppercase");
tenant.setId("login-tenant");
}
}
示例6: buildFilter
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private Component buildFilter() {
final TextField filter = new TextField();
filter.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(final TextChangeEvent event) {
Filterable data = (Filterable) table.getContainerDataSource();
data.removeAllContainerFilters();
data.addContainerFilter(new Filter() {
@Override
public boolean passesFilter(final Object itemId,
final Item item) {
if (event.getText() == null
|| event.getText().equals("")) {
return true;
}
return filterByProperty("country", item,
event.getText())
|| filterByProperty("city", item,
event.getText())
|| filterByProperty("title", item,
event.getText());
}
@Override
public boolean appliesToProperty(final Object propertyId) {
if (propertyId.equals("country")
|| propertyId.equals("city")
|| propertyId.equals("title")) {
return true;
}
return false;
}
});
}
});
filter.setInputPrompt("Filter");
filter.setIcon(FontAwesome.SEARCH);
filter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
filter.addShortcutListener(new ShortcutListener("Clear",
KeyCode.ESCAPE, null) {
@Override
public void handleAction(final Object sender, final Object target) {
filter.setValue("");
((Filterable) table.getContainerDataSource())
.removeAllContainerFilters();
}
});
return filter;
}
示例7: buildFields
import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private Component buildFields() {
HorizontalLayout fields = new HorizontalLayout();
fields.setSpacing(true);
fields.addStyleName("fields");
final TextField username = new TextField("Username");
// Pre-populate for convenience
username.setValue("admin");
username.setIcon(FontAwesome.USER);
username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
final PasswordField password = new PasswordField("Password");
password.setIcon(FontAwesome.LOCK);
password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
password.setValue("[email protected]");
final Button signin = new Button("Sign In");
signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
signin.setClickShortcut(KeyCode.ENTER);
signin.focus();
fields.addComponents(username, password, signin);
fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);
signin.addClickListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = -8816421044737741430L;
@Override
public void buttonClick(final ClickEvent event) {
try {
VaadinServletService.getCurrentServletRequest().login(
username.getValue(), password.getValue());
} catch (ServletException e) {
Notification.show("Authentication Failed");
return;
}
Page.getCurrent().setLocation("secured");
}
});
return fields;
}