本文整理匯總了Java中com.vaadin.ui.CheckBox.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckBox.setEnabled方法的具體用法?Java CheckBox.setEnabled怎麽用?Java CheckBox.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: createAttributeCheckBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
protected CheckBox createAttributeCheckBox(final AttributeSettings settings, final String key) {
final CheckBox checkBox = new CheckBox();
checkBox.setImmediate(true);
if (settings.isPrimaryKey()) {
checkBox.setEnabled(false);
}
checkBox.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
ComponentAttribSetting setting = component.getSingleAttributeSetting(settings.getAttributeId(), key);
String oldValue = setting == null ? Boolean.TRUE.toString() : setting.getValue();
if (setting == null) {
setting = new ComponentAttribSetting(settings.getAttributeId(), component.getId(), key, Boolean.TRUE.toString());
component.addAttributeSetting(setting);
}
setting.setValue(checkBox.getValue().toString());
if (!oldValue.equals(setting.getValue())) {
context.getConfigurationService().save(setting);
}
}
});
checkBox.setReadOnly(readOnly);
return checkBox;
}
示例3: 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;
}
示例4: 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);
}
示例5: 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();
}