List of usage examples for com.vaadin.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPage2.java
License:Open Source License
@SuppressWarnings("serial") private void maybeAddHiddenCheckBoxTL(HorizontalLayout hl, ActionPlan ap) { User me = Mmowgli2UI.getGlobals().getUserTL(); if (me.isAdministrator() || me.isGameMaster()) { Label sp;// www . j a v a2s . c o m hl.addComponent(sp = new Label()); sp.setWidth("80px"); final CheckBox hidCb = new CheckBox("hidden"); hidCb.setValue(ap.isHidden()); hidCb.setDescription("Only game masters see this"); hidCb.setImmediate(true); hl.addComponent(hidCb); hl.setComponentAlignment(hidCb, Alignment.BOTTOM_RIGHT); hidCb.addValueChangeListener(new ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); ActionPlan acntp = ActionPlan.getTL(getApId()); boolean nowHidden = acntp.isHidden(); boolean tobeHidden = hidCb.getValue(); if (nowHidden != tobeHidden) { acntp.setHidden(tobeHidden); ActionPlan.updateTL(acntp); } HSess.close(); } }); final CheckBox supIntCb = new CheckBox("super interesting"); supIntCb.setValue(ap.isSuperInteresting()); supIntCb.setDescription("Mark plan super-interesting (only game masters see this)"); supIntCb.setImmediate(true); hl.addComponent(supIntCb); hl.setComponentAlignment(supIntCb, Alignment.BOTTOM_RIGHT); supIntCb.addValueChangeListener(new ValueChangeListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); ActionPlan acntp = ActionPlan.getTL(getApId()); boolean nowSupInt = acntp.isSuperInteresting(); boolean tobeSupInt = supIntCb.getValue(); if (nowSupInt != tobeSupInt) { acntp.setSuperInteresting(tobeSupInt); ActionPlan.updateTL(acntp); } HSess.close(); } }); } }
From source file:fi.jasoft.simplecalendar.demo.SimpleCalendarDemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { setLocale(DEFAULT_LOCALE);// w ww . j ava2 s . c om VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); Label lbl = new Label("SimpleCalendar"); lbl.setStyleName(Reindeer.LABEL_H1); content.addComponent(lbl); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setSpacing(true); final SimpleCalendar calendar = new SimpleCalendar(); calendar.setImmediate(true); calendar.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { Notification.show(calendar.getValue().toString()); } }); calendar.setMultiSelect(true); layout.addComponent(calendar); Label description = new Label("A calendar component that supports the following features:<ul>" + "<li>Selecting multiple dates by control click</li>" + "<li>Range selection with shift click</li>" + "<li>Keyboard navigation with arrow keys</li>" + "<li>Possibility to disable certain dates</li>" + "<li>Date tooltips</li>" + "<li>Limit start and end dates of calendar</li>" + "<li>Selecting multiple locales", ContentMode.HTML); layout.addComponent(description); layout.setExpandRatio(description, 1); content.addComponent(layout); BeanItemContainer<Locale> locales = new BeanItemContainer<Locale>(Locale.class); locales.addAll(Arrays.asList(Locale.getAvailableLocales())); NativeSelect localeSelect = new NativeSelect(); localeSelect.setContainerDataSource(locales); localeSelect.setValue(DEFAULT_LOCALE); localeSelect.setImmediate(true); localeSelect.setItemCaptionMode(ItemCaptionMode.PROPERTY); localeSelect.setItemCaptionPropertyId("displayName"); localeSelect.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { calendar.setLocale((Locale) event.getProperty().getValue()); } }); content.addComponent(new HorizontalLayout(new Label("Locale:"), localeSelect)); final CheckBox disableWeekends = new CheckBox("Disable weekends", false); disableWeekends.setImmediate(true); disableWeekends.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (disableWeekends.getValue()) { calendar.setDisabledWeekDays(Weekday.SATURDAY, Weekday.SUNDAY); } else { calendar.setDisabledWeekDays(); } } }); content.addComponent(disableWeekends); final CheckBox disable15th = new CheckBox("Disable 15th each month", false); disable15th.setImmediate(true); disable15th.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (disable15th.getValue()) { calendar.setDisabledMonthlyDates(15); } else { calendar.setDisabledMonthlyDates(); } } }); content.addComponent(disable15th); final CheckBox disableToday = new CheckBox("Disable todays date", false); disableToday.setImmediate(true); disableToday.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (disableToday.getValue()) { calendar.setDisabledDates(new Date()); } else { calendar.setDisabledDates(); } } }); content.addComponent(disableToday); final CheckBox allowFutureDate = new CheckBox("Only allow future dates", false); allowFutureDate.setImmediate(true); allowFutureDate.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (allowFutureDate.getValue()) { calendar.setStartDate(new Date()); } else { calendar.setStartDate(null); } } }); content.addComponent(allowFutureDate); final CheckBox allowPastDate = new CheckBox("Only allow past dates", false); allowPastDate.setImmediate(true); allowPastDate.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (allowPastDate.getValue()) { calendar.setEndDate(new Date()); } else { calendar.setEndDate(null); } } }); content.addComponent(allowPastDate); setContent(content); }
From source file:fr.amapj.view.engine.grid.booleangrid.PopupBooleanGrid.java
License:Open Source License
/** * Retourne la valeur dans la cellule sous la forme d'un boolean * jette une exception si il y a une erreur *///w ww .j ava2 s . com private boolean readValueInCell(CheckBox tf) { return tf.getValue().booleanValue(); }
From source file:fr.amapj.view.views.gestioncontratsignes.modifiermasse.date.PopupDeBarrerDateLivraison.java
License:Open Source License
private String readDateToDebarrer() { modeleContratDateToDebarrer.clear(); for (int i = 0; i < datesBarrees.size(); i++) { ContratLigDTO lig = datesBarrees.get(i); // case cocher CheckBox cb = (CheckBox) builder.getComponent(i, "cb"); if (cb.getValue() == true) { modeleContratDateToDebarrer.add(lig); }/*from w w w .j a v a 2 s. c o m*/ } if (modeleContratDateToDebarrer.size() == 0) { return "Vous devez choisir au moins une date pour pouvoir continuer."; } return null; }
From source file:fr.amapj.view.views.gestioncontratsignes.modifiermasse.produit.PopupProduitSuppression.java
License:Open Source License
private String readProduitsToSuppress() { modeleContratProduitsToSuppress.clear(); for (int i = 0; i < modeleContrat.produits.size(); i++) { LigneContratDTO lig = modeleContrat.produits.get(i); // case du prix CheckBox cb = (CheckBox) builder.getComponent(i, "cb"); if (cb.getValue() == true) { modeleContratProduitsToSuppress.add(lig.idModeleContratProduit); }//from w w w . ja va 2s.co m } if (modeleContratProduitsToSuppress.size() == 0) { return "Vous devez supprimer au moins un produit pour pouvoir continuer."; } return null; }
From source file:fr.amapj.view.views.gestioncontratsignes.ReceptionChequeEditorPart.java
License:Open Source License
public boolean performSauvegarder() { for (int i = 0; i < paiements.size(); i++) { DatePaiementDTO paiement = paiements.get(i); Item item = t.getItem(i);/*w w w .ja v a 2s . c om*/ // case cocher CheckBox cb = (CheckBox) item.getItemProperty("box").getValue(); if (cb.getValue().booleanValue() == true) { paiement.etatPaiement = EtatPaiement.AMAP; } else { paiement.etatPaiement = EtatPaiement.A_FOURNIR; } // Commentaire 1 if (peConf.saisieCommentaire1 == ChoixOuiNon.OUI) { TextField tf = (TextField) item.getItemProperty("c1").getValue(); paiement.commentaire1 = tf.getValue(); } // Commentaire 2 if (peConf.saisieCommentaire2 == ChoixOuiNon.OUI) { TextField tf = (TextField) item.getItemProperty("c2").getValue(); paiement.commentaire2 = tf.getValue(); } } new MesPaiementsService().receptionCheque(paiements); return true; }
From source file:fr.amapj.view.views.permanence.periode.update.PopupDeleteUtilisateurForPeriodePermanence.java
License:Open Source License
private String checkUtilisateur() { utilisateurToSuppress.clear();/* www.ja va2 s .com*/ for (int i = 0; i < dto.utilisateurs.size(); i++) { PeriodePermanenceUtilisateurDTO lig = dto.utilisateurs.get(i); // CheckBox cb = (CheckBox) builder.getComponent(i, "cb"); if (cb.getValue() == true) { utilisateurToSuppress.add(lig); } } if (utilisateurToSuppress.size() == 0) { return "Vous devez supprimer au moins un utilisateur pour pouvoir continuer."; } return null; }
From source file:jp.primecloud.auto.ui.ServerButtonsBottom.java
License:Open Source License
private void startButtonClick(Button.ClickEvent event) { final InstanceDto instance = (InstanceDto) sender.serverPanel.serverTable.getValue(); PlatformDto platform = instance.getPlatform(); // AWS??// www. j a v a 2s . c om if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatform().getPlatformType())) { // ???????? if (BooleanUtils.isTrue(platform.getPlatformAws().getVpc()) && StringUtils.isEmpty(instance.getAwsInstance().getSubnetId())) { throw new AutoApplicationException("IUI-000111"); } } // Azure?? else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatform().getPlatformType())) { // ???????? if (StringUtils.isEmpty(instance.getAzureInstance().getSubnetId())) { throw new AutoApplicationException("IUI-000111"); } // ? ProcessService processService = BeanContext.getBean(ProcessService.class); boolean startupErrFlg = processService.checkStartup(platform.getPlatform().getPlatformType(), instance.getAzureInstance().getInstanceName(), instance.getAzureInstance().getInstanceNo()); if (startupErrFlg == true) { // ???????????? // ?No??? throw new AutoApplicationException("IUI-000133"); } } // ? VerticalLayout optionLayout = null; final CheckBox checkBox; String enableService = Config.getProperty("ui.enableService"); if (enableService == null || BooleanUtils.toBoolean(enableService)) { optionLayout = new VerticalLayout(); checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false); checkBox.setImmediate(true); optionLayout.addComponent(checkBox); optionLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_CENTER); } else { checkBox = null; } // ? String actionName = event.getButton().getDescription(); String message = ViewMessages.getMessage("IUI-000013", new Object[] { instance.getInstance().getInstanceName(), actionName }); DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message, Buttons.OKCancel, optionLayout); dialog.setCallback(new DialogConfirm.Callback() { @Override public void onDialogResult(Result result) { if (result != Result.OK) { return; } boolean startService = (checkBox == null) ? false : (Boolean) checkBox.getValue(); start(instance.getInstance().getInstanceNo(), startService); } }); getApplication().getMainWindow().addWindow(dialog); }
From source file:jp.primecloud.auto.ui.ServerButtonsTop.java
License:Open Source License
private void startAllButtonClick(ClickEvent event) { // ?/* www .j a va 2 s. c om*/ VerticalLayout optionLayout = null; final CheckBox checkBox; String enableService = Config.getProperty("ui.enableService"); if (enableService == null || BooleanUtils.toBoolean(enableService)) { optionLayout = new VerticalLayout(); checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false); checkBox.setImmediate(true); optionLayout.addComponent(checkBox); optionLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_CENTER); } else { checkBox = null; } // ? String message = ViewMessages.getMessage("IUI-000011"); DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message, Buttons.OKCancelConfirm, optionLayout); dialog.setCallback(new DialogConfirm.Callback() { @Override public void onDialogResult(Result result) { if (result != Result.OK) { return; } boolean startService = (checkBox == null) ? false : (Boolean) checkBox.getValue(); startAll(startService); } }); getApplication().getMainWindow().addWindow(dialog); }
From source file:jp.primecloud.auto.ui.ServerTable.java
License:Open Source License
public void playButtonClick(Button.ClickEvent event) { final InstanceDto dto = (InstanceDto) this.getValue(); final int index = this.getCurrentPageFirstItemIndex(); final PlatformDto platform = dto.getPlatform(); ProcessService processService = BeanContext.getBean(ProcessService.class); boolean vpc = false; String subnetId = null;//from ww w . j a va 2 s. c om boolean subnetErrFlg; if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatform().getPlatformType())) { // ?? vpc = platform.getPlatformAws().getVpc(); subnetId = dto.getAwsInstance().getSubnetId(); subnetErrFlg = processService.checkSubnet(platform.getPlatform().getPlatformType(), vpc, subnetId); if (subnetErrFlg == true) { //EC2+VPC?????????? DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"), ViewMessages.getMessage("IUI-000111")); getApplication().getMainWindow().addWindow(dialog); return; } } if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatform().getPlatformType())) { // ?? subnetId = dto.getAzureInstance().getSubnetId(); subnetErrFlg = processService.checkSubnet(platform.getPlatform().getPlatformType(), vpc, subnetId); if (subnetErrFlg == true) { // ??????? DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"), ViewMessages.getMessage("IUI-000111")); getApplication().getMainWindow().addWindow(dialog); return; } // ? boolean startupErrFlg; startupErrFlg = processService.checkStartup(platform.getPlatform().getPlatformType(), dto.getAzureInstance().getInstanceName(), dto.getAzureInstance().getInstanceNo()); if (startupErrFlg == true) { // ???????????? // ?No??? DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"), ViewMessages.getMessage("IUI-000133")); getApplication().getMainWindow().addWindow(dialog); return; } } HorizontalLayout optionLayout = new HorizontalLayout(); final CheckBox checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false); checkBox.setImmediate(true); optionLayout.addComponent(checkBox); String actionName = event.getButton().getDescription(); String message = ViewMessages.getMessage("IUI-000013", new Object[] { dto.getInstance().getInstanceName(), actionName }); DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message, Buttons.OKCancel, optionLayout); dialog.setCallback(new DialogConfirm.Callback() { @Override public void onDialogResult(Result result) { if (result != Result.OK) { return; } ProcessService processService = BeanContext.getBean(ProcessService.class); Long farmNo = ViewContext.getFarmNo(); List<Long> list = new ArrayList<Long>(); list.add(dto.getInstance().getInstanceNo()); boolean startService = (Boolean) checkBox.getValue(); // AutoApplication apl = (AutoApplication) getApplication(); apl.doOpLog("SERVER", "Start Server", dto.getInstance().getInstanceNo(), null, null, String.valueOf(startService)); processService.startInstances(farmNo, list, startService); sender.refreshTable(); // ????????? for (Object itemId : getItemIds()) { InstanceDto dto2 = (InstanceDto) itemId; if (dto.getInstance().getInstanceNo().equals(dto2.getInstance().getInstanceNo())) { select(itemId); setCurrentPageFirstItemIndex(index); setButtonStatus(dto2.getInstance()); break; } } } }); getApplication().getMainWindow().addWindow(dialog); }