Example usage for com.vaadin.ui.themes ValoTheme COMBOBOX_SMALL

List of usage examples for com.vaadin.ui.themes ValoTheme COMBOBOX_SMALL

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme COMBOBOX_SMALL.

Prototype

String COMBOBOX_SMALL

To view the source code for com.vaadin.ui.themes ValoTheme COMBOBOX_SMALL.

Click Source Link

Document

Small size combo box.

Usage

From source file:org.eclipse.hawkbit.ui.management.footer.MaintenanceWindowLayout.java

License:Open Source License

/**
 * Combo box to pick the time zone offset.
 *//*  w w  w . jav  a2  s . c o  m*/
private void createMaintenanceTimeZoneControl() {
    // ComboBoxBuilder cannot be used here, because Builder do
    // 'comboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);'
    // which interferes our code: 'timeZone.addItems(getAllTimeZones());'
    timeZone = new ComboBox();
    timeZone.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_TIME_ZONE_ID);
    timeZone.setCaption(i18n.getMessage("caption.maintenancewindow.timezone"));
    timeZone.addItems(getAllTimeZones());
    timeZone.setValue(getClientTimeZone());
    timeZone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    timeZone.setTextInputAllowed(false);
    timeZone.setNullSelectionAllowed(false);
}

From source file:org.jpos.qi.components.DateRangeComponent.java

License:Open Source License

private ComboBox createDateRanges() {
    ComboBox combo = new ComboBox(app.getMessage("or").toUpperCase());
    combo.setStyleName(ValoTheme.COMBOBOX_SMALL);
    combo.setEmptySelectionAllowed(false);
    combo.setItems((Object[]) DateRange.ranges);
    combo.setItemCaptionGenerator(range -> app.getMessage((String) range));
    combo.addValueChangeListener(event -> {
        if (event.getValue() != null) {
            datePickerFrom.setValue(null);
            datePickerTo.setValue(null);
            if (refreshBtn != null)
                refreshBtn.click();//  w w  w .  j  a  v a  2s.  c  o m
        }
    });
    return combo;
}

From source file:org.jpos.qi.eeuser.ConsumersView.java

License:Open Source License

private HorizontalLayout createUserPanel() {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setMargin(new MarginInfo(false, true, true, true));
    hl.setSpacing(true);// www. ja va2s. com
    userComboBox = createUserBox();
    userComboBox.setStyleName(ValoTheme.COMBOBOX_SMALL);
    userComboBox.addValueChangeListener(listener -> {
        ConfigurableFilterDataProvider wrapper = (ConfigurableFilterDataProvider) getGrid().getDataProvider();
        wrapper.setFilter(listener.getValue());
        this.selectedUser = listener.getValue();
        wrapper.refreshAll();
    });
    hl.addComponent(userComboBox);
    return hl;
}

From source file:views.AffiliationInput.java

License:Open Source License

public AffiliationInput(Set<String> institutes, List<String> faculties, Map<String, Integer> personMap) {
    setMargin(true);//from  w w w  . j a va  2 s.  c  o m

    this.personMap = personMap;

    groupName = new TextField("Group Name");
    groupName.setWidth("300px");
    addComponent(groupName);

    acronym = new TextField("Acronym");
    acronym.setWidth("300px");
    addComponent(Styles.questionize(acronym,
            "Short acronym of the lowest level of this affiliation, "
                    + "e.g. of the group if specified or of the institute if group field is left empty.",
            "Acronym"));

    organization = new TextField("Organization");
    organization.setWidth("300px");
    organization.setRequired(true);
    organization.setInputPrompt("...or university name");
    organization.setDescription("Organization or University Name");
    addComponent(organization);

    institute = new ComboBox("Institute", institutes);
    institute.setWidth("300px");
    institute.setNewItemsAllowed(true);
    institute.setStyleName(ValoTheme.COMBOBOX_SMALL);
    institute.setFilteringMode(FilteringMode.CONTAINS);
    // institute.setRequired(true);
    addComponent(Styles.questionize(institute, "Select existing institutes or input a new one.", "Institute"));

    faculty = new ComboBox("Faculty", faculties);
    faculty.setRequired(true);
    faculty.setStyleName(ValoTheme.COMBOBOX_SMALL);
    faculty.setWidth("300px");
    addComponent(Styles.questionize(faculty,
            "Faculty of the institute/affiliation. University affiliations like QBiC "
                    + "that are neither part of Medical nor Science Faculty belong to Central Units. "
                    + "For non-university affiliations select Other.",
            "Faculty"));

    contactPerson = new ComboBox("Contact Person", personMap.keySet());
    contactPerson.setWidth("300px");
    contactPerson.setFilteringMode(FilteringMode.CONTAINS);
    contactPerson.setStyleName(ValoTheme.COMBOBOX_SMALL);
    // contactPerson.setRequired(true);
    addComponent(
            Styles.questionize(contactPerson, "Main contact person of this affiliation.", "Contact Person"));

    head = new ComboBox("Head", personMap.keySet());
    head.setWidth("300px");
    head.setFilteringMode(FilteringMode.CONTAINS);
    // head.setRequired(true);
    head.setStyleName(ValoTheme.COMBOBOX_SMALL);
    addComponent(Styles.questionize(head, "Head of this affiliation.", "Head"));

    street = new TextField("Street");
    street.setWidth("300px");
    street.setRequired(true);
    addComponent(street);

    zipCode = new TextField("Zip Code");
    zipCode.setWidth("300px");
    zipCode.setRequired(true);
    addComponent(zipCode);

    city = new TextField("City");
    city.setWidth("300px");
    city.setRequired(true);
    addComponent(city);

    country = new TextField("Country");
    country.setWidth("300px");
    country.setRequired(true);
    addComponent(country);

    webpage = new TextField("Webpage");
    webpage.setWidth("300px");
    // TODO webpage formats are difficult
    // webpage.addValidator(
    // new RegexpValidator(Helpers.VALID_URL_REGEX, "This is not a valid web page format."));
    addComponent(webpage);

    commit = new Button("Register Affiliation");
    addComponent(commit);
}

From source file:views.AffiliationVIPTab.java

License:Open Source License

public AffiliationVIPTab(Map<String, Integer> persons, Map<String, Integer> affiliations,
        Map<Integer, Tuple> affiliationPeople) {

    this.affiliationMap = affiliations;
    this.personMap = persons;
    this.personAffiliationsInTable = affiliationPeople;

    affiTabOrgs = new ComboBox("Affiliation", affiliations.keySet());
    affiTabOrgs.setStyleName(ValoTheme.COMBOBOX_SMALL);
    affiTabOrgs.setFilteringMode(FilteringMode.CONTAINS);
    affiTabOrgs.addValueChangeListener(new ValueChangeListener() {

        @Override//from  ww  w  .  j  ava  2s .c om
        public void valueChange(ValueChangeEvent event) {
            Object val = affiTabOrgs.getValue();
            contact.setVisible(val != null);
            head.setVisible(val != null);
            if (val != null) {
                String affiName = val.toString();
                int id = affiliations.get(affiName);
                Tuple names = personAffiliationsInTable.get(id);
                contact.setValue(names.getOne());
                head.setValue(names.getTwo());
            }
        }
    });

    head = new ComboBox("Head", persons.keySet());
    head.setStyleName(ValoTheme.COMBOBOX_SMALL);
    head.setFilteringMode(FilteringMode.CONTAINS);
    head.setVisible(false);
    contact = new ComboBox("Contact Person", persons.keySet());
    contact.setStyleName(ValoTheme.COMBOBOX_SMALL);
    contact.setFilteringMode(FilteringMode.CONTAINS);
    contact.setVisible(false);
    ValueChangeListener personListener = new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean hasData = head.getValue() != null || contact.getValue() != null;
            commitAffiTabButton.setEnabled(hasData);
        }
    };
    head.addValueChangeListener(personListener);
    contact.addValueChangeListener(personListener);

    commitAffiTabButton = new Button("Save Contact");
    commitAffiTabButton.setEnabled(false);

    addComponent(affiTabOrgs);
    addComponent(head);
    addComponent(contact);
    commitAffiTabButton.setIcon(FontAwesome.SAVE);
    addComponent(Styles.questionize(commitAffiTabButton,
            "Add or change records to the selected people. "
                    + "Existing people can only be replaced by a new selection, empty selections are ignored.",
            "Save Changes"));
}

From source file:views.MultiAffiliationTab.java

License:Open Source License

public MultiAffiliationTab(Map<String, Integer> persons, Map<String, Integer> affiliations,
        List<String> roles) {
    // tabs = new TabSheet();
    // personTab = new FormLayout();
    setMargin(true);/*from w  w  w.j  ava  2  s  . c  o  m*/
    setSpacing(true);
    this.affiliationMap = affiliations;
    this.personMap = persons;
    this.availableRoles = roles;

    person = new ComboBox("Person", persons.keySet());
    person.setStyleName(ValoTheme.COMBOBOX_SMALL);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setNullSelectionAllowed(false);
    addComponent(person);
    organization = new ComboBox("Organization", affiliations.keySet());
    organization.setNullSelectionAllowed(false);
    organization.setStyleName(ValoTheme.COMBOBOX_SMALL);
    organization.setFilteringMode(FilteringMode.CONTAINS);
    addComponent(organization);

    addToTable = new Button("Add to Preview");
    addComponent(addToTable);
    addToTable.setEnabled(false);

    table = new Table();
    table.setWidthUndefined();
    // table.addContainerProperty("Title", String.class, null);
    // table.addContainerProperty("First Name", String.class, null);
    // table.addContainerProperty("Family Name", String.class, null);
    table.addContainerProperty("Affiliation", String.class, null);
    table.setColumnWidth("Affiliation", 250);
    table.addContainerProperty("Role", ComboBox.class, null);
    // table.addContainerProperty("Main Contact", CheckBox.class, null);
    table.addContainerProperty("Remove", Button.class, null);
    table.setImmediate(true);
    table.setVisible(false);
    addComponent(table);

    commit = new Button("Save Changes");
    addComponent(commit);
    // tabs.addTab(personTab, "Edit Person");

    // tabs.addTab(affiTab, "Edit Affiliation");
    // addComponent(tabs);
}

From source file:views.MultiAffiliationTab.java

License:Open Source License

public void addDataToTable(List<Person> personsWithAffiliations) {
    for (Person p : personsWithAffiliations) {
        // String title = p.getTitle();
        // String first = p.getFirst();
        // String last = p.getLast();
        Map<Integer, RoleAt> map = p.getAffiliationInfos();
        for (Integer i : p.getAffiliationInfos().keySet()) {
            personAffiliationsInTable.put(i, p);
            String affiliation = map.get(i).getAffiliation();
            String role = map.get(i).getRole();
            List<Object> row = new ArrayList<Object>();
            // row.add(title);
            // row.add(first);
            // row.add(last);
            row.add(affiliation);/*  w  w w.  j a  v  a2s  .  com*/
            ComboBox roleInput = new ComboBox("", availableRoles);
            roleInput.setStyleName(ValoTheme.COMBOBOX_SMALL);
            roleInput.setValue(role);
            row.add(roleInput);
            Button delete = new Button("Remove");
            row.add(delete);
            delete.setData(i);
            delete.addClickListener(new Button.ClickListener() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 5414693256990177472L;

                @Override
                public void buttonClick(ClickEvent event) {
                    Button b = event.getButton();
                    Integer iid = (Integer) b.getData();
                    table.removeItem(iid);
                    table.setPageLength(table.size());
                    personAffiliationsInTable.remove(iid);
                }
            });
            table.addItem(row.toArray(), i);
        }
    }
    table.setPageLength(table.size());
}

From source file:views.PersonInput.java

License:Open Source License

public PersonInput(List<String> titles, Map<String, Integer> affiliations, List<String> roles,
        AffiliationInput affiInput) {/* w  ww  .j  av  a2s . c  om*/
    left = new FormLayout();
    left.setMargin(true);

    affiliationMap = affiliations;
    this.affiInput = affiInput;
    this.affiInput.hideRegisterButton();
    this.affiInput.setVisible(false);

    userName = new TextField("Username");
    // userName.setRequired(true);
    userName.addValidator(new RegexpValidator(Helpers.VALID_USERNAME_REGEX, "Please input a valid username."));
    left.addComponent(Styles.questionize(userName,
            "University Tbingen user name or user name provided by QBiC. If left empty a dummy user name is chosen "
                    + "which cannot be used to log in until a real name is added. Person information can still be added to "
                    + "projects or experiments in that case.",
            "User Name"));

    title = new ComboBox("Title", titles);
    title.setRequired(true);
    title.setStyleName(ValoTheme.COMBOBOX_SMALL);
    title.setNullSelectionAllowed(false);
    left.addComponent(title);

    first = new TextField("First Name");
    first.setRequired(true);
    first.addValidator(new RegexpValidator(Helpers.VALID_NAME_REGEX, "Please input a valid name."));
    left.addComponent(first);

    last = new TextField("Last Name");
    last.setRequired(true);
    last.addValidator(new RegexpValidator(Helpers.VALID_NAME_REGEX, "Please input a valid name."));
    left.addComponent(last);

    eMail = new TextField("E-Mail");
    eMail.setRequired(true);
    eMail.addValidator(
            new RegexpValidator(Helpers.VALID_EMAIL_ADDRESS_REGEX, "Please input a valid e-mail address."));
    left.addComponent(eMail);

    phone = new TextField("Phone");
    left.addComponent(phone);

    affiliation = new ComboBox("Affiliation", affiliations.keySet());
    // affiliation.setNullSelectionAllowed(false);
    affiliation.setRequired(true);
    affiliation.setFilteringMode(FilteringMode.CONTAINS);
    affiliation.setStyleName(ValoTheme.COMBOBOX_SMALL);
    left.addComponent(Styles.questionize(affiliation,
            "Work group or organization this person is part of. If it does not exist in the system "
                    + "a \"New Affiliation\" has to be created first. Additional Affiliations and roles can be set in the next Tab.",
            "Affiliation"));

    newAffiliation = new CheckBox("New Affiliation");
    left.addComponent(newAffiliation);
    newAffiliation.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            enableAffiliationInput(newAffiliation.getValue());
            affiliation.select(affiliation.getNullSelectionItemId());
            affiliation.setEnabled(!newAffiliation.getValue());
        }
    });

    role = new ComboBox("Role", roles);
    role.setRequired(true);
    role.setStyleName(ValoTheme.COMBOBOX_SMALL);
    role.setNullSelectionAllowed(false);
    left.addComponent(role);

    commit = new Button("Save New User");
    left.addComponent(commit);

    addComponent(left);
    addComponent(affiInput);
}