Author: adietish
Date: 2010-12-25 05:17:25 -0500 (Sat, 25 Dec 2010)
New Revision: 27736
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java
Log:
[JBIDE-8000] switched to observable pojo that notifies in UI thread only, corrected
binding order (first bind items, then selected item, then enablement)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-25
10:06:20 UTC (rev 27735)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-25
10:17:25 UTC (rev 27736)
@@ -295,7 +295,7 @@
private void bindProfileCombo(final Combo profileCombo, DataBindingContext dbc) {
// bind combo items
dbc.bindList(WidgetProperties.items().observe(profileCombo),
- BeanProperties.list(NewInstancePageModel.PROPERTY_FILTERED_PROFILES).observe(model),
+ BeanProperties.list(NewInstancePageModel.PROP_FILTERED_PROFILES).observe(model),
new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER),
new UpdateListStrategy().setConverter(
new Converter(Object.class, String.class) {
@@ -313,7 +313,7 @@
Binding selectedProfileBinding = dbc.bindValue(
WidgetProperties.singleSelectionIndex().observe(profileCombo),
BeanProperties
- .value(NewInstancePageModel.class,
NewInstancePageModel.PROPERTY_SELECTED_PROFILE_INDEX)
+ .value(NewInstancePageModel.class,
NewInstancePageModel.PROP_SELECTED_PROFILE_INDEX)
.observe(model),
new UpdateValueStrategy()
.setAfterGetValidator(new SelectedComboItemValidator("You must select a
hardware profile.")),
@@ -322,7 +322,7 @@
// bind combo enablement
IObservableList filteredProfilesObservable =
- BeanProperties.list(NewInstancePageModel.PROPERTY_FILTERED_PROFILES).observe(model);
+ BeanProperties.list(NewInstancePageModel.PROP_FILTERED_PROFILES).observe(model);
DataBindingUtils.addChangeListener(
new IChangeListener() {
@@ -349,7 +349,7 @@
DataBindingContext dbc) {
// bind all profiles
IObservable allProfilesObservable =
- BeanProperties.list(NewInstancePageModel.class,
NewInstancePageModel.PROPERTY_ALL_PROFILES).observe(
+ BeanProperties.list(NewInstancePageModel.class,
NewInstancePageModel.PROP_ALL_PROFILES).observe(
model);
DataBindingUtils.addChangeListener(new IChangeListener() {
@@ -362,7 +362,7 @@
// bind selected profile page
IObservableValue selectedProfileIndexObservable =
BeanProperties
- .value(NewInstancePageModel.class,
NewInstancePageModel.PROPERTY_SELECTED_PROFILE_INDEX)
+ .value(NewInstancePageModel.class,
NewInstancePageModel.PROP_SELECTED_PROFILE_INDEX)
.observe(model);
DataBindingUtils.addChangeListener(new IChangeListener() {
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java 2010-12-25
10:06:20 UTC (rev 27735)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePageModel.java 2010-12-25
10:17:25 UTC (rev 27736)
@@ -43,10 +43,10 @@
public static final String PROPERTY_REALMS = "realms"; //$NON-NLS-1$
public static final String PROPERTY_SELECTED_REALM_INDEX =
"selectedRealmIndex"; //$NON-NLS-1$
public static final String PROPERTY_KEYNAME = "keyname"; //$NON-NLS-1$
- public static final String PROPERTY_PROFILE = "profile"; //$NON-NLS-1$
- public static final String PROPERTY_ALL_PROFILES = "allProfiles";
//$NON-NLS-1$
- public static final String PROPERTY_FILTERED_PROFILES = "filteredProfiles";
//$NON-NLS-1$
- public static final String PROPERTY_SELECTED_PROFILE_INDEX =
"selectedProfileIndex"; //$NON-NLS-1$
+ public static final String PROP_PROFILE = "profile"; //$NON-NLS-1$
+ public static final String PROP_ALL_PROFILES = "allProfiles"; //$NON-NLS-1$
+ public static final String PROP_FILTERED_PROFILES = "filteredProfiles";
//$NON-NLS-1$
+ public static final String PROP_SELECTED_PROFILE_INDEX =
"selectedProfileIndex"; //$NON-NLS-1$
private String name;
private DeltaCloudImage image;
@@ -125,7 +125,7 @@
}
private void setAllProfiles(List<DeltaCloudHardwareProfile> profiles) {
- getPropertyChangeSupport().firePropertyChange(PROPERTY_ALL_PROFILES, this.allProfiles,
this.allProfiles = profiles);
+ getPropertyChangeSupport().firePropertyChange(PROP_ALL_PROFILES, this.allProfiles,
this.allProfiles = profiles);
}
public List<DeltaCloudHardwareProfile> getAllProfiles() {
@@ -133,7 +133,7 @@
}
private void setFilteredProfiles(List<DeltaCloudHardwareProfile> profiles) {
- getPropertyChangeSupport().firePropertyChange(PROPERTY_FILTERED_PROFILES,
this.filteredProfiles, this.filteredProfiles = profiles);
+ getPropertyChangeSupport().firePropertyChange(PROP_FILTERED_PROFILES,
this.filteredProfiles, this.filteredProfiles = profiles);
}
public List<DeltaCloudHardwareProfile> getFilteredProfiles() {
@@ -162,7 +162,7 @@
}
DeltaCloudHardwareProfile hardwareProfile = filteredProfiles.get(index);
setSelectedProfile(hardwareProfile);
- firePropertyChange(PROPERTY_SELECTED_PROFILE_INDEX, oldIndex, index);
+ firePropertyChange(PROP_SELECTED_PROFILE_INDEX, oldIndex, index);
}
}