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

The following examples show how to use com.vaadin.ui.TextField#setValue() . 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: Util.java    From gantt with Apache License 2.0 6 votes vote down vote up
public static TextField createNumberEditor(String caption, float value, final Component component,
        final NumberValueChange valueChange) {
    TextField field = new TextField(caption);
    field.setMaxLength(5);
    field.setValue("" + value);
    field.addValueChangeListener(new ValueChangeListener<String>() {

        @Override
        public void valueChange(ValueChangeEvent<String> event) {
            Object v = event.getValue();
            try {
                float f = Float.parseFloat("" + v);
                valueChange.onValueChange(f);
            } catch (NumberFormatException e) {
                Notification.show("Invalid floating number! Format is 123.345");
            }
        }
    });
    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: AddUpdateRolloutWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private TextField createErrorThreshold() {
    final TextField errorField = createIntegerTextField("prompt.error.threshold",
            UIComponentIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
    errorField.addValidator(new ThresholdFieldValidator());
    errorField.setMaxLength(7);
    errorField.setValue(defaultRolloutGroupConditions.getErrorConditionExp());
    return errorField;
}
 
Example 5
Source File: AddUpdateRolloutWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private TextField createTriggerThreshold() {
    final TextField thresholdField = createIntegerTextField("prompt.tigger.threshold",
            UIComponentIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
    thresholdField.addValidator(new ThresholdFieldValidator());
    thresholdField.setValue(defaultRolloutGroupConditions.getSuccessConditionExp());
    return thresholdField;
}
 
Example 6
Source File: Util.java    From gantt with Apache License 2.0 5 votes vote down vote up
public static TextField createTextEditor(String caption, String value, final Component component,
        final TextValueChange valueChange) {
    TextField field = new TextField(caption);
    field.setValue("" + value);
    field.addValueChangeListener(new ValueChangeListener<String>() {

        @Override
        public void valueChange(ValueChangeEvent<String> event) {
            Object v = event.getValue();
            valueChange.onValueChange(String.valueOf(v));
        }
    });
    return field;
}
 
Example 7
Source File: LoginView.java    From gazpachoquest with GNU General Public License v3.0 5 votes vote down vote up
protected HorizontalLayout createCompositionRootx() {
    VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSpacing(true);
    loginPanel.setWidth("400px");

    Label header = new Label("Enter your invitation to start the questionnair");
    header.addStyleName(Reindeer.LABEL_H1);
    loginPanel.addComponent(header);

    invitation = new TextField("Invitation");
    invitation.setWidth("100%");
    invitation.focus();
    invitation.setValue("YAS5ICHRBE");
    loginPanel.addComponent(invitation);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    loginPanel.addComponent(buttons);
    loginPanel.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);

    login = new Button("Start");
    login.setClickShortcut(KeyCode.ENTER);
    login.addStyleName(Reindeer.BUTTON_DEFAULT);
    login.addClickListener(createLoginButtonListener());
    buttons.addComponent(login);

    HorizontalLayout viewLayout = new HorizontalLayout();
    viewLayout.addComponent(loginPanel);
    viewLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
    viewLayout.setSizeFull();
    viewLayout.addStyleName(Reindeer.LAYOUT_BLUE);
    setSizeFull();

    return viewLayout;
}
 
Example 8
Source File: JobLogFilter.java    From chipster with MIT License 4 votes vote down vote up
public JobLogFilter(final JobLogView view, String column, String search) {
	this.view = view;

	searchStringField = new TextField();
	if (search != null) {
		searchStringField.setValue(search);
	}
	searchStringField.setDescription("Search for values starting with this string. Question mark (?) is a wildcard for a single character and asterisk (*) for any number of characters.");  
	searchStringField.addShortcutListener(new ShortcutListener("Search", ShortcutAction.KeyCode.ENTER, null) {

		@Override
		public void handleAction(Object sender, Object target) {
			view.update();
		}
	});

	columnToSearch = new NativeSelect();

	Button clearButton = new Button();
	clearButton.setIcon(new ThemeResource("crystal/button_cancel-bw.png"));
	clearButton.setDescription("Remove filter");
	clearButton.addStyleName("search-button");

	for (int i = 0; i < JobLogContainer.NATURAL_COL_ORDER.length; i++) {

		//Do not search from generated columns
		if (SEARCH_COLUMNS.contains(JobLogContainer.NATURAL_COL_ORDER[i])) {
			columnToSearch.addItem(JobLogContainer.NATURAL_COL_ORDER[i]);
			columnToSearch.setItemCaption(JobLogContainer.NATURAL_COL_ORDER[i],
					JobLogContainer.COL_HEADERS_ENGLISH[i]);
		}
	}

	if (column != null) {
		columnToSearch.setValue(column);
	} else {
		columnToSearch.setValue(JobLogContainer.USERNAME);
	}
	columnToSearch.setNullSelectionAllowed(false);

	clearButton.addClickListener(new Button.ClickListener() {
		public void buttonClick(ClickEvent event) {
			getView().clearFilter(JobLogFilter.this);
		}
	});

	addComponent(columnToSearch);
	addComponent(searchStringField);
	addComponent(clearButton);

	addStyleName("search-filter-bg");
	addStyleName("search-filter");
}