本文整理匯總了Java中com.vaadin.ui.CheckBox.addValueChangeListener方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckBox.addValueChangeListener方法的具體用法?Java CheckBox.addValueChangeListener怎麽用?Java CheckBox.addValueChangeListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.CheckBox
的用法示例。
在下文中一共展示了CheckBox.addValueChangeListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createAttributeCheckBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
protected CheckBox createAttributeCheckBox(final AttributeSettings settings, final String key) {
final CheckBox checkBox = new CheckBox();
checkBox.setImmediate(true);
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.FALSE.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;
}
示例2: createCheckBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private CheckBox createCheckBox(final AttributeSettings settings, final String key) {
final CheckBox checkBox = new CheckBox();
checkBox.setImmediate(true);
checkBox.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
ComponentAttribSetting setting = component.getSingleAttributeSetting(settings.getAttributeId(), key);
String oldValue = setting == null ? Boolean.FALSE.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: initView
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private VerticalLayout initView() {
final Label label = new Label(i18n.getMessage("label.auto.assign.description"));
checkBox = new CheckBox(i18n.getMessage("label.auto.assign.enable"));
checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID);
checkBox.setImmediate(true);
checkBox.addValueChangeListener(this);
setTableEnabled(false);
final VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.addComponent(label);
verticalLayout.addComponent(checkBox);
verticalLayout.addComponent(dsTable);
return verticalLayout;
}
示例4: ProjectOverdueTicketsWidget
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public ProjectOverdueTicketsWidget() {
super(String.format("%s (0)", UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS)), new CssLayout());
this.setWidth("100%");
final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
myItemsSelection.addValueChangeListener(valueChangeEvent -> {
boolean isMyItemsOption = myItemsSelection.getValue();
if (isMyItemsOption) {
searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
} else {
searchCriteria.setAssignUser(null);
}
updateSearchResult();
});
ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class),
new TicketRowDisplayHandler(false), 10) {
@Override
protected String stringWhenEmptyList() {
return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_OVERDUE_TICKET);
}
};
this.addHeaderElement(myItemsSelection);
bodyContent.addComponent(ticketList);
}
示例5: createEntityCheckBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
protected CheckBox createEntityCheckBox(final EntitySettings settings, final String key) {
final CheckBox checkBox = new CheckBox();
checkBox.setImmediate(true);
checkBox.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
ComponentEntitySetting setting = component.getSingleEntitySetting(settings.getEntityId(), key);
String oldValue = setting == null ? Boolean.TRUE.toString() : setting.getValue();
if (setting == null) {
setting = new ComponentEntitySetting(settings.getEntityId(), component.getId(), key, Boolean.TRUE.toString());
component.addEntitySetting(setting);
}
setting.setValue(checkBox.getValue().toString());
if (!oldValue.equals(setting.getValue())) {
context.getConfigurationService().save(setting);
}
}
});
checkBox.setReadOnly(readOnly);
return checkBox;
}
示例6: createCheckBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private CheckBox createCheckBox(final AttributeSettings settings, final String key) {
final CheckBox checkBox = new CheckBox();
checkBox.setImmediate(true);
if (!readOnly) {
checkBox.addValueChangeListener((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;
}
示例7: ProjectUnresolvedTicketsWidget
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public ProjectUnresolvedTicketsWidget() {
super("", new CssLayout());
this.setWidth("100%");
final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
myItemsSelection.addValueChangeListener(valueChangeEvent -> {
boolean isMyItemsOption = myItemsSelection.getValue();
if (isMyItemsOption) {
searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
} else {
searchCriteria.setAssignUser(null);
}
updateSearchResult();
});
taskList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class),
new TicketRowDisplayHandler(false), 10) {
@Override
protected String stringWhenEmptyList() {
return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET);
}
};
addHeaderElement(myItemsSelection);
bodyContent.addComponent(taskList);
}
示例8: UserUnresolvedTicketWidget
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
public UserUnresolvedTicketWidget() {
super("", new CssLayout());
this.setWidth("100%");
final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS));
myItemsSelection.addValueChangeListener(valueChangeEvent -> {
boolean isMyItemsOption = myItemsSelection.getValue();
if (searchCriteria != null) {
if (isMyItemsOption) {
searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername()));
} else {
searchCriteria.setAssignUser(null);
}
updateSearchResult();
}
});
ticketList = new DefaultBeanPagedList<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket>
(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(true), 10) {
@Override
protected String stringWhenEmptyList() {
return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET);
}
};
this.addHeaderElement(myItemsSelection);
this.bodyContent.addComponent(ticketList);
}
示例9: getPopupComponent
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
@Override
public Component getPopupComponent() {
final VerticalLayout layout = new VerticalLayout();
layout.setSizeUndefined();
layout.setMargin(true);
final boolean isLegalEntity = getValue() != null && getValue() instanceof LegalEntity;
final CheckBox isLegalEntityField = new CheckBox("Клиент Юр.лицо", isLegalEntity);
isLegalEntityField.setDescription("Отметте флаг, если клиент является юр.лицом");
isLegalEntityField.addValueChangeListener(event -> {
final Boolean isLE = isLegalEntityField.getValue();
if (getValue() != null)
if (!isLE && getValue() instanceof LegalEntity
|| isLE && getValue() instanceof Person)
setValue(null);
makePopup(layout, isLE);
});
layout.addComponent(isLegalEntityField);
makePopup(layout, isLegalEntity);
return layout;
}
示例10: generateCell
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
@Override
public Object generateCell(Table source, final Object itemId, Object columnId) {
Property<?> prop = source.getItem(itemId).getItemProperty(columnId);
CheckBox checkBox = new CheckBox(null, prop);
checkBox.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
serviceTableClicked((long) itemId);
}
});
return checkBox;
}
示例11: createLinearStepperBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private CheckBox createLinearStepperBox() {
CheckBox checkBox = new CheckBox("Linear Stepper *");
checkBox.setWidth(100, Unit.PERCENTAGE);
checkBox.addValueChangeListener(event -> {
createStepper();
fireEvent(new StepperCreateEvent(StepperPropertiesLayout.this, stepper));
});
return checkBox;
}
示例12: createTargetVisibleField
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
private CheckBox createTargetVisibleField() {
final CheckBox checkBox = new CheckBox();
checkBox.setId(UIComponentIdProvider.METADATA_TARGET_VISIBLE_ID);
checkBox.setCaption(i18n.getMessage("metadata.targetvisible"));
checkBox.addValueChangeListener(this::onCheckBoxChange);
return checkBox;
}
示例13: 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);
}
}
});
}
示例14: 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;
}
示例15: createAttributeCheckBox
import com.vaadin.ui.CheckBox; //導入方法依賴的package包/類
protected CheckBox createAttributeCheckBox(final RecordFormat record, final String key) {
final CheckBox checkBox = new CheckBox();
checkBox.setImmediate(true);
checkBox.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
ComponentAttribSetting setting = component.getSingleAttributeSetting(record.getAttributeId(), key);
String oldValue = setting == null ? Boolean.FALSE.toString() : setting.getValue();
if (setting == null) {
setting = new ComponentAttribSetting(record.getAttributeId(), component.getId(), key, Boolean.FALSE.toString());
component.addAttributeSetting(setting);
}
setting.setValue(checkBox.getValue().toString());
if (!oldValue.equals(setting.getValue())) {
context.getConfigurationService().save(setting);
Set<RecordFormat> attributes = new HashSet<>();
attributes.add(record);
if (oldValue.equals(Boolean.FALSE.toString())) {
moveItemsTo(attributes, getLastSortItemIndex(record.getEntityId(), record.getAttributeId(), true) + 1);
} else {
moveItemsTo(attributes, getLastSortItemIndex(record.getEntityId(), record.getAttributeId(), false));
}
}
calculatePositions();
saveOrdinalSettings();
saveSortSettings();
}
});
return checkBox;
}