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(String caption) 

Source Link

Document

Creates a new checkbox with a set caption.

Usage

From source file:org.vaadin.tori.component.DebugControlPanel.java

License:Apache License

private Component createRegularControl(final Method setter)
        throws SecurityException, NoSuchMethodException, Exception {
    final CheckBox checkbox = new CheckBox(getNameForCheckBox(setter));
    try {//from w ww. j a v  a 2  s  .  com
        final boolean getterValue = callGetter(getGetterFrom(setter));
        checkbox.setValue(getterValue);
        checkbox.addValueChangeListener(new CheckboxListener(data, setter));
        checkbox.setImmediate(true);
    } catch (final CheckBoxShouldBeDisabledException e) {
        /*
         * Because our context doesn't have data to set up this object, we
         * disable the checkbox. E.g. DashboardView doesn't have context
         * data on a particular Category or Thread
         */

        checkbox.setEnabled(false);
    }
    return checkbox;
}

From source file:org.vaadin.tori.view.edit.EditViewImpl.java

License:Apache License

private Component buildUseToriMailService() {
    useToriMailService = new CheckBox("Use Tori mail service");
    useToriMailService.setImmediate(true);
    useToriMailService.addValueChangeListener(new ValueChangeListener() {
        @Override//from w w w.j  av a 2 s . c om
        public void valueChange(final ValueChangeEvent event) {
            updateEmailPreferencesEnabled();
        }
    });
    return getFieldWrapper("Use Tori notification email functionality instead of "
            + "the default one provided by the Message Boards portlet", useToriMailService);
}

From source file:org.vaadin.tori.view.edit.EditViewImpl.java

License:Apache License

private Component buildShowThreadsOnDashboard() {
    showThreadsOnDashboard = new CheckBox("Show threads on dashboard");
    return getFieldWrapper("Let Tori show threads/topics added to the root category on the front page.",
            showThreadsOnDashboard);/*  www.  java2 s . c  om*/
}

From source file:org.vaadin.tori.view.edit.EditViewImpl.java

License:Apache License

private Component buildUpdateTitle() {
    updatePageTitle = new CheckBox("Update the page title");
    return getFieldWrapper("Allow Tori to update the browser title while navigating between different views.",
            updatePageTitle);// w w w. jav a 2  s  .com
}

From source file:org.vaadin.tori.view.edit.EditViewImpl.java

License:Apache License

private Component buildReplaceLinks() {
    replaceMessageBoardsLinks = new CheckBox("Replace message boards link data with tori format");
    return getFieldWrapper("Check the box beneath to let Tori scan post content render-time for links "
            + "intended for Liferay message boards portlet and convert them to tori-format for display.",
            replaceMessageBoardsLinks);/*from  w  w  w  .  j  a  v  a2  s . c  o  m*/
}

From source file:qbic.vaadincomponents.MaxQuantComponent.java

License:Open Source License

/**
 * creates the global parameter component
 * /*  www.j  a  va2  s.c  o  m*/
 * @return
 */
private Component globalParameters() {
    FormLayout globalparameters = new FormLayout();
    globalparameters.setCaption("Global parameters");
    fastaFiles = new SelectFileComponent("", FASTA_FILES_INFO, AVAILABLE_FASTAS_CAPTION,
            SELECTED_FASTAS_CAPTION, model.getFastaBeans(), model.getSelectedFastaBeans());
    globalparameters.addComponent(fastaFiles);
    // fixed modifications
    // fixedModifications = new TwinColSelect("fixed modifications");
    fixedModifications = new TwinColSelect();

    Label fixedInfo = new Label("Fixed Modifications");
    fixedInfo.addStyleName(ValoTheme.LABEL_COLORED);

    globalparameters.addComponent(fixedInfo);
    fixedModifications.addItems("Acetyl (Protein N-term)", "Acetyl (K)", "Oxidation (M)", "Ala->Arg",
            "Carbamidomethyl (C)");
    globalparameters.addComponent(fixedModifications);
    reQuantify = new CheckBox("Requantify");
    globalparameters.addComponent(reQuantify);
    matchBetweenRuns = new CheckBox("Match Between Runs");
    globalparameters.addComponent(matchBetweenRuns);
    return globalparameters;
}

From source file:qbic.vaadincomponents.ParameterComponent.java

License:Open Source License

private CheckBox createParameterCheckBox(Parameter param) {
    String description;/*from  w w  w. j  a  va  2  s .  co m*/
    if (param.getDescription().contains("#br#")) {
        description = param.getDescription().split("#br#")[0];
    } else {
        description = param.getDescription();
    }

    CheckBox box = new CheckBox(description);
    box.setDescription(param.getTitle());
    box.setImmediate(true);
    return box;
}

From source file:rs.pupin.jpo.validation.gui.ValidationSettingsWindow.java

@Override
public void attach() {
    // add endpoint field
    Label lbl = new Label("Endpoint:");
    lbl.setSizeUndefined();//  w w  w .  j a  v a 2  s  . c  om
    settingsLayout.addComponent(lbl, 0, 0, 0, 0);
    settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT);
    endpointInput = new TextField();
    endpointInput.setValue(state.endpoint);
    endpointInput.setWidth("100%");
    settingsLayout.addComponent(endpointInput, 1, 0, 1, 0);

    // add graph field
    lbl = new Label("Graph:");
    lbl.setSizeUndefined();
    settingsLayout.addComponent(lbl, 0, 1, 0, 1);
    settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT);
    graphInput = new TextField();
    graphInput.setValue(state.graph);
    graphInput.setWidth("100%");
    settingsLayout.addComponent(graphInput, 1, 1, 1, 1);

    lbl = new Label("");
    lbl.setHeight("30px");
    settingsLayout.addComponent(lbl, 0, 2, 1, 2);

    // add basic authentication check box
    authCheckBox = new CheckBox("Use basic authentication");
    authCheckBox.setSizeUndefined();
    settingsLayout.addComponent(authCheckBox, 0, 3, 1, 3);
    settingsLayout.setComponentAlignment(authCheckBox, Alignment.MIDDLE_LEFT);

    // add username field
    lbl = new Label("Username:");
    lbl.setSizeUndefined();
    settingsLayout.addComponent(lbl, 0, 4);
    settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT);
    usernameInput = new TextField();
    usernameInput.setWidth("100%");
    usernameInput.setEnabled(false);
    settingsLayout.addComponent(usernameInput, 1, 4);
    settingsLayout.setComponentAlignment(usernameInput, Alignment.MIDDLE_LEFT);

    // add password field
    lbl = new Label("Password:");
    lbl.setSizeUndefined();
    settingsLayout.addComponent(lbl, 0, 5);
    settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT);
    passwordInput = new PasswordField();
    passwordInput.setWidth("100%");
    passwordInput.setEnabled(false);
    settingsLayout.addComponent(passwordInput, 1, 5);

    lbl = new Label("");
    lbl.setHeight("30px");
    settingsLayout.addComponent(lbl, 0, 6, 1, 6);

    // add OntoWiki check box
    owCheckBox = new CheckBox("Use OntoWiki instance");
    owCheckBox.setSizeUndefined();
    if (state.owUrl != null)
        owCheckBox.setValue(true);
    else
        owCheckBox.setValue(false);
    settingsLayout.addComponent(owCheckBox, 0, 7, 1, 7);
    settingsLayout.setComponentAlignment(owCheckBox, Alignment.MIDDLE_LEFT);

    // add OntoWiki field
    lbl = new Label("OntoWiki URL:");
    lbl.setSizeUndefined();
    settingsLayout.addComponent(lbl, 0, 8);
    settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT);
    owInput = new TextField();
    owInput.setWidth("100%");
    if (state.owUrl != null) {
        owInput.setEnabled(true);
        owInput.setValue(state.owUrl);
    } else
        owInput.setEnabled(false);
    settingsLayout.addComponent(owInput, 1, 8);
    settingsLayout.setComponentAlignment(owInput, Alignment.MIDDLE_LEFT);

    lbl = new Label("");
    lbl.setHeight("30px");
    settingsLayout.addComponent(lbl, 0, 9, 1, 9);

    // add buttons
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setSizeUndefined();
    btnOK = new Button("OK");
    btnCancel = new Button("Cancel");
    hl.addComponent(btnOK);
    hl.addComponent(btnCancel);
    settingsLayout.addComponent(hl, 1, 10);
    settingsLayout.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT);

    createListeners();
    center();
}

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

License:Mozilla Public License

private RefreshableTab createSettings() {

    final Form systemForm;
    {/*from  w  ww  .j  a v a 2 s .c om*/
        final ComboBox serviceLocation;
        {
            String[][] defs = { { "? ", "http://195.245.214.33:7777/esv" },
                    { "? ",
                            "http://oraas.rt.ru:7777/gateway/services/SID0003318" } };
            serviceLocation = new ComboBox("?? ?? ");
            serviceLocation.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_EXPLICIT);
            for (String[] def : defs) {
                addOption(serviceLocation, def[1], def[0], false);
            }
            serviceLocation.setImmediate(true);
            serviceLocation.setInputPrompt("http://");
            serviceLocation.setNewItemsAllowed(true);
            serviceLocation.setNewItemHandler(new AbstractSelect.NewItemHandler() {
                @Override
                public void addNewItem(String newItemCaption) {
                    addOption(serviceLocation, newItemCaption, newItemCaption, true);
                }
            });
            String href = AdminServiceProvider.get()
                    .getSystemProperty(CertificateVerifier.VERIFY_SERVICE_LOCATION);
            addOption(serviceLocation, href, href, true);
        }

        final CheckBox allowValidate;
        {
            allowValidate = new CheckBox(" ? ");
            allowValidate.setRequired(true);
            allowValidate.setImmediate(true);
            allowValidate.addListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(Property.ValueChangeEvent event) {
                    serviceLocation.setRequired(Boolean.TRUE.equals(event.getProperty().getValue()));
                }
            });
            allowValidate.setValue(AdminServiceProvider
                    .getBoolProperty(CertificateVerifier.ALLOW_VERIFY_CERTIFICATE_PROPERTY));
        }

        systemForm = new Form();
        systemForm.addField("location", serviceLocation);
        systemForm.addField("allowVerify", allowValidate);
        systemForm.setImmediate(true);
        systemForm.setWriteThrough(false);
        systemForm.setInvalidCommitted(false);

        Button commit = new Button("", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                try {
                    systemForm.commit();
                    set(CertificateVerifier.VERIFY_SERVICE_LOCATION, serviceLocation.getValue());
                    set(CertificateVerifier.ALLOW_VERIFY_CERTIFICATE_PROPERTY, allowValidate.getValue());
                    event.getButton().getWindow().showNotification("?? ?",
                            Window.Notification.TYPE_HUMANIZED_MESSAGE);
                } catch (Validator.InvalidValueException ignore) {
                }
            }
        });

        HorizontalLayout buttons = new HorizontalLayout();
        buttons.setSpacing(true);
        buttons.addComponent(commit);
        systemForm.getFooter().addComponent(buttons);
    }

    Panel b1 = new Panel();
    b1.setSizeFull();
    Label b1label = new Label(" ?");
    b1label.addStyleName(Reindeer.LABEL_H2);
    b1.addComponent(b1label);
    b1.addComponent(systemForm);

    VerticalLayout certificates = new VerticalLayout();
    certificates.setSizeFull();
    certificates.setSpacing(true);

    HorizontalLayout topHl = new HorizontalLayout();
    topHl.setSizeFull();
    topHl.setSpacing(true);

    Panel certificatesPanel = new Panel("", certificates);
    certificatesPanel.setSizeFull();
    certificatesPanel.addStyleName(Reindeer.PANEL_LIGHT);

    boolean linkCertificate = AdminServiceProvider.getBoolProperty(CertificateVerifier.LINK_CERTIFICATE);
    final CheckBox switchLink = new CheckBox("? ");
    switchLink.setValue(linkCertificate);
    switchLink.setImmediate(true);
    switchLink.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            set(CertificateVerifier.LINK_CERTIFICATE, switchLink.getValue());
            event.getButton().getWindow().showNotification("?? ?",
                    Window.Notification.TYPE_HUMANIZED_MESSAGE);
        }
    });

    Panel b2 = new Panel();
    b2.setSizeFull();
    Label b2label = new Label("? ?");
    b2label.addStyleName(Reindeer.LABEL_H2);
    b2.addComponent(b2label);
    b2.addComponent(switchLink);

    certificates.addComponent(b1);
    certificates.addComponent(b2);
    certificates.setExpandRatio(b1, 0.7f);
    certificates.setExpandRatio(b2, 0.3f);

    CheckBox productionMode = new CheckBox("?  ",
            AdminServiceProvider.getBoolProperty(API.PRODUCTION_MODE));
    productionMode.setImmediate(true);
    productionMode.setDescription(
            " ?   ?   ??   ?? testMsg");
    productionMode.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            boolean value = Boolean.TRUE.equals(event.getProperty().getValue());
            set(API.PRODUCTION_MODE, value);
        }
    });
    Panel smevPanel = new Panel(" ");
    smevPanel.setSizeFull();
    smevPanel.addComponent(productionMode);

    HorizontalLayout bottomHl = new HorizontalLayout();
    bottomHl.setSizeFull();
    bottomHl.setSpacing(true);

    LogSettings logSettings = new LogSettings();
    Panel emailDatesPanel = createEmailDatesPanel();

    Panel mailTaskConfigPanel = createMilTaskConfigPanel();

    topHl.addComponent(certificatesPanel);
    topHl.addComponent(emailDatesPanel);
    topHl.addComponent(mailTaskConfigPanel);
    topHl.setExpandRatio(certificatesPanel, 0.4f);
    topHl.setExpandRatio(emailDatesPanel, 0.6f);
    topHl.setExpandRatio(mailTaskConfigPanel, 0.5f);

    Panel esiaPanel = buildEsiaPanel();
    Panel printTemplatesPanel = buildPrintTemplatesPanel();

    bottomHl.addComponent(smevPanel);
    bottomHl.addComponent(esiaPanel);
    bottomHl.addComponent(printTemplatesPanel);
    bottomHl.setExpandRatio(smevPanel, 0.2f);
    bottomHl.setExpandRatio(esiaPanel, 0.4f);
    bottomHl.setExpandRatio(printTemplatesPanel, 0.4f);

    final VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setSizeFull();
    layout.addComponent(topHl);
    layout.addComponent(logSettings);
    layout.addComponent(bottomHl);
    layout.setExpandRatio(topHl, 0.40f);
    layout.setExpandRatio(logSettings, 0.40f);
    layout.setExpandRatio(bottomHl, 0.20f);
    layout.setMargin(true);
    layout.setSpacing(true);

    return new RefreshableTab(layout, logSettings);
}

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

License:Mozilla Public License

private Panel buildEsiaPanel() {
    boolean isEsiaAuth = "true".equals(get(API.ALLOW_ESIA_LOGIN));

    final TextField esiaServiceLocation = new TextField("?? ?? ");
    esiaServiceLocation.setValue(get(API.ESIA_SERVICE_ADDRESS));
    esiaServiceLocation.setEnabled(isEsiaAuth);
    esiaServiceLocation.setRequired(isEsiaAuth);
    esiaServiceLocation.setWidth(370, Sizeable.UNITS_PIXELS);

    final CheckBox allowEsiaLogin = new CheckBox("   ?");
    allowEsiaLogin.setValue(isEsiaAuth);
    allowEsiaLogin.setImmediate(true);//from w ww. jav a 2s  .c  o m
    allowEsiaLogin.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            Boolean newValue = (Boolean) valueChangeEvent.getProperty().getValue();
            esiaServiceLocation.setEnabled(newValue);
            esiaServiceLocation.setRequired(newValue);
        }
    });

    final Form form = new Form();
    form.addField(API.ALLOW_ESIA_LOGIN, allowEsiaLogin);
    form.addField(API.ESIA_SERVICE_ADDRESS, esiaServiceLocation);
    form.setImmediate(true);
    form.setWriteThrough(false);
    form.setInvalidCommitted(false);

    Button commit = new Button("", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                form.commit();
                set(API.ALLOW_ESIA_LOGIN, allowEsiaLogin.getValue());
                set(API.ESIA_SERVICE_ADDRESS, esiaServiceLocation.getValue());
                event.getButton().getWindow().showNotification("?? ?",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
            } catch (Validator.InvalidValueException ignore) {
            }
        }
    });

    Panel panel = new Panel("?? ?");
    panel.setSizeFull();
    panel.addComponent(form);
    panel.addComponent(commit);
    return panel;
}