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


Java TextField.setWidth方法代碼示例

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


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

示例1: addStringFilters

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
 * Ajoute un filtre en TextField sur une liste de colonnes
 * 
 * @param filterRow
 * @param container
 * @param propertys
 */
private void addStringFilters(String... propertys) {
	for (String property : propertys) {
		HeaderCell cell = getFilterCell(property);
		TextField filterField = new TextField();
		filterField.setImmediate(true);
		filterField.setWidth(100, Unit.PERCENTAGE);
		filterField.addStyleName(ValoTheme.TEXTFIELD_TINY);
		filterField.setInputPrompt(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
		filterField.addTextChangeListener(change -> {
			// Can't modify filters so need to replace
			container.removeContainerFilters(property);
			// (Re)create the filter if necessary
			if (!change.getText().isEmpty()) {
				container.addContainerFilter(new InsensitiveStringFilter(property, change.getText()));
			}
			fireFilterListener();
		});
		cell.setComponent(filterField);
	}
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:28,代碼來源:GridFormatting.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: platformBackupWanted

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void platformBackupWanted(boolean wanted) {
  int row = getBackupRow();
  if (wanted) {
    dataRootGrid.insertRow(row);
    TextField id = new TextField();
    id.setPlaceholder("ID");
    id.setValue("BACKUP");
    id.setReadOnly(true);
    TextField path = new TextField();
    path.setPlaceholder("Location");
    path.setValue(new File(baseLocation.getValue(), "data/backup").getAbsolutePath());
    path.setEnabled(false);
    path.setWidth(100, Unit.PERCENTAGE);
    dataRootGrid.addComponent(id, 0, row, 1, row);
    dataRootGrid.addComponent(path, DATAROOT_PATH_COLUMN, row);
  } else {
    dataRootGrid.removeRow(row);
  }
}
 
開發者ID:Terracotta-OSS,項目名稱:tinypounder,代碼行數:20,代碼來源:TinyPounderMainUI.java

示例4: platformPersistenceWanted

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void platformPersistenceWanted(boolean wanted) {
  int row = getPersistenceRow();
  if (wanted) {
    dataRootGrid.insertRow(row);
    TextField id = new TextField();
    id.setPlaceholder("ID");
    id.setValue("PLATFORM");
    id.setReadOnly(true);
    TextField path = new TextField();
    path.setPlaceholder("Location");
    path.setValue(new File(baseLocation.getValue(), "data/platform").getAbsolutePath());
    path.setEnabled(false);
    path.setWidth(100, Unit.PERCENTAGE);
    dataRootGrid.addComponent(id, 0, row, 1, row);
    dataRootGrid.addComponent(path, DATAROOT_PATH_COLUMN, row);
  } else {
    dataRootGrid.removeRow(row);
  }
}
 
開發者ID:Terracotta-OSS,項目名稱:tinypounder,代碼行數:20,代碼來源:TinyPounderMainUI.java

示例5: initSearchField

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
protected void initSearchField() {
  HorizontalLayout searchLayout = new HorizontalLayout();
  searchLayout.setSpacing(true);
  addComponent(searchLayout);
  
  // textfield
  searchField = new TextField();
  searchField.setInputPrompt(i18nManager.getMessage(Messages.PEOPLE_SEARCH));
  searchField.setWidth(180, UNITS_PIXELS);
  searchField.focus();
  searchLayout.addComponent(searchField);
  
  // Logic to change table according to input
  searchField.addListener(new TextChangeListener() {
    public void textChange(TextChangeEvent event) {
      searchPeople(event.getText());
    }
  });
  
  initSelectMyselfButton(searchLayout);
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:22,代碼來源:SelectUsersPopupWindow.java

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

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

示例8: init

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {
    setSizeFull();

    user = new TextField("User:");
    user.setWidth("300px");
    user.setRequiredIndicatorVisible(true);

    password = new PasswordField("Password:");
    password.setWidth("300px");
    user.setRequiredIndicatorVisible(true);
    password.setValue("");

    VerticalLayout fields = new VerticalLayout(user, password, loginButton);
    fields.setCaption("Please login to access the application");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    VerticalLayout uiLayout = new VerticalLayout(fields);
    uiLayout.setSizeFull();
    uiLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);

    setFocusedComponent(user);

    setContent(uiLayout);
}
 
開發者ID:kuylim,項目名稱:spring-boot-security-vaadin,代碼行數:28,代碼來源:LoginUI.java

示例9: generateUi

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
/**
	 * Diese Methode erstellt das UI, bestehend aus Inputfeld für Projektname und
	 * Projektbeschreibung.
	 *
	 * @author Marco Glaser
	 */
	public void generateUi(){
		setWidth(95, UNITS_PERCENTAGE);
		setHeight(SIZE_UNDEFINED, 0);
		setStyleName("projectCreationLayout");
		
		projectNameInput = new TextField();
		projectDescriptionInput = new TextArea();
		gap = new Label();
		secondGap = new Label();
		
		projectNameInput.setWidth(80, UNITS_PERCENTAGE);
//		projectNameInput.setHeight(30, UNITS_PIXELS);
		projectNameInput.setStyleName("projectNameInput");
		projectDescriptionInput.setWidth(80, UNITS_PERCENTAGE);
		projectDescriptionInput.setHeight(300, UNITS_PIXELS);
		projectDescriptionInput.setStyleName("projectNameInput");
		gap.setHeight("20px");
		secondGap.setSizeFull();
		
		projectNameInput.setValue("Geben Sie hier den Projektnamen ein.");
		projectDescriptionInput.setValue("Geben Sie hier eine Beschreibung des Projekts ein.");
		
		addComponent(projectNameInput);
		addComponent(gap);
		addComponent(projectDescriptionInput);
		
		projectNameInput.setCaption("Projektname");
		projectNameInput.setValue("Geben Sie hier den Projektnamen ein.");
		projectDescriptionInput.setCaption("Projektbeschreibung");
		projectDescriptionInput.setValue("Geben Sie hier eine Projektbeschreibung ein");
//		addComponent(secondGap);
//		setExpandRatio(secondGap, 1.0f);
	}
 
開發者ID:DHBW-Karlsruhe,項目名稱:businesshorizon2,代碼行數:40,代碼來源:ProjectCreationViewImpl.java

示例10: createPercentageField

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private TextField createPercentageField(final String in18Key, final String id) {
    final TextField textField = new TextFieldBuilder().prompt(i18n.getMessage(in18Key)).immediate(true).id(id)
            .buildTextComponent();
    textField.setWidth(80, Unit.PIXELS);
    textField.setNullRepresentation("");
    textField.setConverter(new StringToIntegerConverter());
    textField.addValidator(this::validateMandatoryPercentage);
    return textField;
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:10,代碼來源:DefineGroupsLayout.java

示例11: buildVerticalLayout_2

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@AutoGenerated
private VerticalLayout buildVerticalLayout_2() {
	// common part: create layout
	verticalLayout_2 = new VerticalLayout();
	verticalLayout_2.setImmediate(false);
	verticalLayout_2.setWidth("-1px");
	verticalLayout_2.setHeight("-1px");
	verticalLayout_2.setMargin(true);
	verticalLayout_2.setSpacing(true);
	
	// textFieldIssuer
	textFieldIssuer = new TextField();
	textFieldIssuer.setCaption("Issuer");
	textFieldIssuer.setImmediate(false);
	textFieldIssuer.setWidth("-1px");
	textFieldIssuer.setHeight("-1px");
	verticalLayout_2.addComponent(textFieldIssuer);
	
	// checkBoxMustBePresent
	checkBoxMustBePresent = new CheckBox();
	checkBoxMustBePresent.setCaption("Attribute Must Be Present");
	checkBoxMustBePresent.setImmediate(false);
	checkBoxMustBePresent.setWidth("-1px");
	checkBoxMustBePresent.setHeight("-1px");
	verticalLayout_2.addComponent(checkBoxMustBePresent);
	
	return verticalLayout_2;
}
 
開發者ID:apache,項目名稱:incubator-openaz,代碼行數:29,代碼來源:AttributeSelectionWindow.java

示例12: buildMainLayout

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(false);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// textFieldClassname
	textFieldClassname = new TextField();
	textFieldClassname.setCaption("Java Classname");
	textFieldClassname.setImmediate(false);
	textFieldClassname
			.setDescription("Java classname of the code implementing the custom PIP.");
	textFieldClassname.setWidth("-1px");
	textFieldClassname.setHeight("-1px");
	textFieldClassname.setInputPrompt("Eg. com.foo.MyPIP");
	mainLayout.addComponent(textFieldClassname);
	mainLayout.setExpandRatio(textFieldClassname, 1.0f);
	
	// pipParameterComponent
	pipParameterComponent = new PIPParameterComponent(this.entity.getEntity());
	pipParameterComponent.setImmediate(false);
	pipParameterComponent.setWidth("-1px");
	pipParameterComponent.setHeight("-1px");
	mainLayout.addComponent(pipParameterComponent);
	
	return mainLayout;
}
 
開發者ID:apache,項目名稱:incubator-openaz,代碼行數:36,代碼來源:CustomPIPConfigurationComponent.java

示例13: VaadinSearchPanel

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
public VaadinSearchPanel(final Search<T> search, Object[] keys, TableActionListener<T> listener) {
	setMargin(false);
	setSpacing(false);
	setSizeFull();
	
	text = new TextField();
	searchButton = new Button("Search");
	table = new VaadinTable<T>(keys, false, listener);

	HorizontalLayout northPanel = new HorizontalLayout();
	northPanel.setWidth("100%");
	northPanel.addComponent(text);
	northPanel.addComponent(searchButton);
	text.setWidth("100%");
	northPanel.setComponentAlignment(text, Alignment.MIDDLE_LEFT);
	northPanel.setExpandRatio(text, 1.0f);
			
	addComponent(northPanel);
	setExpandRatio(northPanel, 0.0f);
	table.setSizeFull();
	addComponent(table);
	setExpandRatio(table, 1.0f);

	searchButton.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;
		@Override
		public void buttonClick(ClickEvent event) {
			List<T> objects = search.search((String) text.getValue());
			table.setObjects(objects);
		}
	});
	
	width = keys.length * 20;
}
 
開發者ID:BrunoEberhard,項目名稱:minimal-j,代碼行數:35,代碼來源:VaadinSearchPanel.java

示例14: initUi

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
@Override
public void initUi() {
	
	title = new TextField("Title");
	title.setValue(data.getString("title", ""));
	title.setWidth("100%");
	addComponent(title);
	
}
 
開發者ID:mhus,項目名稱:cherry-web,代碼行數:10,代碼來源:WebLayoutPageEditor.java

示例15: initUrl

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
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);
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:14,代碼來源:UrlAttachmentEditorComponent.java


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