本文整理汇总了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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}