Example usage for com.vaadin.ui TwinColSelect setLeftColumnCaption

List of usage examples for com.vaadin.ui TwinColSelect setLeftColumnCaption

Introduction

In this page you can find the example usage for com.vaadin.ui TwinColSelect setLeftColumnCaption.

Prototype

public void setLeftColumnCaption(String leftColumnCaption) 

Source Link

Document

Sets the text shown above the left column.

Usage

From source file:com.arcusys.liferay.vaadinplugin.ui.AdditionalDependenciesWindow.java

License:Apache License

private TwinColSelect createDependenciesSelector() {
    TwinColSelect dependenciesSelector = new TwinColSelect(null, dependencyContainer);
    dependenciesSelector.setImmediate(true);
    dependenciesSelector.setMultiSelect(true);
    dependenciesSelector.setSizeFull();/*  w  ww .  j a  va  2s .  co m*/
    dependenciesSelector.setLeftColumnCaption("Available");
    dependenciesSelector.setRightColumnCaption("Included");
    return dependenciesSelector;
}

From source file:com.cavisson.gui.dashboard.components.controls.NativeSelects.java

License:Apache License

public NativeSelects() {
    setMargin(true);/*from w w w  .ja v  a  2  s.  c  om*/

    Label h1 = new Label("Selects");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    NativeSelect select = new NativeSelect("Drop Down Select");
    row.addComponent(select);

    ListSelect list = new ListSelect("List Select");
    list.setNewItemsAllowed(true);
    row.addComponent(list);

    TwinColSelect tcs = new TwinColSelect("TwinCol Select");
    tcs.setLeftColumnCaption("Left Column");
    tcs.setRightColumnCaption("Right Column");
    tcs.setNewItemsAllowed(true);
    row.addComponent(tcs);

    TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select");
    tcs2.setLeftColumnCaption("Left Column");
    tcs2.setRightColumnCaption("Right Column");
    tcs2.setNewItemsAllowed(true);
    tcs2.setWidth("280px");
    tcs2.setHeight("200px");
    row.addComponent(tcs2);

    for (int i = 1; i <= 10; i++) {
        select.addItem("Option " + i);
        list.addItem("Option " + i);
        tcs.addItem("Option " + i);
        tcs2.addItem("Option " + i);
    }
}

From source file:com.kpg.diary.ui.NativeSelects.java

License:Apache License

public NativeSelects() {
    setMargin(true);/*w ww  .j  a  va  2s .c  o m*/

    Label h1 = new Label("Selects");
    h1.addStyleName(ValoTheme.LABEL_H2);
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    row.setSpacing(true);
    addComponent(row);

    NativeSelect select = new NativeSelect("Drop Down Select");
    row.addComponent(select);

    ListSelect list = new ListSelect("List Select");
    list.setNewItemsAllowed(true);
    row.addComponent(list);

    TwinColSelect tcs = new TwinColSelect("TwinCol Select");
    tcs.setLeftColumnCaption("Left Column");
    tcs.setRightColumnCaption("Right Column");
    tcs.setNewItemsAllowed(true);
    row.addComponent(tcs);

    TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select");
    tcs2.setLeftColumnCaption("Left Column");
    tcs2.setRightColumnCaption("Right Column");
    tcs2.setNewItemsAllowed(true);
    tcs2.setWidth("280px");
    tcs2.setHeight("200px");
    row.addComponent(tcs2);

    for (int i = 1; i <= 10; i++) {
        select.addItem("Option " + i);
        list.addItem("Option " + i);
        tcs.addItem("Option " + i);
        tcs2.addItem("Option " + i);
    }
}

From source file:com.tenforce.lodms.extractors.views.CkanExtractFieldFactory.java

@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
    if ("baseUri".equals(propertyId)) {
        TextField uriField = new TextField("CKAN Url");
        uriField.setRequired(true);//  w  ww .j a v a  2  s.  c o  m
        uriField.setRequiredError("CKAN Url is required!");
        uriField.setWidth(350, VerticalLayout.UNITS_PIXELS);
        uriField.setDescription("Base url of the ckan portal.");
        uriField.setImmediate(true);
        uriField.addValidator(new AbstractStringValidator(null) {
            @Override
            protected boolean isValidString(String value) {
                try {
                    new URIImpl(value);
                    return true;
                } catch (Exception ex) {
                    setErrorMessage("Invalid CKAN Url: " + ex.getMessage());
                    return false;
                }
            }
        });
        return uriField;

    } else if ("httpMethod".equals(propertyId)) {
        Select selector = new Select("Http Method");
        selector.addItem(HttpMethod.GET);
        selector.addItem(HttpMethod.POST);
        return selector;
    } else if ("publisher".equals(propertyId)) {
        Field field = super.createField(item, propertyId, uiContext);
        field.setDescription("The foaf:agent responsible for this catalog.");
        field.setRequired(true);
        return field;
    } else if ("title".equals(propertyId)) {
        Field field = super.createField(item, propertyId, uiContext);
        field.setDescription("Title for this catalog.");
        field.setRequired(true);
        return field;

    } else if ("license".equals(propertyId)) {
        Field field = super.createField(item, propertyId, uiContext);
        field.setDescription("license for this catalog.");
        field.setRequired(true);
        return field;

    } else if ("description".equals(propertyId)) {
        Field field = super.createField(item, propertyId, uiContext);
        field.setDescription("Description for this catalog.");
        field.setWidth(350, VerticalLayout.UNITS_PIXELS);
        field.setRequired(true);
        return field;

    } else if ("ignoredKeys".equals(propertyId)) {
        Field field = super.createField(item, propertyId, uiContext);
        field.setDescription(
                "A comma seperated list of attributes in the metadata that should be ignored by the extractor.");
        return field;

    } else if ("subjectPrefix".equals(propertyId)) {
        TextField subjectField = new TextField("Subject Prefix");
        subjectField.setRequired(true);
        subjectField.setDescription("This prefix will be used to generate the subject url.");
        subjectField.setRequiredError("Subject Prefix is required!");
        subjectField.setWidth(350, VerticalLayout.UNITS_PIXELS);
        return subjectField;
    } else if ("predicatePrefix".equals(propertyId)) {
        TextField predicateField = new TextField("Predicate Prefix");
        predicateField.setRequired(true);
        predicateField.setDescription(
                "All json attributes will be prefixed with this string to generate a predicate.");
        predicateField.setRequiredError("Predicate Prefix is required!");
        predicateField.setWidth(350, VerticalLayout.UNITS_PIXELS);
        return predicateField;
    } else if ("packageIds".equals(propertyId)) {
        TwinColSelect select = new TwinColSelect("Select catalog records to harvest");
        select.setLeftColumnCaption("Available records");
        select.setRightColumnCaption("Selected records");
        select.setRows(20);
        select.setWidth(500, VerticalLayout.UNITS_PIXELS);
        return select;
    } else if ("allDatasets".equals(propertyId)) {
        CheckBox box = new CheckBox("harvest all datasets");
        box.setImmediate(true);
        return box;
    }

    return super.createField(item, propertyId, uiContext);
}

From source file:de.kaiserpfalzEdv.vaadin.LayoutHelper.java

License:Apache License

public <T> TwinColSelect createJpaTwinColSelect(final EntityManager em, final Class<?> clasz,
        final String displayColumn, final String caption, final String captionLeft, final String captionRight,
        final int tabIndex, final int startColumn, final int startRow, final int endColumn, final int endRow) {
    JPAContainer<T> data = createJpaContainer(em, clasz, displayColumn);

    TwinColSelect result = new TwinColSelect(i18n.get(caption), data);
    result.setLeftColumnCaption(i18n.get(captionLeft));
    result.setRightColumnCaption(i18n.get(captionRight));
    result.setMultiSelect(true);//from  w w  w . j  av  a 2 s  .co  m
    result.setRows(2);
    result.setItemCaptionPropertyId(displayColumn);
    result.setConverter(new SingleSelectConverter<T>(result));

    addToLayout(result, tabIndex, startColumn, startRow, endColumn, endRow);
    return result;
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java

License:Apache License

protected TwinColSelect createTwinColListSelect(final String i18nBase, final String displayColumn,
        final int rows, final int tabIndex, final Class<? extends BaseEntity> clasz) {
    JPAContainer container = presenter.getContainer(clasz);
    container.getEntityProvider().setLazyLoadingDelegate(null);

    TwinColSelect result = new TwinColSelect(presenter.translate(i18nBase), container);

    result.setTabIndex(tabIndex);/*from   ww  w  .ja v  a 2s.c  o  m*/
    result.setLeftColumnCaption(presenter.translate(i18nBase + ".available"));
    result.setRightColumnCaption(presenter.translate(i18nBase + ".assigned"));
    result.setWidth(100f, PERCENTAGE);
    result.setBuffered(true);
    result.setMultiSelect(true);
    result.setRows(rows);
    result.setItemCaptionPropertyId(displayColumn);
    result.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    result.setConverter(new MultiSelectListEntityConverter(result));

    result.addValueChangeListener(
            event -> LOG.trace("'{}' changed: {}", i18nBase, event.getProperty().getValue()));

    return result;
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java

License:Apache License

protected TwinColSelect createTwinColSelect(final String i18nBase, final String displayColumn, final int rows,
        final int tabIndex, final Class<? extends BaseEntity> clasz) {
    JPAContainer container = presenter.getContainer(clasz);
    container.getEntityProvider().setLazyLoadingDelegate(null);

    TwinColSelect result = new TwinColSelect(presenter.translate(i18nBase), container);

    result.setTabIndex(tabIndex);//from   w  w w . j ava2s. c  o  m
    result.setLeftColumnCaption(presenter.translate(i18nBase + ".available"));
    result.setRightColumnCaption(presenter.translate(i18nBase + ".assigned"));
    result.setWidth(100f, PERCENTAGE);
    result.setBuffered(true);
    result.setMultiSelect(true);
    result.setRows(rows);
    result.setItemCaptionPropertyId(displayColumn);
    result.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    result.setConverter(new MultiSelectSetEntityConverter(result));

    result.addValueChangeListener(
            event -> LOG.trace("'{}' changed: {}", i18nBase, event.getProperty().getValue()));

    return result;
}

From source file:io.subutai.plugin.accumulo.ui.wizard.ConfigurationStep.java

public static TwinColSelect getTwinSelect(String title, String captionProperty, String leftTitle,
        String rightTitle, int rows) {
    TwinColSelect twinColSelect = new TwinColSelect(title);
    twinColSelect.setItemCaptionPropertyId(captionProperty);
    twinColSelect.setRows(rows);//w  ww.j  a v a2s.c om
    twinColSelect.setMultiSelect(true);
    twinColSelect.setImmediate(true);
    twinColSelect.setLeftColumnCaption(leftTitle);
    twinColSelect.setRightColumnCaption(rightTitle);
    twinColSelect.setWidth(100, Sizeable.Unit.PERCENTAGE);
    twinColSelect.setRequired(true);
    return twinColSelect;
}

From source file:life.qbic.components.OfferGeneratorTab.java

License:Open Source License

/**
 * creates the tab to generate the offers with the respective packages
 * @return vaadin component holding the offer generator
 *//*  w ww  . j  a  v  a2  s . co m*/
static Component createOfferGeneratorTab() {

    Database db = qOfferManager.getDb();
    TabSheet managerTabs = qOfferManager.getManagerTabs();

    ComboBox selectedProjectComboBox = new ComboBox("Select Project");
    selectedProjectComboBox.setInputPrompt("No project selected!");
    selectedProjectComboBox.setDescription("Please select a project before its too late! :P");
    selectedProjectComboBox.addItems(db.getProjects());
    selectedProjectComboBox.setWidth("300px");

    Button completeButton = new Button("Complete");
    completeButton.setDescription("Click here to finalize the offer and save it into the DB!");
    completeButton.setIcon(FontAwesome.CHECK_CIRCLE);
    completeButton.setEnabled(false);

    // get the package ids and names as a bean container
    final BeanItemContainer<String> packageIdsAndNamesContainer = new BeanItemContainer<>(String.class);
    packageIdsAndNamesContainer.addAll(db.getPackageIdsAndNames());

    TwinColSelect selectPackagesTwinColSelect = new TwinColSelect();
    selectPackagesTwinColSelect.setContainerDataSource(packageIdsAndNamesContainer);
    selectPackagesTwinColSelect.setLeftColumnCaption("Available packages");
    selectPackagesTwinColSelect.setRightColumnCaption("Selected packages");
    selectPackagesTwinColSelect.setSizeFull();

    // text field which functions as a filter for the left side of the twin column select
    TextField twinColSelectFilter = new TextField();
    twinColSelectFilter.setCaption("Filter available packages");
    twinColSelectFilter.addTextChangeListener((FieldEvents.TextChangeListener) event -> {
        packageIdsAndNamesContainer.removeAllContainerFilters();
        packageIdsAndNamesContainer.addContainerFilter(new Container.Filter() {

            @Override
            public boolean passesFilter(Object itemId, Item item) throws UnsupportedOperationException {
                return ((String) itemId).toLowerCase().contains(event.getText().toLowerCase())
                        || ((Collection) selectPackagesTwinColSelect.getValue()).contains(itemId);
            }

            @Override
            public boolean appliesToProperty(Object propertyId) {
                return true;
            }
        });
    });

    VerticalLayout right = new VerticalLayout();
    right.setSpacing(true);
    right.setMargin(true);

    VerticalLayout addPackLayout = new VerticalLayout();
    addPackLayout.setMargin(true);
    addPackLayout.setSpacing(true);

    Panel packageDescriptionPanel = new Panel("Package Details");
    packageDescriptionPanel.setContent(right);

    @SuppressWarnings("deprecation")
    Label packageDetailsLabel = new Label("Package details will appear here!", Label.CONTENT_XHTML);
    packageDetailsLabel.addStyleName(ValoTheme.LABEL_BOLD);
    right.addComponent(packageDetailsLabel);

    addListeners(db, managerTabs, selectedProjectComboBox, completeButton, addPackLayout,
            selectPackagesTwinColSelect, packageDescriptionPanel, packageDetailsLabel, twinColSelectFilter);

    addPackLayout.addComponent(selectedProjectComboBox);

    return addPackLayout;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.UserComponent.java

License:Apache License

private Component getProjectRoleManager() {
    VerticalLayout vl = new VerticalLayout();
    ProjectTreeComponent tree = new ProjectTreeComponentBuilder().setShowRequirement(false)
            .setShowTestCase(false).setShowExecution(false).createProjectTreeComponent();
    vl.addComponent(tree);/* ww w . j  a v  a2 s  .c  om*/
    TwinColSelect roles = new TwinColSelect(TRANSLATOR.translate("general.role"));
    tree.addValueChangeListener((Property.ValueChangeEvent event) -> {
        Project selected = (Project) tree.getValue();
        if (user.getUserHasRoleList() == null) {
            user.setUserHasRoleList(new ArrayList<>());
        }
        if (selected != null) {
            HashSet<Role> values = new HashSet<>();
            user.getUserHasRoleList().forEach(uhr -> {
                if (uhr.getProjectId() != null
                        && Objects.equals(uhr.getProjectId().getId(), selected.getId())) {
                    values.add(uhr.getRole());
                }
            });
            roles.setValue(values);
        }
    });
    List<Role> list = new RoleJpaController(DataBaseManager.getEntityManagerFactory()).findRoleEntities();
    Collections.sort(list, (Role r1, Role r2) -> TRANSLATOR.translate(r1.getRoleName())
            .compareTo(TRANSLATOR.translate(r2.getRoleName())));
    BeanItemContainer<Role> roleContainer = new BeanItemContainer<>(Role.class, list);
    roles.setContainerDataSource(roleContainer);
    roles.setRows(5);
    roles.setLeftColumnCaption(TRANSLATOR.translate("available.roles"));
    roles.setRightColumnCaption(TRANSLATOR.translate("current.roles"));
    list.forEach(r -> {
        roles.setItemCaption(r, TRANSLATOR.translate(r.getDescription()));
    });
    roles.addValueChangeListener(event -> {
        Set<Role> selected = (Set<Role>) event.getProperty().getValue();
        UserHasRoleJpaController c = new UserHasRoleJpaController(DataBaseManager.getEntityManagerFactory());
        ProjectServer ps = new ProjectServer((Project) tree.getValue());
        if (ps.getUserHasRoleList().isEmpty()) {
            ps.setUserHasRoleList(new ArrayList<>());
        }
        selected.forEach(r -> {
            //Look for the existing ones
            boolean found = false;
            for (UserHasRole uhr : ps.getUserHasRoleList()) {
                if (Objects.equals(uhr.getVmUser().getId(), user.getId())
                        && Objects.equals(uhr.getRole().getId(), r.getId())) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                try {
                    //Create a new one
                    UserHasRole uhr = new UserHasRole();
                    uhr.setProjectId(ps.getEntity());
                    uhr.setRole(r);
                    uhr.setVmUser(user.getEntity());
                    c.create(uhr);
                    user.update();
                } catch (Exception ex) {
                    LOG.log(Level.SEVERE, null, ex);
                }
            }
        });
    });
    vl.addComponent(roles);
    return vl;
}