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


Java Container.Viewer方法代碼示例

本文整理匯總了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)));
				}
			}
		}
	}

}
 
開發者ID:frincon,項目名稱:abstractform,代碼行數:18,代碼來源:VaadinFormToolkit.java

示例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);
					}
				}
			}
		}
	}
}
 
開發者ID:frincon,項目名稱:abstractform,代碼行數:34,代碼來源:VaadinBindingFormToolkit.java


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