Java 类com.vaadin.ui.FormLayout 实例源码

项目:holon-vaadin7    文件:ExampleInputGroup.java   
public void form1() {
    // tag::form1[]
    final PathProperty<Long> ID = PathProperty.create("id", Long.class);
    final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);

    final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);

    PropertyInputForm form = Components.input.form(new FormLayout()).properties(PROPERTIES).required(ID).build(); // <1>

    form = Components.input.form(new FormLayout()).properties(PROPERTIES).required(ID)
            .composer((layout, source) -> { // <2>
                source.getValueComponents().forEach(c -> layout.addComponent(c.getComponent()));
            }).build();

    form.setValue(PropertyBox.builder(PROPERTIES).set(ID, 1L).set(DESCRIPTION, "Test").build()); // <3>

    PropertyBox value = form.getValue(); // <4>
    // end::form1[]
}
项目:holon-vaadin7    文件:ExampleViewComponent.java   
public void view2() {
    // tag::view2[]
    final PathProperty<Long> ID = PathProperty.create("id", Long.class);
    final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);

    final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);

    PropertyViewGroup viewGroup = Components.view.propertyGroup().properties(PROPERTIES).build(); // <1>

    PropertyViewForm viewForm = Components.view.formVertical().properties(PROPERTIES).build(); // <2>

    viewForm = Components.view.form(new FormLayout()).properties(PROPERTIES) //
            .composer((layout, source) -> { // <3>
                source.getValueComponents().forEach(c -> layout.addComponent(c.getComponent()));
            }).build();

    viewForm.setValue(PropertyBox.builder(PROPERTIES).set(ID, 1L).set(DESCRIPTION, "Test").build()); // <4>

    PropertyBox value = viewForm.getValue(); // <5>
    // end::view2[]
}
项目:easybinder    文件:AutomaticPropertyBindingExample.java   
@Override
public Component getTestComponent() {
    AutoBinder<Flight> binder = new AutoBinder<>(Flight.class);
    binder.bindInstanceFields(this);

    FormLayout f = new FormLayout();
    f.addComponents(airline, flightNumber, flightSuffix, date, legType, sbt, ebt, abt, gate, canceled);

    Label statusLabel = new Label();
    binder.setStatusLabel(statusLabel);     
    f.addComponents(statusLabel);   

    binder.setBean(new Flight());

    return f;
}
项目:easybinder    文件:ManualReflectionBindingExample.java   
@Override
public Component getTestComponent() {
    ReflectionBinder<Flight> binder = new ReflectionBinder<>(Flight.class);
    binder.bind(airline, "flightId.airline");
    binder.bind(flightNumber, "flightId.flightNumber");
    binder.bind(flightSuffix, "flightId.flightSuffix");
    binder.bind(date, "flightId.date");
    binder.bind(legType, "flightId.legType");
    binder.bind(sbt, "sbt");
    binder.bind(ebt, "ebt");
    binder.bind(abt, "abt");
    binder.bind(gate, "gate");
    binder.bind(canceled, "canceled");

    FormLayout f = new FormLayout();

    f.addComponents(airline, flightNumber, flightSuffix, date, legType, sbt, ebt, abt, gate, canceled);

    Label statusLabel = new Label();
    binder.setStatusLabel(statusLabel);     
    f.addComponents(statusLabel);   

    binder.setBean(new Flight());

    return f;
}
项目:holon-vaadin    文件:ExampleInputGroup.java   
public void form1() {
    // tag::form1[]
    final PathProperty<Long> ID = PathProperty.create("id", Long.class);
    final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);

    final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);

    PropertyInputForm form = Components.input.form(new FormLayout()).properties(PROPERTIES).required(ID).build(); // <1>

    form = Components.input.form(new FormLayout()).properties(PROPERTIES).required(ID)
            .composer((layout, source) -> { // <2>
                source.getValueComponents().forEach(c -> layout.addComponent(c.getComponent()));
            }).build();

    form.setValue(PropertyBox.builder(PROPERTIES).set(ID, 1L).set(DESCRIPTION, "Test").build()); // <3>

    PropertyBox value = form.getValue(); // <4>
    // end::form1[]
}
项目:holon-vaadin    文件:ExampleViewComponent.java   
public void view2() {
    // tag::view2[]
    final PathProperty<Long> ID = PathProperty.create("id", Long.class);
    final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);

    final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);

    PropertyViewGroup viewGroup = Components.view.propertyGroup().properties(PROPERTIES).build(); // <1>

    PropertyViewForm viewForm = Components.view.formVertical().properties(PROPERTIES).build(); // <2>

    viewForm = Components.view.form(new FormLayout()).properties(PROPERTIES) //
            .composer((layout, source) -> { // <3>
                source.getValueComponents().forEach(c -> layout.addComponent(c.getComponent()));
            }).build();

    viewForm.setValue(PropertyBox.builder(PROPERTIES).set(ID, 1L).set(DESCRIPTION, "Test").build()); // <4>

    PropertyBox value = viewForm.getValue(); // <5>
    // end::view2[]
}
项目:kumoreg    文件:LoginView.java   
@PostConstruct
    void init() {
        FormLayout formLayout = new FormLayout();
        formLayout.addComponent(usernameField);
        formLayout.addComponent(passwordField);
        formLayout.addComponent(loginButton);
        formLayout.setWidth(null);
        addComponent(formLayout);

        loginButton.setClickShortcut( ShortcutAction.KeyCode.ENTER ) ;
        loginButton.addClickListener((Button.ClickListener) clickEvent -> {
            if (usernameField.isEmpty()) {
                Notification.show("Username is required");
                usernameField.focus();
            } else if (passwordField.isEmpty()) {
                Notification.show("Password is required");
                passwordField.focus();
            } else {
                handler.login(this, usernameField.getValue(), passwordField.getValue());
            }
        });
        usernameField.focus();

//        setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);
    }
项目:dungeonstory-java    文件:SkillForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom");
    shortDescription = new FTextField("Description courte").withFullWidth();
    description = new FTextArea("Description").withFullWidth();
    keyAbility = new ComboBox<Ability>("Attribut clé", Services.getAbilityService().findAll());

    layout.addComponent(name);
    layout.addComponent(shortDescription);
    layout.addComponent(description);
    layout.addComponent(keyAbility);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:AlignmentForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom");
    abbreviation = new FTextField("Abbréviation");
    playable = new FormCheckBox("Jouable par un personnage");
    shortDescription = new FTextField("Description courte").withFullWidth();
    description = new FTextArea("Description").withFullWidth();

    layout.addComponent(name);
    layout.addComponent(abbreviation);
    layout.addComponent(playable);
    layout.addComponent(shortDescription);
    layout.addComponent(description);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:CityForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom");
    region = new ComboBox<Region>("Région", regionService.findAll());
    shortDescription = new FTextField("Description courte");
    description = new FTextArea("Description").withFullWidth();

    layout.addComponent(name);
    layout.addComponent(region);
    layout.addComponent(shortDescription);
    layout.addComponent(description);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:FeatForm.java   
@Override
protected Component createContent() {
    FormLayout layout = new FormLayout();

    name = new FTextField("Nom").withWidth(50, Unit.PERCENTAGE);
    description = new FTextArea("Description").withFullWidth().withRows(10);
    usage = new EnumComboBox<FeatUsage>(FeatUsage.class, "Usage");
    prerequisiteType = new EnumComboBox<PrerequisiteType>(PrerequisiteType.class, "Type de prérequis");
    prerequisiteArmorProficiency = new EnumComboBox<>(ArmorType.ProficiencyType.class, "Maitrise d'armure prérequise");
    prerequisiteAbility = new ComboBox<Ability>("Caractéristique prérequise", abilityService.findAll());
    prerequisiteAbilityScore = new DSIntegerField("Score de caractéristique");

    prerequisiteType.addSelectionListener(event -> adjustTypeVisibility(event.getValue()));

    layout.addComponent(name);
    layout.addComponent(description);
    layout.addComponent(usage);
    layout.addComponents(prerequisiteType, prerequisiteArmorProficiency, prerequisiteAbility, prerequisiteAbilityScore);
    layout.addComponent(getToolbar());

    return layout;
}
项目:dungeonstory-java    文件:SpellChoiceForm.java   
private void getSpellWindow(Spell spell) {
    Messages messages = Messages.getInstance();
    Window window = new Window(spell.getName());
    window.setModal(true);
    window.setWidth("60%");

    CollectionToStringConverter converter = new CollectionToStringConverter();

    FormLayout layout = new FormLayout();
    DSLabel componentType = new DSLabel(messages.getMessage("spellStep.component.label"),
            converter.convertToPresentation(spell.getComponentTypes(), new ValueContext()));
    DSLabel text = new DSLabel(messages.getMessage("spellStep.description.label"), spell.getDescription());
    layout.addComponents(componentType, text);

    //TODO : other useful info

    window.setContent(layout);
    UI.getCurrent().addWindow(window);
}
项目:dungeonstory-java    文件:AdventureForm.java   
@Override
protected Component createContent() {
    layout = new FormLayout();

    name = new FTextField("Titre").withWidth("50%");
    description = new FTextArea("Description").withFullWidth();
    challengeRating = new ComboBox<>("Degré de difficulté");
    challengeRating.setItems(Services.getLevelService().findAll());
    status = new EnumComboBox<>(AdventureStatus.class, "Statut");
    layout.addComponents(name, description, challengeRating, status);
    layout.addComponent(getToolbar());

    messageButton = new Button("Messages", event -> {
        EventBus.post(new NavigationEvent(AdventureView.URI + "/" + getEntity().getId()));
    });
    layout.addComponent(messageButton);

    return layout;
}
项目:dungeonstory-java    文件:MultiColumnFormLayout.java   
public MultiColumnFormLayout(int columns, String caption) {
    if (columns < 1) {
        throw new IllegalArgumentException("column number must be greater than 1");
    }
    hLayout = new HorizontalLayout();
    hLayout.setWidth(100, Unit.PERCENTAGE);
    for (int i = 0; i < columns; i++) {
        FormLayout form = new FormLayout();
        hLayout.addComponent(form, i);
    }

    if (caption != null) {
        hLayout.setMargin(new MarginInfo(false, true));
        Panel panel = new Panel(caption, hLayout);
        setCompositionRoot(panel);
    } else {
        setCompositionRoot(hLayout);
    }

}
项目:bookery    文件:ServerSettingsLayout.java   
@PostConstruct
private void postInit() {
    addStyleName("bookery-content");
    formLayout = new FormLayout();
    formLayout.addStyleName("light");
    formLayout.addComponents(generateFields());
    formLayout.addComponents(generateStatusFields());

    Button checkSolr = new Button("check", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            checkSolr();
        }
    });
    checkSolr.addStyleName(ValoTheme.BUTTON_SMALL);
    checkSolr.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    formLayout.addComponent(checkSolr);

    Label titleLabel = new Label("General Settings");
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    addComponents(titleLabel, formLayout);
}
项目:kumoreg    文件:LoginView.java   
@PostConstruct
    void init() {
        FormLayout formLayout = new FormLayout();
        formLayout.addComponent(usernameField);
        formLayout.addComponent(passwordField);
        formLayout.addComponent(loginButton);
        formLayout.setWidth(null);
        addComponent(formLayout);

        loginButton.setClickShortcut( ShortcutAction.KeyCode.ENTER ) ;
        loginButton.addClickListener((Button.ClickListener) clickEvent -> {
            if (usernameField.isEmpty()) {
                Notification.show("Username is required");
                usernameField.focus();
            } else if (passwordField.isEmpty()) {
                Notification.show("Password is required");
                passwordField.focus();
            } else {
                handler.login(this, usernameField.getValue(), passwordField.getValue());
            }
        });
        usernameField.focus();

//        setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);
    }
项目:solr-app-magnolia-module    文件:SolrManagementAppViewImpl.java   
protected Component createSolrIndexManagementSection() {
    FormLayout layout = new FormLayout();

    Label manageSolrSectionTitle = new Label(i18n.translate("solr.app.manageSolrIndex.label.intro"));
    manageSolrSectionTitle.addStyleName(STYLE_SECTION_TITLE);
    layout.addComponent(manageSolrSectionTitle);
    layout.addComponent(new Label(i18n.translate("solr.app.manageSolrIndex.label.description")));

    Button clearSolrIndexButton =
              new Button(i18n.translate("solr.app.management.button.clearSolrIndex.caption"),
                        event -> listener.clearSolrIndex()
              );
    clearSolrIndexButton.addStyleName(STYLE_V_BUTTON_SMALLAPP);
    clearSolrIndexButton.addStyleName(STYLE_COMMIT);

    VerticalLayout buttons = new VerticalLayout();
    buttons.addStyleName(STYLE_BUTTONS);
    buttons.setSpacing(true);
    buttons.addComponent(clearSolrIndexButton);

    layout.addComponent(buttons);
    return layout;
}
项目:metl    文件:EditReleasePackageDialog.java   
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;
}
项目:metl    文件:PluginsPanelAddDialog.java   
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;
}
项目:metl    文件:PluginRepositoryEditPanel.java   
public PluginRepositoryEditPanel(ApplicationContext context, PluginRepository pluginRepository) {
    this.context = context;
    this.pluginRepository = pluginRepository;

    FormLayout form = new FormLayout();
    form.setSpacing(true);

    TextField field = new TextField("Name", StringUtils.trimToEmpty(pluginRepository.getName()));
    field.setWidth(20, Unit.EM);
    form.addComponent(field);
    field.addValueChangeListener(new NameChangeListener());
    field.focus();

    field = new TextField("Url", StringUtils.trimToEmpty(pluginRepository.getUrl()));
    field.setWidth(45, Unit.EM);
    field.addValueChangeListener(new UrlChangeListener());
    form.addComponent(field);

    addComponent(form);
    setMargin(true);
}
项目:metl    文件:ChangeDependencyVersionDialog.java   
private void initWindow(Object selectedItem) {
    dependency = (ProjectVersionDepends) selectedItem;

    setWidth(400.0f, Unit.PIXELS);
    setHeight(600.0f, Unit.PIXELS);
    VerticalLayout vLayout = new VerticalLayout();
    vLayout.setSizeFull();
    vLayout.setMargin(true);
    ProjectVersion sourceProjectVersion = configService.findProjectVersion(dependency.getProjectVersionId());
    ProjectVersion targetProjectVersion = configService.findProjectVersion(dependency.getTargetProjectVersionId());
    FormLayout form = buildForm(sourceProjectVersion, targetProjectVersion);
    vLayout.addComponent(form);

    Panel projectVersionPanel = new Panel();
    projectVersionPanel.setSizeFull();
    projectVersionPanel.setContent(buildPossibleTargetVersions(targetProjectVersion));
    vLayout.addComponent(projectVersionPanel);
    addComponent(vLayout,1); 
    addComponent(buildButtonBar());
    vLayout.setExpandRatio(projectVersionPanel, 1);       
}
项目:metl    文件:ChangeDependencyVersionDialog.java   
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;
}
项目:metl    文件:PropertySheet.java   
@SuppressWarnings("unchecked")
protected void addCommonComponentSettings(FormLayout formLayout, Object obj) {
    List<Object> list = (List<Object>) obj;
    List<Component> components = new ArrayList<Component>(list.size());
    for (Object object : list) {
        if (object instanceof FlowStep) {
            components.add(((FlowStep) object).getComponent());
        } else if (object instanceof Component) {
            components.add((Component) object);
        }
    }
    if (components.size() != 0 && !readOnly) {
        formLayout.addComponent(buildOptionGroup("Enabled", ENABLED, components));
        formLayout.addComponent(buildOptionGroup("Log Input", LOG_INPUT, components));
        formLayout.addComponent(buildOptionGroup("Log Output", LOG_OUTPUT, components));
    }
}
项目:metl    文件:PropertySheet.java   
protected void addComponentName(FormLayout formLayout, final Component component) {

        ImmediateUpdateTextField textField = new ImmediateUpdateTextField("Component Name") {
            private static final long serialVersionUID = 1L;

            protected void save(String text) {
                component.setName(text);
                context.getConfigurationService().save(component);
                if (listener != null) {
                    List<Component> components = new ArrayList<Component>(1);
                    components.add(component);
                    listener.componentChanged(components);
                }
            };
        };
        textField.setValue(component.getName());
        textField.setRequired(true);
        textField.setDescription("Name for the component on the flow");
        formLayout.addComponent(textField);
    }
项目:Plugins    文件:VirtuosoLoaderVaadinDialog.java   
@Override
protected void buildDialogLayout() {
    FormLayout mainLayout = new FormLayout();

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    final PasswordField passwordField = new PasswordField(PASSWORD_LABEL, password);
    passwordField.setWidth("100%");

    mainLayout.addComponent(createTextField(VIRTUOSO_URL_LABEL, virtuosoUrl));
    mainLayout.addComponent(createTextField(USERNAME_LABEL, username));
    mainLayout.addComponent(passwordField);
    mainLayout.addComponent(new CheckBox(CLEAR_DESTINATION_GRAPH_LABEL, clearDestinationGraph));
    mainLayout.addComponent(createTextField(LOAD_DIRECTORY_PATH_LABEL, loadDirectoryPath));
    mainLayout.addComponent(new CheckBox(INCLUDE_SUBDIRECTORIES_LABEL, includeSubdirectories));
    mainLayout.addComponent(createTextField(LOAD_FILE_PATTERN_LABEL, loadFilePattern));
    mainLayout.addComponent(createTextField(TARGET_CONTEXT_LABEL, targetContext));
    mainLayout.addComponent(createTextField(STATUS_UPDATE_INTERVAL_LABEL, statusUpdateInterval));
    mainLayout.addComponent(createTextField(THREAD_COUNT_LABEL, threadCount));
    mainLayout.addComponent(new CheckBox(SKIP_ON_ERROR_LABEL, skipOnError));

    setCompositionRoot(mainLayout);
}
项目:viritin    文件:Issue309PojoForm.java   
@Override
protected void init(VaadinRequest request) {
    AbstractForm<Pojo> form = new AbstractForm<Pojo>(Pojo.class) {

        private static final long serialVersionUID = 1251886098275380006L;
        IntegerField myInteger = new IntegerField("My Integer");

        @Override
        protected Component createContent() {
            FormLayout layout = new FormLayout(myInteger, getToolbar());
            return layout;
        }
    };

    form.setResetHandler((Pojo entity) -> {
        form.setEntity(null);
    });

    form.setEntity(new Pojo());
    setContent(form);
}
项目:extacrm    文件:ProdCreditPercentForm.java   
/** {@inheritDoc} */
@Override
protected ComponentContainer createEditFields() {
    final FormLayout form = new ExtaFormLayout();
       form.setSizeFull();

    percentField = new EditField("Процентная ставка", "Введите процентную ставку");
    percentField.setConverter(lookup(StringToPercentConverter.class));
    form.addComponent(percentField);

    periodField = new EditField("Срок кредитования", "Введите срок крединования при котором приметяется эта проценнтная ставка");
    form.addComponent(periodField);

    downpaymentField = new EditField("Первоначальный взнос", "Введите минимальный первоначальный взнос при котором применяется эта процентная ставка");
    downpaymentField.setConverter(lookup(StringToPercentConverter.class));
    form.addComponent(downpaymentField);

    return form;
}
项目:extacrm    文件:GetValueWindowLongRange.java   
/** {@inheritDoc} */
@Override
protected ComponentContainer createEditFields() {
    final FormLayout form = new ExtaFormLayout();

    startValueField = new EditField("Начальное значение", "Введите целое число.");
    startValueField.setColumns(15);
    startValueField.setRequired(true);
    startValueField.addValidator(new RangeValidator<>("Неподходящее значение", Long.class, 0L, Long.MAX_VALUE));
    form.addComponent(startValueField);

    endValueField = new EditField("Конечное значение", "Введите целое число.");
    endValueField.setColumns(15);
    endValueField.setRequired(true);
    endValueField.addValidator(new RangeValidator<>("Неподходящее значение", Long.class, 0L, Long.MAX_VALUE));
    form.addComponent(endValueField);

    return form;
}
项目:extacrm    文件:MotorModelEditForm.java   
/** {@inheritDoc} */
@Override
protected ComponentContainer createEditFields() {
    final FormLayout form = new ExtaFormLayout();
    form.setSizeFull();

    typeField = new MotorTypeSelect();
    typeField.setRequired(true);
    form.addComponent(typeField);

    brandField = new MotorBrandSelect();
    brandField.setRequired(true);
    brandField.linkToType(typeField);
    form.addComponent(brandField);

    nameField = new EditField("Название модели", "Введите название модели техники");
    nameField.setColumns(30);
    nameField.setRequired(true);
    form.addComponent(nameField);

    codeField = new EditField("Код модели", "Введите кодовое название модели техники");
    codeField.setColumns(30);
    form.addComponent(codeField);

    return form;
}
项目:extacrm    文件:MotorBrandEditForm.java   
/** {@inheritDoc} */
@Override
protected ComponentContainer createEditFields() {
    final FormLayout form = new ExtaFormLayout();
    form.setSizeFull();

    nameField = new EditField("Название марки техники", "Введите название марки техники");
    nameField.setColumns(20);
    nameField.setRequired(true);
    form.addComponent(nameField);

    typesField = new MotorTypeObjMultiselect("Выпускаемая техника");
    form.addComponent(typesField);

    return form;
}
项目:extacrm    文件:MotorTypeEditForm.java   
/** {@inheritDoc} */
@Override
protected ComponentContainer createEditFields() {
    final FormLayout form = new ExtaFormLayout();
    form.setSizeFull();

    nameField = new EditField("Название типа техники", "Введите название типа техники");
    nameField.setColumns(20);
    nameField.setRequired(true);
    form.addComponent(nameField);

    brandsField = new MotorBrandObjMultiselect("Доступные бренды");
    form.addComponent(brandsField);

    return form;
}
项目:extacrm    文件:PolicyEditForm.java   
/** {@inheritDoc} */
@Override
protected ComponentContainer createEditFields() {
    final FormLayout form = new ExtaFormLayout();
    form.setSizeFull();

    regNumField = new EditField("Номер полиса", "Введите номер полиса.");
    regNumField.setColumns(20);
    regNumField.setRequired(true);
    form.addComponent(regNumField);

    bookTimeField = new DateTimeField("Полис забронирован", "Введите дату бронирования");
    bookTimeField.setWidth(15, Unit.EM);
    bookTimeField.setDateFormat("dd.MM.yyyy HH:mm:ss");
    form.addComponent(bookTimeField);

    issueDateField = new DateTimeField("Дата реализации", "Введите дату оформления полиса");
    issueDateField.setWidth(15, Unit.EM);
    form.addComponent(issueDateField);

    return form;
}
项目:touchkit    文件:NativeSelectInForm.java   
public NativeSelectInForm() {
    setDescription("NativeSelect in forms should work fine on Android");

    BeanItem<Bean> bi = new BeanItem<Bean>(new Bean());
    Form form = new Form();
    form.setCaption("Old deprecated form");
    form.setFormFieldFactory(new FormFieldFactory() {
        @Override
        public Field<?> createField(Item item, Object propertyId,
                Component uiContext) {
            return createNativeSelect();
        }
    });
    form.setItemDataSource(bi);
    form.setBuffered(false);
    addComponent(form);

    NativeSelect select = createNativeSelect();
    FormLayout layout = new FormLayout();
    layout.setCaption("New field group in a form layout");
    layout.addComponent(select);
    FieldGroup fg = new FieldGroup(bi);
    fg.bind(select, "aString");
    fg.setBuffered(false);
    addComponent(layout);
}
项目:PopupExtensionExample    文件:ViewWithPopup.java   
public ViewWithPopup(String title) {
    addComponent(new Label(title));

    button = new Button("Open Popup");
    PopupExtensionManualBundle bundle = PopupExtension.extendWithManualBundle(button);

    addComponent(bundle.getDataTransferComponent());

    final PopupExtension popupExtension = bundle.getPopupExtension();
    popupExtension.setOffset(100, 50);
    popupExtension.setDirection(Alignment.BOTTOM_RIGHT);

    FormLayout popupLayout = new FormLayout();
    popupLayout.setWidth("500px");
    popupLayout.addComponent(new Label("Problematic Combobox (press F5)"));
    popupLayout.addComponent(new ComboBox("POPUP CONTENT"));
    popupExtension.setContent(popupLayout);

    button.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            popupExtension.toggle();
        }
    });
    addComponent(button);
}
项目:easybinder    文件:BuildAndBindExample.java   
@Override
public Component getTestComponent() {
    AutoBinder<Flight> binder = new AutoBinder<>(Flight.class);

    FormLayout f = new FormLayout();
    f.addComponents(binder.buildAndBind("flightId"));

    Label statusLabel = new Label();
    binder.setStatusLabel(statusLabel);     
    f.addComponents(statusLabel);

    binder.setBean(new Flight());

    return f;
}
项目:esup-ecandidat    文件:AdresseForm.java   
/**
 * Crée une fenêtre d'édition d'adresse
 * @param fieldGroupAdresse l'adresse à éditer
 */
public AdresseForm(CustomBeanFieldGroup<Adresse> fieldGroupAdresse, Boolean withCedex) {
    setSpacing(true);
    setSizeFull();

    FormLayout formLayout = new FormLayout();
    formLayout.setWidth(100, Unit.PERCENTAGE);
    formLayout.setSpacing(true);
    for (String fieldName : FIELDS_ORDER) {
        if (withCedex || (!withCedex && !fieldName.equals(Adresse_.cedexAdr.getName()))){
            String caption = applicationContext.getMessage("adresse." + fieldName, null, UI.getCurrent().getLocale());
            Field<?> field;
            if (fieldName.equals(Adresse_.codBdiAdr.getName())){
                field = fieldGroupAdresse.buildAndBind(caption, fieldName,RequiredIntegerField.class);
                ((RequiredIntegerField)field).setNullRepresentation("");
                ((RequiredIntegerField)field).setMaxLength(5);
            }else{
                field = fieldGroupAdresse.buildAndBind(caption, fieldName);
            }
            field.setWidth(100, Unit.PERCENTAGE);
            formLayout.addComponent(field);
        }

    }


    initForm(fieldGroupAdresse);

    addComponent(formLayout);
}
项目:osc-core    文件:MaintenanceView.java   
private VerticalLayout createTab(String caption, String title, FormLayout content, String guid) {
    VerticalLayout tabSheet = new VerticalLayout();
    tabSheet.setCaption(caption);
    tabSheet.setStyleName(StyleConstants.TAB_SHEET);
    Panel panel = new Panel();
    // creating subHeader inside panel
    panel.setContent(content);
    panel.setSizeFull();
    tabSheet.addComponent(ViewUtil.createSubHeader(title, guid));
    tabSheet.addComponent(panel);
    return tabSheet;
}
项目:osc-core    文件:PluginView.java   
private VerticalLayout createComponent(String caption, String title, FormLayout content, String guid) {
    VerticalLayout tabSheet = new VerticalLayout();
    Panel panel = new Panel();
    // creating subHeader inside panel
    panel.setContent(content);
    panel.setSizeFull();
    tabSheet.addComponent(ViewUtil.createSubHeader(title, guid));
    tabSheet.addComponent(panel);
    return tabSheet;
}
项目:osc-core    文件:BaseVCWindow.java   
protected Panel providerPanel() {
    this.providerPanel = new Panel();
    this.providerPanel.setImmediate(true);
    this.providerPanel.setCaption(OPENSTACK_CAPTION);

    this.providerIP = new TextField("IP");
    this.providerIP.setImmediate(true);
    this.adminDomainId = new TextField("Admin Domain Id");
    this.adminDomainId.setImmediate(true);
    this.adminProjectName = new TextField("Admin Project Name");
    this.adminProjectName.setImmediate(true);
    this.providerUser = new TextField("User Name");
    this.providerUser.setImmediate(true);
    this.providerPW = new PasswordField("Password");
    this.providerPW.setImmediate(true);

    // adding not null constraint
    this.adminDomainId.setRequired(true);
    this.adminDomainId.setRequiredError(this.providerPanel.getCaption() + " Admin Domain Id cannot be empty");
    this.adminProjectName.setRequired(true);
    this.adminProjectName.setRequiredError(this.providerPanel.getCaption() + " Admin Project Name cannot be empty");
    this.providerIP.setRequired(true);
    this.providerIP.setRequiredError(this.providerPanel.getCaption() + " IP cannot be empty");
    this.providerUser.setRequired(true);
    this.providerUser.setRequiredError(this.providerPanel.getCaption() + " User Name cannot be empty");
    this.providerPW.setRequired(true);
    this.providerPW.setRequiredError(this.providerPanel.getCaption() + " Password cannot be empty");

    FormLayout providerFormPanel = new FormLayout();
    providerFormPanel.addComponent(this.providerIP);
    providerFormPanel.addComponent(this.adminDomainId);
    providerFormPanel.addComponent(this.adminProjectName);
    providerFormPanel.addComponent(this.providerUser);
    providerFormPanel.addComponent(this.providerPW);
    this.providerPanel.setContent(providerFormPanel);

    return this.providerPanel;
}
项目:osc-core    文件:WindowUtil.java   
/**
 *
 * 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;
}