Java源码示例:org.eclipse.jface.databinding.viewers.IViewerObservableValue
示例1
private void setupProjectSelectorDataBinding() {
IViewerObservableValue projectInput =
ViewerProperties.input().observe(projectSelector.getViewer());
IViewerObservableValue projectSelection =
ViewerProperties.singleSelection().observe(projectSelector.getViewer());
bindingContext.addValidationStatusProvider(
new ProjectSelectionValidator(projectInput, projectSelection, requireValues));
IViewerObservableValue projectList =
ViewerProperties.singleSelection().observe(projectSelector.getViewer());
IObservableValue<String> projectIdModel = PojoProperties.value("projectId").observe(model);
UpdateValueStrategy gcpProjectToProjectId =
new UpdateValueStrategy().setConverter(new GcpProjectToProjectIdConverter());
UpdateValueStrategy projectIdToGcpProject =
new UpdateValueStrategy().setConverter(new ProjectIdToGcpProjectConverter());
bindingContext.bindValue(projectList, projectIdModel,
gcpProjectToProjectId, projectIdToGcpProject);
}
示例2
@Override
protected IWizardPage getDefinitionSelectionWizardPage(
List<ConnectorImplementation> existingImplementation) {
return new AbstractDefinitionSelectionImpementationWizardPage(implWorkingCopy,existingImplementation,((IDefinitionRepositoryStore) defStore).getDefinitions(),getPageTitle(),getPageDescription(),messageProvider){
@Override
protected ITreeContentProvider getContentProvider() {
return new FilterUniqueDefinitionContentProvider();
}
@Override
protected ITreeContentProvider getCustomContentProvider() {
return new FilterUniqueDefinitionContentProvider(true);
}
@Override
protected void bindValue() {
final IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(explorer.getRightTableViewer());
context.bindValue(observeSingleSelection, EMFObservables.observeValue(implementation, ConnectorImplementationPackage.Literals.CONNECTOR_IMPLEMENTATION__DEFINITION_ID),defIdStrategy,defModelStrategy) ;
context.bindValue(ViewersObservables.observeSingleSelection(versionCombo), EMFObservables.observeValue(implementation, ConnectorImplementationPackage.Literals.CONNECTOR_IMPLEMENTATION__DEFINITION_VERSION));
}
};
}
示例3
public void bindControl(final Document document, final EObject context, final EMFDataBindingContext emfDataBindingContext) {
checkArgument(document != null);
checkArgument(context != null);
checkArgument(emfDataBindingContext != null);
final IObservableValue observeInput = ViewersObservables.observeInput(getContractInputComboViewer());
final IObservableValue multipleDocumentObervable = EMFObservables.observeValue(document, ProcessPackage.Literals.DOCUMENT__MULTIPLE);
emfDataBindingContext.bindValue(observeInput,
multipleDocumentObervable,
neverUpdateValueStrategy().create(),
updateValueStrategy().withConverter(toInputList(document, context)).create());
final IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(getContractInputComboViewer());
ControlDecorationSupport.create(emfDataBindingContext.bindValue(observeSingleSelection,
EMFObservables.observeValue(document, ProcessPackage.Literals.DOCUMENT__CONTRACT_INPUT)), SWT.LEFT);
emfDataBindingContext.addValidationStatusProvider(createContractInputParameter(document, observeInput, observeSingleSelection));
}
示例4
protected IWizardPage getDefinitionSelectionWizardPage(
List<ConnectorImplementation> existingImplementation) {
return new AbstractDefinitionSelectionImpementationWizardPage(implWorkingCopy,existingImplementation,((IDefinitionRepositoryStore) defStore).getDefinitions(),getSelectionPageTitle(),getSelectionPageDescription(),messageProvider){
@Override
protected ITreeContentProvider getContentProvider() {
return new UniqueConnectorDefinitionContentProvider();
}
@Override
protected ITreeContentProvider getCustomContentProvider() {
return new UniqueConnectorDefinitionContentProvider(true);
}
@Override
protected void bindValue() {
final IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(explorer.getRightTableViewer());
context.bindValue(observeSingleSelection, EMFObservables.observeValue(implementation, ConnectorImplementationPackage.Literals.CONNECTOR_IMPLEMENTATION__DEFINITION_ID),defIdStrategy,defModelStrategy) ;
context.bindValue(ViewersObservables.observeSingleSelection(versionCombo), EMFObservables.observeValue(implementation, ConnectorImplementationPackage.Literals.CONNECTOR_IMPLEMENTATION__DEFINITION_VERSION));
}
};
}
示例5
protected void updateSelectedConnectorDefinition(
final IViewerObservableValue observeSingleSelection,
IViewerObservableValue versionObservable, final AbstractDefinitionSelectionImpementationWizardPage thisPage) {
final Object o = observeSingleSelection.getValue();
if(o instanceof ConnectorDefinition){
ConnectorDefinition selectedDef = null;
String version = (String) versionObservable.getValue();
for(ConnectorDefinition def : definitions){
if(((ConnectorDefinition) o).getId().equals(def.getId()) && version.equals(def.getVersion())){
selectedDef = def;
break;
}
}
thisPage.setSelectedConnectorDefinition(selectedDef);
setPageComplete(true);
}
}
示例6
public void createBusinessVariableTableViewerComposite(final Composite parent, final DataBindingContext dbc) {
businessVariableTableViewerComposite = new Composite(parent, SWT.NONE);
businessVariableTableViewerComposite.setLayout(GridLayoutFactory.swtDefaults().create());
businessVariableTableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
final TableViewer businessDataTableViewer = new TableViewer(businessVariableTableViewerComposite,
SWT.BORDER | SWT.SINGLE | SWT.NO_FOCUS | SWT.H_SCROLL
| SWT.V_SCROLL);
businessDataTableViewer.getTable().setLayout(GridLayoutFactory.fillDefaults().create());
businessDataTableViewer.getTable()
.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create());
final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
businessDataTableViewer.setContentProvider(contentProvider);
final IObservableSet knownElements = contentProvider.getKnownElements();
final IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements,
new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME,
ProcessPackage.Literals.DATA__MULTIPLE,
ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME });
businessDataTableViewer
.setLabelProvider(new BusinessObjectDataStyledLabelProvider(businessObjectStore, labelMaps));
businessDataTableViewer
.setInput(new WritableList(availableBusinessData, ProcessPackage.Literals.BUSINESS_OBJECT_DATA));
final IViewerObservableValue observeSingleSelection = ViewersObservables
.observeSingleSelection(businessDataTableViewer);
dbc.bindValue(observeSingleSelection, selectedDataObservable);
businessVariableButton.addSelectionListener(createBusinessVariableSelectionAdapter());
}
示例7
public void createDocumentTableViewerComposite(final Composite parent, final DataBindingContext dbc) {
documentTableViewerComposite = new Composite(parent, SWT.NONE);
documentTableViewerComposite.setLayout(GridLayoutFactory.swtDefaults().create());
documentTableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
final TableViewer documentTableViewer = new TableViewer(documentTableViewerComposite,
SWT.BORDER | SWT.SINGLE | SWT.NO_FOCUS | SWT.H_SCROLL
| SWT.V_SCROLL);
documentTableViewer.getTable()
.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create());
final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
documentTableViewer.setContentProvider(contentProvider);
documentTableViewer.setLabelProvider(new DocumentStyledLabelProvider());
documentTableViewer.setInput(new WritableList(availableDocuments, ProcessPackage.Literals.DOCUMENT));
final IViewerObservableValue observeSingleSelection = ViewersObservables
.observeSingleSelection(documentTableViewer);
dbc.bindValue(observeSingleSelection, selectedDataObservable,
updateValueStrategy().withValidator(createDefaultValueAlreadyDefinedValidator()).create(), null);
documentButton.addSelectionListener(createDocumentSelectionAdapter());
}
示例8
public void bindControl(final DataBindingContext context, final IObservableValue dataContainerObservable) {
this.dataContainerObservable = dataContainerObservable;
IObservableSet knownElements = ((ObservableListContentProvider) tableViewer.getContentProvider())
.getKnownElements();
IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements,
new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME,
ProcessPackage.Literals.DATA__MULTIPLE,
ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME, ProcessPackage.Literals.DATA__DATA_TYPE });
tableViewer.setLabelProvider(createLabelProvider(labelMaps));
tableViewer.setInput(CustomEMFEditObservables.observeDetailList(Realm.getDefault(), dataContainerObservable,
dataFeature));
IViewerObservableValue<Object> selectionObservable = ViewerProperties.singleSelection().observe(tableViewer);
UpdateValueStrategy selectionNotNullUpdateValueStrategy = updateValueStrategy().withConverter(selectionNotNull())
.create();
context.bindValue(WidgetProperties.enabled().observe(editButton),
selectionObservable,
neverUpdateValueStrategy().create(),
selectionNotNullUpdateValueStrategy);
context.bindValue(WidgetProperties.enabled().observe(removeButton),
selectionObservable,
neverUpdateValueStrategy().create(),
selectionNotNullUpdateValueStrategy);
}
示例9
private String getSelectedReturnType() {
if (data.isMultiple()) {
return multipleReturnType;
}
final IViewerObservableValue selectedType = ViewersObservables.observeSingleSelection(typeCombo);
final DataType type = (DataType) selectedType.getValue();
if (type instanceof JavaType) {
final String className = ((JavaObjectData) data).getClassName();
if (className == null || className.isEmpty()) {
return String.class.getName();
}
return className;
} else if (type != null) {
final String technicalTypeFor = DataUtil
.getTechnicalTypeFor(ModelHelper.getMainProcess(container), type.getName()).replace(
Messages.dataTechnicalTypeLabel + " ", "");
if (technicalTypeFor.isEmpty()) {
return String.class.getName();
}
return technicalTypeFor;
}
return null;
}
示例10
private ProjectSelectionValidator(IViewerObservableValue projectInput,
IViewerObservableValue projectSelection,
boolean requireValues) {
this.projectInput = projectInput;
this.projectSelection = projectSelection;
this.requireValues = requireValues;
}
示例11
/**
* 对下拉列表和转换器列表进行绑定
* @param context
* @param comboViewer
* @param model
* ;
*/
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
示例12
/**
* 对下拉列表和转换器列表进行绑定
* @param context
* @param comboViewer
* @param model
* ;
*/
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
示例13
public static void bindValue(DataBindingContext context,ComboViewer comboViewer,
ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class);
context.bindValue(observableValue, BeansObservables
.observeValue(model,
"selectedType"));
}
示例14
/**
* 对下拉列表和转换器列表进行绑定
* @param context
* @param comboViewer
* @param model
* ;
*/
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
示例15
/**
* 对下拉列表和转换器列表进行绑定
* @param context
* @param comboViewer
* @param model
* ;
*/
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
示例16
public static void bindValue(DataBindingContext context,ComboViewer comboViewer,
ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class);
context.bindValue(observableValue, BeansObservables
.observeValue(model,
"selectedType"));
}
示例17
protected void createBusinessObjectTypeControl(final Composite mainComposite,
final EMFDataBindingContext ctx) {
final Label businessObjectLabel = new Label(mainComposite, SWT.NONE);
businessObjectLabel.setLayoutData(fillDefaults().align(SWT.END, SWT.CENTER).create());
businessObjectLabel.setText(Messages.businessObject + " *");
final Composite comboComposite = new Composite(mainComposite, SWT.NONE);
comboComposite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 0).create());
comboComposite.setLayoutData(fillDefaults().grab(true, false).create());
final ComboViewer businessObjectComboViewer = new ComboViewer(comboComposite, SWT.READ_ONLY | SWT.BORDER);
businessObjectComboViewer.getControl().setLayoutData(fillDefaults().grab(true, false).create());
businessObjectComboViewer.setContentProvider(new ObservableListContentProvider());
businessObjectComboViewer.setLabelProvider(businessObjectLabelProvider());
final IObservableList<BusinessObject> businessObjectsObservableList = new WritableList(getAllBusinessObjects(),
BusinessObject.class);
final IViewerObservableValue observeSingleSelection = ViewersObservables
.observeSingleSelection(businessObjectComboViewer);
businessObjectComboViewer.setInput(businessObjectsObservableList);
classNameObservable = EMFObservables.observeValue(businessObjectData,
ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME);
ctx.bindValue(observeSingleSelection,
classNameObservable,
updateValueStrategy().withConverter(businessObjectToFQN())
.withValidator(mandatoryValidator(Messages.businessObject))
.create(),
updateValueStrategy().withConverter(fqnToBusinessObject())
.create());
defaultValueReturnTypeObservable = EMFObservables.observeValue(businessObjectData.getDefaultValue(),
ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE);
final String className = businessObjectData.getClassName();
if ((className == null || className.isEmpty()) && !businessObjectsObservableList.isEmpty()) {
observeSingleSelection.setValue(businessObjectsObservableList.get(0));
}
}
示例18
private Composite createMergeViewer(Composite parent) {
Composite composite = new Composite(parent, SWT.None);
composite.setLayout(GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 1).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
viewer = new TreeViewer(composite,
SWT.VIRTUAL | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
viewer.setUseHashlookup(true);
ColumnViewerToolTipSupport.enableFor(viewer);
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
viewer.setContentProvider(new SmartImportBdmTreeContentProvider());
TableLayout layout = new TableLayout();
layout.addColumnData(new ColumnWeightData(6, true));
layout.addColumnData(new ColumnWeightData(2, true));
viewer.getTree().setLayout(layout);
createModelColumn();
createActionColumn();
IViewerObservableValue singleSelectionObservable = ViewerProperties.singleSelection().observe(viewer);
viewer.addDoubleClickListener(e -> viewer.setExpandedState(singleSelectionObservable.getValue(),
!viewer.getExpandedState(singleSelectionObservable.getValue())));
return composite;
}
示例19
private void createInputForDataGroup(final TabbedPropertySheetWidgetFactory widgetFactory,
final Composite dataContent) {
final Group inputGroup = widgetFactory.createGroup(dataContent, Messages.input);
inputGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
inputGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).spacing(5, 3).create());
final Label inputListlabel = widgetFactory.createLabel(inputGroup, Messages.inputList + " *");
inputListlabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).create());
final ControlDecoration inputListlabelDecoration = new ControlDecoration(inputListlabel, SWT.RIGHT);
inputListlabelDecoration.setMarginWidth(-3);
inputListlabelDecoration.setDescriptionText(Messages.inputListHint);
inputListlabelDecoration.setImage(Pics.getImage(PicsConstants.hint));
final ComboViewer inputListComboViewer = createComboViewer(widgetFactory, inputGroup,
new ObservableListContentProviderWithProposalListenersForPool());
inputListComboViewer.getControl().setLayoutData(
GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).indent(5, 0).create());
inputListComboViewer.addFilter(new ListDataFilter());
inputListComboViewer.setSorter(new DataViewerSorter());
final IViewerObservableValue observeSingleSelection = ViewersObservables
.observeSingleSelection(inputListComboViewer);
final IObservableValue selectionObservable = ViewersObservables.observeSingleSelection(selectionProvider);
final IObservableValue observeInputCollectionValue = CustomEMFEditObservables.observeDetailValue(
Realm.getDefault(), selectionObservable,
ProcessPackage.Literals.MULTI_INSTANTIABLE__COLLECTION_DATA_TO_MULTI_INSTANTIATE);
selectionObservable.addValueChangeListener(createInputValueChanged(inputListComboViewer, observeSingleSelection,
observeInputCollectionValue, false));
inputListComboViewer.addSelectionChangedListener(createComboSelectionListener(inputListComboViewer, false));
inputListComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
updateReturnTypeFromSelectedInputCollection(inputListComboViewer);
}
});
context.bindValue(observeSingleSelection, observeInputCollectionValue);
final Label label = widgetFactory.createLabel(inputGroup, "");
label.setImage(Pics.getImage("icon-arrow-down.png"));
label.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).align(SWT.CENTER, SWT.CENTER).create());
createIteratorControl(widgetFactory, inputGroup);
}
示例20
@SuppressWarnings("unchecked")
public void initDataBindings(){
DataBindingContext bindingContext = new DataBindingContext();
//
ISWTObservableValue observeTextTxtProductNameObserveWidget =
WidgetProperties.text(SWT.Modify).observeDelayed(300, txtProductName);
IObservableValue<String> productEigenartikelNameObserveDetailValue = PojoProperties
.value(IArticle.class, "name", String.class).observeDetail(productEigenartikel);
bindingContext.bindValue(observeTextTxtProductNameObserveWidget,
productEigenartikelNameObserveDetailValue,
new SavingUpdateProductChilds(CoreModelServiceHolder.get(), productEigenartikel), null);
observeTextTxtProductNameObserveWidget.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event){
if (productEigenartikel.getValue() != null) {
if (event.diff.getOldValue() != null
&& !event.diff.getOldValue().toString().isEmpty()) {
ContextServiceHolder.get().postEvent(ElexisEventTopics.EVENT_UPDATE,
productEigenartikel.getValue());
}
}
}
});
//
IViewerObservableValue observeSingleSelectionComboViewerProductType =
ViewerProperties.singleSelection().observe(comboViewerProductType);
IObservableValue<IArticle> productEigenartikelTypObserveDetailValue =
PojoProperties.value(IArticle.class, "subTyp", ArticleSubTyp.class)
.observeDetail(productEigenartikel);
bindingContext.bindValue(observeSingleSelectionComboViewerProductType,
productEigenartikelTypObserveDetailValue,
new SavingUpdateProductChilds(CoreModelServiceHolder.get(), productEigenartikel), null);
//
ISWTObservableValue observeTextTxtAtcCodeObserveWidget =
WidgetProperties.text(SWT.Modify).observeDelayed(300, txtAtcCode);
IObservableValue<String> productEigenartikelATC_codeObserveDetailValue = PojoProperties
.value(IArticle.class, "atcCode", String.class).observeDetail(productEigenartikel);
bindingContext.bindValue(observeTextTxtAtcCodeObserveWidget,
productEigenartikelATC_codeObserveDetailValue,
new SavingUpdateProductChilds(CoreModelServiceHolder.get(), productEigenartikel), null);
}