Example usage for com.vaadin.ui CheckBox CheckBox

List of usage examples for com.vaadin.ui CheckBox CheckBox

Introduction

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

Prototype

public CheckBox() 

Source Link

Document

Creates a new checkbox.

Usage

From source file:org.eclipse.hawkbit.ui.distributions.smtable.SwMetadataPopupLayout.java

License:Open Source License

private CheckBox createTargetVisibleField() {
    final CheckBox checkBox = new CheckBox();
    checkBox.setId(UIComponentIdProvider.METADATA_TARGET_VISIBLE_ID);
    checkBox.setCaption(i18n.getMessage("metadata.targetvisible"));
    checkBox.addValueChangeListener(this::onCheckBoxChange);

    return checkBox;
}

From source file:org.geant.sat.ui.SurveyViewer.java

License:BSD License

/**
 * Generates checkbox.//from w  ww .j a va2  s. com
 * 
 * @param details
 *            of the user
 * @return checkbox representing the state
 */
private Component getActiveCB(SurveyDetails details) {
    CheckBox cb = new CheckBox();
    cb.setValue(details.getActive());
    cb.addValueChangeListener(clickEvent -> {
        details.setActive(!details.getActive());
        verifySuccess(getMainUI().getSatApiClient().updateSurvey(details));
    });
    return cb;
}

From source file:org.geant.sat.ui.UserListViewer.java

License:BSD License

/**
 * Generates checkbox representing admin role information.
 * //from  www .  ja v a2  s.c o  m
 * @param details
 *            of the user
 * @return checkbox representing the admin role
 */
private Component getAdminCB(UserDetails details) {
    CheckBox cb = new CheckBox();
    cb.setValue(getMainUI().getRole().isAdmin(details));
    cb.setEnabled(false);
    return cb;
}

From source file:org.geant.sat.ui.UserListViewer.java

License:BSD License

/**
 * Generates checkbox representing assessment coordinator role information.
 * //from  w w w  .jav  a 2 s  .c  o  m
 * @param details
 *            of the user
 * @return checkbox representing the assessment coordinator role
 */
private Component getAssessmentCoordinatorCB(UserDetails details) {
    CheckBox cb = new CheckBox();
    cb.setValue(getMainUI().getRole().isAssessmentCoordinator(details));
    if (details.getPrincipalId() == null) {
        cb.setEnabled(false);
        return cb;
    }
    cb.addValueChangeListener(clickEvent -> {
        if (getMainUI().getRole().isAssessmentCoordinator(details)) {
            LOG.debug("removing role " + getMainUI().getRole().getAssessmentCoordinatorRoleName());
            details.getRoles().remove(getMainUI().getRole().getAssessmentCoordinatorRoleName());
        } else {
            LOG.debug("Adding role " + getMainUI().getRole().getAssessmentCoordinatorRoleName());
            details.getRoles().add(getMainUI().getRole().getAssessmentCoordinatorRoleName());
        }
        verifySuccess(getMainUI().getSatApiClient().updateUser(details));
    });
    return cb;
}

From source file:org.geant.sat.ui.UserListViewer.java

License:BSD License

/**
 * Generates checkbox representing survey owner role information.
 * //from   w  w w.j  a  v  a2s .com
 * @param details
 *            of the user
 * @return checkbox representing the survey owner role
 */
private Component getSurveyOwnerCB(UserDetails details) {
    CheckBox cb = new CheckBox();
    cb.setValue(getMainUI().getRole().isSurveyOwner(details));
    cb.setEnabled(false);
    return cb;
}

From source file:org.generationcp.breeding.manager.crossingmanager.AdditionalDetailsCrossNameComponent.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*from w ww .j  a va  2  s . c  o m*/
public void afterPropertiesSet() throws Exception {
    setHeight("200px");
    setWidth("700px");

    crossNameOptionGroup = new OptionGroup();
    sequenceNumCheckBox = new CheckBox();
    sequenceNumCheckBox.setImmediate(true);
    sequenceNumCheckBox.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            enableSpecifyLeadingZerosComponents(sequenceNumCheckBox.booleanValue());
        }
    });

    specifyPrefixLabel = new Label();
    prefixTextField = new TextField();
    prefixTextField.setWidth("500px");

    howManyDigitsLabel = new Label();
    leadingZerosSelect = new Select();
    for (int i = 1; i <= MAX_LEADING_ZEROS; i++) {
        leadingZerosSelect.addItem(Integer.valueOf(i));
    }
    leadingZerosSelect.setNullSelectionAllowed(false);
    leadingZerosSelect.select(Integer.valueOf(1));
    leadingZerosSelect.setWidth("50px");

    specifySuffixLabel = new Label();
    suffixTextField = new TextField();
    suffixTextField.setWidth("500px");

    nextNameInSequenceLabel = new Label();
    generatedNameLabel = new Label();

    generateButton = new Button();
    generateButton.setData(GENERATE_BUTTON_ID);
    generateButton.addListener(new CrossingManagerImportButtonClickListener(this));

    layoutComponents();
    initializeToggableComponents();
}

From source file:org.hip.vif.admin.groupedit.ui.GroupListView.java

License:Open Source License

private CheckBox createCheck(final GroupWrapper inEntry) {
    final CheckBox out = new CheckBox();
    out.setImmediate(true);/*from w w  w.java 2s. c om*/
    out.setValue(inEntry.isChecked());
    if (inEntry.getIsDeletable()) {
        out.setEnabled(!confirmationMode);
    } else {
        out.setEnabled(false);
    }
    out.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent inEvent) {
            inEntry.setChecked(((CheckBox) inEvent.getProperty()).getValue());
        }
    });
    return out;
}

From source file:org.hip.vif.admin.groupedit.ui.ParticipantListView.java

License:Open Source License

private CheckBox createCheck(final ParticipantBean inEntry,
        final VIFViewHelper.IConfirmationModeChecker inChecker) {
    final CheckBox out = new CheckBox();
    out.setImmediate(true);/*from  www  .  j a v  a 2 s . c  o  m*/
    out.setValue(inEntry.isChecked());
    if (inEntry.isAdmin()) {
        out.setEnabled(false);
    } else {
        out.setEnabled(!inChecker.inConfirmationMode());
    }
    out.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent inEvent) {
            inEntry.setChecked(((CheckBox) inEvent.getProperty()).getValue());
        }
    });
    return out;
}

From source file:org.hip.vif.forum.usersettings.ui.SubscriptionListView.java

License:Open Source License

/** Creates a check box for the list entries to switch the range of the subscription.
 *
 * @param inEntry {@link SubscriptionBean}
 * @param inTask {@link SubscriptionsManageTask}
 * @param inMessages {@link IMessages}//from   ww  w  .  j a  v  a 2  s  .  com
 * @return {@link CheckBox} */
public CheckBox createCheck(final SubscriptionBean inEntry, final SubscriptionsManageTask inTask,
        final IMessages inMessages) {
    final CheckBox out = new CheckBox();
    out.setImmediate(true);
    out.setValue(inEntry.getLocal());
    out.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent inEvent) { // NOPMD
            final boolean isLocal = ((CheckBox) inEvent.getProperty()).getValue();
            inEntry.setChecked(isLocal);
            try {
                inTask.changeRange(inEntry, isLocal);
                Notification.show(inMessages.getMessage("msg.question.subscription.updated"), //$NON-NLS-1$
                        Type.TRAY_NOTIFICATION);
            } catch (final VException | SQLException exc) {
                Notification.show(inMessages.getMessage("errmsg.subscription.change"), Type.WARNING_MESSAGE); //$NON-NLS-1$
            }
        }
    });
    return out;
}

From source file:org.hip.vif.web.util.VIFViewHelper.java

License:Open Source License

/** Helper method to create check boxes for generated table columns.
 *
 * @param inEntry {@link ISelectableBean}
 * @param inChecker {@link IConfirmationModeChecker} an instance checking whether the view is in confirmation mode
 *            or not, <code>null</code> if no such functionality is needed
 * @return {@link CheckBox} *///  ww w. j  a v a 2 s . c o m
@SuppressWarnings("serial")
public static CheckBox createCheck(final ISelectableBean inEntry, final IConfirmationModeChecker inChecker) {
    final CheckBox out = new CheckBox();
    out.setImmediate(true);
    out.setValue(inEntry.isChecked());
    out.setEnabled(inChecker == null ? true : !inChecker.inConfirmationMode());
    out.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent inEvent) { // NOPMD
            inEntry.setChecked(((CheckBox) inEvent.getProperty()).getValue());
        }
    });
    return out;
}