當前位置: 首頁>>代碼示例>>Java>>正文


Java TextField.addValueChangeListener方法代碼示例

本文整理匯總了Java中com.vaadin.ui.TextField.addValueChangeListener方法的典型用法代碼示例。如果您正苦於以下問題:Java TextField.addValueChangeListener方法的具體用法?Java TextField.addValueChangeListener怎麽用?Java TextField.addValueChangeListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.TextField的用法示例。


在下文中一共展示了TextField.addValueChangeListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SearchAnneeUnivApoField

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
 * Constructeur, initialisation du champs
 * @param libelleBtnFind 
 */
public SearchAnneeUnivApoField(String libelleBtnFind) {
	super();
	layout = new HorizontalLayout();
	layout.setSpacing(true);
	anneeField = new TextField();
	anneeField.addValueChangeListener(e->showOrHideError());
	anneeField.setNullRepresentation("");
	anneeField.setReadOnly(true);
	btnSearch = new OneClickButton(libelleBtnFind,FontAwesome.SEARCH);
	btnSearch.addClickListener(e->{
		SearchAnneeUnivApoWindow window = new SearchAnneeUnivApoWindow();
		window.addAnneeUniListener(a->changeFieldValue(a));
		UI.getCurrent().addWindow(window);
	});
	layout.addComponent(anneeField);
	layout.addComponent(btnSearch);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:22,代碼來源:SearchAnneeUnivApoField.java

示例2: updateDataRootGrid

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void updateDataRootGrid() {
  int header = getDataRootFirstRow();
  int nRows = dataRoots.getValue().intValue() + header;
  // removes rows
  for (int r = dataRootGrid.getRows(); r > nRows; r--) {
    dataRootGrid.removeRow(r - 1);
  }
  // set new row limit
  dataRootGrid.setRows(nRows);
  // add new rows
  for (int r = header; r < nRows; r++) {
    if (dataRootGrid.getComponent(0, r) == null) {
      TextField id = new TextField();
      id.setPlaceholder("ID");
      id.setValue("dataroot-" + (r - header + 1));
      TextField path = new TextField();
      path.setPlaceholder("Location");
      path.setValue(new File(baseLocation.getValue(), "data/dataroot-" + (r - header + 1)).getAbsolutePath());
      path.setEnabled(false);
      id.addValueChangeListener(event -> path.setValue(new File(baseLocation.getValue(), "data/" + event.getValue()).getAbsolutePath()));
      path.setWidth(100, Unit.PERCENTAGE);
      dataRootGrid.addComponent(id, 0, r, 1, r);
      dataRootGrid.addComponent(path, DATAROOT_PATH_COLUMN, r);
    }
  }
}
 
開發者ID:Terracotta-OSS,項目名稱:tinypounder,代碼行數:27,代碼來源:TinyPounderMainUI.java

示例3: 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

示例4: 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

示例5: updateKitControls

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void updateKitControls() {
  if (kitAwareClassLoaderDelegator.isEEKit()) {
    if (kitPathLayout.getRows() == 1) {
      final TextField licensePath = new TextField();
      licensePath.setWidth(100, Unit.PERCENTAGE);
      licensePath.setValue(settings.getLicensePath() == null ? "" : settings.getLicensePath());
      licensePath.setPlaceholder("License location");
      licensePath.addValueChangeListener(event -> {
        try {
          displayWarningNotification("License location updated with success !");
          String licensePathValue = licensePath.getValue();
          if (licensePathValue != null) {
            File file = new File(licensePathValue);
            if (!file.exists() || !file.isFile()) {
              throw new NoSuchFileException("Path does not exist on the system !");
            }
          }
          settings.setLicensePath(event.getValue());
        } catch (NoSuchFileException e) {
          displayErrorNotification("Kit path could not update !", "Make sure the path points to a valid license file !");
        }
      });
      kitPathLayout.addComponent(licensePath);
    }
  } else {
    if (kitPathLayout.getRows() == 2) {
      kitPathLayout.removeRow(1);
    }
  }
}
 
開發者ID:Terracotta-OSS,項目名稱:tinypounder,代碼行數:31,代碼來源:TinyPounderMainUI.java

示例6: getAllMetricsGrid

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private Grid<MetricsGridRow> getAllMetricsGrid(Map<String, Number> metrics) {
	allMetricsRows = metrics.entrySet().stream()
							.map(MetricsGridRow::new)
							.collect(Collectors.toList());

	Grid<MetricsGridRow> grid = new Grid<>(MetricsGridRow.class);
	grid.removeAllColumns();
	Column<MetricsGridRow, String> nameColumn = grid.addColumn(MetricsGridRow::getName)
															.setCaption("Name")
															.setExpandRatio(1);
	grid.addColumn(MetricsGridRow::getValue).setCaption("Value");

	grid.setItems(allMetricsRows);
	grid.sort(nameColumn);
	grid.setSizeFull();
	grid.setRowHeight(40);

	TextField filterInput = new TextField();
	filterInput.setPlaceholder("filter by metric...");
	filterInput.addValueChangeListener(e -> updateMetrics(e.getValue()));
	filterInput.setValueChangeMode(ValueChangeMode.LAZY);
	filterInput.setSizeFull();

	// Header row
	HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
	filterRow.getCell(nameColumn).setComponent(filterInput);

	return grid;
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:30,代碼來源:MetricsPage.java

示例7: initFilterRow

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void initFilterRow(Column<Application, String> appColumn, Column<Application, String> envColumn, Column<Application, String> urlColumn) {
	TextField filterApp = new TextField();
	TextField filterEnv = new TextField();
	TextField filterUrl = new TextField();

	filterApp.setPlaceholder("filter by application...");
	filterApp.addValueChangeListener(e -> updateApplications(e.getValue(), filterEnv.getValue(), filterUrl.getValue()));
	filterApp.setValueChangeMode(ValueChangeMode.LAZY);
	filterApp.focus();
	filterApp.setSizeFull();

	filterEnv.setPlaceholder("filter by environment...");
	filterEnv.addValueChangeListener(e -> updateApplications(filterApp.getValue(), e.getValue(), filterUrl.getValue()));
	filterEnv.setValueChangeMode(ValueChangeMode.LAZY);
	filterEnv.setSizeFull();

	filterUrl.setPlaceholder("filter by URL...");
	filterUrl.addValueChangeListener(e -> updateApplications(filterApp.getValue(), filterEnv.getValue(), e.getValue()));
	filterUrl.setValueChangeMode(ValueChangeMode.LAZY);
	filterUrl.setSizeFull();

	// Header row
	HeaderRow filterRow = grid.addHeaderRowAt(grid.getHeaderRowCount());
	filterRow.getCell(appColumn).setComponent(filterApp);
	filterRow.getCell(envColumn).setComponent(filterEnv);
	filterRow.getCell(urlColumn).setComponent(filterUrl);
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:28,代碼來源:ApplicationsPage.java

示例8: getTestComponent

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {
	TextField tf = new TextField();
	new NumeralFieldFormatter(tf, ".", ",", -1, 3, true);
	tf.addValueChangeListener(l -> Notification.show("Value: " + l.getValue()));
	return tf;
}
 
開發者ID:johannesh2,項目名稱:textfieldformatter,代碼行數:8,代碼來源:CustomNumeralFieldFormatterUsageUI.java

示例9: getTestComponent

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {
	TextField tf = new TextField();
	PhoneFieldFormatter formatter = new PhoneFieldFormatter(tf, "LU");
       tf.addValueChangeListener(l -> Notification.show("Value: " + l.getValue()));
	return tf;
}
 
開發者ID:johannesh2,項目名稱:textfieldformatter,代碼行數:8,代碼來源:BasicPhoneFieldFormatterUsageUI.java

示例10: getTestComponent

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {
    TextField tf = new TextField();
    IBANFormatter.fromIBANLength(tf, 18);
    tf.addValueChangeListener(l -> Notification.show("Value: " + l.getValue()));
    return tf;
}
 
開發者ID:johannesh2,項目名稱:textfieldformatter,代碼行數:8,代碼來源:BasicIBANFormatterUsageUI.java

示例11: getTestComponent

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
public Component getTestComponent() {
	TextField tf = new TextField();
	new NumeralFieldFormatter(tf);
	tf.addValueChangeListener(l -> Notification.show("Value: " + l.getValue()));
	return tf;
}
 
開發者ID:johannesh2,項目名稱:textfieldformatter,代碼行數:8,代碼來源:DefaultNumeralFieldFormatterUsageUI.java

示例12: setup

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void setup() {
  // Devices
  ComboBox devicesComboBox = new ComboBox("Actors");
  devicesComboBox.setNullSelectionItemId(false);
  devicesComboBox.setContainerDataSource(
      new BeanItemContainer<>(
          DeviceViewDTO.class,
          deviceSetupService.getAllActors().stream()
              .map(deviceDTO -> modelMapper.map(deviceDTO, DeviceViewDTO.class))
              .collect(Collectors.toList())
      )
  );

  DeviceDTO selectedDeviceDTO = deviceSetupService
      .getDeviceDtoByIdAndType(actionDTO.getDevId(), actionDTO.getDevType());
  if (selectedDeviceDTO != null) {
    devicesComboBox.select(modelMapper.map(selectedDeviceDTO, DeviceViewDTO.class));
  }

  devicesComboBox.addValueChangeListener(event -> {
    DeviceViewDTO selected = (DeviceViewDTO) event.getProperty().getValue();

    actionDTO.setDevId(selected.getDevId());
    actionDTO.setDevType(selected.getType());

    changeListener.accept(actionDTO);
  });
  mainLayout.addComponent(devicesComboBox);

  // Target
  TextField targetTextField = new TextField("Target", actionDTO.getParameter());
  targetTextField.addValueChangeListener(event -> {
    actionDTO.setParameter((String) event.getProperty().getValue());

    changeListener.accept(actionDTO);
  });
  mainLayout.addComponent(targetTextField);

}
 
開發者ID:daergoth,項目名稱:HomeWire-Server,代碼行數:40,代碼來源:SetActionWidget.java

示例13: AbstractCrudView

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
public AbstractCrudView() {

        form = getForm();
        grid = getGrid();
        service = getDataService();
        dataProvider = new CrudDataProvider<>(service, getFilterBy());

        filter = new TextField();
        filter.setId("filterText");
        filter.setPlaceholder("filtre...");
        filter.addValueChangeListener(e -> {
            listEntries(e.getValue());
        });
        Button clearFilterButton = new Button(VaadinIcons.CLOSE);
        clearFilterButton.setId("clearFilterButton");
        clearFilterButton.addClickListener(event -> filter.clear());
        filterLayout = new CssLayout(filter, clearFilterButton);
        filterLayout.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

        initForm();

        initGrid();

        if (form != null) {
            addComponent(title);
            if (isCreateAllowed()) {
                addComponent(buttonLayout);
            }
            addComponent(form);
            if (isFilterAllowed()) {
                addComponent(filterLayout);
            }
            addComponentsAndExpand(grid);
        } else {
            if (isFilterAllowed()) {
                addComponent(filterLayout);
            }
            addComponentsAndExpand(grid);
        }
    }
 
開發者ID:viydaag,項目名稱:dungeonstory-java,代碼行數:41,代碼來源:AbstractCrudView.java

示例14: createNoOfGroupsField

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private TextField createNoOfGroupsField() {
    final TextField noOfGroupsField = createIntegerTextField("prompt.number.of.groups",
            UIComponentIdProvider.ROLLOUT_NO_OF_GROUPS_ID);
    noOfGroupsField.addValidator(new GroupNumberValidator());
    noOfGroupsField.setMaxLength(3);
    noOfGroupsField.addValueChangeListener(this::onGroupNumberChange);
    return noOfGroupsField;
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:9,代碼來源:AddUpdateRolloutWindowLayout.java

示例15: addKitControls

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void addKitControls() {

    kitControlsLayout = new VerticalLayout();
    kitPathLayout = new GridLayout(1, 1);
    kitPathLayout.setWidth(100, Unit.PERCENTAGE);
    kitPathLayout.setColumnExpandRatio(0, 2);

    Label info = new Label();
    if (settings.getKitPath() != null) {
      info.setValue("Using " + (kitAwareClassLoaderDelegator.isEEKit() ? "Enterprise Kit" : "Open source Kit"));
    } else {
      info.setValue("Enter Kit location:");
    }
    TextField kitPath = new TextField();
    kitPath.setPlaceholder("Kit location");
    kitPath.setWidth("100%");
    kitPath.setValue(settings.getKitPath() != null ? settings.getKitPath() : "");
    kitPath.addValueChangeListener(event -> {
      try {
        kitAwareClassLoaderDelegator.setKitPath(kitPath.getValue());
        info.setValue("Using " + (kitAwareClassLoaderDelegator.isEEKit() ? "Enterprise" : "Open source") + " Kit");
        if (voltronConfigLayout != null) {
          voltronConfigLayout.removeAllComponents();
        }
        if (voltronControlLayout != null) {
          voltronControlLayout.removeAllComponents();
        }
        updateKitControls();
        initVoltronConfigLayout();
        initVoltronControlLayout();
        initRuntimeLayout();
        updateServerGrid();
        displayWarningNotification("Kit location updated with success !");
      } catch (Exception e) {
        if (e.getCause() instanceof NoSuchFileException) {
          displayErrorNotification("Kit path could not update !", "Make sure the path points to a kit !");
        } else {
          displayErrorNotification("Kit path could not update !", e);
        }
      }
    });
    kitPathLayout.addComponent(kitPath);
    kitControlsLayout.addComponent(info);
    kitControlsLayout.addComponent(kitPathLayout);
    mainLayout.addTab(kitControlsLayout, "STEP 1: KIT");
  }
 
開發者ID:Terracotta-OSS,項目名稱:tinypounder,代碼行數:47,代碼來源:TinyPounderMainUI.java


注:本文中的com.vaadin.ui.TextField.addValueChangeListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。