Refine search
private ColorPickerPreview() { setStyleName("v-colorpicker-preview"); field = new TextField(); field.setSizeFull(); field.setStyleName("v-colorpicker-preview-textfield"); field.setData(this); valueChangeListenerRegistration = field .addValueChangeListener(this::valueChange); addComponent(field); }
/** * Handles the login. * <p> * In deferred mode, this method is called after the dummy POST request that * triggers the password manager has been completed. In direct mode (the * default setting), it is called directly when the user hits the enter key * or clicks on the login button. In the latter case, you cannot change the * URL in the method or the password manager will not be triggered. */ private void login() { Map<String, String> params = new HashMap<>(); params.put("username", getUsernameField().getValue()); params.put("password", getPasswordField().getValue()); LoginEvent event = new LoginEvent(LoginForm.this, params); fireEvent(event); }
field.setValue(colorCSS); field.setComponentError(null); .addValueChangeListener(this::valueChange); field.removeStyleName(STYLE_DARK_COLOR); field.removeStyleName(STYLE_LIGHT_COLOR); if (this.color.getRed() + this.color.getGreen() + this.color.getBlue() < 3 * 128) { field.addStyleName(STYLE_DARK_COLOR); } else { field.addStyleName(STYLE_LIGHT_COLOR);
/** * Constructs a new <code>TextField</code> with the given caption and * initial text contents. * * @param caption * the caption <code>String</code> for the editor. * @param value * the initial text content of the editor, not {@code null} */ public TextField(String caption, String value) { setValue(value); setCaption(caption); }
addStyleName("dialog"); ueiBase = new TextField("UEI Base"); ueiBase.setNullSettingAllowed(false); ueiBase.setWidth("100%"); ueiBase.setRequired(true); ueiBase.setValue(defaultUei); ueiBase.setRequiredError("UEI Base cannot be null."); okButton = new Button("Continue"); okButton.addClickListener(this); cancelButton = new Button("Cancel"); cancelButton.addClickListener(this); toolbar.addComponent(cancelButton); VerticalLayout layout = new VerticalLayout(); layout.addComponent(ueiBase); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.BOTTOM_RIGHT); setContent(layout);
public AbstractAddWindow(final Window main, String caption) { m_main = main; setModal(true); setWidth("15em"); setCaption(caption); // Configure the windws layout; by default a VerticalLayout VerticalLayout layout = (VerticalLayout) getContent(); layout.setMargin(true); layout.setSpacing(true); m_name = new TextField("name"); final TextField description = new TextField("description"); layout.addComponent(m_name); layout.addComponent(description); Button close = new Button("Ok", new Button.ClickListener() { // inline click-listener public void buttonClick(ClickEvent event) { // close the window by removing it from the parent window (getParent()).removeWindow(AbstractAddWindow.this); // create the feature create((String) m_name.getValue(), (String) description.getValue()); } }); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(close); layout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT); }
@Override public void doBuild(ViewChangeBusMessage event) { super.doBuild(event); centrePanel = new Panel(); centrePanel.addStyleName(ChameleonTheme.PANEL_BUBBLE); centrePanel.setSizeUndefined(); VerticalLayout vl = new VerticalLayout(); centrePanel.setContent(vl); vl.setSpacing(true); vl.setSizeUndefined(); label = new Label(); usernameBox = new TextField(); passwordBox = new PasswordField(); Label demoInfoLabel = new Label("for this demo, enter any user name, and a password of 'password'"); Label demoInfoLabel2 = new Label("In a real application your Shiro Realm implementation defines how to authenticate"); submitButton = new Button(); submitButton.addClickListener(this); statusMsgLabel = new Label("Please enter your username and password"); vl.addComponent(label); vl.addComponent(demoInfoLabel); vl.addComponent(demoInfoLabel2); vl.addComponent(usernameBox); vl.addComponent(passwordBox); vl.addComponent(submitButton); vl.addComponent(statusMsgLabel); setMiddleCentre(centrePanel); }
final TextField nameTextField = new TextField(item.getItemProperty("name")); nameTextField.setWidth(300, Unit.PIXELS); final TextField tf = new TextField(item.getItemProperty("sourceSystemValue")); initTextFieldForWhitespaceVisibility(sourceConfigurationValue.getSourceSystemValue(), tf); tf.setReadOnly(false); tf.setWidth(300, Unit.PIXELS); final Button minusTargetValueButton = new Button(); minusTargetValueButton.setIcon(VaadinIcons.MINUS); minusTargetValueButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); minusTargetValueButton.setDescription("Add new source value."); minusTargetValueButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); sourceValueTableCellLayout.addComponent(hl);
private VerticalLayout buildStateDefinitionLayout() { I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource(); descriptionField = new TextField(); descriptionField.setNullRepresentation(""); descriptionField.setWidth("100%"); commentaryTextArea = new RichTextArea(); commentaryTextArea.setNullRepresentation(""); commentaryTextArea.setWidth("100%"); VerticalLayout stateLayout = new VerticalLayout(); stateLayout.setWidth("100%"); stateLayout.setSpacing(true); stateLayout.setMargin(true); stateLayout.addComponent(styled(new Label(messages.getMessage("field.description")), "h1")); stateLayout.addComponent(htmlLabel(messages.getMessage("field.description.info"))); stateLayout.addComponent(descriptionField); stateLayout.addComponent(styled(new Label(messages.getMessage("field.commentary")), "h1")); stateLayout.addComponent(htmlLabel(messages.getMessage("field.commentary.info"))); stateLayout.addComponent(commentaryTextArea); return stateLayout; }
private Panel issuePanel() { TextField id = new TextField("Card id"); TextField amount = new TextField("Amount"); Button submit = new Button("Submit"); submit.addClickListener(evt -> { commandGateway.sendAndWait(new IssueCmd(id.getValue(), Integer.parseInt(amount.getValue()))); Notification.show("Success", Notification.Type.HUMANIZED_MESSAGE) .addCloseListener(e -> cardSummaryDataProvider.refreshAll()); }); FormLayout form = new FormLayout(); form.addComponents(id, amount, submit); form.setMargin(true); Panel panel = new Panel("Issue single card"); panel.setContent(form); return panel; }
public void enter(int numSourceParameters) { if(numSourceParameters != this.numSourceParameters) { this.numSourceParameters = numSourceParameters; this.sourceParameterNamesTextField = new ArrayList<TextField>(); namesLayout.removeAllComponents(); for (int i = 0; i < this.numSourceParameters; i++) { TextField nameField = new TextField(); nameField.setCaption("Source Parameter Name " + (i + 1)); nameField.setWidth(150, Unit.PIXELS); nameField.removeAllValidators(); nameField.addValidator(new StringLengthValidator("You must provide a parameter name!",1 , null, false)); nameField.setValidationVisible(false); this.sourceParameterNamesTextField.add(nameField); namesLayout.addComponent(nameField); } } }
@Override protected void initContent(VerticalLayout layout) throws Exception { label = new Label(message); label.setContentMode(Label.CONTENT_XHTML); layout.addComponent(label); textField = new TextField(); textField.setValue(txtInput); textField.setWidth("100%"); textField.focus(); textField.addShortcutListener(new ShortcutListener("Confirm", ShortcutAction.KeyCode.ENTER, null) { private static final long serialVersionUID = 1L; @Override public void handleAction(Object sender, Object target) { confirm.doAction(TextInputDialog.this); } }); textField.setImmediate(true); layout.addComponent(textField); txtInput = null; }
protected void buildLayout() { mainLayout = new GridLayout(3, 2); mainLayout.setSpacing(true); colorPickerLayout = new ColorPickerLayout(); ColorPickerHelper.setRgbSliderValues(colorPickerLayout); contentLayout = new VerticalLayout(); colorLabelLayout = new HorizontalLayout(); colorLabelLayout.setMargin(false); colorLabelLayout.addComponents(colorLabel, tagColorPreviewBtn); formLayout.addComponent(tagName); formLayout.addComponent(tagDesc); formLayout.setSizeFull(); contentLayout.addComponent(formLayout); contentLayout.addComponent(colorLabelLayout); contentLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER); contentLayout.setComponentAlignment(colorLabelLayout, Alignment.MIDDLE_LEFT); contentLayout.setSizeUndefined(); mainLayout.setSizeFull(); mainLayout.addComponent(contentLayout, 0, 0); colorPickerLayout.setVisible(false); mainLayout.addComponent(colorPickerLayout, 1, 0); mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(mainLayout); tagName.focus(); }
@Override protected void init(VaadinRequest request) { TextField nameField = new TextField(); nameField.setCaption("Your name"); Button button = new Button("Print Hello", event -> { Runtime runtime = Runtime.getRuntime(); printHelloDocument(String.format( "Hello %s!\n" + "Your PC is so powerful:\n" + "%s processors\n" + "%s free memory\n" + "%s max memory", nameField.getValue(), runtime.availableProcessors(), runtime.freeMemory(), runtime.maxMemory())); }); VerticalLayout content = new VerticalLayout(); content.addComponents(nameField, button); setContent(content); }
@Override protected Component initContent() { addStyleName("linkfield"); rootLayout.setSizeFull(); rootLayout.setSpacing(true); textField.setWidth(100, Unit.PERCENTAGE); textField.addValueChangeListener(event -> { // null value means "remove the currently selected link" T value = itemResolver.getItemByPath(event.getValue()).orElse(null); setValue(value); }); linkLayout.setSizeFull(); linkLayout.addComponent(textField); linkLayout.setExpandRatio(textField, 1); if (!textField.isReadOnly()) { selectButton.addStyleName("magnoliabutton"); linkLayout.addComponent(selectButton); linkLayout.setExpandRatio(selectButton, 0); } rootLayout.addComponent(linkLayout); addValueChangeListener(event -> updateComponents()); updateComponents(); return rootLayout; }
textFieldPanel.setContent(new VerticalLayout()); textFieldPanel.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(textFieldPanel); layout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, UNITS_PERCENTAGE); textFieldPanel.addComponent(commentInputField); addCommentButton = new Button(i18nManager.getMessage(Messages.TASK_ADD_COMMENT)); layout.addComponent(addCommentButton); layout.setComponentAlignment(addCommentButton, Alignment.MIDDLE_LEFT); addCommentButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { addNewComment(commentInputField.getValue().toString());
@Override public Field getPropertyField(FormProperty formProperty) { final TextField textField = new TextField(getPropertyLabel(formProperty)); textField.setRequired(formProperty.isRequired()); textField.setEnabled(formProperty.isWritable()); textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty))); if (formProperty.getValue() != null) { textField.setValue(formProperty.getValue()); } // Add validation of numeric value textField.addValidator(new DoubleValidator("Value must be a double")); textField.setImmediate(true); return textField; }
private HorizontalLayout createSearchBox() { HorizontalLayout horizontalLayout = new HorizontalLayout(); this.searchTextField.setWidth("70%"); horizontalLayout.addComponent(this.searchTextField); Button button = new Button(VaadinIcons.SEARCH); button.addClickListener(event -> searchAction()); button.setWidth("30%"); horizontalLayout.addComponent(button); return horizontalLayout; }
protected void initUrl() { TextField urlField = new TextField(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_URL_URL)); urlField.focus(); urlField.setRequired(true); urlField.setRequiredError(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_URL_URL_REQUIRED)); urlField.setWidth(100, UNITS_PERCENTAGE); // URL isn't mutable once attachment is created if(attachment != null) { urlField.setEnabled(false); } addField("url", urlField); }