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:edu.nps.moves.mmowgli.modules.userprofile.ManageAwardsDialog.java

License:Open Source License

@HibernateUserRead
private void fillPanelTL(User u) {
    @SuppressWarnings("unchecked")
    List<AwardType> typs = (List<AwardType>) HSess.get().createCriteria(AwardType.class).list();
    gridList = new ArrayList<AwardType>(typs.size());
    gridList.addAll(typs);/*from  w ww.  j ava 2 s.c om*/
    gridLayout.removeAllComponents();
    gridLayout.setRows(typs.size());
    gridLayout.setColumns(4);
    gridLayout.setSpacing(true);
    gridLayout.setColumnExpandRatio(2, 0.5f);
    gridLayout.setColumnExpandRatio(3, 0.5f);

    Set<Award> uAwards = u.getAwards();
    MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    for (AwardType at : typs) {
        CheckBox cb;
        boolean checked = hasBeenAwarded(uAwards, at);
        gridLayout.addComponent(cb = new CheckBox());
        cb.setValue(checked);
        gridLayout.setComponentAlignment(cb, Alignment.MIDDLE_CENTER);
        Embedded emb = new Embedded(null, mediaLoc.locate(at.getIcon55x55()));
        emb.addStyleName("m-greyborder3");
        gridLayout.addComponent(emb);
        Label lab;
        gridLayout.addComponent(lab = new Label(at.getName()));
        gridLayout.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
        gridLayout.addComponent(lab = new Label(at.getDescription()));
        gridLayout.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    }
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfile3Top.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
@HibernateUserRead/*from www. j  a  v  a  2s. co m*/
public UserProfile3Top(Object uid) {
    this.uid = uid;

    User u = User.getTL(uid);
    User me = Mmowgli2UI.getGlobals().getUserTL();
    itsSomebodyElse = (u.getId() != me.getId());
    imGuestAccount = me.isViewOnly();
    imAdmin = me.isAdministrator();
    imAdminOrGameMaster = me.isAdministrator() || me.isGameMaster();

    Game game = Game.getTL();
    gameReadOnly = game.isReadonly();

    scoresLab = new Label();
    exploreScoreLab = new Label();
    innovateScoreLab = new Label();

    if (game.isActionPlansEnabled()) {
        scoresLab.addStyleName("m-userProfile3-scores-label");

        exploreScoreLab.addStyleName("m-userProfile3-explorescore-label");
        exploreScoreLab.setValue(formatFloat(u.getCombinedBasicScore())); // u.getBasicScore()));
        exploreScoreLab.setDescription("rounds combined");

        innovateScoreLab.addStyleName("m-userProfile3-explorescore-label");
        innovateScoreLab.setValue(formatFloat(u.getCombinedInnovScore())); // u.getInnovationScore()));
        innovateScoreLab.setDescription("rounds combined");
    } else {
        scoresLab.addStyleName("m-userProfile3-exploreonlyscore-label");

        exploreScoreLab.addStyleName("m-userProfile3-explorescorebig-label");
        exploreScoreLab.setValue(formatFloat(u.getCombinedBasicScore())); // u.getBasicScore()));
        exploreScoreLab.setDescription("rounds combined");
    }

    avatarButt = new NativeButton();

    locationLab = new Label();
    locationLab.setDescription("Where are you from?");

    expertiseLab = new Label();
    expertiseLab.setDescription("Enter a short description of your pertinent expertise.");

    affiliationLab = new Label("AFFILIATION");
    affiliationLab.setDescription("Your professional affliation");
    affiliationLab.addStyleName("m-userProfile3-learn-label");

    coverUpChangePW = new Label();

    nameLab = new Label();
    nameLab.setValue(u.getUserName());

    learnLab = new Label();

    GameQuestion q = u.getQuestion();

    String questSumm = null;
    if (q != null)
        questSumm = q.getSummary();
    questSumm = questSumm == null ? "" : questSumm;
    learnLab.setValue(questSumm);

    String questDesc = null;
    if (q != null)
        questDesc = q.getQuestion();
    questDesc = questDesc == null ? "" : questDesc;
    learnLab.setDescription(questDesc);

    levelLab = new Label();
    Level lev = u.getLevel();
    if (u.isGameMaster()) {
        Level l = Level.getLevelByOrdinalTL(Level.GAME_MASTER_ORDINAL);
        if (l != null)
            lev = l;
    }
    levelLab.setValue(lev.getDescription());

    changePWButt = new NativeButton();

    externMailCB = new CheckBox();
    externMailCB.setValue(u.isOkEmail());
    ingameMailCB = new CheckBox();
    ingameMailCB.setValue(u.isOkGameMessages());

    String s;
    locationTF = new TextField();
    s = u.getLocation();
    locationTF.setValue(s == null ? "" : s);
    expertiseTA = new TextArea();
    s = u.getExpertise();
    expertiseTA.setValue(s == null ? "" : s);

    affiliationTA = new TextArea();
    affiliationTA.setInputPrompt("optional additional affiliations");
    affiliationCombo = new BoundAffiliationCombo();
    affiliationCombo.setInputPrompt("required"); // override "optional"
    affiliationCombo.setNewItemsAllowed(false);
    s = u.getAffiliation();
    fillAffiliation(s);

    learnTA = new TextArea();
    s = u.getAnswer();
    learnTA.setValue(s == null ? "" : s);
    badgeButts = new NativeButton[8];
    badgeLayout = new GridLayout(4, 3); //col,row
    if (itsSomebodyElse) {
        followCB = new CheckBox();
        followCB.setValue(amIFollowing(me));
        followCB.addValueChangeListener(new FollowListener());
    }

    if (imAdmin) {
        manageAwardsButt = new NativeButton("manage awards");
        manageAwardsButt.setDescription("<p>accessible to game administrators</p>");
        manageAwardsButt.addClickListener(new ManageAwardsListener());
    }
}

From source file:eu.unifiedviews.plugins.transformer.metadata.MetadataVaadinDialog.java

License:Creative Commons License

@Override
protected void buildDialogLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(true);//  w ww . jav  a2s .co  m
    mainLayout.setWidth("100%");
    mainLayout.setHeight(null);
    mainLayout.setMargin(false);
    //mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    txtOutSymbolicName = new TextField();
    txtOutSymbolicName.setCaption("Output graph name:");
    txtOutSymbolicName.setWidth("100%");
    mainLayout.addComponent(txtOutSymbolicName);

    tfComsodeDatasetId = new TextField();
    tfComsodeDatasetId.setCaption("COMSODE Dataset ID (will be used as part of the URI)");
    tfComsodeDatasetId.setWidth("100%");
    tfComsodeDatasetId.setInputPrompt("MICR_3");
    mainLayout.addComponent(tfComsodeDatasetId);

    tfDatasetUri = new TextField();
    tfDatasetUri.setCaption("Dataset URI:");
    tfDatasetUri.setWidth("100%");
    mainLayout.addComponent(tfDatasetUri);

    tfDistributionUri = new TextField();
    tfDistributionUri.setCaption("Distribution URI:");
    tfDistributionUri.setWidth("100%");
    mainLayout.addComponent(tfDistributionUri);

    tfDataDumpUrl = new TextField();
    tfDataDumpUrl.setCaption("Data dump URL:");
    tfDataDumpUrl.setWidth("100%");
    mainLayout.addComponent(tfDataDumpUrl);

    cbMime = new ComboBox();
    cbMime.setCaption("Media Type:");
    cbMime.setNewItemsAllowed(false);
    cbMime.setNullSelectionAllowed(false);
    cbMime.setWidth("100%");
    for (String u : mimes) {
        cbMime.addItem(u);
    }
    mainLayout.addComponent(cbMime);

    tfSparqlEndpointUrl = new TextField();
    tfSparqlEndpointUrl.setCaption("Sparql Endpoint URI:");
    tfSparqlEndpointUrl.setWidth("100%");
    tfSparqlEndpointUrl.setNullRepresentation("");
    tfSparqlEndpointUrl.setNullSettingAllowed(true);
    mainLayout.addComponent(tfSparqlEndpointUrl);

    tfContactPoint = new TextField();
    tfContactPoint.setCaption("Contact Point URL:");
    tfContactPoint.setWidth("100%");
    mainLayout.addComponent(tfContactPoint);

    tfLanguage = new TextField();
    tfLanguage.setCaption("Original language - RDF language tag:");
    tfLanguage.setInputPrompt("cs|sk|it");
    tfLanguage.setWidth("100%");
    mainLayout.addComponent(tfLanguage);

    tfTitle = new TextField();
    tfTitle.setCaption("Title original language:");
    tfTitle.setWidth("100%");
    mainLayout.addComponent(tfTitle);

    tfTitleEn = new TextField();
    tfTitleEn.setCaption("Title in English:");
    tfTitleEn.setWidth("100%");
    mainLayout.addComponent(tfTitleEn);

    tfDesc = new TextField();
    tfDesc.setCaption("Description original language:");
    tfDesc.setWidth("100%");
    mainLayout.addComponent(tfDesc);

    tfDescEn = new TextField();
    tfDescEn.setCaption("Description in English:");
    tfDescEn.setWidth("100%");
    mainLayout.addComponent(tfDescEn);

    chkQb = new CheckBox();
    chkQb.setCaption("Dataset is RDF Data Cube");
    chkQb.setWidth("100%");
    mainLayout.addComponent(chkQb);

    dfModified = new DateField();
    dfModified.setCaption("Modified:");
    dfModified.setWidth("100%");
    dfModified.setResolution(Resolution.DAY);
    mainLayout.addComponent(dfModified);

    chkNow = new CheckBox();
    chkNow.setCaption("Always use current date instead");
    chkNow.setWidth("100%");
    mainLayout.addComponent(chkNow);

    cbPeriodicity = new ComboBox();
    cbPeriodicity.setCaption("Periodicity:");
    cbPeriodicity.setNewItemsAllowed(false);
    cbPeriodicity.setNullSelectionAllowed(false);
    cbPeriodicity.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
    cbPeriodicity.setWidth("100%");
    for (URLandCaption u : periodicities) {
        cbPeriodicity.addItem(u.url.toString());
        cbPeriodicity.setItemCaption(u.url.toString(), u.caption);
    }
    mainLayout.addComponent(cbPeriodicity);

    tcsLicenses = new TwinColSelect();
    tcsLicenses.setWidth("97%");
    tcsLicenses.setNewItemsAllowed(true);
    tcsLicenses.setLeftColumnCaption("Available licenses");
    tcsLicenses.setRightColumnCaption("Selected licenses");
    mainLayout.addComponent(tcsLicenses);

    tcsExamples = new TwinColSelect();
    tcsExamples.setWidth("97%");
    tcsExamples.setNewItemsAllowed(true);
    tcsExamples.setLeftColumnCaption("Available example resources");
    tcsExamples.setRightColumnCaption("Selected example resources");
    mainLayout.addComponent(tcsExamples);

    tcsSources = new TwinColSelect();
    tcsSources.setWidth("97%");
    tcsSources.setNewItemsAllowed(true);
    tcsSources.setLeftColumnCaption("Available sources");
    tcsSources.setRightColumnCaption("Selected sources");
    mainLayout.addComponent(tcsSources);

    tcsKeywords = new TwinColSelect();
    tcsKeywords.setWidth("97%");
    tcsKeywords.setNewItemsAllowed(true);
    tcsKeywords.setLeftColumnCaption("Available keywords");
    tcsKeywords.setRightColumnCaption("Selected keywords");
    mainLayout.addComponent(tcsKeywords);

    tcsThemes = new TwinColSelect();
    tcsThemes.setWidth("97%");
    tcsThemes.setNewItemsAllowed(true);
    tcsThemes.setLeftColumnCaption("Available themes");
    tcsThemes.setRightColumnCaption("Selected themes");
    mainLayout.addComponent(tcsThemes);

    tcsLanguages = new TwinColSelect();
    tcsLanguages.setWidth("97%");
    tcsLanguages.setNewItemsAllowed(true);
    tcsLanguages.setLeftColumnCaption("Available languages");
    tcsLanguages.setRightColumnCaption("Selected languages");
    mainLayout.addComponent(tcsLanguages);

    tcsAuthors = new TwinColSelect();
    tcsAuthors.setWidth("97%");
    tcsAuthors.setNewItemsAllowed(true);
    tcsAuthors.setLeftColumnCaption("Available authors");
    tcsAuthors.setRightColumnCaption("Selected authors");
    mainLayout.addComponent(tcsAuthors);

    tcsPublishers = new TwinColSelect();
    tcsPublishers.setWidth("97%");
    tcsPublishers.setNewItemsAllowed(true);
    tcsPublishers.setLeftColumnCaption("Available publishers");
    tcsPublishers.setRightColumnCaption("Selected publishers");
    mainLayout.addComponent(tcsPublishers);

    Panel p = new Panel();
    p.setSizeFull();
    p.setContent(mainLayout);

    setCompositionRoot(p);
}

From source file:fi.hip.sicx.vaadin.LoginWindow.java

License:Open Source License

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);/* w w w.  j  a v  a 2s.c  o  m*/
    mainLayout.setWidth("300px");
    mainLayout.setHeight("130px");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("300px");
    setHeight("130px");

    // usernamel
    usernamel = new Label();
    usernamel.setImmediate(false);
    usernamel.setWidth("-1px");
    usernamel.setHeight("-1px");
    usernamel.setValue("Username");
    mainLayout.addComponent(usernamel, "top:14.0px;left:17.0px;");

    // passwordl
    passwordl = new Label();
    passwordl.setImmediate(false);
    passwordl.setWidth("-1px");
    passwordl.setHeight("-1px");
    passwordl.setValue("Password");
    mainLayout.addComponent(passwordl, "top:47.0px;left:16.0px;");

    // username
    username = new TextField();
    username.setImmediate(false);
    username.setWidth("185px");
    username.setHeight("-1px");
    username.setSecret(false);
    mainLayout.addComponent(username, "top:11.0px;left:95.0px;");

    // password
    password = new TextField();
    password.setImmediate(false);
    password.setWidth("184px");
    password.setHeight("-1px");
    password.setSecret(false);
    mainLayout.addComponent(password, "top:43.0px;left:96.0px;");

    // signin
    signin = new Button();
    signin.setCaption("Sign in");
    signin.setImmediate(true);
    signin.setWidth("-1px");
    signin.setHeight("-1px");
    mainLayout.addComponent(signin, "top:88.0px;left:40.0px;");

    // checkBox_1
    checkBox_1 = new CheckBox();
    checkBox_1.setCaption("Remember me");
    checkBox_1.setImmediate(false);
    checkBox_1.setWidth("-1px");
    checkBox_1.setHeight("-1px");
    mainLayout.addComponent(checkBox_1, "top:91.0px;left:129.0px;");

    // loginfailed
    loginfailed = new Label();
    loginfailed.setImmediate(false);
    loginfailed.setWidth("-1px");
    loginfailed.setHeight("-1px");
    loginfailed.setValue("<font color=\"red\">Login failed, please check your inputs.</font>");
    loginfailed.setContentMode(3);
    mainLayout.addComponent(loginfailed, "top:68.0px;left:53.0px;");

    return mainLayout;
}

From source file:fr.amapj.view.engine.grid.booleangrid.PopupBooleanGrid.java

License:Open Source License

private void addRow(int lig) {
    List<Object> cells = new ArrayList<Object>();

    Label dateLabel = new Label(param.leftPartLine.get(lig));
    dateLabel.addStyleName("big");
    dateLabel.addStyleName("align-center");
    dateLabel.setWidth(param.largeurCol + "px");
    cells.add(dateLabel);/*from   w ww .ja va  2s .  c  o m*/

    if (param.leftPartLine2 != null) {
        dateLabel = new Label(param.leftPartLine2.get(lig));
        dateLabel.addStyleName("big");
        dateLabel.addStyleName("align-center");
        dateLabel.setWidth(param.largeurCol + "px");
        cells.add(dateLabel);
    }

    for (int j = 0; j < param.nbCol; j++) {
        boolean box = param.box[lig][j];

        CheckBox checkbox = new CheckBox();
        checkbox.setValue(box);
        checkbox.addStyleName("align-center");
        checkbox.addStyleName("big");
        checkbox.setWidth((param.largeurCol - 10) + "px");
        cells.add(checkbox);
    }

    table.addItem(cells.toArray(), new Integer(lig));

}

From source file:fr.amapj.view.engine.tools.BaseUiTools.java

License:Open Source License

/**
 * Permet la saisied'une check box/*  w  ww  . ja va2s  .  c  o m*/
 * 
 */

static public CheckBox createCheckBoxField(String title) {
    CheckBox checkbox = new CheckBox();
    checkbox.addStyleName("align-center");
    checkbox.setImmediate(true);

    return checkbox;
}

From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java

License:Open Source License

private CheckBox createCheckBox(boolean value, int taille) {
    CheckBox cb = new CheckBox();
    cb.addStyleName("align-center");
    cb.setValue(value);//from w ww  .  j a  va  2  s . c o m
    cb.setWidth(taille + "px");
    cb.setImmediate(true);
    return cb;
}

From source file:fr.amapj.view.engine.tools.TableBuilder.java

License:Open Source License

public CheckBox createCheckBox(boolean value, int taille) {
    CheckBox cb = new CheckBox();
    cb.addStyleName("align-center");
    cb.setValue(value);/*w w  w .ja  v  a2s.com*/
    cb.setWidth(taille + "px");
    cb.setImmediate(true);
    return cb;
}

From source file:fr.amapj.view.views.cotisation.reception.PopupReceptionMasseCotisation.java

License:Open Source License

@Override
protected void createContent(VerticalLayout contentLayout) {
    listPartContainer = new BeanItemContainer<>(PeriodeCotisationUtilisateurDTO.class);

    // Bind it to a component
    beanTable = new Table("", listPartContainer);
    beanTable.setStyleName("big strong");

    beanTable.addGeneratedColumn("etatPaiement", new ColumnGenerator() {
        @Override/*from   ww  w . ja  v  a2  s.  co  m*/
        public Object generateCell(final Table source, final Object itemId, Object columnId) {
            final PeriodeCotisationUtilisateurDTO dto = (PeriodeCotisationUtilisateurDTO) itemId;

            if (dto.etatPaiementAdhesion == EtatPaiementAdhesion.ENCAISSE) {
                Label l = new Label("OUI");
                return l;
            } else {
                CheckBox box = new CheckBox();
                box.setValue(false);
                box.addValueChangeListener(new ValueChangeListener() {

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        Boolean b = (Boolean) event.getProperty().getValue();
                        if (b.booleanValue() == true) {
                            dto.etatPaiementAdhesion = EtatPaiementAdhesion.ENCAISSE;
                            dto.dateReceptionCheque = DateUtils.getDate();
                        } else {
                            dto.etatPaiementAdhesion = EtatPaiementAdhesion.A_FOURNIR;
                            dto.dateReceptionCheque = null;
                        }
                    }
                });
                return box;
            }

        }
    });

    // Gestion de la liste des colonnes visibles
    beanTable.setVisibleColumns("nomUtilisateur", "prenomUtilisateur", "montantAdhesion", "etatPaiement",
            "typePaiementAdhesion");

    beanTable.setColumnHeader("nomUtilisateur", "Nom");
    beanTable.setColumnHeader("prenomUtilisateur", "Prnom");
    beanTable.setColumnHeader("montantAdhesion", "Montant en ");
    beanTable.setColumnAlignment("montantAdhesion", Align.RIGHT);
    beanTable.setColumnHeader("etatPaiement", "Rceptionn");
    beanTable.setColumnAlignment("montantAdhesion", Align.CENTER);
    beanTable.setColumnHeader("typePaiementAdhesion", "Type");

    beanTable.setConverter("montantAdhesion", new CurrencyTextFieldConverter());

    beanTable.setSelectable(true);
    beanTable.setImmediate(true);

    beanTable.setSizeFull();

    contentLayout.addComponent(beanTable);
    contentLayout.setExpandRatio(beanTable, 1);

    listPartContainer.addAll(dtos);
}

From source file:gov.va.ehtac.appsonfhir.ui.Vitals.java

private IndexedContainer createIndexedContainerVitals(Collection<ObservationResults> collection) {
    IndexedContainer container = new IndexedContainer();
    container.addContainerProperty("selected", CheckBox.class, null);
    container.addContainerProperty("displayName", String.class, null);
    container.addContainerProperty("value", String.class, null);
    container.addContainerProperty("unitofmeasure", String.class, null);
    container.addContainerProperty("dateobserved", String.class, null);
    container.addContainerProperty("codesystem", String.class, null);
    container.addContainerProperty("code", String.class, null);
    container.addContainerProperty("status", String.class, null);
    container.addContainerProperty("reflow", String.class, null);
    container.addContainerProperty("refhigh", String.class, null);
    container.addContainerProperty("oObservation", ObservationResults.class, null);

    int i = 0;/*w w w .ja v a  2 s  .  c o  m*/
    for (ObservationResults p : collection) {
        i++;
        Integer id = new Integer(i);
        Item item = container.addItem(id);
        item.getItemProperty("selected").setValue(new CheckBox());
        item.getItemProperty("displayName").setValue(p.getDisplayName());
        item.getItemProperty("value").setValue(p.getValue());
        item.getItemProperty("unitofmeasure").setValue(p.getUnitOfMeasure());
        item.getItemProperty("dateobserved").setValue(p.getDateObserved());
        item.getItemProperty("codesystem").setValue(p.getCodeSystem());
        item.getItemProperty("code").setValue(p.getCode());
        item.getItemProperty("status").setValue(p.getStatus());
        item.getItemProperty("reflow").setValue(p.getRefLow());
        item.getItemProperty("refhigh").setValue(p.getRefHigh());
        item.getItemProperty("oObservation").setValue(p);
    }
    return container;
}