Java Code Examples for com.vaadin.ui.TextField#addStyleName()

The following examples show how to use com.vaadin.ui.TextField#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TargetDetails.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: FieldFactory.java    From vaadin-grid-util with MIT License 6 votes vote down vote up
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;
}
 
Example 3
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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");
    if (isDemo && !uiProperties.getDemo().getUser().isEmpty()) {
        username.setValue(uiProperties.getDemo().getUser());
    }
}
 
Example 4
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
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");
    }
}
 
Example 5
Source File: AutoCompleteTextFieldComponent.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private TextField createSearchField() {
    final TextField textField = new TextFieldBuilder(TargetFilterQuery.QUERY_MAX_SIZE)
            .id(UIComponentIdProvider.CUSTOM_FILTER_QUERY).buildTextComponent();
    textField.addStyleName("target-filter-textfield");
    textField.setWidth(900.0F, Unit.PIXELS);
    textField.setTextChangeEventMode(TextChangeEventMode.EAGER);
    textField.setTextChangeTimeout(100);
    return textField;
}
 
Example 6
Source File: AbstractTagLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: AbstractTypeLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static 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);
}
 
Example 8
Source File: TextFieldBuilder.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected TextField createTextComponent() {
    final TextField textField = new TextField();
    textField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    return textField;
}