Home » Eclipse Projects » Rich Client Platform (RCP) » [Databinding] combine three listviewer and comboviewer
[Databinding] combine three listviewer and comboviewer [message #453035] |
Thu, 20 July 2006 09:35 |
Gerrit Brehmer Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Hi,
i've a problem with the new databinding engine for swt:
Short overview on my objects:
"Scenario" Properties: ArrayList<Station>
"Station" Properties: ArrayList<Host>, ArrayList<Cluster>
"Host" Properties: HostIp
"Cluster" Properties: Host (must be/referenced to an item from the
ArrayList<Host> from the Station)
The Stations and the Hosts and Cluster from each Station object are shown
in three lists with listviewer.
The Cluster has also an combobox + comboviewer, which shows only the hosts
from the selected station to select something.
The Problem:
If I now select another station with no hosts the combobox is empty for a
very short time and so the property "Host" from the cluster from the
previous station is set to null before the clusters from the new station
are loading.
Here is my code:
// bind the stations of the scenario to the station-list
bindingContext.bind(stationsViewer,
new ListModelDescription(new Property(scenario, "stations",
Station.class, Boolean.TRUE), "name"), null);
// and make an obversable for the selected station
IObservable selectedStation = bindingContext.createObservable(new Property(
stationsViewer, ViewersProperties.SINGLE_SELECTION,
Station.class, Boolean.FALSE));
// bind the hosts of selected station to the host-list
bindingContext.bind(hostsViewer,
new ListModelDescription(new Property(selectedStation, "hosts",
Host.class, Boolean.TRUE), "name"), null);
// and make an obversable for the selected host
IObservable selectedHost = bindingContext.createObservable(new Property(
hostsViewer, ViewersProperties.SINGLE_SELECTION, Host.class,
Boolean.FALSE));
// bind the cluster of the selected station to the cluster-list
bindingContext.bind(mySqlClusterViewer, new ListModelDescription(
new Property(selectedStation, "mySqlCluster",
MySqlCluster.class, Boolean.TRUE), "name"), null);
// and make an obversable for the selected cluster
IObservable selectedCluster = bindingContext.createObservable(new Property(
mySqlClusterViewer, ViewersProperties.SINGLE_SELECTION,
MySqlCluster.class, Boolean.FALSE));
// bind the hosts of the selceted station to a combobox from the cluster
// where i can select an host for the cluster
bindingContext.bind(new Property(
comClusterProperties.getCobvHost(), ViewersProperties.CONTENT),
new ListModelDescription(new Property(selectedStation, "hosts",
Host.class, Boolean.TRUE), "name"), null);
// bind the selected host from the combobox with the host-Property
// from the selected cluster
bindingContext.bind(new Property(
comClusterProperties.getCobvHost(),
ViewersProperties.SINGLE_SELECTION), new Property(
selectedCluster, "host", Host.class, Boolean.FALSE), null);
Thanks in advance for your help!
Gerrit
|
|
|
Goto Forum:
Current Time: Sat Nov 09 00:48:29 GMT 2024
Powered by FUDForum. Page generated in 0.04405 seconds
|