本文整理汇总了Java中com.vaadin.ui.Form类的典型用法代码示例。如果您正苦于以下问题:Java Form类的具体用法?Java Form怎么用?Java Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Form类属于com.vaadin.ui包,在下文中一共展示了Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAlfrescoComponent
import com.vaadin.ui.Form; //导入依赖的package包/类
protected void initAlfrescoComponent() {
alfrescoForm = new Form();
alfrescoForm.setDescription(i18nManager.getMessage(Messages.ALFRESCO_DESCRIPTION));
final TextField alfrescoServer = new TextField(i18nManager.getMessage(Messages.ALFRESCO_SERVER));
alfrescoForm.getLayout().addComponent(alfrescoServer);
final TextField alfrescoUserName = new TextField(i18nManager.getMessage(Messages.ALFRESCO_USERNAME));
alfrescoForm.getLayout().addComponent(alfrescoUserName);
final PasswordField alfrescoPassword = new PasswordField(i18nManager.getMessage(Messages.ALFRESCO_PASSWORD));
alfrescoForm.getLayout().addComponent(alfrescoPassword);
// Matching listener
alfrescoClickListener = new ClickListener() {
public void buttonClick(ClickEvent event) {
Map<String, Object> accountDetails = createAccountDetails(
"alfresco",
alfrescoUserName.getValue().toString(),
alfrescoPassword.getValue().toString(),
"server", alfrescoServer.getValue().toString()
);
fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
}
};
}
示例2: FileAttachmentEditorComponent
import com.vaadin.ui.Form; //导入依赖的package包/类
public FileAttachmentEditorComponent(Attachment attachment, String taskId, String processInstanceId) {
this.attachment = attachment;
this.taskId = taskId;
this.processInstanceId = processInstanceId;
this.i18nManager = ExplorerApp.get().getI18nManager();
taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
form = new Form();
form.setDescription(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_HELP));
setSizeFull();
addComponent(form);
initSuccessIndicator();
initFileUpload();
initName();
initDescription();
}
示例3: WkdXmlConfigDialog
import com.vaadin.ui.Form; //导入依赖的package包/类
public WkdXmlConfigDialog(WkdXmlConfig config) {
form = new Form();
addComponent(form);
beanItem = new BeanItem<WkdXmlConfig>(config);
form.setImmediate(true);
form.setFormFieldFactory(new DefaultFieldFactory() {
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
Field f = super.createField(item, propertyId, uiContext);
f.setRequired(true);
f.setWidth(500,UNITS_PIXELS);
return f;
}
});
form.setItemDataSource(beanItem);
form.focus();
}
示例4: build
import com.vaadin.ui.Form; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Form build() {
Form form = new Form();
if (layout != null)
form.setLayout(layout);
if (formFieldFactory != null)
form.setFormFieldFactory(formFieldFactory);
if (visibleProperties != null)
form.setVisibleItemProperties(visibleProperties);
if (width != null)
form.setWidth(width);
if (height != null)
form.setHeight(height);
return form;
}
示例5: buttonClick
import com.vaadin.ui.Form; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public void buttonClick(ClickEvent event) {
PageableTable<?> table = (PageableTable<?>) getTable();
Filter filter = (Filter) table.getFilter();
if (filter == null)
return;
filter.clear();
if (table.getFilterForm() instanceof Form) {
Form form = (Form) table.getFilterForm();
form.discard();
}
else if (table.getFilterForm() instanceof View) {
((View) table.getFilterForm()).refresh();
}
table.getPaginator().firstPage();
}
示例6: initForm
import com.vaadin.ui.Form; //导入依赖的package包/类
protected void initForm() {
form = new Form();
form.setSizeFull();
addComponent(form);
setComponentAlignment(form, Alignment.TOP_CENTER);
}
示例7: initForm
import com.vaadin.ui.Form; //导入依赖的package包/类
protected void initForm() {
form = new Form();
form.setValidationVisibleOnCommit(true);
form.setImmediate(true);
addComponent(form);
initInputFields();
initCreateButton();
}
示例8: initForm
import com.vaadin.ui.Form; //导入依赖的package包/类
protected void initForm() {
form = new Form();
form.setValidationVisibleOnCommit(true);
form.setImmediate(true);
addComponent(form);
// name
nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
nameField.focus();
nameField.setRequired(true);
nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED));
form.addField("name", nameField);
// description
descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
descriptionArea.setColumns(25);
form.addField("description", descriptionArea);
// duedate
dueDateField = new DateField(i18nManager.getMessage(Messages.TASK_DUEDATE));
dueDateField.setResolution(DateField.RESOLUTION_DAY);
form.addField("duedate", dueDateField);
// priority
priorityComboBox = new PriorityComboBox(i18nManager);
form.addField("priority", priorityComboBox);
}
示例9: FossaLoginScreen
import com.vaadin.ui.Form; //导入依赖的package包/类
public FossaLoginScreen(FossaApplication app, FossaAuthorizer authorizer, String error) {
super(app);
setStyleName("login");
this.authorizer = authorizer;
setCaption("Bitte melden Sie sich an!");
setWidth("500px");
center();
CustomLayout layout = new CustomLayout("./login/loginScreen");
setContent(layout);
Label errorlabel = new Label(error);
formLoginScreen = new Form();
formLoginScreen.addField(username, username);
username.focus();
formLoginScreen.addField(password, password);
formLoginScreen.getField(username).setRequired(true);
formLoginScreen.getField(password).setRequired(true);
layout.addComponent(formLoginScreen, "form");
layout.addComponent(errorlabel, "errorlabel");
Button login = new Button("Anmelden");
layout.addComponent(login, "login");
login.addListener((Button.ClickListener) this);
login.setClickShortcut(KeyCode.ENTER);
}
示例10: renameGroup
import com.vaadin.ui.Form; //导入依赖的package包/类
private static void renameGroup(GraphContainer graphContainer, Vertex group, String newLabel) {
RenameGroupOperation operation = new RenameGroupOperation();
OperationContext context = getOperationContext(graphContainer);
// Execute the operation on the single vertex
operation.execute(Collections.singletonList((VertexRef)group), context);
// Grab the window, put a value into the form field, and commit the form to complete
// the operation.
Window window = context.getMainWindow();
assertEquals(1, window.getChildWindows().size());
Window prompt = window.getChildWindows().iterator().next();
for (Iterator<Component> itr = prompt.getComponentIterator(); itr.hasNext();) {
Component component = itr.next();
try {
Form form = (Form)component;
Field field = form.getField("Group Label");
field.setValue(newLabel);
// Make sure that the value was set, Vaadin will ignore the value
// if, for instance, the specified value is not in the Select list
assertEquals(newLabel, field.getValue());
form.commit();
} catch (ClassCastException e) {
LoggerFactory.getLogger(GroupOperationsTest.class).info("Not a Form: " + component.getClass());
}
}
}
示例11: SPARQLUpdateTransformDialog
import com.vaadin.ui.Form; //导入依赖的package包/类
public SPARQLUpdateTransformDialog(SPARQLUpdateTransformConfig oldConfig) {
this.config = oldConfig;
queryForm = new Form();
queryForm.setSizeFull();
queryForm.setFormFieldFactory(new FormFieldFactory() {
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
if (propertyId.equals("query")) {
TextArea query = new TextArea("SPARQL Query");
query.setSizeFull();
query.setRows(25);
query.addValidator(new AbstractStringValidator("Must be a valid UPDATE query!") {
@Override
protected boolean isValidString(String value) {
SPARQLParser parser = new SPARQLParser();
try {
ParsedUpdate parsed = parser.parseUpdate(value, null);
} catch (Exception ex) {
setErrorMessage(ex.getMessage());
return false;
}
return true;
}
});
return query;
}
return null;
}
});
queryForm.setItemDataSource(new BeanItem<SPARQLUpdateTransformConfig>(config));
addComponent(queryForm);
}
示例12: addOKCancelButtons
import com.vaadin.ui.Form; //导入依赖的package包/类
/**
* Add a default commit/discard buttons to a form
* @param f the Form
*/
public static void addOKCancelButtons(Form f) {
Button ok = newOKButton(f);
Button cancel = newCancelButton(f);
HorizontalLayout hl = new HorizontalLayout();
hl.setSpacing(true);
hl.addComponent(ok);
hl.addComponent(cancel);
HorizontalLayout footer = new HorizontalLayout();
footer.setWidth("100%");
footer.addComponent(hl);
footer.setComponentAlignment(hl, Alignment.TOP_CENTER);
f.setFooter(footer);
}
示例13: newCancelButton
import com.vaadin.ui.Form; //导入依赖的package包/类
/**
* Creates a new cancel button
* @param f form holding the button
* @return new cancel button
*/
private static Button newCancelButton(final Form f) {
Button cancel = new Button(StaticMessageSource.getMessage("cancel"));
cancel.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
f.discard();
}
});
return cancel;
}
示例14: newOKButton
import com.vaadin.ui.Form; //导入依赖的package包/类
/**
* Creates a new OK Button
* @param f form holding the button
* @return new OK Button
*/
private static Button newOKButton(final Form f) {
Button ok = new Button(StaticMessageSource.getMessage("ok"));
ok.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
f.commit();
}
});
return ok;
}
示例15: createForm
import com.vaadin.ui.Form; //导入依赖的package包/类
private Form createForm() {
Form form = new Form();
form.setFormFieldFactory(this.formFieldFactory);
return form;
}