本文整理匯總了Java中com.vaadin.ui.FormLayout.setMargin方法的典型用法代碼示例。如果您正苦於以下問題:Java FormLayout.setMargin方法的具體用法?Java FormLayout.setMargin怎麽用?Java FormLayout.setMargin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.FormLayout
的用法示例。
在下文中一共展示了FormLayout.setMargin方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildEntryForm
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
protected FormLayout buildEntryForm() {
FormLayout form = new FormLayout();
form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
form.setMargin(true);
nameField = new TextField("Name");
nameField.setValue(releasePackage.getName() != null ? releasePackage.getName() : "");
nameField.setReadOnly(releasePackage.isReleased());
form.addComponent(nameField);
versionLabelField = new TextField("Version");
versionLabelField.setValue(releasePackage.getVersionLabel() != null ? releasePackage.getVersionLabel() : "");
versionLabelField.setReadOnly(releasePackage.isReleased());
form.addComponent(versionLabelField);
releaseDateField = new DateField("Release Date");
releaseDateField.setValue(releasePackage.getReleaseDate() != null ? releasePackage.getReleaseDate() : null);
releaseDateField.setReadOnly(releasePackage.isReleased());
form.addComponent(releaseDateField);
return form;
}
示例2: buildUploadLayout
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
protected AbstractLayout buildUploadLayout() {
FormLayout layout = new FormLayout();
layout.setMargin(true);
groupField = new TextField("Group");
groupField.setWidth(100, Unit.PERCENTAGE);
groupField.setRequired(true);
layout.addComponent(groupField);
nameField = new TextField("Name");
nameField.setWidth(100, Unit.PERCENTAGE);
nameField.setRequired(true);
layout.addComponent(nameField);
versionField = new TextField("Version");
versionField.setWidth(100, Unit.PERCENTAGE);
versionField.setRequired(true);
layout.addComponent(versionField);
return layout;
}
示例3: buildForm
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
protected FormLayout buildForm(ProjectVersion sourceProjectVersion, ProjectVersion targetProjectVersion) {
FormLayout form = new FormLayout();
form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
form.setMargin(true);
TextField sourceProjectNameField = new TextField("Source Project");
sourceProjectNameField.setValue(sourceProjectVersion.getProject().getName());
sourceProjectNameField.setEnabled(false);
form.addComponent(sourceProjectNameField);
TextField targetProjectNameField = new TextField("Target Project");
targetProjectNameField.setValue(targetProjectVersion.getProject().getName());
targetProjectNameField.setEnabled(false);
form.addComponent(targetProjectNameField);
TextField currentDependencyVersion = new TextField("Current Dependency Version");
currentDependencyVersion.setValue(targetProjectVersion.getVersionLabel());
currentDependencyVersion.setEnabled(false);
form.addComponent(currentDependencyVersion);
return form;
}
示例4: createValidateWindow
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
/**
*
* Returns a Delete window using provided Content and Caption.It will have a Force Delete check box along with
* Cancel and Ok Buttons.
* The cancel button defaults to closing the window. You can customize behavior of OK,Cancel and Force Delete
* components by calling @link {@link VmidcWindow#getComponentModel()} and setting a different
* listener to that component
*
* @param caption
* Window's Caption
* @param content
* Window's Content
* @return
* Window Object
*/
public static VmidcWindow<OkCancelValidateButtonModel> createValidateWindow(String caption, String content) {
final VmidcWindow<OkCancelValidateButtonModel> validateWindow = new VmidcWindow<OkCancelValidateButtonModel>(
new OkCancelValidateButtonModel());
validateWindow.setCaption(caption);
validateWindow.getComponentModel().setCancelClickedListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = -1166844267835596823L;
@Override
public void buttonClick(ClickEvent event) {
validateWindow.close();
}
});
Label contentLabel = new Label(content);
contentLabel.setContentMode(ContentMode.HTML);
FormLayout form = new FormLayout();
form.setMargin(true);
form.setSizeUndefined();
form.addComponent(contentLabel);
validateWindow.setContent(form);
return validateWindow;
}
示例5: createAlertWindow
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
/**
* Returns a simple window with the specified caption and content(which can be HTML) with an OK and Cancel Buttons.
* The cancel button defaults to closing the window.
* This behaviour can be modified by calling @link {@link VmidcWindow#getComponentModel()} and setting a different
* listener to the cancel button
*
* @param caption
* the caption
* @param content
* the content
* @return the handle to window object
*/
public static VmidcWindow<OkCancelButtonModel> createAlertWindow(String caption, String content) {
final VmidcWindow<OkCancelButtonModel> alertWindow = new VmidcWindow<OkCancelButtonModel>(
new OkCancelButtonModel());
alertWindow.setCaption(caption);
alertWindow.getComponentModel().setCancelClickedListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = 98853982893459323L;
@Override
public void buttonClick(ClickEvent event) {
alertWindow.close();
}
});
Label contentLabel = new Label(content);
contentLabel.setContentMode(ContentMode.HTML);
FormLayout form = new FormLayout();
form.setMargin(true);
form.setSizeUndefined();
form.addComponent(contentLabel);
alertWindow.setContent(form);
return alertWindow;
}
示例6: NewPasswordWindow
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public NewPasswordWindow(LoginView parentView, LoginPresenter loginPresenter) {
super("Set Password");
this.handler = loginPresenter;
this.parentView = parentView;
setIcon(FontAwesome.LOCK);
setModal(true);
center();
setClosable(false);
setWidth(400, Unit.PIXELS);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
formLayout.addComponent(password);
formLayout.addComponent(verifyPassword);
formLayout.addComponent(save);
password.focus();
save.addClickListener((Button.ClickListener) clickEvent -> {
if (password.isEmpty()) {
parentView.notify("Password can not be empty");
password.focus();
} else if (password.getValue().toLowerCase().equals("password")) {
parentView.notify("Password can't be \"password\"");
password.selectAll();
} else if (!password.getValue().equals(verifyPassword.getValue())) {
parentView.notify("Password and Verification do not match");
verifyPassword.selectAll();
} else {
handler.setNewPassword(this.parentView, password.getValue());
close();
}
});
setContent(formLayout);
save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
save.addStyleName(ValoTheme.BUTTON_PRIMARY);
}
示例7: CreditCardAuthWindow
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public CreditCardAuthWindow(OrderView parentView, OrderPresenter orderPresenter) {
super("Authorization Number");
this.handler = orderPresenter;
this.parentView = parentView;
setIcon(FontAwesome.CREDIT_CARD);
setModal(true);
center();
setWidth(600, Unit.PIXELS);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
formLayout.addComponent(authNumber);
formLayout.addComponent(save);
authNumber.setMaxLength(7);
authNumber.focus();
save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
save.addClickListener((Button.ClickListener) clickEvent -> {
if (authNumber.getValue().trim().length() >= 6) {
handler.saveAuthNumberClicked(this.parentView, authNumber.getValue());
close();
} else {
authNumber.selectAll();
}
});
setContent(formLayout);
save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
save.addStyleName(ValoTheme.BUTTON_PRIMARY);
}
示例8: buildContents
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private void buildContents() {
FormLayout verticalLayout = new FormLayout();
verticalLayout.setMargin(true);
verticalLayout.setSpacing(true);
paymentType.setNullSelectionAllowed(false);
for (Payment.PaymentType p : Payment.PaymentType.values()) {
// Don't show the PREREG payment type unless the record is already set to PREREG.
// IE - the order was imported with prereg payment type)
if (p != Payment.PaymentType.PREREG) {
paymentType.addItem(p);
}
}
paymentType.setValue(Payment.PaymentType.CASH);
verticalLayout.addComponent(paymentType);
verticalLayout.addComponent(amount);
verticalLayout.addComponent(authNumber);
verticalLayout.addComponent(paymentTakenBy);
verticalLayout.addComponent(paymentTakenAt);
verticalLayout.addComponent(paymentLocation);
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSpacing(true);
horizontalLayout.addComponent(save);
horizontalLayout.addComponent(cancel);
horizontalLayout.addComponent(delete);
delete.addStyleName(ValoTheme.BUTTON_DANGER);
save.addClickListener((Button.ClickListener) clickEvent -> saveClicked());
cancel.addClickListener((Button.ClickListener) clickEvent -> close());
delete.addClickListener((Button.ClickListener) clickEvent -> deleteClicked());
verticalLayout.addComponent(horizontalLayout);
save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
save.addStyleName(ValoTheme.BUTTON_PRIMARY);
amount.focus();
setContent(verticalLayout);
}
示例9: ViewInstructionsWindow
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public ViewInstructionsWindow(String instructions) {
super(" Instructions");
setIcon(FontAwesome.BOOK);
setModal(true);
setClosable(true);
center();
setWidth("70%");
FormLayout verticalLayout = new FormLayout();
verticalLayout.setMargin(true);
verticalLayout.setSpacing(true);
verticalLayout.addComponent(labelInstructionText);
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSpacing(true);
horizontalLayout.addComponent(btnClose);
btnClose.addClickListener((Button.ClickListener) clickEvent -> close());
verticalLayout.addComponent(horizontalLayout);
setContent(verticalLayout);
labelInstructionText.setContentMode(ContentMode.HTML);
labelInstructionText.setSizeFull();
labelInstructionText.setValue(instructions);
btnClose.setClickShortcut(ShortcutAction.KeyCode.ENTER);
btnClose.addClickListener((Button.ClickListener) clickEvent -> {
this.close();
});
}
示例10: createContent
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
@Override
protected Component createContent() {
Messages messages = Messages.getInstance();
layout = new FormLayout();
layout.setMargin(new MarginInfo(true, true));
name = new FTextField(messages.getMessage("informationStep.name.label")).withWidth("250px");
gender = new RadioButtonGroup<Gender>(messages.getMessage("informationStep.sex.label"), EnumSet.allOf(Gender.class));
age = new DSIntegerField(messages.getMessage("informationStep.age.label"));
weight = new DSIntegerField(messages.getMessage("informationStep.weight.label"));
height = new TextField(messages.getMessage("informationStep.height.label"));
alignment = new ComboBox<>(messages.getMessage("informationStep.alignment.label"), alignmentService.findAllPlayable());
region = new ComboBox<>(messages.getMessage("informationStep.region.label"), regionService.findAllOrderBy("name", "ASC"));
getBinder().forMemberField(age).withValidator((value, context) -> {
int minAge = getEntity().getRace().getMinAge();
int maxAge = getEntity().getRace().getMaxAge();
if (value.intValue() < minAge || value.intValue() > maxAge) {
return ValidationResult.error(messages.getMessage("informationStep.age.validator", minAge, maxAge, getEntity().getRace().getName()));
}
return ValidationResult.ok();
});
gender.addValueChangeListener(event -> initImageSelector(event.getValue()));
layout.addComponents(name, gender, age, weight, height, alignment, region);
initImageSelector(null);
return layout;
}
示例11: createContent
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private FormLayout createContent() {
usernameField = new TextField("Username", "some.user");
passwordField = new PasswordField("Password", "password");
fullnameField = new TextField("Fullname", "Some User");
eMailField = new TextField("EMail", "[email protected]");
roles = new TextField("Roles", "user");
FormLayout userCardContent = new FormLayout(usernameField, passwordField, fullnameField, eMailField, roles);
userCardContent.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
userCardContent.setMargin(true);
return userCardContent;
}
示例12: buildMainLayout
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
@AutoGenerated
private FormLayout buildMainLayout() {
// common part: create layout
mainLayout = new FormLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("-1px");
mainLayout.setHeight("-1px");
mainLayout.setMargin(true);
mainLayout.setSpacing(true);
// top-level component properties
setWidth("-1px");
setHeight("-1px");
// textFieldSubdomain
textFieldSubdomain = new TextField();
textFieldSubdomain.setCaption("Enter Sub Domain");
textFieldSubdomain.setImmediate(false);
textFieldSubdomain
.setDescription("You can enter sub domain name - do not use spaces or wildcard characters.");
textFieldSubdomain.setWidth("-1px");
textFieldSubdomain.setHeight("-1px");
textFieldSubdomain.setInvalidAllowed(false);
textFieldSubdomain
.setInputPrompt("Examples: sales hr business marketing.");
mainLayout.addComponent(textFieldSubdomain);
mainLayout.setExpandRatio(textFieldSubdomain, 1.0f);
// buttonSave
buttonSave = new Button();
buttonSave.setCaption("Save");
buttonSave.setImmediate(true);
buttonSave.setWidth("-1px");
buttonSave.setHeight("-1px");
mainLayout.addComponent(buttonSave);
mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
return mainLayout;
}
示例13: buildDialogLayout
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
@Override
protected void buildDialogLayout() {
FormLayout mainLayout = new FormLayout();
// top-level component properties
setWidth("100%");
setHeight("100%");
mainLayout.setMargin(true);
mainLayout.setSpacing(true);
encodingSelect = new NativeSelect(ctx.tr("dialog.tlfs.encoding"));
for (Encoding encoding : Encoding.values()) {
encodingSelect.addItem(encoding);
encodingSelect.setItemCaption(encoding, encoding.getCharset());
}
encodingSelect.setNullSelectionAllowed(false);
encodingSelect.setImmediate(true);
TextField txtSearch = new TextField(this.ctx.tr("dialog.tlfs.search"), search);
txtSearch.setWidth("100%");
TextField txtReplace = new TextField(this.ctx.tr("dialog.tlfs.replace"), replace);
txtReplace.setWidth("100%");
mainLayout.addComponent(encodingSelect);
mainLayout.addComponent(txtSearch);
mainLayout.addComponent(txtReplace);
setCompositionRoot(mainLayout);
}
示例14: InputDialog
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public InputDialog(final UI parent, String title, String question, Recipient recipient)
{
this.recipient = recipient;
FormLayout form = new FormLayout();
form.setMargin(true);
form.setSizeFull();
field.setCaption(question);
field.setSizeFull();
form.addComponent(field);
dialog = new InputFormDialog(parent, title, field, form, this);
}
示例15: RestorePasswordWindow
import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public RestorePasswordWindow() {
super(CisConstants.uiRestorePassword);
setModal(true);
setSizeUndefined();
setResizable(false);
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSizeUndefined();
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
Button restoreButton = new Button(CisConstants.uiRestore);
restoreButton.addListener(this);
panel.setVisible(false);
panel.addComponent(label);
formLayout.addComponent(loginTf);
formLayout.addComponent(restoreButton);
verticalLayout.addComponent(panel);
verticalLayout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
verticalLayout.addComponent(formLayout);
verticalLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);
setContent(verticalLayout);
loginTf.focus();
restoreButton.setClickShortcut(KeyCode.ENTER);
}