List of usage examples for com.vaadin.ui AbstractTextField selectAll
public void selectAll()
From source file:info.magnolia.ui.workbench.tree.InplaceEditingFieldFactory.java
License:Open Source License
/** * For partial updates to work, we need to perform a dry run to attach the component to the table beforehand, * i.e. before it is actually requested at paint phase by the table. *//*from w ww . j a v a2 s .c o m*/ private Field<?> createFieldAndRegister(Container container, Object itemId, Object propertyId) { Property<?> containerProperty = container.getContainerProperty(itemId, propertyId); // the previous call can return null, i.e. when clicking on an empty cell of a node row (i.e. /config/server and then the "value" cell) if (containerProperty == null) { return null; } Class<?> type = containerProperty.getType(); Field<?> field = createFieldByPropertyType(type); if (field != null) { field.setCaption(DefaultFieldFactory.createCaptionByPropertyId(propertyId)); field.setSizeFull(); } // set TextField listeners if (field instanceof AbstractTextField) { final AbstractTextField tf = (AbstractTextField) field; tf.addBlurListener(fieldBlurListener); tf.focus(); tf.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { final Object text = event.getProperty().getValue(); if (text instanceof String) { tf.selectAll(); } tf.removeValueChangeListener(this); } }); } return field; }
From source file:org.abstractform.binding.vaadin.internal.VaadinBindingFormInstanceImpl.java
License:Apache License
@Override public void refreshValidationSummary() { validationSummaryComponent.removeAllComponents(); for (ValidationError error : validationErrosSummaryList) { if (error != null) { Component errorComponent = null; if (error.getFieldId() != null) { errorComponent = getComponentById(error.getFieldId()); }/*from w ww. j ava 2 s .com*/ if (errorComponent != null) { HorizontalLayout layout = new HorizontalLayout(); if (errorComponent instanceof AbstractField) { final AbstractField component = (AbstractField) errorComponent; Button but = new Button(errorComponent.getCaption()); but.setStyleName(BaseTheme.BUTTON_LINK); but.addListener(new Button.ClickListener() { private static final long serialVersionUID = -635674369175495232L; @Override public void buttonClick(ClickEvent event) { component.focus(); if (component instanceof AbstractField) { AbstractTextField field = (AbstractTextField) component; field.selectAll(); } } }); layout.addComponent(but); } else { layout.addComponent(new Label(errorComponent.getCaption())); } layout.addComponent(new Label(" : " + error.getMessage())); validationSummaryComponent.addComponent(layout); } else { validationSummaryComponent.addComponent(new Label(error.getMessage())); } } } }