Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2016-06-28 21:40:24 +0000
committerBrian Vosburgh2017-05-18 22:37:33 +0000
commit3e8dd95926f4ff410651f340f7b9cd19e9aabb60 (patch)
treedda8891e2c66784c81b2c9d93af0bad2b65034e8
parenteeb9f64e9c9ff48ba95353ee109063fe7c1be17f (diff)
downloadwebtools.dali-3e8dd95926f4ff410651f340f7b9cd19e9aabb60.tar.gz
webtools.dali-3e8dd95926f4ff410651f340f7b9cd19e9aabb60.tar.xz
webtools.dali-3e8dd95926f4ff410651f340f7b9cd19e9aabb60.zip
rework EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite:
remove ValueListAdapter
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java84
1 files changed, 25 insertions, 59 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java
index e09f683051..c53fbebc29 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java
@@ -11,17 +11,13 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details.orm;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.closure.BooleanClosure;
-import org.eclipse.jpt.common.utility.internal.iterable.SuperListIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListValueModelTools;
-import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyModifiablePropertyValueModelWrapper;
-import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.model.value.ValueListAdapter;
import org.eclipse.jpt.common.utility.iterable.ListIterable;
-import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
-import org.eclipse.jpt.common.utility.model.listener.StateChangeListener;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkSpecifiedTenantDiscriminatorColumn2_3;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTenantDiscriminatorColumn2_3;
@@ -61,10 +57,10 @@ public class EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite extend
}
protected EclipseLinkTenantDiscriminatorColumnsComposite<EntityMappings> buildTenantDiscriminatorColumnsComposite(Composite container) {
- return new EclipseLinkTenantDiscriminatorColumnsComposite<EntityMappings>(
+ return new EclipseLinkTenantDiscriminatorColumnsComposite<>(
this,
this.getSubjectHolder(),
- new TenantDiscriminatorColumnPaneEnablerHolder(),
+ this.buildSpecifiedTenantDiscriminatorColumnsPaneEnabledModel(),
container,
this.buildTenantDiscriminatorColumnsEditor()
);
@@ -84,7 +80,7 @@ public class EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite extend
}
public ListIterable<EclipseLinkTenantDiscriminatorColumn2_3> getDefaultTenantDiscriminatorColumns(EntityMappings subject) {
- return new SuperListIterableWrapper<EclipseLinkTenantDiscriminatorColumn2_3>(((EclipseLinkEntityMappings) subject).getDefaultTenantDiscriminatorColumns());
+ return IterableTools.upCast(((EclipseLinkEntityMappings) subject).getDefaultTenantDiscriminatorColumns());
}
public int getDefaultTenantDiscriminatorColumnsSize(EntityMappings subject) {
@@ -96,7 +92,7 @@ public class EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite extend
}
public ListIterable<EclipseLinkTenantDiscriminatorColumn2_3> getSpecifiedTenantDiscriminatorColumns(EntityMappings subject) {
- return new SuperListIterableWrapper<EclipseLinkTenantDiscriminatorColumn2_3>(((EclipseLinkEntityMappings) subject).getSpecifiedTenantDiscriminatorColumns());
+ return IterableTools.upCast(((EclipseLinkEntityMappings) subject).getSpecifiedTenantDiscriminatorColumns());
}
public int getSpecifiedTenantDiscriminatorColumnsSize(EntityMappings subject) {
@@ -125,7 +121,7 @@ public class EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite extend
getSubjectHolder(), EclipseLinkEntityMappings.SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST) {
@Override
protected ListIterable<EclipseLinkTenantDiscriminatorColumn2_3> getListIterable() {
- return new SuperListIterableWrapper<EclipseLinkTenantDiscriminatorColumn2_3>(((EclipseLinkEntityMappings) this.subject).getSpecifiedTenantDiscriminatorColumns());
+ return IterableTools.upCast(((EclipseLinkEntityMappings) this.subject).getSpecifiedTenantDiscriminatorColumns());
}
@Override
@@ -169,55 +165,25 @@ public class EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite extend
}
}
- /* CU private */ class TenantDiscriminatorColumnPaneEnablerHolder
- extends TransformationPropertyValueModel<EntityMappings, Boolean>
- {
- private StateChangeListener stateChangeListener;
-
- TenantDiscriminatorColumnPaneEnablerHolder() {
- super(
- new ValueListAdapter<EntityMappings>(
- new ReadOnlyModifiablePropertyValueModelWrapper<EntityMappings>(getSubjectHolder()),
- EclipseLinkEntityMappings.SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST
- )
- );
- this.stateChangeListener = this.buildStateChangeListener();
- }
-
- private StateChangeListener buildStateChangeListener() {
- return new StateChangeListener() {
- public void stateChanged(StateChangeEvent event) {
- TenantDiscriminatorColumnPaneEnablerHolder.this.valueStateChanged();
- }
- };
- }
-
- void valueStateChanged() {
- Object old = this.value;
- this.value = this.transform(this.valueModel.getValue());
- firePropertyChanged(VALUE, old, this.value);
- }
-
- @Override
- protected Boolean transform(EntityMappings v) {
- return (v == null) ? Boolean.FALSE : super.transform(v);
- }
-
- @Override
- protected Boolean transform_(EntityMappings v) {
- return Boolean.valueOf(((EclipseLinkEntityMappings) v).getSpecifiedTenantDiscriminatorColumnsSize() > 0);
- }
+ protected PropertyValueModel<Boolean> buildSpecifiedTenantDiscriminatorColumnsPaneEnabledModel() {
+ return this.buildSpecifiedTenantDiscriminatorColumnsIsNotEmptyModel();
+ }
- @Override
- protected void engageModel() {
- super.engageModel();
- this.valueModel.addStateChangeListener(this.stateChangeListener);
- }
+ protected PropertyValueModel<Boolean> buildSpecifiedTenantDiscriminatorColumnsIsNotEmptyModel() {
+ return ListValueModelTools.isNotEmptyPropertyValueModel(this.buildSpecifiedTenantDiscriminatorColumnsModel());
+ }
- @Override
- protected void disengageModel() {
- this.valueModel.removeStateChangeListener(this.stateChangeListener);
- super.disengageModel();
- }
+ @SuppressWarnings("unchecked")
+ protected ListValueModel<EclipseLinkOrmSpecifiedTenantDiscriminatorColumn2_3> buildSpecifiedTenantDiscriminatorColumnsModel() {
+ return new ListAspectAdapter<EclipseLinkEntityMappings, EclipseLinkOrmSpecifiedTenantDiscriminatorColumn2_3>((PropertyValueModel<EclipseLinkEntityMappings>) this.getSubjectHolder(), EclipseLinkEntityMappings.SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST) {
+ @Override
+ protected ListIterable<EclipseLinkOrmSpecifiedTenantDiscriminatorColumn2_3> getListIterable() {
+ return IterableTools.upCast(this.subject.getSpecifiedTenantDiscriminatorColumns());
+ }
+ @Override
+ protected int size_() {
+ return this.subject.getSpecifiedTenantDiscriminatorColumnsSize();
+ }
+ };
}
}

Back to the top