Example usage for com.vaadin.ui CheckBox getValue

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

Introduction

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

Prototype

@Override
    public Boolean getValue() 

Source Link

Usage

From source file:org.eclipse.hawkbit.ui.distributions.disttype.DistributionSetTypeSoftwareModuleSelectLayout.java

License:Open Source License

protected static boolean isMandatoryModuleType(final Item item) {
    final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(getDistTypeMandatory()).getValue();
    return mandatoryCheckBox.getValue();
}

From source file:org.eclipse.hawkbit.ui.management.dstable.DistributionTable.java

License:Open Source License

private CheckBox enableMaintenanceWindowControl() {
    final CheckBox enableMaintenanceWindow = new CheckBox(
            getI18n().getMessage("caption.maintenancewindow.enabled"));
    enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
    enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
    enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
    enableMaintenanceWindow.addValueChangeListener(event -> {
        final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
        maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
        maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
        enableSaveButton(!isMaintenanceWindowEnabled);
        maintenanceWindowLayout.clearAllControls();
    });//from  ww  w . j a v  a 2 s.  co m
    return enableMaintenanceWindow;
}

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

License:Open Source License

private CheckBox enableMaintenanceWindowControl() {
    final CheckBox enableMaintenanceWindow = new CheckBox(i18n.getMessage("caption.maintenancewindow.enabled"));
    enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID);
    enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL);
    enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable");
    enableMaintenanceWindow.addValueChangeListener(event -> {
        final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue();
        maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled);
        maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled);
        enableSaveButton(!isMaintenanceWindowEnabled);
        maintenanceWindowLayout.clearAllControls();
    });//from w  w  w.ja  v a 2s .c om

    return enableMaintenanceWindow;
}

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.AuthenticationConfigurationView.java

License:Open Source License

@Override
public void valueChange(final ValueChangeEvent event) {

    if (!(event.getProperty() instanceof CheckBox)) {
        return;/*from   w  w  w  . j av  a 2 s  .  com*/
    }

    notifyConfigurationChanged();

    final CheckBox checkBox = (CheckBox) event.getProperty();
    BooleanConfigurationItem configurationItem;

    if (gatewaySecTokenCheckBox.equals(checkBox)) {
        configurationItem = gatewaySecurityTokenAuthenticationConfigurationItem;
    } else if (targetSecTokenCheckBox.equals(checkBox)) {
        configurationItem = targetSecurityTokenAuthenticationConfigurationItem;
    } else if (certificateAuthCheckbox.equals(checkBox)) {
        configurationItem = certificateAuthenticationConfigurationItem;
    } else if (downloadAnonymousCheckBox.equals(checkBox)) {
        configurationItem = anonymousDownloadAuthenticationConfigurationItem;
    } else {
        return;
    }

    if (checkBox.getValue()) {
        configurationItem.configEnable();
    } else {
        configurationItem.configDisable();
    }
}

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.RepositoryConfigurationView.java

License:Open Source License

@Override
public void valueChange(final ValueChangeEvent event) {

    if (!(event.getProperty() instanceof CheckBox)) {
        return;//from   ww w.j  av  a 2 s .com
    }

    notifyConfigurationChanged();

    final CheckBox checkBox = (CheckBox) event.getProperty();
    BooleanConfigurationItem configurationItem;

    if (actionAutocloseCheckBox.equals(checkBox)) {
        configurationItem = actionAutocloseConfigurationItem;
    } else if (actionAutocleanupCheckBox.equals(checkBox)) {
        configurationItem = actionAutocleanupConfigurationItem;
    } else {
        return;
    }

    if (checkBox.getValue()) {
        configurationItem.configEnable();
    } else {
        configurationItem.configDisable();
    }
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private Form buildCreateOrgUnitForm() {
    final Form form = new Form();
    form.setImmediate(true);/*from   w  w w. j a va 2 s.c  o m*/

    // Name
    final TextField txtNameContext = new TextField();
    txtNameContext.setCaption("Name");
    txtNameContext.setImmediate(false);
    txtNameContext.setWidth("-1px");
    txtNameContext.setHeight("-1px");
    txtNameContext.setInvalidAllowed(false);
    txtNameContext.setRequired(true);
    form.addField("txtNameContext", txtNameContext);

    // Description
    final TextField txtDescContext = new TextField("Description");
    txtDescContext.setImmediate(false);
    txtDescContext.setWidth("-1px");
    txtDescContext.setHeight("-1px");
    form.addField("txtDescContext", txtDescContext);

    final CheckBox checkStatusOpened = new CheckBox("Create OrgUnit in Status opened?", true);
    checkStatusOpened.setImmediate(true);
    form.addField("checkStatusOpened", checkStatusOpened);

    // btnAddContext
    final Button btnAddContext = new Button("Submit", new Button.ClickListener() {
        private static final long serialVersionUID = -1373866726572059290L;

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                form.commit();
                controller.createResourceAddOrgUnit(txtNameContext.getValue().toString(),
                        txtDescContext.getValue().toString(), (Boolean) checkStatusOpened.getValue(), router,
                        router.getServiceLocation());
                router.getMainWindow().showNotification("Organizational Unit "
                        + txtNameContext.getValue().toString() + " created successfully ",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
                form.getField("txtNameContext").setValue("");
                form.getField("txtDescContext").setValue("");
            } catch (final EmptyValueException e) {
                router.getMainWindow().showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final Exception e) {
                router.getMainWindow().showNotification(
                        ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    btnAddContext.setWidth("-1px");
    btnAddContext.setHeight("-1px");
    form.getLayout().addComponent(btnAddContext);

    form.getField("txtNameContext").setRequired(true);
    form.getField("txtNameContext").setRequiredError("Name is missing");

    form.getField("txtDescContext").setRequired(true);
    form.getField("txtDescContext").setRequiredError("Description is missing");
    return form;
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private void formAddContext(final VerticalLayout vlAccCreateContext) throws EscidocClientException {
    final Form frm = new Form();
    frm.setImmediate(true);/*from www . j  av  a2 s. co m*/
    // Name
    final TextField txtNameContext = new TextField();
    txtNameContext.setCaption("Name");
    txtNameContext.setImmediate(false);
    txtNameContext.setWidth("-1px");
    txtNameContext.setHeight("-1px");
    txtNameContext.setInvalidAllowed(false);
    txtNameContext.setRequired(true);
    frm.addField("txtNameContext", txtNameContext);

    // Description
    final TextField txtDescContext = new TextField("Description");
    txtDescContext.setImmediate(false);
    txtDescContext.setWidth("-1px");
    txtDescContext.setHeight("-1px");
    frm.addField("txtDescContext", txtDescContext);

    // Description
    final TextField txtType = new TextField("Type");
    txtType.setImmediate(false);
    txtType.setWidth("-1px");
    txtType.setHeight("-1px");
    frm.addField("txtType", txtType);

    // OrgUnit
    final NativeSelect slOrgUnit = new NativeSelect("Organizational Unit");
    slOrgUnit.setImmediate(true);
    slOrgUnit.setWidth("-1px");
    slOrgUnit.setHeight("-1px");
    slOrgUnit.setRequired(true);
    slOrgUnit.setNullSelectionAllowed(false);
    frm.addField("slOrgUnit", slOrgUnit);

    final OrgUnitService orgUnitService = new OrgUnitService(router.getServiceLocation().getEscidocUri(),
            router.getApp().getCurrentUser().getToken());
    final Collection<OrganizationalUnit> orgUnits = orgUnitService.findAll();
    for (final OrganizationalUnit organizationalUnit : orgUnits) {
        slOrgUnit.addItem(organizationalUnit.getObjid());
        slOrgUnit.setItemCaption(organizationalUnit.getObjid(), organizationalUnit.getXLinkTitle());
    }

    frm.getLayout().addComponent(slOrgUnit);
    final CheckBox checkStatusOpened = new CheckBox("Create Context in Status opened?", true);
    checkStatusOpened.setImmediate(true);
    frm.addField("checkStatusOpened", checkStatusOpened);

    // btnAddContext
    final Button btnAddContext = new Button("Submit", new Button.ClickListener() {
        private static final long serialVersionUID = -4696167135894721166L;

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                frm.commit();
                controller.createResourceAddContext(txtNameContext.getValue().toString(),
                        txtDescContext.getValue().toString(), txtType.getValue().toString(),
                        slOrgUnit.getValue().toString(), (Boolean) checkStatusOpened.getValue(), repositories,
                        router.getServiceLocation());
                router.getMainWindow().showNotification(
                        "Context " + txtNameContext.getValue().toString() + " created successfully ",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
                frm.getField("txtNameContext").setValue("");
                frm.getField("txtDescContext").setValue("");
                frm.getField("txtType").setValue("");
                frm.getField("slOrgUnit").setValue(null);
                // Ideally here should be a sync method to sync the tree

            } catch (final EmptyValueException e) {
                router.getMainWindow().showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final EscidocClientException e) {
                router.getMainWindow().showNotification(
                        ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    btnAddContext.setWidth("-1px");
    btnAddContext.setHeight("-1px");
    frm.getLayout().addComponent(btnAddContext);

    frm.getField("txtNameContext").setRequired(true);
    frm.getField("txtNameContext").setRequiredError("Name is missing");

    frm.getField("txtDescContext").setRequired(true);
    frm.getField("txtDescContext").setRequiredError("Description is missing");

    frm.getField("txtType").setRequired(true);
    frm.getField("txtType").setRequiredError("Context Type is missing");
    //
    frm.getField("slOrgUnit").setRequired(true);
    frm.getField("slOrgUnit").setRequiredError("Organizazional Unit is required");

    vlAccCreateContext.addComponent(frm);
}

From source file:org.hip.vif.admin.admin.tasks.RefreshIndexTask.java

License:Open Source License

/** Callback method, processing the view input.
 *
 * @param inCheckBoxes {@link Collection}
 * @return String the feedback//  w w  w.ja  v  a  2  s.co  m
 * @throws Exception */
public String reindex(final Collection<CheckBox> inCheckBoxes) throws Exception { // NOPMD
    final IMessages lMessages = Activator.getMessages();
    final StringBuilder out = new StringBuilder();
    for (final CheckBox lCheckBox : inCheckBoxes) {
        final Boolean value = lCheckBox.getValue();
        if (value != null && value) {
            if (Constants.INDEX_CONTENT.equals(lCheckBox.getData())) {
                final VIFContentIndexer lIndexer = new VIFContentIndexer();
                out.append(lMessages.getFormattedMessage("admin.reindex.feedback.content", //$NON-NLS-1$
                        (Object[]) lIndexer.refreshIndex()));
                out.append(NL);
            } else {
                final VIFMemberIndexer lIndexer = new VIFMemberIndexer();
                out.append(lMessages.getFormattedMessage("admin.reindex.feedback.person", //$NON-NLS-1$
                        (Object[]) lIndexer.refreshIndex()));
                out.append(NL);
            }
        }
    }
    return new String(out);
}

From source file:org.hip.vif.admin.admin.ui.ReindexView.java

License:Open Source License

private CheckBox createCheckbox(final String inLabel, final String inData) {
    final CheckBox outCheckBox = new CheckBox(inLabel);
    outCheckBox.setStyleName("vif-check"); //$NON-NLS-1$
    outCheckBox.setData(inData);/* w w w . ja v a2s  .co m*/
    outCheckBox.setImmediate(true);
    outCheckBox.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(final ValueChangeEvent inEvent) { // NOPMD
            for (final CheckBox lCheckBox : checkBoxes) {
                final Boolean lValue = lCheckBox.getValue();
                if (lValue != null && lValue.booleanValue()) {
                    reindex.setEnabled(true);
                    return;
                }
            }
            reindex.setEnabled(false);
        }
    });
    checkBoxes.add(outCheckBox);
    return outCheckBox;
}

From source file:org.iespuigcastellar.attendancemanager.screenlayouts.NoModalWindowTeacherMainLayout.java

License:Open Source License

private void updateEnabledCheckBoxes(Student student) {
    boolean missFlag = true;
    boolean excusedFlag = true;
    boolean delayFlag = true;
    boolean expulsionFlag = true;

    CheckBox missCheckBox = (CheckBox) table.getItem(student.getID()).getItemProperty("Miss").getValue();
    if ((Boolean) missCheckBox.getValue()) {
        excusedFlag = false;//from  w w  w.  j a v  a 2 s . c om
        delayFlag = false;
        expulsionFlag = false;
    }

    CheckBox excusedCheckBox = (CheckBox) table.getItem(student.getID()).getItemProperty("Excused").getValue();
    if ((Boolean) excusedCheckBox.getValue()) {
        missFlag = false;
        delayFlag = false;
        expulsionFlag = false;
    }

    CheckBox delayCheckBox = (CheckBox) table.getItem(student.getID()).getItemProperty("Delay").getValue();
    if ((Boolean) delayCheckBox.getValue()) {
        missFlag = false;
        excusedFlag = false;
    }

    CheckBox expulsionCheckBox = (CheckBox) table.getItem(student.getID()).getItemProperty("Expulsion")
            .getValue();
    if ((Boolean) expulsionCheckBox.getValue()) {
        missFlag = false;
        excusedFlag = false;
    }

    if (missFlag != missCheckBox.isEnabled())
        missCheckBox.setEnabled(missFlag);
    if (excusedFlag != excusedCheckBox.isEnabled())
        excusedCheckBox.setEnabled(excusedFlag);
    if (delayFlag != delayCheckBox.isEnabled())
        delayCheckBox.setEnabled(delayFlag);
    if (expulsionFlag != expulsionCheckBox.isEnabled())
        expulsionCheckBox.setEnabled(expulsionFlag);
}