当前位置: 首页>>代码示例>>Java>>正文


Java TextField.setEnabled方法代码示例

本文整理汇总了Java中com.vaadin.ui.TextField.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setEnabled方法的具体用法?Java TextField.setEnabled怎么用?Java TextField.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.TextField的用法示例。


在下文中一共展示了TextField.setEnabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

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

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

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

示例4: getPropertyField

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@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 LongValidator("Value must be a long"));
  textField.setImmediate(true);

  return textField;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:LongFormPropertyRenderer.java

示例5: initContent

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@Override
protected void initContent(VerticalLayout layout) throws Exception {
	setCaption(operation.getDescription().getCaption());
	{
		TextField label = new TextField();
		label.setEnabled(false);
		label.setValue(nodePaths());
		label.setWidth("100%");
		layout.addComponent(label);
	}
	editor = operation.createEditor(editorProperties, this);
	if (editor != null)	{
		layout.addComponent(editor);
		layout.setExpandRatio(editor, 1);
	}
}
 
开发者ID:mhus,项目名称:cherry-web,代码行数:17,代码来源:ActionDialog.java

示例6: getPropertyField

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@Override
public Field getPropertyField(FormProperty formProperty) {
  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());
  }

  return textField;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:14,代码来源:StringFormPropertyRenderer.java

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

示例8: doUpdate

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
@Override
		public void doUpdate(NavNode nav) {
	        CherryApi api = MApi.lookup(CherryApi.class);
	        CaoNode cur = nav.getCurrent();
			Map<String, Acl> acls = api.getEffectiveAcls(cur);
			TreeMap<String, Acl> sorted = new TreeMap<>(acls);
			for (Entry<String, Acl> entry : sorted.entrySet()) {
				TextField bName = new TextField();
				bName.setValue(entry.getKey());
				bName.setEnabled(false);
//				bName.setCaption("<b>" + entry.getKey() + "</b>");
				bName.setWidth("100%");
				addComponent(bName);

				CaoNode def = entry.getValue().getDefiningNode();
				String txt = null;
				if (def.getId().equals(cur.getId()))
					txt = "From here";
				else
					txt = MString.truncateNiceLeft(def.getPath(), 40);
				Label src = new Label(txt);
				addComponent(src);
				for (String ace : entry.getValue().getAces()) {
					Label lAce = new Label( ace );
					addComponent(lAce);
				}
			}
		}
 
开发者ID:mhus,项目名称:cherry-web,代码行数:29,代码来源:PageControlAcls.java

示例9: windowContent

import com.vaadin.ui.TextField; //导入方法依赖的package包/类
private VerticalLayout windowContent(Player player, boolean admin) {
	VerticalLayout root = new VerticalLayout();
	root.setMargin(true);

	HorizontalLayout formsContainer = new HorizontalLayout();
	formsContainer.setSpacing(true);

	FieldGroup fieldGroup = new BeanFieldGroup<Player>(Player.class);
	fieldGroup.setItemDataSource(new BeanItem<Player>(player));

	final FormLayout content1 = new FormLayout();
	Field<?> buildAndBind = fieldGroup.buildAndBind(I18n.t("player.number"), "number");
	buildAndBind.setEnabled(admin);
	content1.addComponent(buildAndBind);
	buildAndBind = fieldGroup.buildAndBind(I18n.t("player.firstName"), "firstName");
	buildAndBind.setEnabled(admin);
	content1.addComponent(buildAndBind);
	buildAndBind = fieldGroup.buildAndBind(I18n.t("player.lastName"), "lastName");
	buildAndBind.setEnabled(admin);
	content1.addComponent(buildAndBind);
	buildAndBind = fieldGroup.buildAndBind(I18n.t("player.position"), "position");
	buildAndBind.setEnabled(admin);
	content1.addComponent(buildAndBind);
	buildAndBind = fieldGroup.buildAndBind(I18n.t("player.position2"), "position2");
	buildAndBind.setEnabled(admin);
	content1.addComponent(buildAndBind);
	buildAndBind = fieldGroup.buildAndBind(I18n.t("player.role"), "role");
	buildAndBind.setEnabled(admin);
	content1.addComponent(buildAndBind);
	formsContainer.addComponent(content1);

	final FormLayout content2 = new FormLayout();
	content2.addComponent(fieldGroup.buildAndBind(I18n.t("player.birthdate"), "birthdate"));
	content2.addComponent(fieldGroup.buildAndBind(I18n.t("player.heightCm"), "height"));
	TextField email = new TextField(I18n.t("player.email"), player.getUser() != null
			&& player.getUser().getEmail() != null ? player.getUser().getEmail() : "");
	email.setEnabled(false);
	content2.addComponent(email);
	content2.addComponent(fieldGroup.buildAndBind(I18n.t("player.phone"), "phone"));
	content2.addComponent(fieldGroup.buildAndBind(I18n.t("player.comment"), "comment"));
	formsContainer.addComponent(content2);

	root.addComponent(formsContainer);

	HorizontalLayout footer = new HorizontalLayout();
	footer.setWidth("100%");
	footer.setSpacing(true);
	footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);

	Label footerText = new Label();

	Button ok = new Button(I18n.t("ok"));
	ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
	ok.addClickListener(event -> {
		try {
			fieldGroup.commit();
			this.savedModel = playerService.save(player);
			EditPlayerWindow.this.close();
			BBPlay.info(I18n.t("saveOk"));
		} catch (CommitException e) {
			BBPlay.error(I18n.t("saveFail"));
		}

	});

	Button cancel = new Button(I18n.t("cancel"));
	cancel.addClickListener(event -> EditPlayerWindow.this.close());

	footer.addComponents(footerText, ok, cancel);
	footer.setExpandRatio(footerText, 1);

	root.addComponent(footer);

	return root;
}
 
开发者ID:Horuss,项目名称:bbplay,代码行数:76,代码来源:EditPlayerWindow.java


注:本文中的com.vaadin.ui.TextField.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。