Example usage for com.vaadin.ui HorizontalLayout setVisible

List of usage examples for com.vaadin.ui HorizontalLayout setVisible

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setVisible.

Prototype

@Override
    public void setVisible(boolean visible) 

Source Link

Usage

From source file:pt.ist.vaadinframework.ui.PaginatedSorterViewer.java

License:Open Source License

public void setFilter(Alignment position, Object[] filterIds, String[] filterLabels) {
    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);/*from  ww w  . j  a v a  2 s.co  m*/
    if (filterIds.length > 0) {
        controls.setVisible(true);
        controls.addComponent(new Label(VaadinResources.getString(COMMONS_FILTERBY_LABEL) + ":"));
        for (int i = 0; i < filterIds.length; i++) {
            controls.addComponent(new FilterControl(filterIds[i], filterLabels[i]));
        }
    } else {
        controls.removeAllComponents();
        controls.setVisible(false);
    }
    addControls(controls, position);
}

From source file:ru.codeinside.adm.ui.employee.TableEmployee.java

License:Mozilla Public License

public static void setRolesEnabled(OptionGroup optionGroup, Component certificateBlock,
        Component executorGroups, HorizontalLayout supervisorGroupsEmp, HorizontalLayout supervisorGroupsOrg) {

    Set<Role> roles = (Set) optionGroup.getValue();
    Boolean e = roles.isEmpty();// w ww. j av  a 2 s  .com
    Boolean c = roles.contains(Role.Administrator);
    for (Object role : optionGroup.getItemIds()) {
        if (role == Role.Administrator) {
            optionGroup.setItemEnabled(role, e || c);
        } else {
            optionGroup.setItemEnabled(role, e || !c);
        }
    }
    certificateBlock.setVisible(roles.contains(Role.Executor) || roles.contains(Role.Declarant)
            || roles.contains(Role.Supervisor) || roles.contains(Role.SuperSupervisor));
    executorGroups.setVisible(roles.contains(Role.Executor));
    supervisorGroupsEmp.setVisible(roles.contains(Role.Supervisor));
    supervisorGroupsOrg.setVisible(roles.contains(Role.Supervisor));
}

From source file:uicomponents.TechChooser.java

License:Open Source License

/**
 * Creates a new condition chooser component
 * //from   w  ww. j  a  v  a2 s . com
 * @param options List of different possible conditions
 * @param other Name of the "other" condition, which when selected will enable an input field for
 *        free text
 * @param special Name of a "special" condition like species for the entity input, which when
 *        selected will disable the normal species input because there is more than one instance
 * @param nullSelectionAllowed true, if the conditions may be empty
 */
public TechChooser(List<String> options, Set<String> persons) {
    chooser = new ComboBox("Analyte", options);
    chooser.setStyleName(Styles.boxTheme);

    replicates = new OpenbisInfoTextField("Replicates", "", "50px", "1");
    pool = new CheckBox("Pool/Multiplex Samples");
    setSpacing(true);
    helpers = new ArrayList<HorizontalLayout>();
    HorizontalLayout help1 = Styles.questionize(chooser, "Choose the analyte that is measured.", "Analytes");
    addComponent(help1);
    HorizontalLayout help2 = Styles.questionize(replicates.getInnerComponent(),
            "Number of prepared replicates (1 means no replicates) of this analyte", "Replicates");
    addComponent(help2);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Contact Person");
    person = new ComboBox();
    person.addItems(persons);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setStyleName(Styles.boxTheme);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(person);
    persBoxH.addComponent(reloadPeople);

    HorizontalLayout help3 = Styles.questionize(persBoxH, "Person responsible for this part of the experiment",
            "Contact Person");
    addComponent(help3);
    HorizontalLayout help4 = Styles.questionize(pool,
            "Select if multiple samples are pooled into a single " + "sample before measurement.", "Pooling");

    chooser.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (chooser.getValue() != null) {
                help4.setVisible(!chooser.getValue().equals("PROTEINS"));
            }
        }
    });

    addComponent(help4);
    helpers.add(help1);
    helpers.add(help2);
    helpers.add(help3);
    helpers.add(help4);
}