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:org.hip.vif.admin.member.ui.SelectMemberLookup.java

License:Open Source License

/** View constructor.
 *
 * @param inSubtitle String/*from   w w  w  .j a v  a  2s  .c  o m*/
 * @param inRightColumnTitle String
 * @param inMembers {@link MemberBeanContainer} the available members to select from
 * @param inAdmins {@link Collection} the collection of members already selected (must be a subset of
 *            <code>inMembers</code>)
 * @param inTask {@link AbstrachtMemberLookupTask} */
public SelectMemberLookup(final String inSubtitle, final String inRightColumnTitle,
        final MemberBeanContainer inMembers, final Collection<MemberBean> inAdmins,
        final AbstrachtMemberLookupTask inTask) {
    final VerticalLayout lLayout = new VerticalLayout();
    setCompositionRoot(lLayout);

    final IMessages lMessages = Activator.getMessages();
    lLayout.setStyleName("vif-view"); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$
            lMessages.getMessage("ui.member.lookup.title.page")), ContentMode.HTML)); //$NON-NLS-1$
    lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-description", inSubtitle), //$NON-NLS-1$
            ContentMode.HTML));

    final TwinColSelect lSelect = new TwinColSelect();
    lSelect.setContainerDataSource(inMembers);
    lSelect.setValue(inAdmins);

    lSelect.setLeftColumnCaption(lMessages.getMessage("ui.member.lookup.available")); //$NON-NLS-1$
    lSelect.setRightColumnCaption(inRightColumnTitle); //$NON-NLS-1$

    lSelect.setWidth(650, Unit.PIXELS);
    lSelect.setRows(19);
    lSelect.setImmediate(true);
    lLayout.addComponent(lSelect);
    lLayout.addComponent(RiplaViewHelper.createSpacer());

    final Button lSave = new Button(lMessages.getMessage("ui.member.button.save")); //$NON-NLS-1$
    lSave.addClickListener(new Button.ClickListener() {
        @Override
        @SuppressWarnings("unchecked")
        public void buttonClick(final ClickEvent inEvent) {
            if (!inTask.selectMembers((Collection<MemberBean>) lSelect.getValue())) {
                Notification.show(lMessages.getMessage("ui.member.lookup.error.msg"), Type.WARNING_MESSAGE); //$NON-NLS-1$
            }
        }
    });
    lLayout.addComponent(lSave);
}

From source file:org.jumpmind.metl.ui.views.admin.GroupEditPanel.java

License:Open Source License

public GroupEditPanel(ApplicationContext context, Group group) {
    this.context = context;
    this.group = group;

    FormLayout layout = new FormLayout();

    TextField nameField = new TextField("Group Name", StringUtils.trimToEmpty(group.getName()));
    nameField.addValueChangeListener(new NameChangeListener());
    layout.addComponent(nameField);// ww w  . j a v  a2 s .  c  om
    nameField.focus();

    CheckBox readOnly = new CheckBox("Read Only");
    readOnly.setImmediate(true);
    readOnly.setValue(group.isReadOnly());
    readOnly.addValueChangeListener(new ReadOnlyChangeListener());
    layout.addComponent(readOnly);

    TwinColSelect privSelect = new TwinColSelect();
    for (Privilege priv : Privilege.values()) {
        privSelect.addItem(priv.name());
    }
    lastPrivs = new HashSet<String>();
    for (GroupPrivilege groupPriv : group.getGroupPrivileges()) {
        lastPrivs.add(groupPriv.getName());
    }
    privSelect.setValue(lastPrivs);
    privSelect.setRows(20);
    privSelect.setNullSelectionAllowed(true);
    privSelect.setMultiSelect(true);
    privSelect.setImmediate(true);
    privSelect.setLeftColumnCaption("Available privileges");
    privSelect.setRightColumnCaption("Selected privileges");
    privSelect.addValueChangeListener(new PrivilegeChangeListener());
    layout.addComponent(privSelect);

    addComponent(layout);
    setMargin(true);
}

From source file:org.jumpmind.metl.ui.views.admin.UserEditPanel.java

License:Open Source License

public UserEditPanel(ApplicationContext context, User user) {
    this.context = context;
    this.user = user;

    FormLayout form = new FormLayout();
    form.setSpacing(true);/*w  w  w . j a v  a2s  .  c  om*/

    TextField loginField = new TextField("Login ID", StringUtils.trimToEmpty(user.getLoginId()));
    form.addComponent(loginField);
    loginField.addValueChangeListener(new LoginChangeListener());
    loginField.focus();

    TextField nameField = new TextField("Full Name", StringUtils.trimToEmpty(user.getName()));
    nameField.addValueChangeListener(new NameChangeListener());
    form.addComponent(nameField);

    PasswordField passwordField = new PasswordField("Password", NOCHANGE);
    passwordField.addValueChangeListener(new PasswordChangeListener());
    form.addComponent(passwordField);

    List<Group> groups = context.getConfigurationService().findGroups();
    groupsById = new HashMap<String, Group>();
    TwinColSelect groupSelect = new TwinColSelect();
    for (Group group : groups) {
        groupSelect.addItem(group.getId());
        groupSelect.setItemCaption(group.getId(), group.getName());
        groupsById.put(group.getId(), group);
    }
    lastGroups = new HashSet<String>();
    for (Group group : user.getGroups()) {
        lastGroups.add(group.getId());
    }
    groupSelect.setValue(lastGroups);
    groupSelect.setRows(20);
    groupSelect.setNullSelectionAllowed(true);
    groupSelect.setMultiSelect(true);
    groupSelect.setImmediate(true);
    groupSelect.setLeftColumnCaption("Available groups");
    groupSelect.setRightColumnCaption("Selected groups");
    groupSelect.addValueChangeListener(new GroupChangeListener());
    form.addComponent(groupSelect);

    addComponent(form);
    setMargin(true);
}

From source file:ru.codeinside.adm.ui.TreeTableOrganization.java

License:Mozilla Public License

void createGroupEditor(final long id, final Set<String> names) {
    final Organization org = AdminServiceProvider.get().findOrganizationById(id);
    final Set<String> all = AdminServiceProvider.get().getOrgGroupNames();

    final VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);/*from w ww . j  ava2 s. c o  m*/

    final TwinColSelect twin = new TwinColSelect();
    twin.setSizeFull();
    twin.setNullSelectionAllowed(true);
    twin.setLeftColumnCaption("?");
    twin.setRightColumnCaption(" ? " + org.getName());
    twin.setImmediate(true);
    for (final String name : all) {
        twin.addItem(name);
        if (names.contains(name)) {
            twin.select(name);
        }
    }
    layout.addComponent(twin);

    final HorizontalLayout h = new HorizontalLayout();
    h.setSpacing(true);
    Button cancel = new Button("", new Button.ClickListener() {

        private static final long serialVersionUID = -2885182304929510066L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            showOrganization(id);
        }
    });
    cancel.setClickShortcut(KeyCode.ESCAPE, 0);

    Button ok = new Button("", new Button.ClickListener() {

        private static final long serialVersionUID = -3182280627040233669L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            AdminServiceProvider.get().setOrgGroupNames(id,
                    new TreeSet<String>((Collection<String>) twin.getValue()));
            showOrganization(id);
        }
    });
    ok.setClickShortcut(KeyCode.O, ModifierKey.CTRL);

    h.addComponent(ok);
    h.addComponent(cancel);

    layout.addComponent(h);
    layout.setSizeFull();
    panel.removeAllComponents();
    panel.addComponent(layout);
    twin.focus();
}