本文整理匯總了Java中com.vaadin.data.Container.Viewer方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.Viewer方法的具體用法?Java Container.Viewer怎麽用?Java Container.Viewer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.data.Container
的用法示例。
在下文中一共展示了Container.Viewer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildSelectorProviders
import com.vaadin.data.Container; //導入方法依賴的package包/類
protected void buildSelectorProviders(Map<String, AbstractComponent> mapComponents, VaadinFormInstance formInstance) {
for (AbstractComponent component : mapComponents.values()) {
if (component.getData() instanceof VaadinDataObject) {
VaadinDataObject dataObject = (VaadinDataObject) component.getData();
Field field = dataObject.getField();
if (field.getType().equals(SelectorConstants.TYPE_SELECTOR)) {
if (component instanceof Container.Viewer) {
Container.Viewer viewer = (Container.Viewer) component;
SelectorProviderFactory factory = (SelectorProviderFactory) field
.getExtra(SelectorConstants.EXTRA_SELECTOR_PROVIDER_FACTORY);
viewer.setContainerDataSource(new VaadinSelectorContainer(factory.createSelectorProvider(formInstance)));
}
}
}
}
}
示例2: replaceFormInstanceReferences
import com.vaadin.data.Container; //導入方法依賴的package包/類
private void replaceFormInstanceReferences(VaadinFormInstance delegate, VaadinBindingFormInstance<?> real) {
for (String fieldId : delegate.getFieldIds()) {
AbstractComponent component = delegate.getComponentById(fieldId);
if (component.getData() instanceof VaadinDataObject) {
VaadinDataObject dataObject = (VaadinDataObject) component.getData();
Field field = dataObject.getField();
if (field.getType().equals(SelectorConstants.TYPE_SELECTOR)) {
if (component instanceof Container.Viewer) {
final Container.Viewer viewer = (Container.Viewer) component;
SelectorProviderFactory factory = (SelectorProviderFactory) field
.getExtra(SelectorConstants.EXTRA_SELECTOR_PROVIDER_FACTORY);
final VaadinSelectorContainer container = new VaadinSelectorContainer(factory.createSelectorProvider(real));
if (viewer instanceof AbstractSelect) {
final AbstractSelect abstractSelect = (AbstractSelect) viewer;
container.addListener(new Container.ItemSetChangeListener() {
@Override
public void containerItemSetChange(ItemSetChangeEvent event) {
boolean readOnly = abstractSelect.isReadOnly();
abstractSelect.setReadOnly(false);
abstractSelect.sanitizeSelection();
abstractSelect.setReadOnly(readOnly);
}
});
viewer.setContainerDataSource(container);
}
}
}
}
}
}