当前位置: 首页>>代码示例>>Java>>正文


Java TextField.addStyleName方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:28,代码来源:GridFormatting.java

示例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;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:24,代码来源:TargetDetails.java

示例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);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:TaskListHeader.java

示例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;
}
 
开发者ID:melistik,项目名称:vaadin-grid-util,代码行数:19,代码来源:FieldFactory.java

示例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);
	
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:30,代码来源:RequiredColorPickerField.java

示例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;
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:31,代码来源:LoginView.java

示例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;
}
 
开发者ID:felixhusse,项目名称:bookery,代码行数:34,代码来源:AppHeader.java

示例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");
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:8,代码来源:AbstractHawkbitLoginUI.java

示例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");
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:11,代码来源:AbstractHawkbitLoginUI.java

示例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;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:11,代码来源:AutoCompleteTextFieldComponent.java

示例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);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:19,代码来源:CreateUpdateTypeLayout.java

示例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);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:17,代码来源:AbstractCreateUpdateTagLayout.java

示例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;
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:54,代码来源:TransactionsView.java

示例14: createTextComponent

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@Override
protected TextField createTextComponent() {
    final TextField textField = new TextField();
    textField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    return textField;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:7,代码来源:TextFieldBuilder.java

示例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;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:45,代码来源:LoginUI.java


注:本文中的com.vaadin.ui.TextField.addStyleName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。