本文整理匯總了Java中com.vaadin.ui.TextField.addStyleName方法的典型用法代碼示例。如果您正苦於以下問題:Java TextField.addStyleName方法的具體用法?Java TextField.addStyleName怎麽用?Java TextField.addStyleName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.TextField
的用法示例。
在下文中一共展示了TextField.addStyleName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addStringFilters
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
* Ajoute un filtre en TextField sur une liste de colonnes
*
* @param filterRow
* @param container
* @param propertys
*/
private void addStringFilters(String... propertys) {
for (String property : propertys) {
HeaderCell cell = getFilterCell(property);
TextField filterField = new TextField();
filterField.setImmediate(true);
filterField.setWidth(100, Unit.PERCENTAGE);
filterField.addStyleName(ValoTheme.TEXTFIELD_TINY);
filterField.setInputPrompt(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
filterField.addTextChangeListener(change -> {
// Can't modify filters so need to replace
container.removeContainerFilters(property);
// (Re)create the filter if necessary
if (!change.getText().isEmpty()) {
container.addContainerFilter(new InsensitiveStringFilter(property, change.getText()));
}
fireFilterListener();
});
cell.setComponent(filterField);
}
}
示例2: getSecurityTokenLayout
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private HorizontalLayout getSecurityTokenLayout(final String securityToken) {
final HorizontalLayout securityTokenLayout = new HorizontalLayout();
final Label securityTableLbl = new Label(
SPUIComponentProvider.getBoldHTMLText(getI18n().getMessage("label.target.security.token")),
ContentMode.HTML);
securityTableLbl.addStyleName(SPUIDefinitions.TEXT_STYLE);
securityTableLbl.addStyleName("label-style");
final TextField securityTokentxt = new TextField();
securityTokentxt.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
securityTokentxt.addStyleName(ValoTheme.TEXTFIELD_TINY);
securityTokentxt.addStyleName("targetDtls-securityToken");
securityTokentxt.addStyleName(SPUIDefinitions.TEXT_STYLE);
securityTokentxt.setCaption(null);
securityTokentxt.setNullRepresentation("");
securityTokentxt.setValue(securityToken);
securityTokentxt.setReadOnly(true);
securityTokenLayout.addComponent(securityTableLbl);
securityTokenLayout.addComponent(securityTokentxt);
return securityTokenLayout;
}
示例3: initInputField
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
protected void initInputField() {
// Csslayout is used to style inputtext as rounded
CssLayout csslayout = new CssLayout();
csslayout.setHeight(24, UNITS_PIXELS);
csslayout.setWidth(100, UNITS_PERCENTAGE);
layout.addComponent(csslayout);
inputField = new TextField();
inputField.setWidth(100, UNITS_PERCENTAGE);
inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
inputField.focus();
csslayout.addComponent(inputField);
layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
layout.setExpandRatio(csslayout, 1.0f);
}
示例4: genNumberField
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
public static <T> TextField genNumberField(Binder<T> binder, String propertyId, Converter converter, String inputPrompt) {
final TextField field = new TextField();
field.setWidth("100%");
field.addStyleName(STYLENAME_GRIDCELLFILTER);
field.addStyleName(ValoTheme.TEXTFIELD_TINY);
field.addValueChangeListener(e -> {
if (binder.isValid()) {
field.setComponentError(null);
}
});
binder.forField(field)
.withNullRepresentation("")
// .withValidator(text -> text != null && text.length() > 0, "invalid")
.withConverter(converter)
.bind(propertyId);
field.setPlaceholder(inputPrompt);
return field;
}
示例5: RequiredColorPickerField
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
* Constructeur, initialisation du champs
*/
public RequiredColorPickerField(String caption) {
super();
layout = new HorizontalLayout();
layout.setWidth(100, Unit.PERCENTAGE);
layout.setSpacing(true);
colorTextField = new TextField();
colorTextField.addValueChangeListener(e->showOrHideError());
colorTextField.setNullRepresentation("");
colorTextField.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
colorTextField.setReadOnly(true);
btnColor = new ColorPicker("Couleur de l'alerte");
btnColor.addColorChangeListener(e->{
changeFieldValue(e.getColor().getCSS());
});
btnColor.setPosition(Page.getCurrent().getBrowserWindowWidth() / 2 - 246/2,
Page.getCurrent().getBrowserWindowHeight() / 2 - 507/2);
btnColor.setSwatchesVisibility(true);
btnColor.setHistoryVisibility(false);
btnColor.setTextfieldVisibility(true);
btnColor.setHSVVisibility(false);
layout.addComponent(btnColor);
layout.addComponent(colorTextField);
layout.setExpandRatio(colorTextField, 1);
}
示例6: 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;
}
示例7: 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;
}
示例8: 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");
}
示例9: 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");
}
}
示例10: createSearchField
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private TextField createSearchField() {
final TextField textField = new TextFieldBuilder().immediate(true).id(UIComponentIdProvider.CUSTOM_FILTER_QUERY)
.maxLengthAllowed(SPUILabelDefinitions.TARGET_FILTER_QUERY_TEXT_FIELD_LENGTH).buildTextComponent();
textField.addStyleName("target-filter-textfield");
textField.setWidth(900.0F, Unit.PIXELS);
textField.setTextChangeEventMode(TextChangeEventMode.EAGER);
textField.setImmediate(true);
textField.setTextChangeTimeout(100);
return textField;
}
示例11: createDynamicStyleForComponents
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
* Set tag name and desc field border color based on chosen color.
*
* @param tagName
* @param tagDesc
* @param taregtTagColor
*/
private void createDynamicStyleForComponents(final TextField tagName, final TextField typeKey,
final TextArea typeDesc, final String typeTagColor) {
tagName.removeStyleName(SPUIDefinitions.TYPE_NAME);
typeKey.removeStyleName(SPUIDefinitions.TYPE_KEY);
typeDesc.removeStyleName(SPUIDefinitions.TYPE_DESC);
getDynamicStyles(typeTagColor);
tagName.addStyleName(TYPE_NAME_DYNAMIC_STYLE);
typeKey.addStyleName(TYPE_NAME_DYNAMIC_STYLE);
typeDesc.addStyleName(TYPE_DESC_DYNAMIC_STYLE);
}
示例12: createDynamicStyleForComponents
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
* Set tag name and desc field border color based on chosen color.
*
* @param tagName
* @param tagDesc
* @param taregtTagColor
*/
protected void createDynamicStyleForComponents(final TextField tagName, final TextArea tagDesc,
final String taregtTagColor) {
tagName.removeStyleName(SPUIDefinitions.TAG_NAME);
tagDesc.removeStyleName(SPUIDefinitions.TAG_DESC);
getTargetDynamicStyles(taregtTagColor);
tagName.addStyleName(TAG_NAME_DYNAMIC_STYLE);
tagDesc.addStyleName(TAG_DESC_DYNAMIC_STYLE);
}
示例13: 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;
}
示例14: createTextComponent
import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
protected TextField createTextComponent() {
final TextField textField = new TextField();
textField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
return textField;
}
示例15: 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;
}