當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckBox.setValue方法代碼示例

本文整理匯總了Java中com.vaadin.ui.CheckBox.setValue方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckBox.setValue方法的具體用法?Java CheckBox.setValue怎麽用?Java CheckBox.setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.CheckBox的用法示例。


在下文中一共展示了CheckBox.setValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateCell

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {

	CheckBox assignmentColumn = new CheckBox();
	assignmentColumn.setImmediate(true);
	
	final Application applicationItem = (Application) itemId;
	
	assignmentColumn.setValue(containsApp(applicationItem));

	assignmentColumn.addListener(new ValueChangeListener() {
		@Override
		public void valueChange(Property.ValueChangeEvent event) {
			boolean assignmentValue = (Boolean) event.getProperty().getValue();

			if (assignmentValue)
				user.getApplications().add(applicationItem);
			else 
				user.getApplications().remove(getApp(applicationItem));

		}

	});

	return assignmentColumn;
}
 
開發者ID:thingtrack,項目名稱:konekti,代碼行數:27,代碼來源:UserApplicationCollectionField.java

示例2: setValue

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
@Override
public void setValue(String newValue) throws com.vaadin.data.Property.ReadOnlyException
{
	for (CheckBox box : boxes)
	{
		box.setValue(false);
	}
	if (newValue != null && newValue.length() > 0)
	{
		String[] values = newValue.split(",");
		for (String value : values)
		{
			int index = Integer.parseInt(value);
			if (index > 0)
			{
				boxes.get(index - 1).setValue(true);
			}
		}
	}

}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:22,代碼來源:DayOfWeekCheckBoxes.java

示例3: DroitProfilMembreCommWindow

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
/**
 * Constructeur de la fenêtre de profil pour membre de commission
 */
public DroitProfilMembreCommWindow() {
	super(NomenclatureUtils.DROIT_PROFIL_COMMISSION);
	
	/*CheckBox idPresident pour les commissions*/
	cbIsPresident = new CheckBox(applicationContext.getMessage("droitprofilind.table.individu.isPres", null, Locale.getDefault()));
	cbIsPresident.setValue(false);
	addOption(cbIsPresident);
	setMinExpendRatio();
	setOptionLayoutWidth(150);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:14,代碼來源:DroitProfilMembreCommWindow.java

示例4: initSelectionMode

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
/**
 * Init selection mode
 */
private void initSelectionMode() {
	final CheckBox checkBox = new CheckBox("Multi Select");
	addComponent(checkBox);
	checkBox.setImmediate(true);
	checkBox.setValue(false);
	checkBox.addValueChangeListener(new ValueChangeListener() {

		/**
		 * 
		 */
		private static final long serialVersionUID = -1261311232228188664L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if (checkBox.getValue()) {
				grid.setSelectionMode(SelectionMode.MULTI);
				grid.recalculateColumnWidths();
				// Seems to be some bug in Vaadin Grid when expand ration is
				// not given the column shrinks and this is visible when
				// selection mode is single
				for (Column column : grid.getColumns()) {
					column.setExpandRatio(1);
				}
			} else {
				grid.setSelectionMode(SelectionMode.SINGLE);
			}
		}
	});
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:33,代碼來源:BasicGridView.java

示例5: getPropertyField

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
@Override
public Field getPropertyField(FormProperty formProperty) {
  
  CheckBox checkBox = new CheckBox(getPropertyLabel(formProperty));
  checkBox.setRequired(formProperty.isRequired());
  checkBox.setEnabled(formProperty.isWritable());

  if (formProperty.getValue() != null) {
    checkBox.setValue(formProperty.getValue());
  }

  return checkBox;
}
 
開發者ID:logicalhacking,項目名稱:SecureBPMN,代碼行數:14,代碼來源:BooleanFormPropertyRenderer.java

示例6: addSetting

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
protected AbstractField<?> addSetting(String text, String globalSetting, String defaultValue,
        String description, Class<?> converter) {
    final GlobalSetting setting = getGlobalSetting(globalSetting, defaultValue);
    AbstractField<?> field = null;
    if (Boolean.class.equals(converter)) {
        final CheckBox checkbox = new CheckBox(text);
        checkbox.setImmediate(true);
        checkbox.setValue(Boolean.parseBoolean(setting.getValue()));
        checkbox.addValueChangeListener(
                (e) -> saveSetting(setting, checkbox.getValue().toString()));
        field = checkbox;
    } else {
        field = new ImmediateUpdateTextField(text) {
            protected void save(String value) {
                saveSetting(setting, value);
            }
        };
        field.setDescription(description);
        ((ImmediateUpdateTextField) field).setValue(setting.getValue());

        if (converter != null) {
            field.setConverter(converter);
        }
    }
    form.addComponent(field);
    return field;
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:28,代碼來源:GeneralSettingsPanel.java

示例7: display

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public void display() {
    this.setWidth("100%");
    this.addStyleName("tm-container");
    this.setSpacing(true);
    this.setMargin(new MarginInfo(false, false, true, false));

    MHorizontalLayout headerLayout = new MHorizontalLayout().withStyleName(WebThemes.PANEL_HEADER, "wrapped");
    headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE));

    final CheckBox noDateSetMilestone = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET));
    noDateSetMilestone.setValue(false);

    final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed));
    includeClosedMilestone.setValue(false);

    noDateSetMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue()));
    includeClosedMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue()));
    headerLayout.with(titleLbl, noDateSetMilestone, includeClosedMilestone).expand(titleLbl).withAlign
            (noDateSetMilestone, Alignment.MIDDLE_RIGHT).withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));

    this.addComponent(headerLayout);
    timelineContainer = new CssLayout();
    timelineContainer.setWidth("100%");
    this.addComponent(timelineContainer);
    timelineContainer.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:35,代碼來源:MilestoneTimelineWidget.java

示例8: display

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public void display() {
    this.withMargin(new MarginInfo(false, false, true, false)).withStyleName("tm-container").withFullWidth();

    MHorizontalLayout headerLayout = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withStyleName(WebThemes.PANEL_HEADER, "wrapped");
    headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE));

    final CheckBox includeNoDateSet = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET));
    includeNoDateSet.setValue(false);

    final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed));
    includeClosedMilestone.setValue(false);

    includeNoDateSet.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue()));
    includeClosedMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue()));
    headerLayout.with(titleLbl, includeNoDateSet, includeClosedMilestone).expand(titleLbl).withAlign(includeNoDateSet, Alignment
            .MIDDLE_RIGHT).withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));

    this.addComponent(headerLayout);
    timelineContainer = new CssLayout();
    timelineContainer.setWidth("100%");
    this.addComponent(timelineContainer);
    timelineContainer.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:34,代碼來源:AllMilestoneTimelineWidget.java

示例9: unsetDefaultOrganization

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private void unsetDefaultOrganization(String code) {
	for (Object itemId: userOrganizationTreeTable.getItemIds()) {
		Item item = userOrganizationTreeTable.getItem(itemId);
		
		CheckBox defaultOrganizationCheckbox = (CheckBox)item.getItemProperty("Defecto").getValue();
		
		if (defaultOrganizationCheckbox.getData() instanceof Organization) {
			if (!((Organization)defaultOrganizationCheckbox.getData()).getCode().equals(code))
				defaultOrganizationCheckbox.setValue(false);
		}
	}
	
}
 
開發者ID:thingtrack,項目名稱:konekti,代碼行數:14,代碼來源:UserOrganizationCollectionField.java

示例10: unsetDefaultLocation

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private void unsetDefaultLocation(String code) {
	for (Object itemId: userOrganizationTreeTable.getItemIds()) {
		Item item = userOrganizationTreeTable.getItem(itemId);
		
		CheckBox defaultLocationCheckbox = (CheckBox)item.getItemProperty("Defecto").getValue();
		
		if (defaultLocationCheckbox.getData() instanceof Location) {
			if (!((Location)defaultLocationCheckbox.getData()).getCode().equals(code))
				defaultLocationCheckbox.setValue(false);
		}
	}
	
}
 
開發者ID:thingtrack,項目名稱:konekti,代碼行數:14,代碼來源:UserOrganizationCollectionField.java

示例11: unsetDefaultArea

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private void unsetDefaultArea(String code) {
	for (Object itemId: userOrganizationTreeTable.getItemIds()) {
		Item item = userOrganizationTreeTable.getItem(itemId);
		
		CheckBox defaultAreaCheckbox = (CheckBox)item.getItemProperty("Defecto").getValue();
		
		if (defaultAreaCheckbox.getData() instanceof Area) {
			if (!((Area)defaultAreaCheckbox.getData()).getCode().equals(code))
				defaultAreaCheckbox.setValue(false);			
		}
	}
	
}
 
開發者ID:thingtrack,項目名稱:konekti,代碼行數:14,代碼來源:UserOrganizationCollectionField.java

示例12: init

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {

    // panel with standard toggle icons and icon
    Panel section0 = new SectionPanel("StackPanel with icon");
    section0.setIcon(VaadinIcons.ADJUST);
    StackPanel.extend(section0);

    // panel with standard toggle icons
    Panel section1 = new SectionPanel("StackPanel");
    StackPanel.extend(section1);

    // panel with individual icons
    Panel section2 = new SectionPanel("StackPanel with individual toggle icons");
    StackPanel panel2 = StackPanel.extend(section2);
    panel2.setToggleDownIcon(VaadinIcons.CARET_SQUARE_DOWN_O);
    panel2.setToggleUpIcon(VaadinIcons.CARET_SQUARE_UP_O);

    // panel without toggle icons
    Panel section3 = new SectionPanel("StackPanel without icons");
    StackPanel panel3 = StackPanel.extend(section3);
    panel3.setToggleIconsEnabled(false);

    // panel without toggle icons
    Panel section4 = new SectionPanel("StackPanel with toggle listener");
    StackPanel panel4 = StackPanel.extend(section4);
    panel4.addToggleListener(new ToggleListener() {

        @Override
        public void toggleClick(StackPanel source) {
            Notification.show("Toggle Listener fired!");
        }
    });

    // panel with caption as html
    Panel section5 = new SectionPanel("StackPanel <b>with caption as html</b>");
    section5.setCaptionAsHtml(true);
    section5.setIcon(VaadinIcons.CART);
    StackPanel panel5 = StackPanel.extend(section5);
    CheckBox enableDisable = new CheckBox("Section 5 enabled");
    enableDisable.setValue(true);
    enableDisable.addValueChangeListener((v) -> {
        panel5.setToggleEnabled(v.getValue());
    });
    panel5.addToggleDisabledClickListener(s -> Notification.show("Header Clicked!"));
    panel5.addToggleListener(s -> Notification.show("Toggle Clicked!"));
    setContent(new VerticalLayout(section0, section1, section2, section3, section4, section5, enableDisable));
}
 
開發者ID:mouellet,項目名稱:vaadin-stackpanel,代碼行數:49,代碼來源:DemoUI.java

示例13: buildProjectsAndVersions

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
protected Panel buildProjectsAndVersions(String releasePackageId) {
    Panel projectsAndVersionsPanel = new Panel("Projects and Branches");
    projectsAndVersionsPanel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
    projectsAndVersionsPanel.setSizeFull();

    VerticalLayout projectLayout = new VerticalLayout();
    projectLayout.setMargin(true);
    projectCheckboxes.clear();
    projectVersionOptionGroups.clear();
    List<Project> projects = configurationService.findProjects();
    for (Project project : projects) {
        //first allow the user to select or unselect a project
        CheckBox checkBox = new CheckBox(project.getName());
        checkBox.setData(project.getId());
        if (releasePackage.isReleased()) {
            checkBox.setEnabled(false);
        }
        projectLayout.addComponent(checkBox);
        //now put the project version options for each project            
        OptionGroup optionGroup = new OptionGroup();   
        optionGroup.addStyleName("indent");
        List<Rppv> rppvs = configurationService.findReleasePackageProjectVersions(releasePackageId);
        Set<String> projectVersionsInReleasePackage = getListOfProjectVersionsInReleasePackages(rppvs);
        for (ProjectVersion projectVersion : project.getProjectVersions()) {
            optionGroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
            optionGroup.addItem(projectVersion.getId());
            optionGroup.setEnabled(false);
            optionGroup.setItemCaption(projectVersion.getId(),projectVersion.getName());
            if (projectVersionsInReleasePackage.contains(projectVersion.getId())) {
                checkBox.setValue(true);
                optionGroup.select(projectVersion.getId());
                if (!releasePackage.isReleased()) {
                    optionGroup.setEnabled(true);
                }
            }
            projectVersionOptionGroups.put(project.getId(), optionGroup);
            projectLayout.addComponent(optionGroup);
        }
        projectCheckboxes.add(checkBox);
        checkBox.addValueChangeListener(e -> projectSelectionListener(e));
    }
    
    projectsAndVersionsPanel.setContent(projectLayout);
    return projectsAndVersionsPanel;
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:46,代碼來源:EditReleasePackageDialog.java

示例14: GroupEditPanel

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public GroupEditPanel(ApplicationContext context, Group group) {
    this.context = context;
    this.group = group;

    FormLayout layout = new FormLayout();

    TextField nameField = new TextField("Group Name", StringUtils.trimToEmpty(group.getName()));
    nameField.addValueChangeListener(new NameChangeListener());
    layout.addComponent(nameField);
    nameField.focus();
    
    readOnly = new CheckBox("Read Only");
    readOnly.setEnabled(isNotBlank(group.getName()));
    readOnly.setImmediate(true);
    readOnly.setValue(group.isReadOnly());
    readOnly.addValueChangeListener(new ReadOnlyChangeListener());
    layout.addComponent(readOnly);
    
    privSelect = new TwinColSelect();
    privSelect.setEnabled(isNotBlank(group.getName()));
    for (Privilege priv : Privilege.values()) {
        privSelect.addItem(priv.name());
    }
    lastPrivs = new HashSet<String>();
    for (GroupPrivilege groupPriv : group.getGroupPrivileges()) {
        lastPrivs.add(groupPriv.getName());
    }
    privSelect.setValue(lastPrivs);
    privSelect.setRows(20);
    privSelect.setNullSelectionAllowed(true);
    privSelect.setMultiSelect(true);
    privSelect.setImmediate(true);
    privSelect.setLeftColumnCaption("Available privileges");
    privSelect.setRightColumnCaption("Selected privileges");
    privSelect.addValueChangeListener(new PrivilegeChangeListener());
    layout.addComponent(privSelect);

    addComponent(layout);
    setMargin(true);
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:41,代碼來源:GroupEditPanel.java

示例15: show

import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public void show(List<ComponentDto> components) {
    this.components = components;

    removeAllItems();

    if (components == null) {
        return;
    }

    for (ComponentDto component : components) {
        // チェックボックス
        CheckBox checkBox = new CheckBox();
        checkBox.setImmediate(true);
        checkBox.setEnabled(false);
        if (selectedComponentNos.contains(component.getComponent().getComponentNo())) {
            checkBox.setValue(true);
        } else {
            checkBox.setValue(false);
        }

        checkBox.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                // チェックボックスの有効/無効を製禦
                changeCheckEnabled();

                // テーブル再描畫
                requestRepaint();
            }
        });

        // サービス名
        String serviceName = component.getComponent().getComponentName();
        if (StringUtils.isNotEmpty(component.getComponent().getComment())) {
            serviceName = component.getComponent().getComment() + "\n[" + serviceName + "]";
        }
        Label serviceNameLabel = new Label(serviceName, Label.CONTENT_PREFORMATTED);
        serviceNameLabel.setHeight(COLUMN_HEIGHT);

        // ステータス
        String status = null;
        if (instance != null) {
            for (ComponentInstanceDto componentInstance : instance.getComponentInstances()) {
                if (componentInstance.getComponentInstance().getComponentNo()
                        .equals(component.getComponent().getComponentNo())) {
                    status = componentInstance.getComponentInstance().getStatus();
                    break;
                }
            }
        }
        if (StringUtils.isEmpty(status)) {
            status = "Stopped";
        } else {
            status = StringUtils.capitalize(StringUtils.lowerCase(status));
        }

        Icons statusIcon = Icons.fromName(status);
        Label statusLabel = new Label(IconUtils.createImageTag(getApplication(), statusIcon, status),
                Label.CONTENT_XHTML);
        statusLabel.setHeight(COLUMN_HEIGHT);

        addItem(new Object[] { checkBox, serviceNameLabel, statusLabel }, component.getComponent()
                .getComponentNo());
    }

    changeCheckEnabled();
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:68,代碼來源:WinServerAttachService.java


注:本文中的com.vaadin.ui.CheckBox.setValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。