Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 399380
Collapse All | Expand All

(-)src/org/eclipse/scout/rt/extension/client/Replace.java (+3 lines)
Lines 20-28 Link Here
20
 * the first object is removed which type is the annotated class's super class.
20
 * the first object is removed which type is the annotated class's super class.
21
 * 
21
 * 
22
 * @since 3.9.0
22
 * @since 3.9.0
23
 * @deprecated Do not use this class any more. It has been replaced by
24
 *             {@link org.eclipse.scout.commons.annotations.Replace}.
23
 */
25
 */
24
@Retention(RetentionPolicy.RUNTIME)
26
@Retention(RetentionPolicy.RUNTIME)
25
@Target(ElementType.TYPE)
27
@Target(ElementType.TYPE)
28
@Deprecated
26
public @interface Replace {
29
public @interface Replace {
27
30
28
  /**
31
  /**
(-)src/org/eclipse/scout/rt/extension/client/ExtensionUtility.java (+9 lines)
Lines 23-28 Link Here
23
import org.eclipse.scout.commons.BeanUtility;
23
import org.eclipse.scout.commons.BeanUtility;
24
import org.eclipse.scout.commons.CompareUtility;
24
import org.eclipse.scout.commons.CompareUtility;
25
import org.eclipse.scout.commons.CompositeObject;
25
import org.eclipse.scout.commons.CompositeObject;
26
import org.eclipse.scout.commons.ConfigurationUtility;
26
import org.eclipse.scout.commons.TypeCastUtility;
27
import org.eclipse.scout.commons.TypeCastUtility;
27
import org.eclipse.scout.commons.logger.IScoutLogger;
28
import org.eclipse.scout.commons.logger.IScoutLogger;
28
import org.eclipse.scout.commons.logger.ScoutLogManager;
29
import org.eclipse.scout.commons.logger.ScoutLogManager;
Lines 63-69 Link Here
63
  /**
64
  /**
64
   * Removes those objects of the given list that match any {@link Replace} annotation on other elements being part of
65
   * Removes those objects of the given list that match any {@link Replace} annotation on other elements being part of
65
   * the same list.
66
   * the same list.
67
   * 
68
   * @deprecated The {@link Replace} annotation this method works for has been replaced by
69
   *             {@link org.eclipse.scout.commons.annotations.Replace}. The corresponding methods for this one are
70
   *             {@link ConfigurationUtility#removeReplacedClasses(Class[])},
71
   *             {@link ConfigurationUtility#getReplacementMapping(Class[])} and
72
   *             {@link ConfigurationUtility#getReplacingLeafClasses(Class[])}.
66
   */
73
   */
74
  @Deprecated
75
  @SuppressWarnings("deprecation")
67
  public static <T> Map<T, T> processReplaceAnnotations(List<T> list) {
76
  public static <T> Map<T, T> processReplaceAnnotations(List<T> list) {
68
    if (list == null || list.isEmpty()) {
77
    if (list == null || list.isEmpty()) {
69
      return Collections.emptyMap();
78
      return Collections.emptyMap();
(-)src/org/eclipse/scout/rt/extension/client/ui/basic/table/AbstractExtensibleTable.java (+1 lines)
Lines 34-39 Link Here
34
 * 
34
 * 
35
 * @since 3.9.0
35
 * @since 3.9.0
36
 */
36
 */
37
@SuppressWarnings("deprecation")
37
public abstract class AbstractExtensibleTable extends AbstractTable implements IExtensibleScoutObject {
38
public abstract class AbstractExtensibleTable extends AbstractTable implements IExtensibleScoutObject {
38
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractExtensibleTable.class);
39
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractExtensibleTable.class);
39
40
(-)src/org/eclipse/scout/commons/ConfigurationUtility.java (-8 / +189 lines)
Lines 15-25 Link Here
15
import java.lang.reflect.Modifier;
15
import java.lang.reflect.Modifier;
16
import java.util.ArrayList;
16
import java.util.ArrayList;
17
import java.util.Collection;
17
import java.util.Collection;
18
import java.util.Collections;
19
import java.util.HashMap;
20
import java.util.HashSet;
21
import java.util.List;
22
import java.util.Map;
23
import java.util.Set;
18
import java.util.TreeMap;
24
import java.util.TreeMap;
19
25
20
import org.eclipse.scout.commons.annotations.IOrdered;
26
import org.eclipse.scout.commons.annotations.IOrdered;
21
import org.eclipse.scout.commons.annotations.InjectFieldTo;
27
import org.eclipse.scout.commons.annotations.InjectFieldTo;
22
import org.eclipse.scout.commons.annotations.Order;
28
import org.eclipse.scout.commons.annotations.Order;
29
import org.eclipse.scout.commons.annotations.Replace;
23
import org.eclipse.scout.commons.logger.IScoutLogger;
30
import org.eclipse.scout.commons.logger.IScoutLogger;
24
import org.eclipse.scout.commons.logger.ScoutLogManager;
31
import org.eclipse.scout.commons.logger.ScoutLogManager;
25
32
Lines 55-61 Link Here
55
          orderedClassesMap.put(new CompositeObject(order.value(), i), classes[i]);
62
          orderedClassesMap.put(new CompositeObject(order.value(), i), classes[i]);
56
        }
63
        }
57
        else {
64
        else {
58
          LOG.error("missing @Order annotation: " + classes[i].getName());
65
          if (!classes[i].isAnnotationPresent(Replace.class)) {
66
            LOG.error("missing @Order annotation: " + classes[i].getName());
67
          }
59
          orderedClassesMap.put(new CompositeObject(Double.MAX_VALUE, i), classes[i]);
68
          orderedClassesMap.put(new CompositeObject(Double.MAX_VALUE, i), classes[i]);
60
        }
69
        }
61
      }
70
      }
Lines 111-117 Link Here
111
   * 
120
   * 
112
   * @param classes
121
   * @param classes
113
   * @param filter
122
   * @param filter
114
   * @return first occurrence of filter, might be annotated with {@link InjectFieldTo}
123
   * @return first occurrence of filter, might be annotated with {@link InjectFieldTo} or {@link Replace}
115
   */
124
   */
116
  @SuppressWarnings("unchecked")
125
  @SuppressWarnings("unchecked")
117
  public static <T> Class<T> filterClass(Class[] classes, Class<T> filter) {
126
  public static <T> Class<T> filterClass(Class[] classes, Class<T> filter) {
Lines 124-130 Link Here
124
  }
133
  }
125
134
126
  /**
135
  /**
127
   * same as {@link #filterClass(Class[], Class)} but ignoring classes with {@link InjectFieldTo} annotation
136
   * same as {@link #filterClass(Class[], Class)} but ignoring classes with {@link InjectFieldTo} and {@link Replace}
137
   * annotations
128
   * 
138
   * 
129
   * @since 3.8.1
139
   * @since 3.8.1
130
   */
140
   */
Lines 132-138 Link Here
132
  public static <T> Class<T> filterClassIgnoringInjectFieldAnnotation(Class[] classes, Class<T> filter) {
142
  public static <T> Class<T> filterClassIgnoringInjectFieldAnnotation(Class[] classes, Class<T> filter) {
133
    for (Class c : classes) {
143
    for (Class c : classes) {
134
      if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
144
      if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
135
        if (!c.isAnnotationPresent(InjectFieldTo.class)) {
145
        if (!isInjectFieldAnnotationPresent(c)) {
136
          return c;
146
          return c;
137
        }
147
        }
138
      }
148
      }
Lines 161-167 Link Here
161
  }
171
  }
162
172
163
  /**
173
  /**
164
   * same as {@link #filterClasses(Class[], Class)} but ignoring classes with {@link InjectFieldTo} annotation
174
   * same as {@link #filterClasses(Class[], Class)} but ignoring classes with {@link InjectFieldTo} and {@link Replace}
175
   * annotations
165
   * 
176
   * 
166
   * @since 3.8.1
177
   * @since 3.8.1
167
   */
178
   */
Lines 170-176 Link Here
170
    ArrayList<Class<T>> list = new ArrayList<Class<T>>();
181
    ArrayList<Class<T>> list = new ArrayList<Class<T>>();
171
    for (Class c : classes) {
182
    for (Class c : classes) {
172
      if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
183
      if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
173
        if (!c.isAnnotationPresent(InjectFieldTo.class)) {
184
        if (!isInjectFieldAnnotationPresent(c)) {
174
          list.add(c);
185
          list.add(c);
175
        }
186
        }
176
      }
187
      }
Lines 179-185 Link Here
179
  }
190
  }
180
191
181
  /**
192
  /**
182
   * same as {@link #filterClasses(Class[], Class)} but only accepting classes with {@link InjectFieldTo} annotation
193
   * same as {@link #filterClasses(Class[], Class)} but only accepting classes with {@link InjectFieldTo} and
194
   * {@link Replace} annotations
183
   * 
195
   * 
184
   * @since 3.8.1
196
   * @since 3.8.1
185
   */
197
   */
Lines 188-194 Link Here
188
    ArrayList<Class<T>> list = new ArrayList<Class<T>>();
200
    ArrayList<Class<T>> list = new ArrayList<Class<T>>();
189
    for (Class c : classes) {
201
    for (Class c : classes) {
190
      if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
202
      if (filter.isAssignableFrom(c) && !Modifier.isAbstract(c.getModifiers())) {
191
        if (c.isAnnotationPresent(InjectFieldTo.class)) {
203
        if (isInjectFieldAnnotationPresent(c)) {
192
          list.add(c);
204
          list.add(c);
193
        }
205
        }
194
      }
206
      }
Lines 197-202 Link Here
197
  }
209
  }
198
210
199
  /**
211
  /**
212
   * @return Returns <code>true</code> if the given class is annotated by {@link InjectFieldTo} or {@link Replace}.
213
   *         Otherwise <code>false</code>.
214
   *         <p/>
215
   *         <b>Note:</b> This method throws a {@link NullPointerException} if the given class is null.
216
   */
217
  public static boolean isInjectFieldAnnotationPresent(Class<?> c) {
218
    return c.isAnnotationPresent(InjectFieldTo.class) || c.isAnnotationPresent(Replace.class);
219
  }
220
221
  /**
200
   * get all declared classes (inner types) of the specified class and all its
222
   * get all declared classes (inner types) of the specified class and all its
201
   * super classes
223
   * super classes
202
   */
224
   */
Lines 261-264 Link Here
261
    }
283
    }
262
    return c;
284
    return c;
263
  }
285
  }
286
287
  /**
288
   * Returns a new array without those classes, that are replaced by another class. The returned array is a new
289
   * instance, except there are no replacing classes. Replacing classes are annotated with {@link Replace}. Replacing
290
   * classes are reordered according to their nearest {@link Order} annotation that is found up the type hierarchy.
291
   * 
292
   * @param classes
293
   * @return
294
   * @since 3.8.2
295
   */
296
  @SuppressWarnings("unchecked")
297
  public static <T> Class<? extends T>[] removeReplacedClasses(Class<? extends T>[] classes) {
298
    Set<Class<? extends T>> replacingClasses = getReplacingLeafClasses(classes);
299
    if (replacingClasses.isEmpty()) {
300
      // there are no replacing classes -> return original array
301
      return classes;
302
    }
303
304
    // compute resulting list of ordered classes
305
    List<Class<? extends T>> list = new ArrayList<Class<? extends T>>();
306
    for (Class<? extends T> c : classes) {
307
      list.add(c);
308
    }
309
310
    for (Class<? extends T> replacingClass : replacingClasses) {
311
      boolean reorder = !replacingClass.isAnnotationPresent(Order.class);
312
      boolean reordered = false;
313
314
      // handle transitive replacements
315
      Class<?> classToBeReplaced = replacingClass.getSuperclass();
316
      while (classToBeReplaced.isAnnotationPresent(Replace.class)) {
317
        // reorder replacement if necessary
318
        if (reorder && !reordered && classToBeReplaced.isAnnotationPresent(Order.class)) {
319
          reordered = moveBefore(list, replacingClass, (Class<? extends T>) classToBeReplaced);
320
        }
321
        list.remove(classToBeReplaced);
322
        classToBeReplaced = classToBeReplaced.getSuperclass();
323
      }
324
325
      // reorder replacement if necessary
326
      if (reorder && !reordered) {
327
        moveBefore(list, replacingClass, (Class<? extends T>) classToBeReplaced);
328
      }
329
      list.remove(classToBeReplaced);
330
    }
331
332
    return list.toArray(new Class[list.size()]);
333
  }
334
335
  /**
336
   * Computes a map based on the given classes that contains replaced classes pointing to their replacing classes. This
337
   * method never returns <code>null</code>.
338
   * <p/>
339
   * <b>Example:</b> Given the following two classes
340
   * 
341
   * <pre>
342
   * public class A {
343
   * }
344
   * 
345
   * &#064;Replace
346
   * public class B extends A {
347
   * }
348
   * </pre>
349
   * 
350
   * The invocation of <code>getReplacementMapping(new Class[] {B.class, String.class})</code> returns a map containing
351
   * <code>&lt;A.class, B.class&gt;</code>.
352
   * 
353
   * @param classes
354
   * @return
355
   * @since 3.8.2
356
   */
357
  public static <T> Map<Class<?>, Class<? extends T>> getReplacementMapping(Class<? extends T>[] classes) {
358
    Set<Class<? extends T>> replacingClasses = getReplacingLeafClasses(classes);
359
    if (replacingClasses.isEmpty()) {
360
      // there are no replacing classes -> return original array
361
      return Collections.emptyMap();
362
    }
363
364
    // compute resulting replacement mapping
365
    Map<Class<?>, Class<? extends T>> mappings = new HashMap<Class<?>, Class<? extends T>>();
366
    for (Class<? extends T> c : replacingClasses) {
367
      Class<?> tmpClass = c;
368
      do {
369
        tmpClass = tmpClass.getSuperclass();
370
        mappings.put(tmpClass, c);
371
      }
372
      while (tmpClass.isAnnotationPresent(Replace.class));
373
    }
374
    return mappings;
375
  }
376
377
  /**
378
   * Computes the set of classes that are annotated with {@link Replace} and removes transitive dependencies, so that
379
   * the most specific classes are returned.
380
   * <p/>
381
   * <b>Example:</b> Given the following two classes
382
   * 
383
   * <pre>
384
   * public class A {
385
   * }
386
   * 
387
   * &#064;Replace
388
   * public class B extends A {
389
   * }
390
   * </pre>
391
   * 
392
   * The invocation of <code>getReplacingLeafClasses(new Class[] {A.class, B.class, String.class})</code> returns a set
393
   * that contains <code>B.class</code> only. <code>String.class</code> is not annotated with {@link Replace} and
394
   * <code>A.class</code> is not a leaf replacement, but further replaced by <code>B.class</code>.
395
   * 
396
   * @param classes
397
   * @return Returns the set of replacing leaf classes or an empty set.
398
   * @since 3.8.2
399
   */
400
  public static <T> Set<Class<? extends T>> getReplacingLeafClasses(Class<? extends T>[] classes) {
401
    // gather all replacing and replaced classes (i.e. those annotated with @Replace and their super classes)
402
    Set<Class<? extends T>> replacingClasses = new HashSet<Class<? extends T>>();
403
    Set<Class<?>> replacedClasses = new HashSet<Class<?>>();
404
    for (Class<? extends T> c : classes) {
405
      if (c.isAnnotationPresent(Replace.class)) {
406
        replacingClasses.add(c);
407
        Class<?> tmpClass = c;
408
        do {
409
          tmpClass = tmpClass.getSuperclass();
410
          replacedClasses.add(tmpClass);
411
        }
412
        while (tmpClass.isAnnotationPresent(Replace.class));
413
      }
414
    }
415
416
    if (replacingClasses.isEmpty()) {
417
      return Collections.emptySet();
418
    }
419
420
    // remove transitive replacements (e.g. if A replaces B and B replaces C, A and B are replacing classes but we are interested in A only)
421
    replacingClasses.removeAll(replacedClasses);
422
    return replacingClasses;
423
  }
424
425
  /**
426
   * Moves the given element before the reference element. Both are expected to be part of the given list. If the
427
   * reference element is not in the list, the list remains untouched. If the element to move is not part of the list,
428
   * it is added before the reference element.
429
   * 
430
   * @param list
431
   * @param element
432
   * @param referenceElement
433
   * @return Returns <code>true</code> if the element has been moved or inserted. Otherwise <code>false</code>.
434
   * @since 3.8.2
435
   */
436
  private static <T> boolean moveBefore(List<T> list, T element, T referenceElement) {
437
    int index = list.indexOf(referenceElement);
438
    if (index != -1) {
439
      list.remove(element);
440
      list.add(index, element);
441
      return true;
442
    }
443
    return false;
444
  }
264
}
445
}
(-)src/org/eclipse/scout/commons/annotations/Replace.java (+146 lines)
Line 0 Link Here
1
package org.eclipse.scout.commons.annotations;
2
3
import java.lang.annotation.ElementType;
4
import java.lang.annotation.Retention;
5
import java.lang.annotation.RetentionPolicy;
6
import java.lang.annotation.Target;
7
8
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
9
10
/**
11
 * Annotation on a class used to replace the first occurrence of its super class. The Annotation can be applied to
12
 * several scout objects types like columns, menus, form fields. Further, the annotation can be applied recursively
13
 * (i.e. replaced objects can be replaced as well).
14
 * <p/>
15
 * <h3>Usage on form fields</h3> If this annotation is added to a form field in an extended form, it works like the
16
 * {@link InjectFieldTo} annotation except that the original field is removed. The replaced field's container is used by
17
 * the replacing field as well. If the {@link Order} annotation is missing on the replacing class, the order of the
18
 * extended class is used. Finally, the {@link FormData} annotation is inherited form the replaced field. If the
19
 * replaced field does not have a form field data, the replacing field may crate on using {@link SdkCommand#CREATE} or
20
 * {@link SdkCommand#USE}.
21
 * <p/>
22
 * <b>Example:</b> The NameExField replaces the NameField in the original BaseForm without changing its order within the
23
 * FirstGroupBox. <b>Note:</b> the weird looking super constructor call is required for initializing the extended
24
 * <em>inner class</em>.
25
 * 
26
 * <pre>
27
 * public class BaseForm extends AbstractForm {
28
 *   &#064;Order(10)
29
 *   public class MainBox extends AbstractGroupBox {
30
 *     &#064;Order(10)
31
 *     public class FirstGroupBox extends AbstractGroupBox {
32
 *       &#064;Order(10)
33
 *       public class NameField extends AbstractStringField {
34
 *       }
35
 *     }
36
 *   }
37
 * }
38
 * 
39
 * public class ExtendedForm extends BaseForm {
40
 *   &#064;Replace
41
 *   public class NameExField extends NameField {
42
 *     public NameExField(BaseForm.MainBox.FirstGroupBox container) {
43
 *       container.super();
44
 *     }
45
 *   }
46
 * }
47
 * </pre>
48
 * 
49
 * <h3>Usage on table columns</h3> The annotation can be used to modify or move columns within a table. By default, the
50
 * replaced column uses the same {@link Order} of the replaced column.
51
 * <p/>
52
 * <b>Example 1:</b> The FirstExColumn replaces the FirstColumn in the original Table without changing its order.
53
 * 
54
 * <pre>
55
 * public class Table extends AbstractTable {
56
 *   &#064;Order(10)
57
 *   public class FirstColumn extends AbstractStringColumn {
58
 *   }
59
 * 
60
 *   &#064;Order(20)
61
 *   public class SecondColumn extends AbstractStringColumn {
62
 *   }
63
 * }
64
 * 
65
 * public class ExtendedTable extends Table {
66
 *   &#064;Replace
67
 *   public class FirstExColumn extends FirstColumn {
68
 *   }
69
 * }
70
 * </pre>
71
 * 
72
 * <b>Example 2:</b> Modifying the table of a table field requires to replace the table field as well:
73
 * 
74
 * <pre>
75
 * public class BaseForm extends AbstractForm {
76
 *   &#064;Order(10)
77
 *   public class MainBox extends AbstractGroupBox {
78
 *     &#064;Order(10)
79
 *     public class FirstGroupBox extends AbstractGroupBox {
80
 *       &#064;Order(10)
81
 *       public class TableField extends AbstractTableField {
82
 *         public class Table extends AbstractTable {
83
 *           &#064;Order(10)
84
 *           public class FirstColumn extends AbstractStringColumn {
85
 *           }
86
 *         }
87
 *       }
88
 *     }
89
 *   }
90
 * }
91
 * 
92
 * public class ExtendedForm extends BaseForm {
93
 *   &#064;Replace
94
 *   public class TableExField extends NameField {
95
 *     public TableExField(BaseForm.MainBox.FirstGroupBox container) {
96
 *       container.super();
97
 *     }
98
 * 
99
 *     public class TableEx extends Table {
100
 *       &#064;Replace
101
 *       public class FirstExColumn extends FirstColumn {
102
 *       }
103
 *     }
104
 *   }
105
 * }
106
 * </pre>
107
 * 
108
 * <h3>Usage on action containers</h3> The annotation can be used to change the behavior of an action. Menus, key
109
 * strokes, tool buttons and view buttons are actions as well.
110
 * <p/>
111
 * <b>Example:</b> Modify the behavior of a menu defined on a smart field:
112
 * 
113
 * <pre>
114
 * public class BaseForm extends AbstractForm {
115
 *   &#064;Order(10)
116
 *   public class MainBox extends AbstractGroupBox {
117
 *     &#064;Order(10)
118
 *     public class MySmartField extends AbstractSmartField&lt;Long&gt; {
119
 *       &#064;Order(10)
120
 *       public class MyMenu extends AbstractMenu {
121
 *       }
122
 *     }
123
 *   }
124
 * }
125
 * 
126
 * public class ExtendedForm extends BaseForm {
127
 *   &#064;Replace
128
 *   public class MyExSmartField extends MySmartField {
129
 *     public MyExSmartField(BaseForm.MainBox container) {
130
 *       container.super();
131
 *     }
132
 * 
133
 *     &#064;Replace
134
 *     public class MyExMenu extends MyMenu {
135
 *     }
136
 *   }
137
 * }
138
 * </pre>
139
 * 
140
 * @since 3.8.2
141
 */
142
@Retention(RetentionPolicy.RUNTIME)
143
@Target(ElementType.TYPE)
144
public @interface Replace {
145
146
}
(-)src/org/eclipse/scout/sdk/RuntimeClasses.java (+1 lines)
Lines 128-133 Link Here
128
  public static final String BasicHierarchyPermission = "org.eclipse.scout.rt.shared.security.BasicHierarchyPermission"; // NO_UCD
128
  public static final String BasicHierarchyPermission = "org.eclipse.scout.rt.shared.security.BasicHierarchyPermission"; // NO_UCD
129
  public static final String BasicPermission = "java.security.BasicPermission"; // NO_UCD
129
  public static final String BasicPermission = "java.security.BasicPermission"; // NO_UCD
130
  public static final String FormData = "org.eclipse.scout.commons.annotations.FormData"; // NO_UCD
130
  public static final String FormData = "org.eclipse.scout.commons.annotations.FormData"; // NO_UCD
131
  public static final String Replace = "org.eclipse.scout.commons.annotations.Replace"; // NO_UCD
131
  public static final String FormData_UpdateOperation = "org.eclipse.scout.commons.annotations.FormData.UpdateOperation"; // NO_UCD
132
  public static final String FormData_UpdateOperation = "org.eclipse.scout.commons.annotations.FormData.UpdateOperation"; // NO_UCD
132
  public static final String ClientProxyServiceFactory = "org.eclipse.scout.rt.client.services.ClientProxyServiceFactory"; // NO_UCD
133
  public static final String ClientProxyServiceFactory = "org.eclipse.scout.rt.client.services.ClientProxyServiceFactory"; // NO_UCD
133
  public static final String ClientServiceFactory = "org.eclipse.scout.rt.client.services.ClientServiceFactory"; // NO_UCD
134
  public static final String ClientServiceFactory = "org.eclipse.scout.rt.client.services.ClientServiceFactory"; // NO_UCD
(-)src/org/eclipse/scout/sdk/workspace/type/ScoutTypeUtility.java (-14 / +104 lines)
Lines 47-52 Link Here
47
import org.eclipse.scout.sdk.icon.IIconProvider;
47
import org.eclipse.scout.sdk.icon.IIconProvider;
48
import org.eclipse.scout.sdk.internal.ScoutSdk;
48
import org.eclipse.scout.sdk.internal.ScoutSdk;
49
import org.eclipse.scout.sdk.operation.form.formdata.FormDataAnnotation;
49
import org.eclipse.scout.sdk.operation.form.formdata.FormDataAnnotation;
50
import org.eclipse.scout.sdk.operation.form.formdata.FormDataUtility;
50
import org.eclipse.scout.sdk.util.Regex;
51
import org.eclipse.scout.sdk.util.Regex;
51
import org.eclipse.scout.sdk.util.ScoutMethodUtility;
52
import org.eclipse.scout.sdk.util.ScoutMethodUtility;
52
import org.eclipse.scout.sdk.util.ScoutUtility;
53
import org.eclipse.scout.sdk.util.ScoutUtility;
Lines 182-187 Link Here
182
    return null;
183
    return null;
183
  }
184
  }
184
185
186
  /**
187
   * @return Returns <code>true</code> if the given type exists and if it is annotated with an
188
   *         {@link RuntimeClasses#Replace} annotation.
189
   * @since 3.8.2
190
   */
191
  public static boolean isReplaceAnnotationPresent(IType type) {
192
    IAnnotation annotation = JdtUtility.getAnnotation(type, RuntimeClasses.Replace);
193
    return TypeUtility.exists(annotation);
194
  }
195
196
  /**
197
   * @return Returns the form field data for the given form field or <code>null</code> if it does not have one.
198
   * @since 3.8.2
199
   */
200
  public static IType getFormDataType(IType formField, ITypeHierarchy hierarchy) throws JavaModelException {
201
    IType primaryType = getFormFieldDataPrimaryTypeRec(formField, hierarchy);
202
    if (!TypeUtility.exists(primaryType)) {
203
      return null;
204
    }
205
    IType formDataType = primaryType.getType(FormDataUtility.getBeanName(FormDataUtility.getFieldNameWithoutSuffix(formField.getElementName()), true));
206
    if (TypeUtility.exists(formDataType)) {
207
      return formDataType;
208
    }
209
    return null;
210
  }
211
212
  /**
213
   * @return Returns the form field data for the given form field or <code>null</code> if it does not have one. The
214
   *         method walks recursively through the list of declaring classes until it has reached a primary type.
215
   * @since 3.8.2
216
   */
217
  private static IType getFormFieldDataPrimaryTypeRec(IType recursiveDeclaringType, ITypeHierarchy hierarchy) throws JavaModelException {
218
    if (!TypeUtility.exists(recursiveDeclaringType)) {
219
      return null;
220
    }
221
    FormDataAnnotation formDataAnnotation = findFormDataAnnotation(recursiveDeclaringType, hierarchy);
222
    if (formDataAnnotation == null) {
223
      return null;
224
    }
225
    if (FormDataAnnotation.isIgnore(formDataAnnotation)) {
226
      return null;
227
    }
228
229
    IType declaringType = recursiveDeclaringType.getDeclaringType();
230
    if (declaringType == null) {
231
      // primary type
232
      if (FormDataAnnotation.isSdkCommandCreate(formDataAnnotation) || FormDataAnnotation.isSdkCommandUse(formDataAnnotation)) {
233
        return getTypeBySignature(formDataAnnotation.getFormDataTypeSignature());
234
      }
235
      return null;
236
    }
237
238
    return getFormFieldDataPrimaryTypeRec(declaringType, hierarchy);
239
  }
240
185
  public static FormDataAnnotation findFormDataAnnotation(IType type, ITypeHierarchy hierarchy) throws JavaModelException {
241
  public static FormDataAnnotation findFormDataAnnotation(IType type, ITypeHierarchy hierarchy) throws JavaModelException {
186
    return findFormDataAnnnotationImpl(type, hierarchy);
242
    return findFormDataAnnnotationImpl(type, hierarchy);
187
  }
243
  }
Lines 212-219 Link Here
212
268
213
  private static void parseFormDataAnnotationReq(FormDataAnnotation annotation, IType type, ITypeHierarchy hierarchy, boolean isOwner) {
269
  private static void parseFormDataAnnotationReq(FormDataAnnotation annotation, IType type, ITypeHierarchy hierarchy, boolean isOwner) {
214
    if (TypeUtility.exists(type)) {
270
    if (TypeUtility.exists(type)) {
271
      boolean replaceAnnotationPresent = isReplaceAnnotationPresent(type);
215
      IType superType = hierarchy.getSuperclass(type);
272
      IType superType = hierarchy.getSuperclass(type);
216
      parseFormDataAnnotationReq(annotation, superType, hierarchy, false);
273
      parseFormDataAnnotationReq(annotation, superType, hierarchy, replaceAnnotationPresent);
274
275
      if (replaceAnnotationPresent) {
276
        if (!isReplaceAnnotationPresent(superType)) {
277
          // super type is the original field that is going to be replaced by the given type
278
          // check whether the super type is embedded into a form field that is annotated by @FormData with SdkCommand.IGNORE.
279
          try {
280
            IType declaringType = superType.getDeclaringType();
281
            while (TypeUtility.exists(declaringType)) {
282
              FormDataAnnotation declaringTypeformDataAnnotation = findFormDataAnnotation(declaringType, hierarchy);
283
              if (FormDataAnnotation.isIgnore(declaringTypeformDataAnnotation)) {
284
                // super type is embedded into a ignored form field. Hence this field is ignored as well. Adjust parsed annotation.
285
                annotation.setSdkCommand(SdkCommand.IGNORE);
286
                break;
287
              }
288
              declaringType = declaringType.getDeclaringType();
289
            }
290
          }
291
          catch (JavaModelException e) {
292
            ScoutSdk.logWarning("could not determine enclosing class's @FormData annotation", e);
293
          }
294
        }
295
296
        if (!FormDataAnnotation.isIgnore(annotation)) {
297
          // a form field data must always be created for a replacing fields if its parent has one and it must extend the parent field's field data class
298
          return;
299
        }
300
      }
301
217
      try {
302
      try {
218
        fillFormDataAnnotation(type, annotation, isOwner);
303
        fillFormDataAnnotation(type, annotation, isOwner);
219
      }
304
      }
Lines 704-722 Link Here
704
  }
789
  }
705
790
706
  /**
791
  /**
792
   * @see #getValidationRuleMethods(IType, ITypeHierarchy)
793
   */
794
  public static List<ValidationRuleMethod> getValidationRuleMethods(IType declaringType) throws JavaModelException {
795
    return getValidationRuleMethods(declaringType, null);
796
  }
797
798
  /**
707
   * @return a map with all validation rule names mapped to the method on the most specific declaring type
799
   * @return a map with all validation rule names mapped to the method on the most specific declaring type
708
   * @throws JavaModelException
800
   * @throws JavaModelException
709
   */
801
   */
710
  public static List<ValidationRuleMethod> getValidationRuleMethods(IType declaringType) throws JavaModelException {
802
  public static List<ValidationRuleMethod> getValidationRuleMethods(IType declaringType, org.eclipse.jdt.core.ITypeHierarchy superTypeHierarchy) throws JavaModelException {
711
    TreeMap<String, ValidationRuleMethod> ruleMap = new TreeMap<String, ValidationRuleMethod>();
803
    TreeMap<String, ValidationRuleMethod> ruleMap = new TreeMap<String, ValidationRuleMethod>();
712
    org.eclipse.jdt.core.ITypeHierarchy superTypeHierarchy = null;
804
    if (superTypeHierarchy == null) {
713
    try {
805
      try {
714
      superTypeHierarchy = declaringType.newSupertypeHierarchy(null);
806
        superTypeHierarchy = declaringType.newSupertypeHierarchy(null);
715
    }
807
      }
716
    catch (JavaModelException e) {
808
      catch (JavaModelException e) {
717
      ScoutSdk.logWarning("could not build super type hierarchy for '" + declaringType.getFullyQualifiedName() + "'", e);
809
        ScoutSdk.logWarning("could not build super type hierarchy for '" + declaringType.getFullyQualifiedName() + "'", e);
718
      return Collections.emptyList();
810
        return Collections.emptyList();
811
      }
719
    }
812
    }
813
720
    ArrayList<IType> targetTypeList = new ArrayList<IType>(5);
814
    ArrayList<IType> targetTypeList = new ArrayList<IType>(5);
721
    targetTypeList.add(0, declaringType);
815
    targetTypeList.add(0, declaringType);
722
    IType[] superClasses = superTypeHierarchy.getAllSuperclasses(declaringType);
816
    IType[] superClasses = superTypeHierarchy.getAllSuperclasses(declaringType);
Lines 807-816 Link Here
807
          continue;
901
          continue;
808
        }
902
        }
809
        //found new rule annotation, now find most specific method in subclasses to generate source code
903
        //found new rule annotation, now find most specific method in subclasses to generate source code
810
        if (ruleSkip.booleanValue()) {
811
          ruleMap.put(hashKey, null);
812
          continue;
813
        }
814
        if (ruleGeneratedSourceCode != null && ruleGeneratedSourceCode.length() == 0) {
904
        if (ruleGeneratedSourceCode != null && ruleGeneratedSourceCode.length() == 0) {
815
          ruleGeneratedSourceCode = null;
905
          ruleGeneratedSourceCode = null;
816
        }
906
        }
Lines 840-846 Link Here
840
          implementedMethod = annotatedMethod;
930
          implementedMethod = annotatedMethod;
841
        }
931
        }
842
        //new rule is sufficiently parsed
932
        //new rule is sufficiently parsed
843
        ValidationRuleMethod vm = new ValidationRuleMethod(validationRuleAnnotation, ruleField, ruleString, ruleGeneratedSourceCode, annotatedMethod, implementedMethod, superTypeHierarchy);
933
        ValidationRuleMethod vm = new ValidationRuleMethod(validationRuleAnnotation, ruleField, ruleString, ruleGeneratedSourceCode, annotatedMethod, implementedMethod, superTypeHierarchy, ruleSkip);
844
        ruleMap.put(hashKey, vm);
934
        ruleMap.put(hashKey, vm);
845
      }
935
      }
846
    }
936
    }
(-)src/org/eclipse/scout/sdk/workspace/type/validationrule/ValidationRuleMethod.java (-1 / +9 lines)
Lines 26-33 Link Here
26
  private final IMethod m_annotatedMethod;
26
  private final IMethod m_annotatedMethod;
27
  private final IMethod m_implementedMethod;
27
  private final IMethod m_implementedMethod;
28
  private final ITypeHierarchy m_superTypeHierarchy;
28
  private final ITypeHierarchy m_superTypeHierarchy;
29
  private final boolean m_skipRule;
29
30
30
  public ValidationRuleMethod(IAnnotation annotation, IField ruleField, String ruleName, String ruleGeneratedSourceCode, IMethod annotatedMethod, IMethod implementedMethod, ITypeHierarchy superTypeHierarchy) {
31
  public ValidationRuleMethod(IAnnotation annotation, IField ruleField, String ruleName, String ruleGeneratedSourceCode, IMethod annotatedMethod, IMethod implementedMethod, ITypeHierarchy superTypeHierarchy, boolean skipRule) {
31
    m_annotation = annotation;
32
    m_annotation = annotation;
32
    m_ruleField = ruleField;
33
    m_ruleField = ruleField;
33
    m_ruleName = ruleName;
34
    m_ruleName = ruleName;
Lines 35-40 Link Here
35
    m_annotatedMethod = annotatedMethod;
36
    m_annotatedMethod = annotatedMethod;
36
    m_implementedMethod = implementedMethod;
37
    m_implementedMethod = implementedMethod;
37
    m_superTypeHierarchy = superTypeHierarchy;
38
    m_superTypeHierarchy = superTypeHierarchy;
39
    m_skipRule = skipRule;
38
  }
40
  }
39
41
40
  /**
42
  /**
Lines 86-89 Link Here
86
    return m_superTypeHierarchy;
88
    return m_superTypeHierarchy;
87
  }
89
  }
88
90
91
  /**
92
   * @return Returns <code>true</code> if this rule should be skipped.
93
   */
94
  public boolean isSkipRule() {
95
    return m_skipRule;
96
  }
89
}
97
}
(-)src/org/eclipse/scout/sdk/operation/form/formdata/FormDataUtility.java (-5 / +15 lines)
Lines 33-38 Link Here
33
import org.eclipse.scout.sdk.util.signature.SignatureUtility;
33
import org.eclipse.scout.sdk.util.signature.SignatureUtility;
34
import org.eclipse.scout.sdk.util.type.TypeUtility;
34
import org.eclipse.scout.sdk.util.type.TypeUtility;
35
import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
35
import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
36
import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
36
import org.eclipse.text.edits.InsertEdit;
37
import org.eclipse.text.edits.InsertEdit;
37
import org.eclipse.text.edits.MultiTextEdit;
38
import org.eclipse.text.edits.MultiTextEdit;
38
39
Lines 104-111 Link Here
104
  public static ITypeSourceBuilder getPrimaryTypeFormDataSourceBuilder(String superTypeSignature, IType formField, ITypeHierarchy hierarchy) {
105
  public static ITypeSourceBuilder getPrimaryTypeFormDataSourceBuilder(String superTypeSignature, IType formField, ITypeHierarchy hierarchy) {
105
    ITypeSourceBuilder builder = null;
106
    ITypeSourceBuilder builder = null;
106
    try {
107
    try {
107
      String typeErasure = Signature.getTypeErasure(superTypeSignature);
108
      IType superType = ScoutTypeUtility.getTypeBySignature(superTypeSignature);
108
      if (Signature.getSignatureSimpleName(typeErasure).equals(Signature.getSimpleName(RuntimeClasses.AbstractTableFieldData))) {
109
      ITypeHierarchy superTypeHierarchy = null;
110
      if (TypeUtility.exists(superType)) {
111
        superTypeHierarchy = TypeUtility.getSuperTypeHierarchy(superType);
112
      }
113
114
      if (superTypeHierarchy != null && superTypeHierarchy.contains(TypeUtility.getType(RuntimeClasses.AbstractTableFieldData))) {
109
        builder = new TableFieldSourceBuilder(formField, hierarchy);
115
        builder = new TableFieldSourceBuilder(formField, hierarchy);
110
      }
116
      }
111
      else {
117
      else {
Lines 119-128 Link Here
119
    return builder;
125
    return builder;
120
  }
126
  }
121
127
122
  public static ITypeSourceBuilder getInnerTypeFormDataSourceBuilder(String superTypeSignature, IType formField, ITypeHierarchy hierarchy) {
128
  public static ITypeSourceBuilder getInnerTypeFormDataSourceBuilder(IType superType, String superTypeSignature, IType formField, ITypeHierarchy hierarchy) {
123
    ITypeSourceBuilder builder = null;
129
    ITypeSourceBuilder builder = null;
124
    String typeErasure = Signature.getTypeErasure(superTypeSignature);
130
    ITypeHierarchy superTypeHierarchy = null;
125
    if (Signature.toString(typeErasure).equals(RuntimeClasses.AbstractTableFieldData)) {
131
    if (TypeUtility.exists(superType)) {
132
      superTypeHierarchy = TypeUtility.getSuperTypeHierarchy(superType);
133
    }
134
135
    if (superTypeHierarchy != null && superTypeHierarchy.contains(TypeUtility.getType(RuntimeClasses.AbstractTableFieldData))) {
126
      builder = new TableFieldSourceBuilder(formField, hierarchy);
136
      builder = new TableFieldSourceBuilder(formField, hierarchy);
127
    }
137
    }
128
    else {
138
    else {
(-)src/org/eclipse/scout/sdk/operation/form/formdata/SourceBuilderWithProperties.java (-7 / +46 lines)
Lines 143-152 Link Here
143
  protected void addValidationRules(IType type) {
143
  protected void addValidationRules(IType type) {
144
    // validation rules
144
    // validation rules
145
    try {
145
    try {
146
      List<ValidationRuleMethod> list = ScoutTypeUtility.getValidationRuleMethods(type);
146
      boolean replaceAnnotationPresent = ScoutTypeUtility.isReplaceAnnotationPresent(type);
147
148
      ITypeHierarchy hierarchy = TypeUtility.getSuperTypeHierarchy(type);
149
      if (hierarchy == null) {
150
        return;
151
      }
152
153
      // If the replace annotation is available, we have to check whether the replaced field
154
      // is not associated to a form field data
155
      boolean superTypeHasNoFormFieldData = false;
156
      if (replaceAnnotationPresent) {
157
        IType superType = hierarchy.getSuperclass(type);
158
        superTypeHasNoFormFieldData = ScoutTypeUtility.getFormDataType(superType, hierarchy) == null;
159
      }
160
161
      List<ValidationRuleMethod> list = ScoutTypeUtility.getValidationRuleMethods(type, hierarchy.getJdtHierarchy());
147
      if (list.size() > 0) {
162
      if (list.size() > 0) {
148
        for (Iterator<ValidationRuleMethod> it = list.iterator(); it.hasNext();) {
163
        for (Iterator<ValidationRuleMethod> it = list.iterator(); it.hasNext();) {
149
          ValidationRuleMethod vm = it.next();
164
          ValidationRuleMethod vm = it.next();
165
          if (replaceAnnotationPresent) {
166
            if (superTypeHasNoFormFieldData && vm.isSkipRule()) {
167
              it.remove();
168
              continue;
169
            }
170
            else if (!superTypeHasNoFormFieldData && !type.equals(vm.getImplementedMethod().getDeclaringType())) {
171
              // remove all validation rules that are not overridden by the replacement class
172
              it.remove();
173
              continue;
174
            }
175
          }
176
          else if (vm.isSkipRule()) {
177
            // class does not replace its super class. Hence remove all skipped validation rules
178
            it.remove();
179
            continue;
180
          }
181
150
          String generatedSourceCode = vm.getRuleGeneratedSourceCode();
182
          String generatedSourceCode = vm.getRuleGeneratedSourceCode();
151
          if (generatedSourceCode != null) {
183
          if (generatedSourceCode != null) {
152
            if (generatedSourceCode.equals("null")) {
184
            if (generatedSourceCode.equals("null")) {
Lines 198-204 Link Here
198
          String generatedSourceCode = vm.getRuleGeneratedSourceCode();
230
          String generatedSourceCode = vm.getRuleGeneratedSourceCode();
199
          //filter
231
          //filter
200
          generatedSourceCode = filterGeneratedSourceCode(vm.getImplementedMethod(), generatedSourceCode, validator);
232
          generatedSourceCode = filterGeneratedSourceCode(vm.getImplementedMethod(), generatedSourceCode, validator);
201
          if (generatedSourceCode == null || containsBrackets(generatedSourceCode)) {
233
          if (!vm.isSkipRule() && (generatedSourceCode == null || containsBrackets(generatedSourceCode))) {
202
            //add javadoc warning
234
            //add javadoc warning
203
            String fqn = vm.getImplementedMethod().getDeclaringType().getFullyQualifiedName('.') + " # " + vm.getImplementedMethod().getElementName();
235
            String fqn = vm.getImplementedMethod().getDeclaringType().getFullyQualifiedName('.') + " # " + vm.getImplementedMethod().getElementName();
204
            buf.append("/**");
236
            buf.append("/**");
Lines 224-234 Link Here
224
          }
256
          }
225
          //
257
          //
226
          buf.append(NL);
258
          buf.append(NL);
227
          buf.append("ruleMap.put(");
259
          if (vm.isSkipRule()) {
228
          buf.append(ruleDecl);
260
            buf.append("ruleMap.remove(");
229
          buf.append(", ");
261
            buf.append(ruleDecl);
230
          buf.append(generatedSourceCode);
262
            buf.append(");");
231
          buf.append(");");
263
          }
264
          else {
265
            buf.append("ruleMap.put(");
266
            buf.append(ruleDecl);
267
            buf.append(", ");
268
            buf.append(generatedSourceCode);
269
            buf.append(");");
270
          }
232
        }
271
        }
233
        catch (Exception e) {
272
        catch (Exception e) {
234
          String fqn = vm.getImplementedMethod().getDeclaringType().getFullyQualifiedName() + "#" + vm.getImplementedMethod().getElementName();
273
          String fqn = vm.getImplementedMethod().getDeclaringType().getFullyQualifiedName() + "#" + vm.getImplementedMethod().getElementName();
(-)src/org/eclipse/scout/sdk/operation/form/formdata/CompositePrimaryTypeSourceBuilder.java (-8 / +27 lines)
Lines 66-85 Link Here
66
    if (formDataAnnotation != null) {
66
    if (formDataAnnotation != null) {
67
      if (FormDataAnnotation.isCreate(formDataAnnotation)) {
67
      if (FormDataAnnotation.isCreate(formDataAnnotation)) {
68
        String formDataElementName = FormDataUtility.getBeanName(FormDataUtility.getFieldNameWithoutSuffix(formField.getElementName()), true);
68
        String formDataElementName = FormDataUtility.getBeanName(FormDataUtility.getFieldNameWithoutSuffix(formField.getElementName()), true);
69
        String superTypeSignature = formDataAnnotation.getSuperTypeSignature();
69
        String superTypeSignature = null;
70
        if (formDataAnnotation.getGenericOrdinal() >= 0) {
70
        IType superType = null;
71
          IType superType = TypeUtility.getTypeBySignature(superTypeSignature);
71
72
          if (TypeUtility.isGenericType(superType)) {
72
        boolean replaceAnnotationPresent = ScoutTypeUtility.isReplaceAnnotationPresent(formField);
73
            String genericTypeSig = org.eclipse.scout.sdk.operation.form.formdata.FormDataUtility.computeFormFieldGenericType(formField, formFieldHierarchy);
73
        if (replaceAnnotationPresent) {
74
            if (genericTypeSig != null) {
74
          IType replacedType = formFieldHierarchy.getSuperclass(formField);
75
              superTypeSignature = superTypeSignature.replaceAll("\\;$", "<" + genericTypeSig + ">;");
75
          IType replacedFormFieldDataType = ScoutTypeUtility.getFormDataType(replacedType, formFieldHierarchy);
76
          if (replacedFormFieldDataType != null) {
77
            superTypeSignature = Signature.createTypeSignature(replacedFormFieldDataType.getTypeQualifiedName(), false);
78
            superType = replacedFormFieldDataType;
79
          }
80
        }
81
82
        if (superTypeSignature == null) {
83
          superTypeSignature = formDataAnnotation.getSuperTypeSignature();
84
          superType = TypeUtility.getTypeBySignature(superTypeSignature);
85
          if (formDataAnnotation.getGenericOrdinal() >= 0) {
86
            if (TypeUtility.isGenericType(superType)) {
87
              String genericTypeSig = org.eclipse.scout.sdk.operation.form.formdata.FormDataUtility.computeFormFieldGenericType(formField, formFieldHierarchy);
88
              if (genericTypeSig != null) {
89
                superTypeSignature = superTypeSignature.replaceAll("\\;$", "<" + genericTypeSig + ">;");
90
              }
76
            }
91
            }
77
          }
92
          }
78
        }
93
        }
79
        ITypeSourceBuilder builder = FormDataUtility.getInnerTypeFormDataSourceBuilder(superTypeSignature, formField, formFieldHierarchy);
94
95
        ITypeSourceBuilder builder = FormDataUtility.getInnerTypeFormDataSourceBuilder(superType, superTypeSignature, formField, formFieldHierarchy);
80
        builder.setElementName(formDataElementName);
96
        builder.setElementName(formDataElementName);
81
        builder.setSuperTypeSignature(superTypeSignature);
97
        builder.setSuperTypeSignature(superTypeSignature);
82
        builder.setFlags(Flags.AccPublic | Flags.AccStatic);
98
        builder.setFlags(Flags.AccPublic | Flags.AccStatic);
99
        if (replaceAnnotationPresent) {
100
          builder.addAnnotation(new AnnotationSourceBuilder(Signature.createTypeSignature(RuntimeClasses.Replace, true)));
101
        }
83
        addBuilder(builder, CATEGORY_TYPE_FIELD);
102
        addBuilder(builder, CATEGORY_TYPE_FIELD);
84
        MethodSourceBuilder getterBuilder = new MethodSourceBuilder(NL);
103
        MethodSourceBuilder getterBuilder = new MethodSourceBuilder(NL);
85
        getterBuilder.setElementName("get" + formDataElementName);
104
        getterBuilder.setElementName("get" + formDataElementName);
(-)src/org/eclipse/scout/rt/client/ui/action/tree/AbstractActionNode.java (-2 / +2 lines)
Lines 38-44 Link Here
38
   */
38
   */
39
  private Class<? extends IActionNode>[] getConfiguredChildActions() {
39
  private Class<? extends IActionNode>[] getConfiguredChildActions() {
40
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
40
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
41
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IActionNode.class);
41
    Class<IActionNode>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IActionNode.class);
42
    return ConfigurationUtility.removeReplacedClasses(foca);
42
  }
43
  }
43
44
44
  @Override
45
  @Override
Lines 65-71 Link Here
65
    catch (Exception e) {
66
    catch (Exception e) {
66
      LOG.error("error occured while dynamically contribute action nodes.", e);
67
      LOG.error("error occured while dynamically contribute action nodes.", e);
67
    }
68
    }
68
69
    setChildActions(nodeList);
69
    setChildActions(nodeList);
70
  }
70
  }
71
71
(-)src/org/eclipse/scout/rt/client/ui/action/AbstractAction.java (-1 / +6 lines)
Lines 18-23 Link Here
18
import org.eclipse.scout.commons.annotations.ConfigProperty;
18
import org.eclipse.scout.commons.annotations.ConfigProperty;
19
import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
19
import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
20
import org.eclipse.scout.commons.annotations.Order;
20
import org.eclipse.scout.commons.annotations.Order;
21
import org.eclipse.scout.commons.annotations.Replace;
21
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
22
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
22
import org.eclipse.scout.commons.exception.ProcessingException;
23
import org.eclipse.scout.commons.exception.ProcessingException;
23
import org.eclipse.scout.commons.logger.IScoutLogger;
24
import org.eclipse.scout.commons.logger.IScoutLogger;
Lines 272-278 Link Here
272
273
273
  @Override
274
  @Override
274
  public String getActionId() {
275
  public String getActionId() {
275
    String s = getClass().getName();
276
    Class<?> c = getClass();
277
    while (c.isAnnotationPresent(Replace.class)) {
278
      c = c.getSuperclass();
279
    }
280
    String s = c.getName();
276
    int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
281
    int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
277
    s = s.substring(i + 1);
282
    s = s.substring(i + 1);
278
    return s;
283
    return s;
(-)src/org/eclipse/scout/rt/client/ui/basic/calendar/provider/AbstractCalendarItemProvider.java (-1 / +2 lines)
Lines 89-95 Link Here
89
89
90
  private Class<? extends IMenu>[] getConfiguredMenus() {
90
  private Class<? extends IMenu>[] getConfiguredMenus() {
91
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
91
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
92
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
92
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
93
    return ConfigurationUtility.removeReplacedClasses(foca);
93
  }
94
  }
94
95
95
  /**
96
  /**
(-)src/org/eclipse/scout/rt/client/ui/basic/calendar/AbstractCalendar.java (-3 / +6 lines)
Lines 94-105 Link Here
94
94
95
  private Class<? extends ICalendarItemProvider>[] getConfiguredProducers() {
95
  private Class<? extends ICalendarItemProvider>[] getConfiguredProducers() {
96
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
96
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
97
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, ICalendarItemProvider.class);
97
    Class<ICalendarItemProvider>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, ICalendarItemProvider.class);
98
    return ConfigurationUtility.removeReplacedClasses(foca);
98
  }
99
  }
99
100
100
  private Class<? extends IMenu>[] getConfiguredMenus() {
101
  private Class<? extends IMenu>[] getConfiguredMenus() {
101
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
102
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
102
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
103
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
104
    return ConfigurationUtility.removeReplacedClasses(foca);
103
  }
105
  }
104
106
105
  @ConfigOperation
107
  @ConfigOperation
Lines 452-458 Link Here
452
  }
454
  }
453
455
454
  /**
456
  /**
455
   * do not use this internal method unless you are implementing a container that holds and controls an {@link ICalendar}
457
   * do not use this internal method unless you are implementing a container that holds and controls an
458
   * {@link ICalendar}
456
   */
459
   */
457
  public void setContainerInternal(Object container) {
460
  public void setContainerInternal(Object container) {
458
    propertySupport.setProperty(PROP_CONTAINER, container);
461
    propertySupport.setProperty(PROP_CONTAINER, container);
(-)src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTreeNode.java (-1 / +3 lines)
Lines 144-150 Link Here
144
144
145
  private Class<? extends IMenu>[] getConfiguredMenus() {
145
  private Class<? extends IMenu>[] getConfiguredMenus() {
146
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
146
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
147
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
147
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
148
    return ConfigurationUtility.removeReplacedClasses(foca);
148
  }
149
  }
149
150
150
  protected void initConfig() {
151
  protected void initConfig() {
Lines 607-612 Link Here
607
608
608
  @Override
609
  @Override
609
  public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
610
  public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
611
    // ActionFinder performs instance-of checks. Hence the menu replacement mapping is not required
610
    return new ActionFinder().findAction(getMenus(), menuType);
612
    return new ActionFinder().findAction(getMenus(), menuType);
611
  }
613
  }
612
614
(-)src/org/eclipse/scout/rt/client/ui/basic/tree/AbstractTree.java (-2 / +5 lines)
Lines 235-246 Link Here
235
235
236
  private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
236
  private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
237
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
237
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
238
    return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
238
    Class<IKeyStroke>[] fca = ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
239
    return ConfigurationUtility.removeReplacedClasses(fca);
239
  }
240
  }
240
241
241
  private Class<? extends IMenu>[] getConfiguredMenus() {
242
  private Class<? extends IMenu>[] getConfiguredMenus() {
242
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
243
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
243
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
244
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
245
    return ConfigurationUtility.removeReplacedClasses(foca);
244
  }
246
  }
245
247
246
  @ConfigOperation
248
  @ConfigOperation
Lines 491-496 Link Here
491
493
492
  @Override
494
  @Override
493
  public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
495
  public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
496
    // ActionFinder performs instance-of checks. Hence the menu replacement mapping is not required
494
    return new ActionFinder().findAction(getMenus(), menuType);
497
    return new ActionFinder().findAction(getMenus(), menuType);
495
  }
498
  }
496
499
(-)src/org/eclipse/scout/rt/client/ui/basic/activitymap/AbstractActivityMap.java (-1 / +2 lines)
Lines 137-143 Link Here
137
137
138
  private Class<? extends IMenu>[] getConfiguredMenus() {
138
  private Class<? extends IMenu>[] getConfiguredMenus() {
139
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
139
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
140
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
140
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
141
    return ConfigurationUtility.removeReplacedClasses(foca);
141
  }
142
  }
142
143
143
  /**
144
  /**
(-)src/org/eclipse/scout/rt/client/ui/basic/table/AbstractTable.java (-4 / +35 lines)
Lines 39-44 Link Here
39
import org.eclipse.scout.commons.annotations.ConfigProperty;
39
import org.eclipse.scout.commons.annotations.ConfigProperty;
40
import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
40
import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
41
import org.eclipse.scout.commons.annotations.Order;
41
import org.eclipse.scout.commons.annotations.Order;
42
import org.eclipse.scout.commons.annotations.Replace;
42
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
43
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
43
import org.eclipse.scout.commons.dnd.TextTransferObject;
44
import org.eclipse.scout.commons.dnd.TextTransferObject;
44
import org.eclipse.scout.commons.dnd.TransferObject;
45
import org.eclipse.scout.commons.dnd.TransferObject;
Lines 109-114 Link Here
109
  private final HashMap<CompositeObject, ITableRow> m_deletedRows;
110
  private final HashMap<CompositeObject, ITableRow> m_deletedRows;
110
  private TreeSet<ITableRow/* ordered by rowIndex */> m_selectedRows = new TreeSet<ITableRow>(new RowIndexComparator());
111
  private TreeSet<ITableRow/* ordered by rowIndex */> m_selectedRows = new TreeSet<ITableRow>(new RowIndexComparator());
111
  private IMenu[] m_menus;
112
  private IMenu[] m_menus;
113
  private Map<Class<?>, Class<? extends IMenu>> m_menuReplacementMapping;
112
  private ITableUIFacade m_uiFacade;
114
  private ITableUIFacade m_uiFacade;
113
  private final ArrayList<ITableRowFilter> m_rowFilters;
115
  private final ArrayList<ITableRowFilter> m_rowFilters;
114
  private String m_userPreferenceContext;
116
  private String m_userPreferenceContext;
Lines 702-718 Link Here
702
704
703
  private Class<? extends IMenu>[] getConfiguredMenus() {
705
  private Class<? extends IMenu>[] getConfiguredMenus() {
704
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
706
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
705
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
707
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
708
    return ConfigurationUtility.removeReplacedClasses(foca);
706
  }
709
  }
707
710
708
  private Class<? extends IColumn>[] getConfiguredColumns() {
711
  private Class<? extends IColumn>[] getConfiguredColumns() {
709
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
712
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
710
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IColumn.class);
713
    Class<IColumn>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IColumn.class);
714
    return ConfigurationUtility.removeReplacedClasses(foca);
711
  }
715
  }
712
716
713
  private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
717
  private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
714
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
718
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
715
    return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
719
    Class<IKeyStroke>[] fca = ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
720
    return ConfigurationUtility.removeReplacedClasses(fca);
716
  }
721
  }
717
722
718
  protected void initConfig() {
723
  protected void initConfig() {
Lines 742-747 Link Here
742
    // menus
747
    // menus
743
    ArrayList<IMenu> menuList = new ArrayList<IMenu>();
748
    ArrayList<IMenu> menuList = new ArrayList<IMenu>();
744
    Class<? extends IMenu>[] ma = getConfiguredMenus();
749
    Class<? extends IMenu>[] ma = getConfiguredMenus();
750
    Map<Class<?>, Class<? extends IMenu>> replacements = ConfigurationUtility.getReplacementMapping(ma);
751
    if (!replacements.isEmpty()) {
752
      m_menuReplacementMapping = replacements;
753
    }
745
    for (int i = 0; i < ma.length; i++) {
754
    for (int i = 0; i < ma.length; i++) {
746
      try {
755
      try {
747
        IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
756
        IMenu menu = ConfigurationUtility.newInnerInstance(this, ma[i]);
Lines 1531-1543 Link Here
1531
1540
1532
  @Override
1541
  @Override
1533
  public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
1542
  public <T extends IMenu> T getMenu(Class<T> menuType) throws ProcessingException {
1543
    // ActionFinder performs instance-of checks. Hence the menu replacement mapping is not required
1534
    return new ActionFinder().findAction(getMenus(), menuType);
1544
    return new ActionFinder().findAction(getMenus(), menuType);
1535
  }
1545
  }
1536
1546
1537
  @Override
1547
  @Override
1538
  public boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException {
1548
  public boolean runMenu(Class<? extends IMenu> menuType) throws ProcessingException {
1549
    Class<? extends IMenu> c = getReplacingMenuClass(menuType);
1539
    for (IMenu m : getMenus()) {
1550
    for (IMenu m : getMenus()) {
1540
      if (m.getClass() == menuType) {
1551
      if (m.getClass() == c) {
1541
        if (!m.isEnabledProcessingAction()) {
1552
        if (!m.isEnabledProcessingAction()) {
1542
          return false;
1553
          return false;
1543
        }
1554
        }
Lines 1557-1562 Link Here
1557
  }
1568
  }
1558
1569
1559
  /**
1570
  /**
1571
   * Checks whether the menu with the given class has been replaced by another menu. If so, the replacing
1572
   * menu's class is returned. Otherwise the given class itself.
1573
   * 
1574
   * @param c
1575
   * @return Returns the possibly available replacing menu class for the given class.
1576
   * @see Replace
1577
   * @since 3.8.2
1578
   */
1579
  private <T extends IMenu> Class<? extends T> getReplacingMenuClass(Class<T> c) {
1580
    if (m_menuReplacementMapping != null) {
1581
      @SuppressWarnings("unchecked")
1582
      Class<? extends T> replacingMenuClass = (Class<? extends T>) m_menuReplacementMapping.get(c);
1583
      if (replacingMenuClass != null) {
1584
        return replacingMenuClass;
1585
      }
1586
    }
1587
    return c;
1588
  }
1589
1590
  /**
1560
   * factory to manage table column filters
1591
   * factory to manage table column filters
1561
   * <p>
1592
   * <p>
1562
   * default creates a {@link DefaultTableColumnFilterManager}
1593
   * default creates a {@link DefaultTableColumnFilterManager}
(-)src/org/eclipse/scout/rt/client/ui/basic/table/ColumnSet.java (-1 / +39 lines)
Lines 22-27 Link Here
22
import org.eclipse.scout.commons.CompareUtility;
22
import org.eclipse.scout.commons.CompareUtility;
23
import org.eclipse.scout.commons.CompositeObject;
23
import org.eclipse.scout.commons.CompositeObject;
24
import org.eclipse.scout.commons.ConfigurationUtility;
24
import org.eclipse.scout.commons.ConfigurationUtility;
25
import org.eclipse.scout.commons.annotations.Replace;
25
import org.eclipse.scout.commons.logger.IScoutLogger;
26
import org.eclipse.scout.commons.logger.IScoutLogger;
26
import org.eclipse.scout.commons.logger.ScoutLogManager;
27
import org.eclipse.scout.commons.logger.ScoutLogManager;
27
import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
28
import org.eclipse.scout.rt.client.ui.ClientUIPreferences;
Lines 60-66 Link Here
60
   */
61
   */
61
  private final HashMap<String, IColumn> m_idIndexes = new HashMap<String, IColumn>();
62
  private final HashMap<String, IColumn> m_idIndexes = new HashMap<String, IColumn>();
62
63
64
  private final Map<Class<?>, Class<? extends IColumn>> m_columnReplacements;
65
63
  public ColumnSet(AbstractTable table, Collection<IColumn> columns) {
66
  public ColumnSet(AbstractTable table, Collection<IColumn> columns) {
67
    // process @Replace annotations
68
    @SuppressWarnings("unchecked")
69
    Class<? extends IColumn>[] columnArray = new Class[columns.size()];
70
    int i = 0;
71
    for (IColumn c : columns) {
72
      columnArray[i] = c.getClass();
73
      i++;
74
    }
75
    Map<Class<?>, Class<? extends IColumn>> replacements = ConfigurationUtility.getReplacementMapping(columnArray);
76
    if (replacements.isEmpty()) {
77
      replacements = null;
78
    }
79
    m_columnReplacements = replacements;
80
    //
64
    m_table = table;
81
    m_table = table;
65
    m_columns = new IColumn[columns.size()];
82
    m_columns = new IColumn[columns.size()];
66
    m_userSortColumns = new ArrayList<IColumn>();
83
    m_userSortColumns = new ArrayList<IColumn>();
Lines 282-288 Link Here
282
299
283
  @SuppressWarnings("unchecked")
300
  @SuppressWarnings("unchecked")
284
  public <T extends IColumn> T getColumnByClass(Class<T> c) {
301
  public <T extends IColumn> T getColumnByClass(Class<T> c) {
285
    T col = (T) m_classIndexes.get(c);
302
    Class<? extends T> columnClass = getReplacingColumnClass(c);
303
    T col = (T) m_classIndexes.get(columnClass);
286
    return col;
304
    return col;
287
  }
305
  }
288
306
Lines 291-296 Link Here
291
    return (T) m_idIndexes.get(id);
309
    return (T) m_idIndexes.get(id);
292
  }
310
  }
293
311
312
  /**
313
   * Checks whether the column with the given class has been replaced by another column. If so, the replacing
314
   * column's class is returned. Otherwise the given class itself.
315
   * 
316
   * @param c
317
   * @return Returns the possibly available replacing column class for the given class.
318
   * @see Replace
319
   * @since 3.8.2
320
   */
321
  private <T extends IColumn> Class<? extends T> getReplacingColumnClass(Class<T> c) {
322
    if (m_columnReplacements != null) {
323
      @SuppressWarnings("unchecked")
324
      Class<? extends T> replacingColumnClass = (Class<? extends T>) m_columnReplacements.get(c);
325
      if (replacingColumnClass != null) {
326
        return replacingColumnClass;
327
      }
328
    }
329
    return c;
330
  }
331
294
  public IColumn getDisplayableColumn(int index) {
332
  public IColumn getDisplayableColumn(int index) {
295
    if (index >= 0 && index < m_displayableIndexes.length) {
333
    if (index >= 0 && index < m_displayableIndexes.length) {
296
      return m_columns[m_displayableIndexes[index]];
334
      return m_columns[m_displayableIndexes[index]];
(-)src/org/eclipse/scout/rt/client/ui/basic/table/columns/AbstractColumn.java (-1 / +6 lines)
Lines 25-30 Link Here
25
import org.eclipse.scout.commons.annotations.ConfigProperty;
25
import org.eclipse.scout.commons.annotations.ConfigProperty;
26
import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
26
import org.eclipse.scout.commons.annotations.ConfigPropertyValue;
27
import org.eclipse.scout.commons.annotations.Order;
27
import org.eclipse.scout.commons.annotations.Order;
28
import org.eclipse.scout.commons.annotations.Replace;
28
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
29
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
29
import org.eclipse.scout.commons.exception.ProcessingException;
30
import org.eclipse.scout.commons.exception.ProcessingException;
30
import org.eclipse.scout.commons.logger.IScoutLogger;
31
import org.eclipse.scout.commons.logger.IScoutLogger;
Lines 828-834 Link Here
828
829
829
  @Override
830
  @Override
830
  public String getColumnId() {
831
  public String getColumnId() {
831
    String s = getClass().getSimpleName();
832
    Class<?> c = getClass();
833
    while (c.isAnnotationPresent(Replace.class)) {
834
      c = c.getSuperclass();
835
    }
836
    String s = c.getSimpleName();
832
    if (s.endsWith("Column")) {
837
    if (s.endsWith("Column")) {
833
      s = s.replaceAll("Column$", "");
838
      s = s.replaceAll("Column$", "");
834
    }
839
    }
(-)src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktop.java (-2 / +7 lines)
Lines 199-205 Link Here
199
199
200
  private Class<? extends IAction>[] getConfiguredActions() {
200
  private Class<? extends IAction>[] getConfiguredActions() {
201
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
201
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
202
    return ConfigurationUtility.filterClasses(dca, IAction.class);
202
    Class<IAction>[] fca = ConfigurationUtility.filterClasses(dca, IAction.class);
203
    return ConfigurationUtility.removeReplacedClasses(fca);
203
  }
204
  }
204
205
205
  /**
206
  /**
Lines 619-624 Link Here
619
620
620
  @Override
621
  @Override
621
  public <T extends IMenu> T getMenu(Class<? extends T> searchType) {
622
  public <T extends IMenu> T getMenu(Class<? extends T> searchType) {
623
    // ActionFinder performs instance-of checks. Hence the menu replacement mapping is not required
622
    return new ActionFinder().findAction(getMenus(), searchType);
624
    return new ActionFinder().findAction(getMenus(), searchType);
623
  }
625
  }
624
626
Lines 921-928 Link Here
921
923
922
  @Override
924
  @Override
923
  public void setOutline(Class<? extends IOutline> outlineType) {
925
  public void setOutline(Class<? extends IOutline> outlineType) {
926
    if (outlineType == null) {
927
      return;
928
    }
924
    for (IOutline o : getAvailableOutlines()) {
929
    for (IOutline o : getAvailableOutlines()) {
925
      if (o.getClass() == outlineType) {
930
      if (outlineType.isInstance(o)) {
926
        setOutline(o);
931
        setOutline(o);
927
        return;
932
        return;
928
      }
933
      }
(-)src/org/eclipse/scout/rt/client/ui/desktop/AbstractDesktopExtension.java (-1 / +2 lines)
Lines 373-379 Link Here
373
373
374
  private Class<? extends IAction>[] getConfiguredActions() {
374
  private Class<? extends IAction>[] getConfiguredActions() {
375
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
375
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
376
    return ConfigurationUtility.filterClasses(dca, IAction.class);
376
    Class<IAction>[] fca = ConfigurationUtility.filterClasses(dca, IAction.class);
377
    return ConfigurationUtility.removeReplacedClasses(fca);
377
  }
378
  }
378
379
379
}
380
}
(-)src/org/eclipse/scout/rt/client/ui/form/DefaultFormFieldInjection.java (-77 lines)
Lines 1-77 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.scout.rt.client.ui.form;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
16
import org.eclipse.scout.commons.annotations.InjectFieldTo;
17
import org.eclipse.scout.commons.annotations.Order;
18
import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
19
20
/**
21
 * Default implementation that inserts the fields at the right place based on their {@link Order} annotation.
22
 * 
23
 * @since 3.8.1
24
 */
25
public class DefaultFormFieldInjection implements IFormFieldInjection {
26
  private final ArrayList<IFormField> m_list = new ArrayList<IFormField>();
27
28
  public void addField(IFormField f) {
29
    m_list.add(f);
30
  }
31
32
  @Override
33
  public void injectFields(IFormField container, List<IFormField> fieldList) {
34
    if (container == null || fieldList == null || m_list.isEmpty()) {
35
      return;
36
    }
37
    Class<?> containerClazz = container.getClass();
38
    for (IFormField f : m_list) {
39
      InjectFieldTo ann = f.getClass().getAnnotation(InjectFieldTo.class);
40
      if (ann == null) {
41
        continue;
42
      }
43
      if (ann.value() != containerClazz) {
44
        continue;
45
      }
46
      insertField(fieldList, f);
47
    }
48
  }
49
50
  /**
51
   * add the field f to the list at the right place regarding the {@link Order} annotation
52
   */
53
  protected void insertField(List<IFormField> list, IFormField f) {
54
    //check if list already contains f
55
    if (list.contains(f)) {
56
      return;
57
    }
58
    Class<?> c = f.getClass();
59
    if (!c.isAnnotationPresent(Order.class)) {
60
      list.add(f);
61
      return;
62
    }
63
    double newOrder = c.getAnnotation(Order.class).value();
64
    for (int i = 0, n = list.size(); i < n; i++) {
65
      Class<?> existingClazz = list.get(i).getClass();
66
      if (existingClazz.isAnnotationPresent(Order.class)) {
67
        double existingOrder = existingClazz.getAnnotation(Order.class).value();
68
        if (newOrder < existingOrder) {
69
          list.add(i, f);
70
          return;
71
        }
72
      }
73
    }
74
    //default at end
75
    list.add(f);
76
  }
77
}
(-)src/org/eclipse/scout/rt/client/ui/form/FormFieldInjectionThreadLocal.java (-1 / +24 lines)
Lines 14-24 Link Here
14
import java.util.List;
14
import java.util.List;
15
15
16
import org.eclipse.scout.commons.annotations.InjectFieldTo;
16
import org.eclipse.scout.commons.annotations.InjectFieldTo;
17
import org.eclipse.scout.commons.annotations.Replace;
17
import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
18
import org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField;
18
import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
19
import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
19
20
20
/**
21
/**
21
 * Thread local used to inject form fields using the {@link InjectFieldTo} annotation
22
 * Thread local used to inject form fields using the {@link InjectFieldTo} and {@link Replace} annotations.
22
 * <p>
23
 * <p>
23
 * This thread local is used by {@link AbstractForm} and {@link AbstractFormField} to put its contributions.
24
 * This thread local is used by {@link AbstractForm} and {@link AbstractFormField} to put its contributions.
24
 * <p>
25
 * <p>
Lines 52-57 Link Here
52
53
53
  /**
54
  /**
54
   * @param container
55
   * @param container
56
   *          is the container field the given field classes are created for
57
   * @param fieldList
58
   *          live and mutable list of configured field classes (i.e. yet not instantiated)
59
   * @since 3.8.2
60
   */
61
  public static void filterFields(IFormField container, List<Class<? extends IFormField>> fieldList) {
62
    THREAD_LOCAL.get().filterFieldsInternal(container, fieldList);
63
  }
64
65
  /**
66
   * @param container
55
   *          is the container field that is being added potential injected fields
67
   *          is the container field that is being added potential injected fields
56
   * @param fieldList
68
   * @param fieldList
57
   *          live and mutable list of currently (configured) fields, not yet initialized
69
   *          live and mutable list of currently (configured) fields, not yet initialized
Lines 94-97 Link Here
94
      i.injectFields(container, fieldList);
106
      i.injectFields(container, fieldList);
95
    }
107
    }
96
  }
108
  }
109
110
  private void filterFieldsInternal(IFormField container, List<Class<? extends IFormField>> fieldList) {
111
    if (m_stack.isEmpty()) {
112
      return;
113
    }
114
    for (IFormFieldInjection i : m_stack) {
115
      if (i instanceof IFormFieldInjection2) {
116
        ((IFormFieldInjection2) i).filterFields(container, fieldList);
117
      }
118
    }
119
  }
97
}
120
}
(-)src/org/eclipse/scout/rt/client/ui/form/AbstractForm.java (-40 / +35 lines)
Lines 21-28 Link Here
21
import java.nio.charset.Charset;
21
import java.nio.charset.Charset;
22
import java.security.Permission;
22
import java.security.Permission;
23
import java.util.ArrayList;
23
import java.util.ArrayList;
24
import java.util.Arrays;
25
import java.util.Comparator;
26
import java.util.EventListener;
24
import java.util.EventListener;
27
import java.util.HashMap;
25
import java.util.HashMap;
28
import java.util.HashSet;
26
import java.util.HashSet;
Lines 139-144 Link Here
139
  private DataChangeListener m_internalDataChangeListener;
137
  private DataChangeListener m_internalDataChangeListener;
140
  private IEventHistory<FormEvent> m_eventHistory;
138
  private IEventHistory<FormEvent> m_eventHistory;
141
139
140
  // field replacement support
141
  private Map<Class<?>, Class<? extends IFormField>> m_fieldReplacements;
142
142
  public AbstractForm() throws ProcessingException {
143
  public AbstractForm() throws ProcessingException {
143
    this(true);
144
    this(true);
144
  }
145
  }
Lines 452-478 Link Here
452
453
453
  private Class<? extends IFormField>[] getConfiguredInjectedFields() {
454
  private Class<? extends IFormField>[] getConfiguredInjectedFields() {
454
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
455
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
455
    Class<IFormField>[] filteredClasses = ConfigurationUtility.filterClassesWithInjectFieldAnnotation(dca, IFormField.class);
456
    return ConfigurationUtility.filterClassesWithInjectFieldAnnotation(dca, IFormField.class);
456
    // sort injected fields by enclosing class so that sub classes are before parent classes
457
    // this order is required so that sub classes may inject fields to other injected fields defined in a super class
458
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=392972
459
    Comparator<Class<?>> comparator = new Comparator<Class<?>>() {
460
      @Override
461
      public int compare(Class<?> c1, Class<?> c2) {
462
        Class<?> ec1 = c1.getEnclosingClass();
463
        Class<?> ec2 = c2.getEnclosingClass();
464
465
        if (ec1 == ec2) {
466
          return 0;
467
        }
468
        if (ec2 != null && ec2.getSuperclass() == ec1) {
469
          return 1;
470
        }
471
        return -1;
472
      }
473
    };
474
    Arrays.sort(filteredClasses, comparator);
475
    return filteredClasses;
476
  }
457
  }
477
458
478
  protected void initConfig() throws ProcessingException {
459
  protected void initConfig() throws ProcessingException {
Lines 482-506 Link Here
482
    // prepare injected fields
463
    // prepare injected fields
483
    Class<? extends IFormField>[] fieldArray = getConfiguredInjectedFields();
464
    Class<? extends IFormField>[] fieldArray = getConfiguredInjectedFields();
484
    DefaultFormFieldInjection injectedFields = null;
465
    DefaultFormFieldInjection injectedFields = null;
485
    if (fieldArray.length > 0) {
486
      injectedFields = new DefaultFormFieldInjection();
487
    }
488
    IGroupBox rootBox = getRootGroupBox();
466
    IGroupBox rootBox = getRootGroupBox();
489
    try {
467
    try {
490
      if (injectedFields != null) {
468
      if (fieldArray.length > 0) {
469
        injectedFields = new DefaultFormFieldInjection(this);
470
        injectedFields.addFields(fieldArray);
491
        FormFieldInjectionThreadLocal.push(injectedFields);
471
        FormFieldInjectionThreadLocal.push(injectedFields);
492
        // create instances of injected fields
493
        for (Class<? extends IFormField> clazz : fieldArray) {
494
          try {
495
            IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
496
            if (f != null) {
497
              injectedFields.addField(f);
498
            }
499
          }// end try
500
          catch (Throwable t) {
501
            SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
502
          }
503
        }
504
      }
472
      }
505
      //
473
      //
506
      // add mainbox if getter returns null
474
      // add mainbox if getter returns null
Lines 517-522 Link Here
517
    }
485
    }
518
    finally {
486
    finally {
519
      if (injectedFields != null) {
487
      if (injectedFields != null) {
488
        m_fieldReplacements = injectedFields.getReplacementMapping();
520
        FormFieldInjectionThreadLocal.pop(injectedFields);
489
        FormFieldInjectionThreadLocal.pop(injectedFields);
521
      }
490
      }
522
    }
491
    }
Lines 2117-2123 Link Here
2117
  }
2086
  }
2118
2087
2119
  /**
2088
  /**
2120
   * Model Observer .
2089
   * @return Returns a map having old field classes as keys and replacement field classes as values. <code>null</code> is
2090
   *         returned if no form fields are replaced. Do not use this internal method.
2091
   * @since 3.8.2
2092
   */
2093
  public Map<Class<?>, Class<? extends IFormField>> getFormFieldReplacementsInternal() {
2094
    return m_fieldReplacements;
2095
  }
2096
2097
  /**
2098
   * Registers the given form field replacements on this form. Do not use this internal method.
2099
   * 
2100
   * @param replacements
2101
   *          Map having old field classes as key and replacing field classes as values.
2102
   * @since 3.8.2
2103
   */
2104
  public void registerFormFieldReplacementsInternal(Map<Class<?>, Class<? extends IFormField>> replacements) {
2105
    if (replacements == null || replacements.isEmpty()) {
2106
      return;
2107
    }
2108
    if (m_fieldReplacements == null) {
2109
      m_fieldReplacements = new HashMap<Class<?>, Class<? extends IFormField>>();
2110
    }
2111
    m_fieldReplacements.putAll(replacements);
2112
  }
2113
2114
  /**
2115
   * Model Observer.
2121
   */
2116
   */
2122
  @Override
2117
  @Override
2123
  public void addFormListener(FormListener listener) {
2118
  public void addFormListener(FormListener listener) {
(-)src/org/eclipse/scout/rt/client/ui/form/fields/smartfield/AbstractSmartField.java (-1 / +2 lines)
Lines 347-353 Link Here
347
347
348
  private Class<? extends IMenu>[] getConfiguredMenus() {
348
  private Class<? extends IMenu>[] getConfiguredMenus() {
349
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
349
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
350
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
350
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
351
    return ConfigurationUtility.removeReplacedClasses(foca);
351
  }
352
  }
352
353
353
  // override to freeze
354
  // override to freeze
(-)src/org/eclipse/scout/rt/client/ui/form/fields/filechooserfield/AbstractFileChooserField.java (-1 / +2 lines)
Lines 128-134 Link Here
128
128
129
  private Class<? extends IMenu>[] getConfiguredMenus() {
129
  private Class<? extends IMenu>[] getConfiguredMenus() {
130
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
130
    Class<?>[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
131
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
131
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
132
    return ConfigurationUtility.removeReplacedClasses(foca);
132
  }
133
  }
133
134
134
  @Override
135
  @Override
(-)src/org/eclipse/scout/rt/client/ui/form/fields/imagebox/AbstractImageField.java (-1 / +2 lines)
Lines 138-144 Link Here
138
138
139
  private Class<? extends IMenu>[] getConfiguredMenus() {
139
  private Class<? extends IMenu>[] getConfiguredMenus() {
140
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
140
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
141
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
141
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
142
    return ConfigurationUtility.removeReplacedClasses(foca);
142
  }
143
  }
143
144
144
  @Override
145
  @Override
(-)src/org/eclipse/scout/rt/client/ui/form/fields/AbstractCompositeField.java (-19 / +58 lines)
Lines 14-24 Link Here
14
import java.beans.PropertyChangeListener;
14
import java.beans.PropertyChangeListener;
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.List;
16
import java.util.List;
17
import java.util.Map;
17
18
18
import org.eclipse.scout.commons.ConfigurationUtility;
19
import org.eclipse.scout.commons.ConfigurationUtility;
19
import org.eclipse.scout.commons.annotations.InjectFieldTo;
20
import org.eclipse.scout.commons.annotations.InjectFieldTo;
21
import org.eclipse.scout.commons.annotations.Replace;
20
import org.eclipse.scout.commons.exception.ProcessingException;
22
import org.eclipse.scout.commons.exception.ProcessingException;
21
import org.eclipse.scout.commons.holders.Holder;
23
import org.eclipse.scout.commons.holders.Holder;
24
import org.eclipse.scout.rt.client.ui.form.AbstractForm;
22
import org.eclipse.scout.rt.client.ui.form.DefaultFormFieldInjection;
25
import org.eclipse.scout.rt.client.ui.form.DefaultFormFieldInjection;
23
import org.eclipse.scout.rt.client.ui.form.FormFieldInjectionThreadLocal;
26
import org.eclipse.scout.rt.client.ui.form.FormFieldInjectionThreadLocal;
24
import org.eclipse.scout.rt.client.ui.form.IForm;
27
import org.eclipse.scout.rt.client.ui.form.IForm;
Lines 31-36 Link Here
31
public abstract class AbstractCompositeField extends AbstractFormField implements ICompositeField {
34
public abstract class AbstractCompositeField extends AbstractFormField implements ICompositeField {
32
35
33
  private IFormField[] m_fields;
36
  private IFormField[] m_fields;
37
  private Map<Class<?>, Class<? extends IFormField>> m_formFieldReplacements;
34
38
35
  public AbstractCompositeField() {
39
  public AbstractCompositeField() {
36
    this(true);
40
    this(true);
Lines 66-86 Link Here
66
    Class<? extends IFormField>[] fieldArray = getConfiguredFields();
70
    Class<? extends IFormField>[] fieldArray = getConfiguredFields();
67
    // prepare injected fields
71
    // prepare injected fields
68
    DefaultFormFieldInjection injectedFields = null;
72
    DefaultFormFieldInjection injectedFields = null;
73
    List<Class<? extends IFormField>> configuredFields = new ArrayList<Class<? extends IFormField>>();
69
    for (Class<? extends IFormField> clazz : fieldArray) {
74
    for (Class<? extends IFormField> clazz : fieldArray) {
70
      if (!clazz.isAnnotationPresent(InjectFieldTo.class)) {
75
      if (ConfigurationUtility.isInjectFieldAnnotationPresent(clazz)) {
71
        continue;
76
        if (injectedFields == null) {
72
      }
77
          injectedFields = new DefaultFormFieldInjection(this);
73
      try {
74
        IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
75
        if (f != null) {
76
          if (injectedFields == null) {
77
            injectedFields = new DefaultFormFieldInjection();
78
          }
79
          injectedFields.addField(f);
80
        }
78
        }
81
      }// end try
79
        injectedFields.addField(clazz);
82
      catch (Throwable t) {
80
      }
83
        SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("field: " + clazz.getName(), t));
81
      else {
82
        configuredFields.add(clazz);
84
      }
83
      }
85
    }
84
    }
86
    ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
85
    ArrayList<IFormField> fieldList = new ArrayList<IFormField>();
Lines 89-98 Link Here
89
        FormFieldInjectionThreadLocal.push(injectedFields);
88
        FormFieldInjectionThreadLocal.push(injectedFields);
90
      }
89
      }
91
      //
90
      //
92
      for (Class<? extends IFormField> clazz : fieldArray) {
91
      filterFieldsInternal(configuredFields);
93
        if (clazz.isAnnotationPresent(InjectFieldTo.class)) {
92
      for (Class<? extends IFormField> clazz : configuredFields) {
94
          continue;
95
        }
96
        try {
93
        try {
97
          IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
94
          IFormField f = ConfigurationUtility.newInnerInstance(this, clazz);
98
          fieldList.add(f);
95
          fieldList.add(f);
Lines 105-110 Link Here
105
    }
102
    }
106
    finally {
103
    finally {
107
      if (injectedFields != null) {
104
      if (injectedFields != null) {
105
        m_formFieldReplacements = injectedFields.getReplacementMapping();
108
        FormFieldInjectionThreadLocal.pop(injectedFields);
106
        FormFieldInjectionThreadLocal.pop(injectedFields);
109
      }
107
      }
110
    }
108
    }
Lines 120-125 Link Here
120
  }
118
  }
121
119
122
  /**
120
  /**
121
   * Filter list of configured fields before they are instantiated.
122
   * <p/>
123
   * The default implementation removes fields replaced by another field annotated with {@link Replace}.
124
   * 
125
   * @param fieldList
126
   *          live and mutable list of configured field classes (i.e. yet not instantiated)
127
   * @since 3.8.2
128
   */
129
  protected void filterFieldsInternal(List<Class<? extends IFormField>> fieldList) {
130
    FormFieldInjectionThreadLocal.filterFields(this, fieldList);
131
  }
132
133
  /**
123
   * Override this internal method only in order to make use of dynamic fields<br>
134
   * Override this internal method only in order to make use of dynamic fields<br>
124
   * Used to manage field list and add/remove fields (see {@link AbstractGroupBox} with wizard buttons)
135
   * Used to manage field list and add/remove fields (see {@link AbstractGroupBox} with wizard buttons)
125
   * <p>
136
   * <p>
Lines 136-141 Link Here
136
  @Override
147
  @Override
137
  public void setFormInternal(IForm form) {
148
  public void setFormInternal(IForm form) {
138
    super.setFormInternal(form);
149
    super.setFormInternal(form);
150
    if (form instanceof AbstractForm) {
151
      ((AbstractForm) form).registerFormFieldReplacementsInternal(m_formFieldReplacements);
152
    }
139
    IFormField[] a = m_fields;
153
    IFormField[] a = m_fields;
140
    for (int i = 0; i < a.length; i++) {
154
    for (int i = 0; i < a.length; i++) {
141
      IFormField f = a[i];
155
      IFormField f = a[i];
Lines 192-204 Link Here
192
  }
206
  }
193
207
194
  @Override
208
  @Override
195
  public <T extends IFormField> T getFieldByClass(final Class<T> c) {
209
  public <T extends IFormField> T getFieldByClass(Class<T> c) {
210
    final Class<? extends T> formFieldClass = getReplacingFieldClass(c);
196
    final Holder<T> found = new Holder<T>(c);
211
    final Holder<T> found = new Holder<T>(c);
197
    IFormFieldVisitor v = new IFormFieldVisitor() {
212
    IFormFieldVisitor v = new IFormFieldVisitor() {
198
      @Override
213
      @Override
199
      @SuppressWarnings("unchecked")
214
      @SuppressWarnings("unchecked")
200
      public boolean visitField(IFormField field, int level, int fieldIndex) {
215
      public boolean visitField(IFormField field, int level, int fieldIndex) {
201
        if (field.getClass() == c) {
216
        if (field.getClass() == formFieldClass) {
202
          found.setValue((T) field);
217
          found.setValue((T) field);
203
        }
218
        }
204
        return found.getValue() == null;
219
        return found.getValue() == null;
Lines 208-213 Link Here
208
    return found.getValue();
223
    return found.getValue();
209
  }
224
  }
210
225
226
  /**
227
   * Checks whether the form field with the given class has been replaced by another form field. If so, the replacing
228
   * form field's class is returned. Otherwise the given class itself.
229
   * 
230
   * @param c
231
   * @return Returns the possibly available replacing field class for the given class.
232
   * @see Replace
233
   * @since 3.8.2
234
   */
235
  private <T extends IFormField> Class<? extends T> getReplacingFieldClass(Class<T> c) {
236
    IForm form = getForm();
237
    if (form instanceof AbstractForm) {
238
      Map<Class<?>, Class<? extends IFormField>> mapping = ((AbstractForm) form).getFormFieldReplacementsInternal();
239
      if (mapping != null) {
240
        @SuppressWarnings("unchecked")
241
        Class<? extends T> replacementFieldClass = (Class<? extends T>) mapping.get(c);
242
        if (replacementFieldClass != null) {
243
          return replacementFieldClass;
244
        }
245
      }
246
    }
247
    return c;
248
  }
249
211
  @Override
250
  @Override
212
  public IFormField[] getFields() {
251
  public IFormField[] getFields() {
213
    IFormField[] a = new IFormField[m_fields.length];
252
    IFormField[] a = new IFormField[m_fields.length];
(-)src/org/eclipse/scout/rt/client/ui/form/fields/AbstractFormField.java (-20 / +13 lines)
Lines 27-38 Link Here
27
import org.eclipse.scout.commons.annotations.FormData;
27
import org.eclipse.scout.commons.annotations.FormData;
28
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
28
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
29
import org.eclipse.scout.commons.annotations.Order;
29
import org.eclipse.scout.commons.annotations.Order;
30
import org.eclipse.scout.commons.annotations.Replace;
30
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
31
import org.eclipse.scout.commons.beans.AbstractPropertyObserver;
31
import org.eclipse.scout.commons.beans.BasicPropertySupport;
32
import org.eclipse.scout.commons.beans.BasicPropertySupport;
32
import org.eclipse.scout.commons.exception.IProcessingStatus;
33
import org.eclipse.scout.commons.exception.IProcessingStatus;
33
import org.eclipse.scout.commons.exception.ProcessingException;
34
import org.eclipse.scout.commons.exception.ProcessingException;
34
import org.eclipse.scout.commons.exception.ProcessingStatus;
35
import org.eclipse.scout.commons.exception.ProcessingStatus;
35
import org.eclipse.scout.commons.holders.Holder;
36
import org.eclipse.scout.commons.logger.IScoutLogger;
36
import org.eclipse.scout.commons.logger.IScoutLogger;
37
import org.eclipse.scout.commons.logger.ScoutLogManager;
37
import org.eclipse.scout.commons.logger.ScoutLogManager;
38
import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
38
import org.eclipse.scout.commons.xmlparser.SimpleXmlElement;
Lines 43-49 Link Here
43
import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
43
import org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke;
44
import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
44
import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
45
import org.eclipse.scout.rt.client.ui.form.IForm;
45
import org.eclipse.scout.rt.client.ui.form.IForm;
46
import org.eclipse.scout.rt.client.ui.form.IFormFieldVisitor;
47
import org.eclipse.scout.rt.client.ui.form.PrintDevice;
46
import org.eclipse.scout.rt.client.ui.form.PrintDevice;
48
import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
47
import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
49
import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
48
import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
Lines 651-657 Link Here
651
650
652
  private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
651
  private Class<? extends IKeyStroke>[] getConfiguredKeyStrokes() {
653
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
652
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
654
    return ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
653
    Class<IKeyStroke>[] fca = ConfigurationUtility.filterClasses(dca, IKeyStroke.class);
654
    return ConfigurationUtility.removeReplacedClasses(fca);
655
  }
655
  }
656
656
657
  @ConfigOperation
657
  @ConfigOperation
Lines 805-828 Link Here
805
      return getForm().getFieldByClass(c);
805
      return getForm().getFieldByClass(c);
806
    }
806
    }
807
807
808
    final Holder<T> found = new Holder<T>(c);
809
    IFormFieldVisitor v = new IFormFieldVisitor() {
810
      @Override
811
      @SuppressWarnings("unchecked")
812
      public boolean visitField(IFormField field, int level, int fieldIndex) {
813
        if (field.getClass() == c) {
814
          found.setValue((T) field);
815
        }
816
        return found.getValue() == null;
817
      }
818
    };
819
820
    // search requested field within critical parent field
808
    // search requested field within critical parent field
821
    Collections.reverse(enclosingFields);
809
    Collections.reverse(enclosingFields);
822
    for (ICompositeField parentField : enclosingFields) {
810
    for (ICompositeField parentField : enclosingFields) {
823
      parentField.visitFields(v, 0);
811
      T field = parentField.getFieldByClass(c);
824
      if (found.getValue() != null) {
812
      if (field != null) {
825
        return found.getValue();
813
        return field;
826
      }
814
      }
827
    }
815
    }
828
816
Lines 1033-1039 Link Here
1033
1021
1034
  @Override
1022
  @Override
1035
  public String getFieldId() {
1023
  public String getFieldId() {
1036
    return getClass().getSimpleName();
1024
    Class<?> c = getClass();
1025
    while (c.isAnnotationPresent(Replace.class)) {
1026
      c = c.getSuperclass();
1027
    }
1028
    return c.getSimpleName();
1037
  }
1029
  }
1038
1030
1039
  /*
1031
  /*
Lines 1736-1742 Link Here
1736
        SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("keyStroke: " + shortcutArray[i].getName(), t));
1728
        SERVICES.getService(IExceptionHandlerService.class).handleException(new ProcessingException("keyStroke: " + shortcutArray[i].getName(), t));
1737
      }
1729
      }
1738
    }
1730
    }
1739
    return ksMap.values().toArray(new IKeyStroke[ksMap.size()]);
1731
    List<IKeyStroke> ksList = new ArrayList<IKeyStroke>(ksMap.values());
1732
    return ksList.toArray(new IKeyStroke[ksList.size()]);
1740
  }
1733
  }
1741
1734
1742
  @Override
1735
  @Override
(-)src/org/eclipse/scout/rt/client/ui/form/fields/button/AbstractButton.java (-1 / +2 lines)
Lines 210-216 Link Here
210
210
211
  private Class<? extends IMenu>[] getConfiguredMenus() {
211
  private Class<? extends IMenu>[] getConfiguredMenus() {
212
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
212
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
213
    return ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
213
    Class<IMenu>[] foca = ConfigurationUtility.sortFilteredClassesByOrderAnnotation(dca, IMenu.class);
214
    return ConfigurationUtility.removeReplacedClasses(foca);
214
  }
215
  }
215
216
216
  @Override
217
  @Override
(-)src/org/eclipse/scout/rt/client/ui/form/IFormFieldInjection2.java (+33 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.scout.rt.client.ui.form;
12
13
import java.util.List;
14
15
import org.eclipse.scout.rt.client.ui.form.fields.IFormField;
16
17
/**
18
 * Interface extension to {@link IFormFieldInjection} that provides additional methods for filtering form fields before
19
 * they are initialized.
20
 * 
21
 * @since 3.8.2
22
 */
23
public interface IFormFieldInjection2 extends IFormFieldInjection {
24
25
  /**
26
   * @param container
27
   *          is the container field the given field classes are created for
28
   * @param fieldList
29
   *          live and mutable list of configured field classes (i.e. yet not instantiated)
30
   * @since 3.8.2
31
   */
32
  void filterFields(IFormField container, List<Class<? extends IFormField>> fieldList);
33
}
(-)src/org/eclipse/scout/rt/extension/client/ExtensionUtilityTest.java (+1 lines)
Lines 34-39 Link Here
34
/**
34
/**
35
 * @since 3.9.0
35
 * @since 3.9.0
36
 */
36
 */
37
@SuppressWarnings("deprecation")
37
public class ExtensionUtilityTest {
38
public class ExtensionUtilityTest {
38
39
39
  private List<Object> m_instanceList;
40
  private List<Object> m_instanceList;
(-)src/org/eclipse/scout/rt/extension/client/ui/basic/table/ExtensibleTableTest.java (+1 lines)
Lines 22-27 Link Here
22
/**
22
/**
23
 * @since 3.9.0
23
 * @since 3.9.0
24
 */
24
 */
25
@SuppressWarnings("deprecation")
25
public class ExtensibleTableTest {
26
public class ExtensibleTableTest {
26
27
27
  @Test
28
  @Test
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/BaseFormData.java (+135 lines)
Line 0 Link Here
1
package formdata.shared.services.process.replace;
2
3
import org.eclipse.scout.rt.shared.data.form.ValidationRule;
4
import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
5
import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
6
7
public class BaseFormData extends AbstractFormData {
8
  private static final long serialVersionUID = 1L;
9
10
  public BaseFormData() {
11
  }
12
13
  public Lookup getLookup() {
14
    return getFieldByClass(Lookup.class);
15
  }
16
17
  public Name getName() {
18
    return getFieldByClass(Name.class);
19
  }
20
21
  public SdkCommandCreate getSdkCommandCreate() {
22
    return getFieldByClass(SdkCommandCreate.class);
23
  }
24
25
  public SdkCommandNone getSdkCommandNone() {
26
    return getFieldByClass(SdkCommandNone.class);
27
  }
28
29
  public SdkCommandUse getSdkCommandUse() {
30
    return getFieldByClass(SdkCommandUse.class);
31
  }
32
33
  public Smart getSmart() {
34
    return getFieldByClass(Smart.class);
35
  }
36
37
  public static class Lookup extends AbstractValueFieldData<Long> {
38
    private static final long serialVersionUID = 1L;
39
40
    public Lookup() {
41
    }
42
43
    /**
44
     * list of derived validation rules.
45
     */
46
    @Override
47
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
48
      super.initValidationRules(ruleMap);
49
      ruleMap.put(ValidationRule.LOOKUP_CALL, TestingLookupCall.class);
50
      ruleMap.put(ValidationRule.ZERO_NULL_EQUALITY, true);
51
    }
52
  }
53
54
  public static class Name extends AbstractValueFieldData<String> {
55
    private static final long serialVersionUID = 1L;
56
57
    public Name() {
58
    }
59
60
    /**
61
     * list of derived validation rules.
62
     */
63
    @Override
64
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
65
      super.initValidationRules(ruleMap);
66
      ruleMap.put(ValidationRule.MANDATORY, true);
67
      ruleMap.put(ValidationRule.MAX_LENGTH, 60);
68
    }
69
  }
70
71
  public static class SdkCommandCreate extends AbstractValueFieldData<String> {
72
    private static final long serialVersionUID = 1L;
73
74
    public SdkCommandCreate() {
75
    }
76
77
    /**
78
     * list of derived validation rules.
79
     */
80
    @Override
81
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
82
      super.initValidationRules(ruleMap);
83
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
84
    }
85
  }
86
87
  public static class SdkCommandNone extends AbstractValueFieldData<String> {
88
    private static final long serialVersionUID = 1L;
89
90
    public SdkCommandNone() {
91
    }
92
93
    /**
94
     * list of derived validation rules.
95
     */
96
    @Override
97
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
98
      super.initValidationRules(ruleMap);
99
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
100
    }
101
  }
102
103
  public static class SdkCommandUse extends UsingFormFieldData {
104
    private static final long serialVersionUID = 1L;
105
106
    public SdkCommandUse() {
107
    }
108
109
    /**
110
     * list of derived validation rules.
111
     */
112
    @Override
113
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
114
      super.initValidationRules(ruleMap);
115
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
116
    }
117
  }
118
119
  public static class Smart extends AbstractValueFieldData<Long> {
120
    private static final long serialVersionUID = 1L;
121
122
    public Smart() {
123
    }
124
125
    /**
126
     * list of derived validation rules.
127
     */
128
    @Override
129
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
130
      super.initValidationRules(ruleMap);
131
      ruleMap.put(ValidationRule.CODE_TYPE, TestingCodeType.class);
132
      ruleMap.put(ValidationRule.ZERO_NULL_EQUALITY, true);
133
    }
134
  }
135
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/ExtendedExtendedFormData.java (+848 lines)
Line 0 Link Here
1
package formdata.shared.services.process.replace;
2
3
import org.eclipse.scout.commons.annotations.Replace;
4
import org.eclipse.scout.rt.shared.data.form.ValidationRule;
5
import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
6
import org.eclipse.scout.rt.shared.data.form.properties.AbstractPropertyData;
7
8
public class ExtendedExtendedFormData extends ExtendedFormData {
9
  private static final long serialVersionUID = 1L;
10
11
  public ExtendedExtendedFormData() {
12
  }
13
14
  public IgnoringGroupBoxExCreateNone getIgnoringGroupBoxExCreateNone() {
15
    return getFieldByClass(IgnoringGroupBoxExCreateNone.class);
16
  }
17
18
  public IgnoringGroupBoxExNoneCreate getIgnoringGroupBoxExNoneCreate() {
19
    return getFieldByClass(IgnoringGroupBoxExNoneCreate.class);
20
  }
21
22
  public NameExEx getNameExEx() {
23
    return getFieldByClass(NameExEx.class);
24
  }
25
26
  public SdkCommandCreateCreateCreate getSdkCommandCreateCreateCreate() {
27
    return getFieldByClass(SdkCommandCreateCreateCreate.class);
28
  }
29
30
  public SdkCommandCreateCreateIgnore getSdkCommandCreateCreateIgnore() {
31
    return getFieldByClass(SdkCommandCreateCreateIgnore.class);
32
  }
33
34
  public SdkCommandCreateCreateNone getSdkCommandCreateCreateNone() {
35
    return getFieldByClass(SdkCommandCreateCreateNone.class);
36
  }
37
38
  public SdkCommandCreateCreateUse getSdkCommandCreateCreateUse() {
39
    return getFieldByClass(SdkCommandCreateCreateUse.class);
40
  }
41
42
  public SdkCommandCreateIgnoreCreate getSdkCommandCreateIgnoreCreate() {
43
    return getFieldByClass(SdkCommandCreateIgnoreCreate.class);
44
  }
45
46
  public SdkCommandCreateIgnoreIgnore getSdkCommandCreateIgnoreIgnore() {
47
    return getFieldByClass(SdkCommandCreateIgnoreIgnore.class);
48
  }
49
50
  public SdkCommandCreateIgnoreNone getSdkCommandCreateIgnoreNone() {
51
    return getFieldByClass(SdkCommandCreateIgnoreNone.class);
52
  }
53
54
  public SdkCommandCreateIgnoreUse getSdkCommandCreateIgnoreUse() {
55
    return getFieldByClass(SdkCommandCreateIgnoreUse.class);
56
  }
57
58
  public SdkCommandCreateNoneCreate getSdkCommandCreateNoneCreate() {
59
    return getFieldByClass(SdkCommandCreateNoneCreate.class);
60
  }
61
62
  public SdkCommandCreateNoneIgnore getSdkCommandCreateNoneIgnore() {
63
    return getFieldByClass(SdkCommandCreateNoneIgnore.class);
64
  }
65
66
  public SdkCommandCreateNoneNone getSdkCommandCreateNoneNone() {
67
    return getFieldByClass(SdkCommandCreateNoneNone.class);
68
  }
69
70
  public SdkCommandCreateNoneUse getSdkCommandCreateNoneUse() {
71
    return getFieldByClass(SdkCommandCreateNoneUse.class);
72
  }
73
74
  public SdkCommandCreateUseCreate getSdkCommandCreateUseCreate() {
75
    return getFieldByClass(SdkCommandCreateUseCreate.class);
76
  }
77
78
  public SdkCommandCreateUseIgnore getSdkCommandCreateUseIgnore() {
79
    return getFieldByClass(SdkCommandCreateUseIgnore.class);
80
  }
81
82
  public SdkCommandCreateUseNone getSdkCommandCreateUseNone() {
83
    return getFieldByClass(SdkCommandCreateUseNone.class);
84
  }
85
86
  public SdkCommandCreateUseUse getSdkCommandCreateUseUse() {
87
    return getFieldByClass(SdkCommandCreateUseUse.class);
88
  }
89
90
  public SdkCommandIgnoreCreateCreate getSdkCommandIgnoreCreateCreate() {
91
    return getFieldByClass(SdkCommandIgnoreCreateCreate.class);
92
  }
93
94
  public SdkCommandIgnoreCreateIgnore getSdkCommandIgnoreCreateIgnore() {
95
    return getFieldByClass(SdkCommandIgnoreCreateIgnore.class);
96
  }
97
98
  public SdkCommandIgnoreCreateNone getSdkCommandIgnoreCreateNone() {
99
    return getFieldByClass(SdkCommandIgnoreCreateNone.class);
100
  }
101
102
  public SdkCommandIgnoreCreateUse getSdkCommandIgnoreCreateUse() {
103
    return getFieldByClass(SdkCommandIgnoreCreateUse.class);
104
  }
105
106
  public SdkCommandIgnoreIgnoreCreate getSdkCommandIgnoreIgnoreCreate() {
107
    return getFieldByClass(SdkCommandIgnoreIgnoreCreate.class);
108
  }
109
110
  public SdkCommandIgnoreIgnoreUse getSdkCommandIgnoreIgnoreUse() {
111
    return getFieldByClass(SdkCommandIgnoreIgnoreUse.class);
112
  }
113
114
  public SdkCommandIgnoreNoneCreate getSdkCommandIgnoreNoneCreate() {
115
    return getFieldByClass(SdkCommandIgnoreNoneCreate.class);
116
  }
117
118
  public SdkCommandIgnoreNoneUse getSdkCommandIgnoreNoneUse() {
119
    return getFieldByClass(SdkCommandIgnoreNoneUse.class);
120
  }
121
122
  public SdkCommandIgnoreUseCreate getSdkCommandIgnoreUseCreate() {
123
    return getFieldByClass(SdkCommandIgnoreUseCreate.class);
124
  }
125
126
  public SdkCommandIgnoreUseIgnore getSdkCommandIgnoreUseIgnore() {
127
    return getFieldByClass(SdkCommandIgnoreUseIgnore.class);
128
  }
129
130
  public SdkCommandIgnoreUseNone getSdkCommandIgnoreUseNone() {
131
    return getFieldByClass(SdkCommandIgnoreUseNone.class);
132
  }
133
134
  public SdkCommandIgnoreUseUse getSdkCommandIgnoreUseUse() {
135
    return getFieldByClass(SdkCommandIgnoreUseUse.class);
136
  }
137
138
  public SdkCommandNoneCreateCreate getSdkCommandNoneCreateCreate() {
139
    return getFieldByClass(SdkCommandNoneCreateCreate.class);
140
  }
141
142
  public SdkCommandNoneCreateIgnore getSdkCommandNoneCreateIgnore() {
143
    return getFieldByClass(SdkCommandNoneCreateIgnore.class);
144
  }
145
146
  public SdkCommandNoneCreateNone getSdkCommandNoneCreateNone() {
147
    return getFieldByClass(SdkCommandNoneCreateNone.class);
148
  }
149
150
  public SdkCommandNoneCreateUse getSdkCommandNoneCreateUse() {
151
    return getFieldByClass(SdkCommandNoneCreateUse.class);
152
  }
153
154
  public SdkCommandNoneIgnoreCreate getSdkCommandNoneIgnoreCreate() {
155
    return getFieldByClass(SdkCommandNoneIgnoreCreate.class);
156
  }
157
158
  public SdkCommandNoneIgnoreIgnore getSdkCommandNoneIgnoreIgnore() {
159
    return getFieldByClass(SdkCommandNoneIgnoreIgnore.class);
160
  }
161
162
  public SdkCommandNoneIgnoreNone getSdkCommandNoneIgnoreNone() {
163
    return getFieldByClass(SdkCommandNoneIgnoreNone.class);
164
  }
165
166
  public SdkCommandNoneIgnoreUse getSdkCommandNoneIgnoreUse() {
167
    return getFieldByClass(SdkCommandNoneIgnoreUse.class);
168
  }
169
170
  public SdkCommandNoneNoneCreate getSdkCommandNoneNoneCreate() {
171
    return getFieldByClass(SdkCommandNoneNoneCreate.class);
172
  }
173
174
  public SdkCommandNoneNoneIgnore getSdkCommandNoneNoneIgnore() {
175
    return getFieldByClass(SdkCommandNoneNoneIgnore.class);
176
  }
177
178
  public SdkCommandNoneNoneNone getSdkCommandNoneNoneNone() {
179
    return getFieldByClass(SdkCommandNoneNoneNone.class);
180
  }
181
182
  public SdkCommandNoneNoneUse getSdkCommandNoneNoneUse() {
183
    return getFieldByClass(SdkCommandNoneNoneUse.class);
184
  }
185
186
  public SdkCommandNoneUseCreate getSdkCommandNoneUseCreate() {
187
    return getFieldByClass(SdkCommandNoneUseCreate.class);
188
  }
189
190
  public SdkCommandNoneUseIgnore getSdkCommandNoneUseIgnore() {
191
    return getFieldByClass(SdkCommandNoneUseIgnore.class);
192
  }
193
194
  public SdkCommandNoneUseNone getSdkCommandNoneUseNone() {
195
    return getFieldByClass(SdkCommandNoneUseNone.class);
196
  }
197
198
  public SdkCommandNoneUseUse getSdkCommandNoneUseUse() {
199
    return getFieldByClass(SdkCommandNoneUseUse.class);
200
  }
201
202
  public SdkCommandUseCreateCreate getSdkCommandUseCreateCreate() {
203
    return getFieldByClass(SdkCommandUseCreateCreate.class);
204
  }
205
206
  public SdkCommandUseCreateIgnore getSdkCommandUseCreateIgnore() {
207
    return getFieldByClass(SdkCommandUseCreateIgnore.class);
208
  }
209
210
  public SdkCommandUseCreateNone getSdkCommandUseCreateNone() {
211
    return getFieldByClass(SdkCommandUseCreateNone.class);
212
  }
213
214
  public SdkCommandUseCreateUse getSdkCommandUseCreateUse() {
215
    return getFieldByClass(SdkCommandUseCreateUse.class);
216
  }
217
218
  public SdkCommandUseIgnoreCreate getSdkCommandUseIgnoreCreate() {
219
    return getFieldByClass(SdkCommandUseIgnoreCreate.class);
220
  }
221
222
  public SdkCommandUseIgnoreIgnore getSdkCommandUseIgnoreIgnore() {
223
    return getFieldByClass(SdkCommandUseIgnoreIgnore.class);
224
  }
225
226
  public SdkCommandUseIgnoreNone getSdkCommandUseIgnoreNone() {
227
    return getFieldByClass(SdkCommandUseIgnoreNone.class);
228
  }
229
230
  public SdkCommandUseIgnoreUse getSdkCommandUseIgnoreUse() {
231
    return getFieldByClass(SdkCommandUseIgnoreUse.class);
232
  }
233
234
  public SdkCommandUseNoneCreate getSdkCommandUseNoneCreate() {
235
    return getFieldByClass(SdkCommandUseNoneCreate.class);
236
  }
237
238
  public SdkCommandUseNoneIgnore getSdkCommandUseNoneIgnore() {
239
    return getFieldByClass(SdkCommandUseNoneIgnore.class);
240
  }
241
242
  public SdkCommandUseNoneNone getSdkCommandUseNoneNone() {
243
    return getFieldByClass(SdkCommandUseNoneNone.class);
244
  }
245
246
  public SdkCommandUseNoneUse getSdkCommandUseNoneUse() {
247
    return getFieldByClass(SdkCommandUseNoneUse.class);
248
  }
249
250
  public SdkCommandUseUseCreate getSdkCommandUseUseCreate() {
251
    return getFieldByClass(SdkCommandUseUseCreate.class);
252
  }
253
254
  public SdkCommandUseUseIgnore getSdkCommandUseUseIgnore() {
255
    return getFieldByClass(SdkCommandUseUseIgnore.class);
256
  }
257
258
  public SdkCommandUseUseNone getSdkCommandUseUseNone() {
259
    return getFieldByClass(SdkCommandUseUseNone.class);
260
  }
261
262
  public SdkCommandUseUseUse getSdkCommandUseUseUse() {
263
    return getFieldByClass(SdkCommandUseUseUse.class);
264
  }
265
266
  @Replace
267
  public static class IgnoringGroupBoxExCreateNone extends ExtendedFormData.IgnoringGroupBoxExCreate {
268
    private static final long serialVersionUID = 1L;
269
270
    public IgnoringGroupBoxExCreateNone() {
271
    }
272
  }
273
274
  @Replace
275
  public static class IgnoringGroupBoxExNoneCreate extends AbstractValueFieldData<String> {
276
    private static final long serialVersionUID = 1L;
277
278
    public IgnoringGroupBoxExNoneCreate() {
279
    }
280
281
    /**
282
     * list of derived validation rules.
283
     */
284
    @Override
285
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
286
      super.initValidationRules(ruleMap);
287
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
288
    }
289
  }
290
291
  @Replace
292
  public static class NameExEx extends ExtendedFormData.NameEx {
293
    private static final long serialVersionUID = 1L;
294
295
    public NameExEx() {
296
    }
297
298
    public StringPropertyProperty getStringPropertyProperty() {
299
      return getPropertyByClass(StringPropertyProperty.class);
300
    }
301
302
    /**
303
     * access method for property StringProperty.
304
     */
305
    public String getStringProperty() {
306
      return getStringPropertyProperty().getValue();
307
    }
308
309
    /**
310
     * access method for property StringProperty.
311
     */
312
    public void setStringProperty(String stringProperty) {
313
      getStringPropertyProperty().setValue(stringProperty);
314
    }
315
316
    public class StringPropertyProperty extends AbstractPropertyData<String> {
317
      private static final long serialVersionUID = 1L;
318
319
      public StringPropertyProperty() {
320
      }
321
    }
322
323
    /**
324
     * list of derived validation rules.
325
     */
326
    @Override
327
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
328
      super.initValidationRules(ruleMap);
329
      ruleMap.put(ValidationRule.MAX_LENGTH, 15);
330
    }
331
  }
332
333
  @Replace
334
  public static class SdkCommandCreateCreateCreate extends ExtendedFormData.SdkCommandCreateCreate {
335
    private static final long serialVersionUID = 1L;
336
337
    public SdkCommandCreateCreateCreate() {
338
    }
339
  }
340
341
  @Replace
342
  public static class SdkCommandCreateCreateIgnore extends ExtendedFormData.SdkCommandCreateCreate {
343
    private static final long serialVersionUID = 1L;
344
345
    public SdkCommandCreateCreateIgnore() {
346
    }
347
  }
348
349
  @Replace
350
  public static class SdkCommandCreateCreateNone extends ExtendedFormData.SdkCommandCreateCreate {
351
    private static final long serialVersionUID = 1L;
352
353
    public SdkCommandCreateCreateNone() {
354
    }
355
  }
356
357
  @Replace
358
  public static class SdkCommandCreateCreateUse extends ExtendedFormData.SdkCommandCreateCreate {
359
    private static final long serialVersionUID = 1L;
360
361
    public SdkCommandCreateCreateUse() {
362
    }
363
  }
364
365
  @Replace
366
  public static class SdkCommandCreateIgnoreCreate extends ExtendedFormData.SdkCommandCreateIgnore {
367
    private static final long serialVersionUID = 1L;
368
369
    public SdkCommandCreateIgnoreCreate() {
370
    }
371
  }
372
373
  @Replace
374
  public static class SdkCommandCreateIgnoreIgnore extends ExtendedFormData.SdkCommandCreateIgnore {
375
    private static final long serialVersionUID = 1L;
376
377
    public SdkCommandCreateIgnoreIgnore() {
378
    }
379
  }
380
381
  @Replace
382
  public static class SdkCommandCreateIgnoreNone extends ExtendedFormData.SdkCommandCreateIgnore {
383
    private static final long serialVersionUID = 1L;
384
385
    public SdkCommandCreateIgnoreNone() {
386
    }
387
  }
388
389
  @Replace
390
  public static class SdkCommandCreateIgnoreUse extends ExtendedFormData.SdkCommandCreateIgnore {
391
    private static final long serialVersionUID = 1L;
392
393
    public SdkCommandCreateIgnoreUse() {
394
    }
395
  }
396
397
  @Replace
398
  public static class SdkCommandCreateNoneCreate extends ExtendedFormData.SdkCommandCreateNone {
399
    private static final long serialVersionUID = 1L;
400
401
    public SdkCommandCreateNoneCreate() {
402
    }
403
  }
404
405
  @Replace
406
  public static class SdkCommandCreateNoneIgnore extends ExtendedFormData.SdkCommandCreateNone {
407
    private static final long serialVersionUID = 1L;
408
409
    public SdkCommandCreateNoneIgnore() {
410
    }
411
  }
412
413
  @Replace
414
  public static class SdkCommandCreateNoneNone extends ExtendedFormData.SdkCommandCreateNone {
415
    private static final long serialVersionUID = 1L;
416
417
    public SdkCommandCreateNoneNone() {
418
    }
419
  }
420
421
  @Replace
422
  public static class SdkCommandCreateNoneUse extends ExtendedFormData.SdkCommandCreateNone {
423
    private static final long serialVersionUID = 1L;
424
425
    public SdkCommandCreateNoneUse() {
426
    }
427
  }
428
429
  @Replace
430
  public static class SdkCommandCreateUseCreate extends ExtendedFormData.SdkCommandCreateUse {
431
    private static final long serialVersionUID = 1L;
432
433
    public SdkCommandCreateUseCreate() {
434
    }
435
  }
436
437
  @Replace
438
  public static class SdkCommandCreateUseIgnore extends ExtendedFormData.SdkCommandCreateUse {
439
    private static final long serialVersionUID = 1L;
440
441
    public SdkCommandCreateUseIgnore() {
442
    }
443
  }
444
445
  @Replace
446
  public static class SdkCommandCreateUseNone extends ExtendedFormData.SdkCommandCreateUse {
447
    private static final long serialVersionUID = 1L;
448
449
    public SdkCommandCreateUseNone() {
450
    }
451
  }
452
453
  @Replace
454
  public static class SdkCommandCreateUseUse extends ExtendedFormData.SdkCommandCreateUse {
455
    private static final long serialVersionUID = 1L;
456
457
    public SdkCommandCreateUseUse() {
458
    }
459
  }
460
461
  @Replace
462
  public static class SdkCommandIgnoreCreateCreate extends ExtendedFormData.SdkCommandIgnoreCreate {
463
    private static final long serialVersionUID = 1L;
464
465
    public SdkCommandIgnoreCreateCreate() {
466
    }
467
  }
468
469
  @Replace
470
  public static class SdkCommandIgnoreCreateIgnore extends ExtendedFormData.SdkCommandIgnoreCreate {
471
    private static final long serialVersionUID = 1L;
472
473
    public SdkCommandIgnoreCreateIgnore() {
474
    }
475
  }
476
477
  @Replace
478
  public static class SdkCommandIgnoreCreateNone extends ExtendedFormData.SdkCommandIgnoreCreate {
479
    private static final long serialVersionUID = 1L;
480
481
    public SdkCommandIgnoreCreateNone() {
482
    }
483
  }
484
485
  @Replace
486
  public static class SdkCommandIgnoreCreateUse extends ExtendedFormData.SdkCommandIgnoreCreate {
487
    private static final long serialVersionUID = 1L;
488
489
    public SdkCommandIgnoreCreateUse() {
490
    }
491
  }
492
493
  @Replace
494
  public static class SdkCommandIgnoreIgnoreCreate extends AbstractValueFieldData<String> {
495
    private static final long serialVersionUID = 1L;
496
497
    public SdkCommandIgnoreIgnoreCreate() {
498
    }
499
500
    /**
501
     * list of derived validation rules.
502
     */
503
    @Override
504
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
505
      super.initValidationRules(ruleMap);
506
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
507
    }
508
  }
509
510
  @Replace
511
  public static class SdkCommandIgnoreIgnoreUse extends UsingFormFieldData {
512
    private static final long serialVersionUID = 1L;
513
514
    public SdkCommandIgnoreIgnoreUse() {
515
    }
516
517
    /**
518
     * list of derived validation rules.
519
     */
520
    @Override
521
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
522
      super.initValidationRules(ruleMap);
523
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
524
    }
525
  }
526
527
  @Replace
528
  public static class SdkCommandIgnoreNoneCreate extends AbstractValueFieldData<String> {
529
    private static final long serialVersionUID = 1L;
530
531
    public SdkCommandIgnoreNoneCreate() {
532
    }
533
534
    /**
535
     * list of derived validation rules.
536
     */
537
    @Override
538
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
539
      super.initValidationRules(ruleMap);
540
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
541
    }
542
  }
543
544
  @Replace
545
  public static class SdkCommandIgnoreNoneUse extends UsingFormFieldData {
546
    private static final long serialVersionUID = 1L;
547
548
    public SdkCommandIgnoreNoneUse() {
549
    }
550
551
    /**
552
     * list of derived validation rules.
553
     */
554
    @Override
555
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
556
      super.initValidationRules(ruleMap);
557
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
558
    }
559
  }
560
561
  @Replace
562
  public static class SdkCommandIgnoreUseCreate extends ExtendedFormData.SdkCommandIgnoreUse {
563
    private static final long serialVersionUID = 1L;
564
565
    public SdkCommandIgnoreUseCreate() {
566
    }
567
  }
568
569
  @Replace
570
  public static class SdkCommandIgnoreUseIgnore extends ExtendedFormData.SdkCommandIgnoreUse {
571
    private static final long serialVersionUID = 1L;
572
573
    public SdkCommandIgnoreUseIgnore() {
574
    }
575
  }
576
577
  @Replace
578
  public static class SdkCommandIgnoreUseNone extends ExtendedFormData.SdkCommandIgnoreUse {
579
    private static final long serialVersionUID = 1L;
580
581
    public SdkCommandIgnoreUseNone() {
582
    }
583
  }
584
585
  @Replace
586
  public static class SdkCommandIgnoreUseUse extends ExtendedFormData.SdkCommandIgnoreUse {
587
    private static final long serialVersionUID = 1L;
588
589
    public SdkCommandIgnoreUseUse() {
590
    }
591
  }
592
593
  @Replace
594
  public static class SdkCommandNoneCreateCreate extends ExtendedFormData.SdkCommandNoneCreate {
595
    private static final long serialVersionUID = 1L;
596
597
    public SdkCommandNoneCreateCreate() {
598
    }
599
  }
600
601
  @Replace
602
  public static class SdkCommandNoneCreateIgnore extends ExtendedFormData.SdkCommandNoneCreate {
603
    private static final long serialVersionUID = 1L;
604
605
    public SdkCommandNoneCreateIgnore() {
606
    }
607
  }
608
609
  @Replace
610
  public static class SdkCommandNoneCreateNone extends ExtendedFormData.SdkCommandNoneCreate {
611
    private static final long serialVersionUID = 1L;
612
613
    public SdkCommandNoneCreateNone() {
614
    }
615
  }
616
617
  @Replace
618
  public static class SdkCommandNoneCreateUse extends ExtendedFormData.SdkCommandNoneCreate {
619
    private static final long serialVersionUID = 1L;
620
621
    public SdkCommandNoneCreateUse() {
622
    }
623
  }
624
625
  @Replace
626
  public static class SdkCommandNoneIgnoreCreate extends ExtendedFormData.SdkCommandNoneIgnore {
627
    private static final long serialVersionUID = 1L;
628
629
    public SdkCommandNoneIgnoreCreate() {
630
    }
631
  }
632
633
  @Replace
634
  public static class SdkCommandNoneIgnoreIgnore extends ExtendedFormData.SdkCommandNoneIgnore {
635
    private static final long serialVersionUID = 1L;
636
637
    public SdkCommandNoneIgnoreIgnore() {
638
    }
639
  }
640
641
  @Replace
642
  public static class SdkCommandNoneIgnoreNone extends ExtendedFormData.SdkCommandNoneIgnore {
643
    private static final long serialVersionUID = 1L;
644
645
    public SdkCommandNoneIgnoreNone() {
646
    }
647
  }
648
649
  @Replace
650
  public static class SdkCommandNoneIgnoreUse extends ExtendedFormData.SdkCommandNoneIgnore {
651
    private static final long serialVersionUID = 1L;
652
653
    public SdkCommandNoneIgnoreUse() {
654
    }
655
  }
656
657
  @Replace
658
  public static class SdkCommandNoneNoneCreate extends ExtendedFormData.SdkCommandNoneNone {
659
    private static final long serialVersionUID = 1L;
660
661
    public SdkCommandNoneNoneCreate() {
662
    }
663
  }
664
665
  @Replace
666
  public static class SdkCommandNoneNoneIgnore extends ExtendedFormData.SdkCommandNoneNone {
667
    private static final long serialVersionUID = 1L;
668
669
    public SdkCommandNoneNoneIgnore() {
670
    }
671
  }
672
673
  @Replace
674
  public static class SdkCommandNoneNoneNone extends ExtendedFormData.SdkCommandNoneNone {
675
    private static final long serialVersionUID = 1L;
676
677
    public SdkCommandNoneNoneNone() {
678
    }
679
  }
680
681
  @Replace
682
  public static class SdkCommandNoneNoneUse extends ExtendedFormData.SdkCommandNoneNone {
683
    private static final long serialVersionUID = 1L;
684
685
    public SdkCommandNoneNoneUse() {
686
    }
687
  }
688
689
  @Replace
690
  public static class SdkCommandNoneUseCreate extends ExtendedFormData.SdkCommandNoneUse {
691
    private static final long serialVersionUID = 1L;
692
693
    public SdkCommandNoneUseCreate() {
694
    }
695
  }
696
697
  @Replace
698
  public static class SdkCommandNoneUseIgnore extends ExtendedFormData.SdkCommandNoneUse {
699
    private static final long serialVersionUID = 1L;
700
701
    public SdkCommandNoneUseIgnore() {
702
    }
703
  }
704
705
  @Replace
706
  public static class SdkCommandNoneUseNone extends ExtendedFormData.SdkCommandNoneUse {
707
    private static final long serialVersionUID = 1L;
708
709
    public SdkCommandNoneUseNone() {
710
    }
711
  }
712
713
  @Replace
714
  public static class SdkCommandNoneUseUse extends ExtendedFormData.SdkCommandNoneUse {
715
    private static final long serialVersionUID = 1L;
716
717
    public SdkCommandNoneUseUse() {
718
    }
719
  }
720
721
  @Replace
722
  public static class SdkCommandUseCreateCreate extends ExtendedFormData.SdkCommandUseCreate {
723
    private static final long serialVersionUID = 1L;
724
725
    public SdkCommandUseCreateCreate() {
726
    }
727
  }
728
729
  @Replace
730
  public static class SdkCommandUseCreateIgnore extends ExtendedFormData.SdkCommandUseCreate {
731
    private static final long serialVersionUID = 1L;
732
733
    public SdkCommandUseCreateIgnore() {
734
    }
735
  }
736
737
  @Replace
738
  public static class SdkCommandUseCreateNone extends ExtendedFormData.SdkCommandUseCreate {
739
    private static final long serialVersionUID = 1L;
740
741
    public SdkCommandUseCreateNone() {
742
    }
743
  }
744
745
  @Replace
746
  public static class SdkCommandUseCreateUse extends ExtendedFormData.SdkCommandUseCreate {
747
    private static final long serialVersionUID = 1L;
748
749
    public SdkCommandUseCreateUse() {
750
    }
751
  }
752
753
  @Replace
754
  public static class SdkCommandUseIgnoreCreate extends ExtendedFormData.SdkCommandUseIgnore {
755
    private static final long serialVersionUID = 1L;
756
757
    public SdkCommandUseIgnoreCreate() {
758
    }
759
  }
760
761
  @Replace
762
  public static class SdkCommandUseIgnoreIgnore extends ExtendedFormData.SdkCommandUseIgnore {
763
    private static final long serialVersionUID = 1L;
764
765
    public SdkCommandUseIgnoreIgnore() {
766
    }
767
  }
768
769
  @Replace
770
  public static class SdkCommandUseIgnoreNone extends ExtendedFormData.SdkCommandUseIgnore {
771
    private static final long serialVersionUID = 1L;
772
773
    public SdkCommandUseIgnoreNone() {
774
    }
775
  }
776
777
  @Replace
778
  public static class SdkCommandUseIgnoreUse extends ExtendedFormData.SdkCommandUseIgnore {
779
    private static final long serialVersionUID = 1L;
780
781
    public SdkCommandUseIgnoreUse() {
782
    }
783
  }
784
785
  @Replace
786
  public static class SdkCommandUseNoneCreate extends ExtendedFormData.SdkCommandUseNone {
787
    private static final long serialVersionUID = 1L;
788
789
    public SdkCommandUseNoneCreate() {
790
    }
791
  }
792
793
  @Replace
794
  public static class SdkCommandUseNoneIgnore extends ExtendedFormData.SdkCommandUseNone {
795
    private static final long serialVersionUID = 1L;
796
797
    public SdkCommandUseNoneIgnore() {
798
    }
799
  }
800
801
  @Replace
802
  public static class SdkCommandUseNoneNone extends ExtendedFormData.SdkCommandUseNone {
803
    private static final long serialVersionUID = 1L;
804
805
    public SdkCommandUseNoneNone() {
806
    }
807
  }
808
809
  @Replace
810
  public static class SdkCommandUseNoneUse extends ExtendedFormData.SdkCommandUseNone {
811
    private static final long serialVersionUID = 1L;
812
813
    public SdkCommandUseNoneUse() {
814
    }
815
  }
816
817
  @Replace
818
  public static class SdkCommandUseUseCreate extends ExtendedFormData.SdkCommandUseUse {
819
    private static final long serialVersionUID = 1L;
820
821
    public SdkCommandUseUseCreate() {
822
    }
823
  }
824
825
  @Replace
826
  public static class SdkCommandUseUseIgnore extends ExtendedFormData.SdkCommandUseUse {
827
    private static final long serialVersionUID = 1L;
828
829
    public SdkCommandUseUseIgnore() {
830
    }
831
  }
832
833
  @Replace
834
  public static class SdkCommandUseUseNone extends ExtendedFormData.SdkCommandUseUse {
835
    private static final long serialVersionUID = 1L;
836
837
    public SdkCommandUseUseNone() {
838
    }
839
  }
840
841
  @Replace
842
  public static class SdkCommandUseUseUse extends ExtendedFormData.SdkCommandUseUse {
843
    private static final long serialVersionUID = 1L;
844
845
    public SdkCommandUseUseUse() {
846
    }
847
  }
848
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/ExtendedFormData.java (+302 lines)
Line 0 Link Here
1
package formdata.shared.services.process.replace;
2
3
import org.eclipse.scout.commons.annotations.Replace;
4
import org.eclipse.scout.rt.shared.data.form.ValidationRule;
5
import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
6
7
public class ExtendedFormData extends BaseFormData {
8
  private static final long serialVersionUID = 1L;
9
10
  public ExtendedFormData() {
11
  }
12
13
  public FirstName getFirstName() {
14
    return getFieldByClass(FirstName.class);
15
  }
16
17
  public IgnoringGroupBoxExCreate getIgnoringGroupBoxExCreate() {
18
    return getFieldByClass(IgnoringGroupBoxExCreate.class);
19
  }
20
21
  public IgnoringGroupBoxExUse getIgnoringGroupBoxExUse() {
22
    return getFieldByClass(IgnoringGroupBoxExUse.class);
23
  }
24
25
  public NameEx getNameEx() {
26
    return getFieldByClass(NameEx.class);
27
  }
28
29
  public SdkCommandCreateCreate getSdkCommandCreateCreate() {
30
    return getFieldByClass(SdkCommandCreateCreate.class);
31
  }
32
33
  public SdkCommandCreateIgnore getSdkCommandCreateIgnore() {
34
    return getFieldByClass(SdkCommandCreateIgnore.class);
35
  }
36
37
  public SdkCommandCreateNone getSdkCommandCreateNone() {
38
    return getFieldByClass(SdkCommandCreateNone.class);
39
  }
40
41
  public SdkCommandCreateUse getSdkCommandCreateUse() {
42
    return getFieldByClass(SdkCommandCreateUse.class);
43
  }
44
45
  public SdkCommandIgnoreCreate getSdkCommandIgnoreCreate() {
46
    return getFieldByClass(SdkCommandIgnoreCreate.class);
47
  }
48
49
  public SdkCommandIgnoreUse getSdkCommandIgnoreUse() {
50
    return getFieldByClass(SdkCommandIgnoreUse.class);
51
  }
52
53
  public SdkCommandNoneCreate getSdkCommandNoneCreate() {
54
    return getFieldByClass(SdkCommandNoneCreate.class);
55
  }
56
57
  public SdkCommandNoneIgnore getSdkCommandNoneIgnore() {
58
    return getFieldByClass(SdkCommandNoneIgnore.class);
59
  }
60
61
  public SdkCommandNoneNone getSdkCommandNoneNone() {
62
    return getFieldByClass(SdkCommandNoneNone.class);
63
  }
64
65
  public SdkCommandNoneUse getSdkCommandNoneUse() {
66
    return getFieldByClass(SdkCommandNoneUse.class);
67
  }
68
69
  public SdkCommandUseCreate getSdkCommandUseCreate() {
70
    return getFieldByClass(SdkCommandUseCreate.class);
71
  }
72
73
  public SdkCommandUseIgnore getSdkCommandUseIgnore() {
74
    return getFieldByClass(SdkCommandUseIgnore.class);
75
  }
76
77
  public SdkCommandUseNone getSdkCommandUseNone() {
78
    return getFieldByClass(SdkCommandUseNone.class);
79
  }
80
81
  public SdkCommandUseUse getSdkCommandUseUse() {
82
    return getFieldByClass(SdkCommandUseUse.class);
83
  }
84
85
  public SmartEx getSmartEx() {
86
    return getFieldByClass(SmartEx.class);
87
  }
88
89
  public static class FirstName extends AbstractValueFieldData<String> {
90
    private static final long serialVersionUID = 1L;
91
92
    public FirstName() {
93
    }
94
95
    /**
96
     * list of derived validation rules.
97
     */
98
    @Override
99
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
100
      super.initValidationRules(ruleMap);
101
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
102
    }
103
  }
104
105
  @Replace
106
  public static class IgnoringGroupBoxExCreate extends AbstractValueFieldData<String> {
107
    private static final long serialVersionUID = 1L;
108
109
    public IgnoringGroupBoxExCreate() {
110
    }
111
112
    /**
113
     * list of derived validation rules.
114
     */
115
    @Override
116
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
117
      super.initValidationRules(ruleMap);
118
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
119
    }
120
  }
121
122
  @Replace
123
  public static class IgnoringGroupBoxExUse extends UsingFormFieldData {
124
    private static final long serialVersionUID = 1L;
125
126
    public IgnoringGroupBoxExUse() {
127
    }
128
129
    /**
130
     * list of derived validation rules.
131
     */
132
    @Override
133
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
134
      super.initValidationRules(ruleMap);
135
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
136
    }
137
  }
138
139
  @Replace
140
  public static class NameEx extends BaseFormData.Name {
141
    private static final long serialVersionUID = 1L;
142
143
    public NameEx() {
144
    }
145
146
    /**
147
     * list of derived validation rules.
148
     */
149
    @Override
150
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
151
      super.initValidationRules(ruleMap);
152
      ruleMap.put(ValidationRule.MAX_LENGTH, 100);
153
    }
154
  }
155
156
  @Replace
157
  public static class SdkCommandCreateCreate extends BaseFormData.SdkCommandCreate {
158
    private static final long serialVersionUID = 1L;
159
160
    public SdkCommandCreateCreate() {
161
    }
162
  }
163
164
  @Replace
165
  public static class SdkCommandCreateIgnore extends BaseFormData.SdkCommandCreate {
166
    private static final long serialVersionUID = 1L;
167
168
    public SdkCommandCreateIgnore() {
169
    }
170
  }
171
172
  @Replace
173
  public static class SdkCommandCreateNone extends BaseFormData.SdkCommandCreate {
174
    private static final long serialVersionUID = 1L;
175
176
    public SdkCommandCreateNone() {
177
    }
178
  }
179
180
  @Replace
181
  public static class SdkCommandCreateUse extends BaseFormData.SdkCommandCreate {
182
    private static final long serialVersionUID = 1L;
183
184
    public SdkCommandCreateUse() {
185
    }
186
  }
187
188
  @Replace
189
  public static class SdkCommandIgnoreCreate extends AbstractValueFieldData<String> {
190
    private static final long serialVersionUID = 1L;
191
192
    public SdkCommandIgnoreCreate() {
193
    }
194
195
    /**
196
     * list of derived validation rules.
197
     */
198
    @Override
199
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
200
      super.initValidationRules(ruleMap);
201
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
202
    }
203
  }
204
205
  @Replace
206
  public static class SdkCommandIgnoreUse extends UsingFormFieldData {
207
    private static final long serialVersionUID = 1L;
208
209
    public SdkCommandIgnoreUse() {
210
    }
211
212
    /**
213
     * list of derived validation rules.
214
     */
215
    @Override
216
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
217
      super.initValidationRules(ruleMap);
218
      ruleMap.put(ValidationRule.MAX_LENGTH, 4000);
219
    }
220
  }
221
222
  @Replace
223
  public static class SdkCommandNoneCreate extends BaseFormData.SdkCommandNone {
224
    private static final long serialVersionUID = 1L;
225
226
    public SdkCommandNoneCreate() {
227
    }
228
  }
229
230
  @Replace
231
  public static class SdkCommandNoneIgnore extends BaseFormData.SdkCommandNone {
232
    private static final long serialVersionUID = 1L;
233
234
    public SdkCommandNoneIgnore() {
235
    }
236
  }
237
238
  @Replace
239
  public static class SdkCommandNoneNone extends BaseFormData.SdkCommandNone {
240
    private static final long serialVersionUID = 1L;
241
242
    public SdkCommandNoneNone() {
243
    }
244
  }
245
246
  @Replace
247
  public static class SdkCommandNoneUse extends BaseFormData.SdkCommandNone {
248
    private static final long serialVersionUID = 1L;
249
250
    public SdkCommandNoneUse() {
251
    }
252
  }
253
254
  @Replace
255
  public static class SdkCommandUseCreate extends BaseFormData.SdkCommandUse {
256
    private static final long serialVersionUID = 1L;
257
258
    public SdkCommandUseCreate() {
259
    }
260
  }
261
262
  @Replace
263
  public static class SdkCommandUseIgnore extends BaseFormData.SdkCommandUse {
264
    private static final long serialVersionUID = 1L;
265
266
    public SdkCommandUseIgnore() {
267
    }
268
  }
269
270
  @Replace
271
  public static class SdkCommandUseNone extends BaseFormData.SdkCommandUse {
272
    private static final long serialVersionUID = 1L;
273
274
    public SdkCommandUseNone() {
275
    }
276
  }
277
278
  @Replace
279
  public static class SdkCommandUseUse extends BaseFormData.SdkCommandUse {
280
    private static final long serialVersionUID = 1L;
281
282
    public SdkCommandUseUse() {
283
    }
284
  }
285
286
  @Replace
287
  public static class SmartEx extends BaseFormData.Smart {
288
    private static final long serialVersionUID = 1L;
289
290
    public SmartEx() {
291
    }
292
293
    /**
294
     * list of derived validation rules.
295
     */
296
    @Override
297
    protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
298
      super.initValidationRules(ruleMap);
299
      ruleMap.remove(ValidationRule.CODE_TYPE);
300
    }
301
  }
302
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/TableFieldBaseFormData.java (+158 lines)
Line 0 Link Here
1
package formdata.shared.services.process.replace;
2
3
import org.eclipse.scout.rt.shared.data.basic.table.AbstractTableRowData;
4
import org.eclipse.scout.rt.shared.data.form.AbstractFormData;
5
import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldBeanData;
6
7
public class TableFieldBaseFormData extends AbstractFormData {
8
  private static final long serialVersionUID = 1L;
9
10
  public TableFieldBaseFormData() {
11
  }
12
13
  public EmptyTable getEmptyTable() {
14
    return getFieldByClass(EmptyTable.class);
15
  }
16
17
  public NoTable getNoTable() {
18
    return getFieldByClass(NoTable.class);
19
  }
20
21
  public Table getTable() {
22
    return getFieldByClass(Table.class);
23
  }
24
25
  public static class EmptyTable extends AbstractTableFieldBeanData {
26
    private static final long serialVersionUID = 1L;
27
28
    public EmptyTable() {
29
    }
30
31
    @Override
32
    public EmptyTableRowData addRow(int rowState) {
33
      return (EmptyTableRowData) super.addRow(rowState);
34
    }
35
36
    @Override
37
    public EmptyTableRowData addRow() {
38
      return (EmptyTableRowData) super.addRow();
39
    }
40
41
    @Override
42
    public EmptyTableRowData createRow() {
43
      return new EmptyTableRowData();
44
    }
45
46
    @Override
47
    public Class<? extends AbstractTableRowData> getRowType() {
48
      return EmptyTableRowData.class;
49
    }
50
51
    @Override
52
    public EmptyTableRowData[] getRows() {
53
      return (EmptyTableRowData[]) super.getRows();
54
    }
55
56
    @Override
57
    public EmptyTableRowData rowAt(int idx) {
58
      return (EmptyTableRowData) super.rowAt(idx);
59
    }
60
61
    public void setRows(EmptyTableRowData[] rows) {
62
      super.setRows(rows);
63
    }
64
65
    public static class EmptyTableRowData extends AbstractTableRowData {
66
      private static final long serialVersionUID = 1L;
67
68
      public EmptyTableRowData() {
69
      }
70
    }
71
  }
72
73
  public static class NoTable extends AbstractTableFieldBeanData {
74
    private static final long serialVersionUID = 1L;
75
76
    public NoTable() {
77
    }
78
79
    @Override
80
    public AbstractTableRowData createRow() {
81
      return new AbstractTableRowData() {
82
        private static final long serialVersionUID = 1L;
83
      };
84
    }
85
86
    @Override
87
    public Class<? extends AbstractTableRowData> getRowType() {
88
      return AbstractTableRowData.class;
89
    }
90
  }
91
92
  public static class Table extends AbstractTableFieldBeanData {
93
    private static final long serialVersionUID = 1L;
94
95
    public Table() {
96
    }
97
98
    @Override
99
    public TableRowData addRow() {
100
      return (TableRowData) super.addRow();
101
    }
102
103
    @Override
104
    public TableRowData addRow(int rowState) {
105
      return (TableRowData) super.addRow(rowState);
106
    }
107
108
    @Override
109
    public TableRowData createRow() {
110
      return new TableRowData();
111
    }
112
113
    @Override
114
    public Class<? extends AbstractTableRowData> getRowType() {
115
      return TableRowData.class;
116
    }
117
118
    @Override
119
    public TableRowData[] getRows() {
120
      return (TableRowData[]) super.getRows();
121
    }
122
123
    @Override
124
    public TableRowData rowAt(int idx) {
125
      return (TableRowData) super.rowAt(idx);
126
    }
127
128
    public void setRows(TableRowData[] rows) {
129
      super.setRows(rows);
130
    }
131
132
    public static class TableRowData extends AbstractTableRowData {
133
      private static final long serialVersionUID = 1L;
134
135
      public TableRowData() {
136
      }
137
138
      private String m_first;
139
      private String m_second;
140
141
      public String getFirst() {
142
        return m_first;
143
      }
144
145
      public void setFirst(String first) {
146
        m_first = first;
147
      }
148
149
      public String getSecond() {
150
        return m_second;
151
      }
152
153
      public void setSecond(String second) {
154
        m_second = second;
155
      }
156
    }
157
  }
158
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/TableFieldExFormData.java (+200 lines)
Line 0 Link Here
1
package formdata.shared.services.process.replace;
2
3
import org.eclipse.scout.commons.annotations.Replace;
4
import org.eclipse.scout.rt.shared.data.basic.table.AbstractTableRowData;
5
6
public class TableFieldExFormData extends TableFieldBaseFormData {
7
  private static final long serialVersionUID = 1L;
8
9
  public TableFieldExFormData() {
10
  }
11
12
  public EmptyTableExtended getEmptyTableExtended() {
13
    return getFieldByClass(EmptyTableExtended.class);
14
  }
15
16
  public NoTableExtended getNoTableExtended() {
17
    return getFieldByClass(NoTableExtended.class);
18
  }
19
20
  public TableExtended getTableExtended() {
21
    return getFieldByClass(TableExtended.class);
22
  }
23
24
  @Replace
25
  public static class EmptyTableExtended extends TableFieldBaseFormData.EmptyTable {
26
    private static final long serialVersionUID = 1L;
27
28
    public EmptyTableExtended() {
29
    }
30
31
    @Override
32
    public TableExRowData addRow() {
33
      return (TableExRowData) super.addRow();
34
    }
35
36
    @Override
37
    public TableExRowData addRow(int rowState) {
38
      return (TableExRowData) super.addRow(rowState);
39
    }
40
41
    @Override
42
    public TableExRowData createRow() {
43
      return new TableExRowData();
44
    }
45
46
    @Override
47
    public Class<? extends AbstractTableRowData> getRowType() {
48
      return TableExRowData.class;
49
    }
50
51
    @Override
52
    public TableExRowData[] getRows() {
53
      return (TableExRowData[]) super.getRows();
54
    }
55
56
    @Override
57
    public TableExRowData rowAt(int idx) {
58
      return (TableExRowData) super.rowAt(idx);
59
    }
60
61
    public void setRows(TableExRowData[] rows) {
62
      super.setRows(rows);
63
    }
64
65
    public static class TableExRowData extends TableFieldBaseFormData.EmptyTable.EmptyTableRowData {
66
      private static final long serialVersionUID = 1L;
67
68
      public TableExRowData() {
69
      }
70
71
      private String m_single;
72
73
      public void setSingle(String single) {
74
        m_single = single;
75
      }
76
77
      public String getSingle() {
78
        return m_single;
79
      }
80
    }
81
  }
82
83
  @Replace
84
  public static class NoTableExtended extends TableFieldBaseFormData.NoTable {
85
    private static final long serialVersionUID = 1L;
86
87
    public NoTableExtended() {
88
    }
89
90
    @Override
91
    public NoTableExtendedRowData addRow() {
92
      return (NoTableExtendedRowData) super.addRow();
93
    }
94
95
    @Override
96
    public NoTableExtendedRowData addRow(int rowState) {
97
      return (NoTableExtendedRowData) super.addRow(rowState);
98
    }
99
100
    @Override
101
    public NoTableExtendedRowData createRow() {
102
      return new NoTableExtendedRowData();
103
    }
104
105
    @Override
106
    public Class<? extends AbstractTableRowData> getRowType() {
107
      return NoTableExtendedRowData.class;
108
    }
109
110
    @Override
111
    public NoTableExtendedRowData[] getRows() {
112
      return (NoTableExtendedRowData[]) super.getRows();
113
    }
114
115
    @Override
116
    public NoTableExtendedRowData rowAt(int idx) {
117
      return (NoTableExtendedRowData) super.rowAt(idx);
118
    }
119
120
    public void setRows(NoTableExtendedRowData[] rows) {
121
      super.setRows(rows);
122
    }
123
124
    public static class NoTableExtendedRowData extends AbstractTableRowData {
125
      private static final long serialVersionUID = 1L;
126
127
      public NoTableExtendedRowData() {
128
      }
129
130
      private String m_newValue;
131
132
      public void setNew(String newValue) {
133
        m_newValue = newValue;
134
      }
135
136
      public String getNew() {
137
        return m_newValue;
138
      }
139
    }
140
  }
141
142
  @Replace
143
  public static class TableExtended extends TableFieldBaseFormData.Table {
144
    private static final long serialVersionUID = 1L;
145
146
    public TableExtended() {
147
    }
148
149
    @Override
150
    public TableExRowData addRow(int rowState) {
151
      return (TableExRowData) super.addRow(rowState);
152
    }
153
154
    @Override
155
    public TableExRowData addRow() {
156
      return (TableExRowData) super.addRow();
157
    }
158
159
    @Override
160
    public TableExRowData createRow() {
161
      return new TableExRowData();
162
    }
163
164
    @Override
165
    public Class<? extends AbstractTableRowData> getRowType() {
166
      return TableExRowData.class;
167
    }
168
169
    @Override
170
    public TableExRowData[] getRows() {
171
      return (TableExRowData[]) super.getRows();
172
    }
173
174
    @Override
175
    public TableExRowData rowAt(int idx) {
176
      return (TableExRowData) super.rowAt(idx);
177
    }
178
179
    public void setRows(TableExRowData[] rows) {
180
      super.setRows(rows);
181
    }
182
183
    public static class TableExRowData extends TableFieldBaseFormData.Table.TableRowData {
184
      private static final long serialVersionUID = 1L;
185
186
      public TableExRowData() {
187
      }
188
189
      private Boolean m_booleanValue;
190
191
      public void setBoolean(Boolean booleanValue) {
192
        m_booleanValue = booleanValue;
193
      }
194
195
      public Boolean getBoolean() {
196
        return m_booleanValue;
197
      }
198
    }
199
  }
200
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/TestingCodeType.java (+23 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.shared.services.process.replace;
12
13
import org.eclipse.scout.rt.shared.services.common.code.AbstractCodeType;
14
15
public class TestingCodeType extends AbstractCodeType<Long> {
16
17
  private static final long serialVersionUID = 1L;
18
19
  @Override
20
  public Long getId() {
21
    return 42L;
22
  }
23
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/TestingLookupCall.java (+19 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.shared.services.process.replace;
12
13
import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
14
15
public class TestingLookupCall extends LookupCall {
16
17
  private static final long serialVersionUID = 1L;
18
19
}
(-)resources/operation/formData/formdata.shared/src/formdata/shared/services/process/replace/UsingFormFieldData.java (+19 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.shared.services.process.replace;
12
13
import org.eclipse.scout.rt.shared.data.form.fields.AbstractValueFieldData;
14
15
public class UsingFormFieldData extends AbstractValueFieldData<String> {
16
17
  private static final long serialVersionUID = 1L;
18
19
}
(-)resources/operation/formData/formdata.shared/META-INF/MANIFEST.MF (+1 lines)
Lines 10-14 Link Here
10
 org.eclipse.scout.rt.shared;visibility:=reexport
10
 org.eclipse.scout.rt.shared;visibility:=reexport
11
Export-Package: formdata.shared,
11
Export-Package: formdata.shared,
12
 formdata.shared.services.process,
12
 formdata.shared.services.process,
13
 formdata.shared.services.process.replace,
13
 formdata.shared.security,
14
 formdata.shared.security,
14
 formdata.shared.services.common.text
15
 formdata.shared.services.common.text
(-)resources/operation/formData/formdata.client/src/formdata/client/ui/forms/replace/AbstractLookupField.java (+24 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.client.ui.forms.replace;
12
13
import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
14
import org.eclipse.scout.rt.shared.services.lookup.LookupCall;
15
16
import formdata.shared.services.process.replace.TestingLookupCall;
17
18
public abstract class AbstractLookupField extends AbstractSmartField<Long> {
19
20
  @Override
21
  protected Class<? extends LookupCall> getConfiguredLookupCall() {
22
    return TestingLookupCall.class;
23
  }
24
}
(-)resources/operation/formData/formdata.client/src/formdata/client/ui/forms/replace/BaseForm.java (+136 lines)
Line 0 Link Here
1
package formdata.client.ui.forms.replace;
2
3
import org.eclipse.scout.commons.annotations.FormData;
4
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
5
import org.eclipse.scout.commons.annotations.Order;
6
import org.eclipse.scout.commons.exception.ProcessingException;
7
import org.eclipse.scout.rt.client.ui.form.AbstractForm;
8
import org.eclipse.scout.rt.client.ui.form.fields.button.AbstractCloseButton;
9
import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
10
import org.eclipse.scout.rt.client.ui.form.fields.smartfield.AbstractSmartField;
11
import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
12
import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
13
14
import formdata.client.ui.forms.replace.BaseForm.MainBox.CloseButton;
15
import formdata.client.ui.forms.replace.BaseForm.MainBox.GroupBox;
16
import formdata.client.ui.forms.replace.BaseForm.MainBox.GroupBox.NameField;
17
import formdata.client.ui.forms.replace.BaseForm.MainBox.GroupBox.SmartField;
18
import formdata.client.ui.forms.replace.BaseForm.MainBox.IgnoringGroupBox;
19
import formdata.client.ui.forms.replace.BaseForm.MainBox.IgnoringGroupBox.IgnoringGroupBoxField;
20
import formdata.shared.services.process.replace.BaseFormData;
21
import formdata.shared.services.process.replace.TestingCodeType;
22
import formdata.shared.services.process.replace.UsingFormFieldData;
23
24
@FormData(value = BaseFormData.class, sdkCommand = SdkCommand.CREATE)
25
public class BaseForm extends AbstractForm {
26
27
  public BaseForm() throws ProcessingException {
28
    super();
29
  }
30
31
  public MainBox getMainBox() {
32
    return getFieldByClass(MainBox.class);
33
  }
34
35
  public GroupBox getGroupBox() {
36
    return getFieldByClass(GroupBox.class);
37
  }
38
39
  public NameField getNameField() {
40
    return getFieldByClass(NameField.class);
41
  }
42
43
  public SmartField getSmartField() {
44
    return getFieldByClass(SmartField.class);
45
  }
46
47
  public IgnoringGroupBox getIgnoringGroupBox() {
48
    return getFieldByClass(IgnoringGroupBox.class);
49
  }
50
51
  public IgnoringGroupBoxField getIgnoringGroupBoxField() {
52
    return getFieldByClass(IgnoringGroupBoxField.class);
53
  }
54
55
  public CloseButton getCloseButton() {
56
    return getFieldByClass(CloseButton.class);
57
  }
58
59
  @Order(10.0)
60
  public class MainBox extends AbstractGroupBox {
61
62
    @Order(10)
63
    public class NoneFormDataFieldsGroupBox extends AbstractGroupBox {
64
      @Order(10)
65
      public class SdkCommandNoneField extends AbstractStringField {
66
      }
67
    }
68
69
    @Order(20)
70
    public class CreatingFormDataFieldsGroupBox extends AbstractGroupBox {
71
      @Order(10)
72
      @FormData(sdkCommand = SdkCommand.CREATE)
73
      public class SdkCommandCreateField extends AbstractStringField {
74
      }
75
    }
76
77
    @Order(30)
78
    public class UsingFormDataFieldsGroupBox extends AbstractGroupBox {
79
      @Order(10)
80
      @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
81
      public class SdkCommandUseField extends AbstractStringField {
82
      }
83
    }
84
85
    @Order(40)
86
    public class IgnoringFormDataFieldsGroupBox extends AbstractGroupBox {
87
      @Order(10)
88
      @FormData(sdkCommand = SdkCommand.IGNORE)
89
      public class SdkCommandIgnoreField extends AbstractStringField {
90
      }
91
    }
92
93
    @Order(50.0)
94
    public class GroupBox extends AbstractGroupBox {
95
96
      @Order(10.0)
97
      public class NameField extends AbstractStringField {
98
99
        @Override
100
        protected boolean getConfiguredMandatory() {
101
          return true;
102
        }
103
104
        @Override
105
        protected int getConfiguredMaxLength() {
106
          return 60;
107
        }
108
      }
109
110
      @Order(20.0)
111
      public class SmartField extends AbstractSmartField<Long> {
112
        @Override
113
        protected Class<? extends ICodeType<?>> getConfiguredCodeType() {
114
          return TestingCodeType.class;
115
        }
116
      }
117
118
      @Order(30.0)
119
      public class LookupField extends AbstractLookupField {
120
      }
121
    }
122
123
    @Order(20.0)
124
    @FormData(sdkCommand = SdkCommand.IGNORE)
125
    public class IgnoringGroupBox extends AbstractGroupBox {
126
127
      @Order(10.0)
128
      public class IgnoringGroupBoxField extends AbstractStringField {
129
      }
130
    }
131
132
    @Order(100.0)
133
    public class CloseButton extends AbstractCloseButton {
134
    }
135
  }
136
}
(-)resources/operation/formData/formdata.client/src/formdata/client/ui/forms/replace/ExtendedExtendedForm.java (+610 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.client.ui.forms.replace;
12
13
import org.eclipse.scout.commons.annotations.FormData;
14
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
15
import org.eclipse.scout.commons.annotations.Replace;
16
import org.eclipse.scout.commons.exception.ProcessingException;
17
18
import formdata.client.ui.forms.replace.BaseForm.MainBox.GroupBox;
19
import formdata.shared.services.process.replace.ExtendedExtendedFormData;
20
import formdata.shared.services.process.replace.UsingFormFieldData;
21
22
@FormData(value = ExtendedExtendedFormData.class, sdkCommand = SdkCommand.CREATE)
23
public class ExtendedExtendedForm extends ExtendedForm {
24
25
  public ExtendedExtendedForm() throws ProcessingException {
26
    super();
27
  }
28
29
  /* ##########################################################################
30
   * replacing fields that are creating a form data (without explicitly
31
   * defining a @FormData annotation)
32
   * expectation: replacing form field data must be created and it must be a
33
   *              subclass of the parent field's form field data. Hence any
34
   *              @FormData annotation available on the field replacements are
35
   *              ignored.
36
   * ##########################################################################
37
   */
38
  @Replace
39
  public class SdkCommandNoneNoneNoneField extends ExtendedForm.SdkCommandNoneNoneField {
40
    public SdkCommandNoneNoneNoneField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
41
      super(container);
42
    }
43
  }
44
45
  @Replace
46
  @FormData(sdkCommand = SdkCommand.CREATE)
47
  public class SdkCommandNoneNoneCreateField extends ExtendedForm.SdkCommandNoneNoneField {
48
    public SdkCommandNoneNoneCreateField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
49
      super(container);
50
    }
51
  }
52
53
  @Replace
54
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
55
  public class SdkCommandNoneNoneUseField extends ExtendedForm.SdkCommandNoneNoneField {
56
    public SdkCommandNoneNoneUseField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
57
      super(container);
58
    }
59
  }
60
61
  @Replace
62
  @FormData(sdkCommand = SdkCommand.IGNORE)
63
  public class SdkCommandNoneNoneIgnoreField extends ExtendedForm.SdkCommandNoneNoneField {
64
    public SdkCommandNoneNoneIgnoreField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
65
      super(container);
66
    }
67
  }
68
69
  @Replace
70
  public class SdkCommandNoneCreateNoneField extends ExtendedForm.SdkCommandNoneCreateField {
71
    public SdkCommandNoneCreateNoneField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
72
      super(container);
73
    }
74
  }
75
76
  @Replace
77
  @FormData(sdkCommand = SdkCommand.CREATE)
78
  public class SdkCommandNoneCreateCreateField extends ExtendedForm.SdkCommandNoneCreateField {
79
    public SdkCommandNoneCreateCreateField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
80
      super(container);
81
    }
82
  }
83
84
  @Replace
85
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
86
  public class SdkCommandNoneCreateUseField extends ExtendedForm.SdkCommandNoneCreateField {
87
    public SdkCommandNoneCreateUseField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
88
      super(container);
89
    }
90
  }
91
92
  @Replace
93
  @FormData(sdkCommand = SdkCommand.IGNORE)
94
  public class SdkCommandNoneCreateIgnoreField extends ExtendedForm.SdkCommandNoneCreateField {
95
    public SdkCommandNoneCreateIgnoreField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
96
      super(container);
97
    }
98
  }
99
100
  @Replace
101
  public class SdkCommandNoneUseNoneField extends ExtendedForm.SdkCommandNoneUseField {
102
    public SdkCommandNoneUseNoneField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
103
      super(container);
104
    }
105
  }
106
107
  @Replace
108
  @FormData(sdkCommand = SdkCommand.CREATE)
109
  public class SdkCommandNoneUseCreateField extends ExtendedForm.SdkCommandNoneUseField {
110
    public SdkCommandNoneUseCreateField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
111
      super(container);
112
    }
113
  }
114
115
  @Replace
116
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
117
  public class SdkCommandNoneUseUseField extends ExtendedForm.SdkCommandNoneUseField {
118
    public SdkCommandNoneUseUseField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
119
      super(container);
120
    }
121
  }
122
123
  @Replace
124
  @FormData(sdkCommand = SdkCommand.IGNORE)
125
  public class SdkCommandNoneUseIgnoreField extends ExtendedForm.SdkCommandNoneUseField {
126
    public SdkCommandNoneUseIgnoreField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
127
      super(container);
128
    }
129
  }
130
131
  @Replace
132
  public class SdkCommandNoneIgnoreNoneField extends ExtendedForm.SdkCommandNoneIgnoreField {
133
    public SdkCommandNoneIgnoreNoneField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
134
      super(container);
135
    }
136
  }
137
138
  @Replace
139
  @FormData(sdkCommand = SdkCommand.CREATE)
140
  public class SdkCommandNoneIgnoreCreateField extends ExtendedForm.SdkCommandNoneIgnoreField {
141
    public SdkCommandNoneIgnoreCreateField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
142
      super(container);
143
    }
144
  }
145
146
  @Replace
147
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
148
  public class SdkCommandNoneIgnoreUseField extends ExtendedForm.SdkCommandNoneIgnoreField {
149
    public SdkCommandNoneIgnoreUseField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
150
      super(container);
151
    }
152
  }
153
154
  @Replace
155
  @FormData(sdkCommand = SdkCommand.IGNORE)
156
  public class SdkCommandNoneIgnoreIgnoreField extends ExtendedForm.SdkCommandNoneIgnoreField {
157
    public SdkCommandNoneIgnoreIgnoreField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
158
      super(container);
159
    }
160
  }
161
162
  /* ##########################################################################
163
   * replacing fields that are creating a form data (SdkCommand CREATE)
164
   * expectation: replacing form field data must be created and it must be a
165
   *              subclass of the parent field's form field data. Hence any
166
   *              @FormData annotation available on the field replacements are
167
   *              ignored.
168
   * ##########################################################################
169
   */
170
  @Replace
171
  public class SdkCommandCreateNoneNoneField extends ExtendedForm.SdkCommandCreateNoneField {
172
    public SdkCommandCreateNoneNoneField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
173
      super(container);
174
    }
175
  }
176
177
  @Replace
178
  @FormData(sdkCommand = SdkCommand.CREATE)
179
  public class SdkCommandCreateNoneCreateField extends ExtendedForm.SdkCommandCreateNoneField {
180
    public SdkCommandCreateNoneCreateField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
181
      super(container);
182
    }
183
  }
184
185
  @Replace
186
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
187
  public class SdkCommandCreateNoneUseField extends ExtendedForm.SdkCommandCreateNoneField {
188
    public SdkCommandCreateNoneUseField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
189
      super(container);
190
    }
191
  }
192
193
  @Replace
194
  @FormData(sdkCommand = SdkCommand.IGNORE)
195
  public class SdkCommandCreateNoneIgnoreField extends ExtendedForm.SdkCommandCreateNoneField {
196
    public SdkCommandCreateNoneIgnoreField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
197
      super(container);
198
    }
199
  }
200
201
  @Replace
202
  public class SdkCommandCreateCreateNoneField extends ExtendedForm.SdkCommandCreateCreateField {
203
    public SdkCommandCreateCreateNoneField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
204
      super(container);
205
    }
206
  }
207
208
  @Replace
209
  @FormData(sdkCommand = SdkCommand.CREATE)
210
  public class SdkCommandCreateCreateCreateField extends ExtendedForm.SdkCommandCreateCreateField {
211
    public SdkCommandCreateCreateCreateField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
212
      super(container);
213
    }
214
  }
215
216
  @Replace
217
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
218
  public class SdkCommandCreateCreateUseField extends ExtendedForm.SdkCommandCreateCreateField {
219
    public SdkCommandCreateCreateUseField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
220
      super(container);
221
    }
222
  }
223
224
  @Replace
225
  @FormData(sdkCommand = SdkCommand.IGNORE)
226
  public class SdkCommandCreateCreateIgnoreField extends ExtendedForm.SdkCommandCreateCreateField {
227
    public SdkCommandCreateCreateIgnoreField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
228
      super(container);
229
    }
230
  }
231
232
  @Replace
233
  public class SdkCommandCreateUseNoneField extends ExtendedForm.SdkCommandCreateUseField {
234
    public SdkCommandCreateUseNoneField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
235
      super(container);
236
    }
237
  }
238
239
  @Replace
240
  @FormData(sdkCommand = SdkCommand.CREATE)
241
  public class SdkCommandCreateUseCreateField extends ExtendedForm.SdkCommandCreateUseField {
242
    public SdkCommandCreateUseCreateField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
243
      super(container);
244
    }
245
  }
246
247
  @Replace
248
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
249
  public class SdkCommandCreateUseUseField extends ExtendedForm.SdkCommandCreateUseField {
250
    public SdkCommandCreateUseUseField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
251
      super(container);
252
    }
253
  }
254
255
  @Replace
256
  @FormData(sdkCommand = SdkCommand.IGNORE)
257
  public class SdkCommandCreateUseIgnoreField extends ExtendedForm.SdkCommandCreateUseField {
258
    public SdkCommandCreateUseIgnoreField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
259
      super(container);
260
    }
261
  }
262
263
  @Replace
264
  public class SdkCommandCreateIgnoreNoneField extends ExtendedForm.SdkCommandCreateIgnoreField {
265
    public SdkCommandCreateIgnoreNoneField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
266
      super(container);
267
    }
268
  }
269
270
  @Replace
271
  @FormData(sdkCommand = SdkCommand.CREATE)
272
  public class SdkCommandCreateIgnoreCreateField extends ExtendedForm.SdkCommandCreateIgnoreField {
273
    public SdkCommandCreateIgnoreCreateField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
274
      super(container);
275
    }
276
  }
277
278
  @Replace
279
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
280
  public class SdkCommandCreateIgnoreUseField extends ExtendedForm.SdkCommandCreateIgnoreField {
281
    public SdkCommandCreateIgnoreUseField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
282
      super(container);
283
    }
284
  }
285
286
  @Replace
287
  @FormData(sdkCommand = SdkCommand.IGNORE)
288
  public class SdkCommandCreateIgnoreIgnoreField extends ExtendedForm.SdkCommandCreateIgnoreField {
289
    public SdkCommandCreateIgnoreIgnoreField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
290
      super(container);
291
    }
292
  }
293
294
  /* ##########################################################################
295
   * replacing fields that are using a form data (SdkCommand USE)
296
   * expectation: replacing form field data must be created and it must be a
297
   *              subclass of the parent field's form field data. Hence any
298
   *              @FormData annotation available on the field replacements are
299
   *              ignored.
300
   * ##########################################################################
301
   */
302
  @Replace
303
  public class SdkCommandUseNoneNoneField extends ExtendedForm.SdkCommandUseNoneField {
304
    public SdkCommandUseNoneNoneField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
305
      super(container);
306
    }
307
  }
308
309
  @Replace
310
  @FormData(sdkCommand = SdkCommand.CREATE)
311
  public class SdkCommandUseNoneCreateField extends ExtendedForm.SdkCommandUseNoneField {
312
    public SdkCommandUseNoneCreateField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
313
      super(container);
314
    }
315
  }
316
317
  @Replace
318
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
319
  public class SdkCommandUseNoneUseField extends ExtendedForm.SdkCommandUseNoneField {
320
    public SdkCommandUseNoneUseField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
321
      super(container);
322
    }
323
  }
324
325
  @Replace
326
  @FormData(sdkCommand = SdkCommand.IGNORE)
327
  public class SdkCommandUseNoneIgnoreField extends ExtendedForm.SdkCommandUseNoneField {
328
    public SdkCommandUseNoneIgnoreField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
329
      super(container);
330
    }
331
  }
332
333
  @Replace
334
  public class SdkCommandUseCreateNoneField extends ExtendedForm.SdkCommandUseCreateField {
335
    public SdkCommandUseCreateNoneField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
336
      super(container);
337
    }
338
  }
339
340
  @Replace
341
  @FormData(sdkCommand = SdkCommand.CREATE)
342
  public class SdkCommandUseCreateCreateField extends ExtendedForm.SdkCommandUseCreateField {
343
    public SdkCommandUseCreateCreateField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
344
      super(container);
345
    }
346
  }
347
348
  @Replace
349
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
350
  public class SdkCommandUseCreateUseField extends ExtendedForm.SdkCommandUseCreateField {
351
    public SdkCommandUseCreateUseField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
352
      super(container);
353
    }
354
  }
355
356
  @Replace
357
  @FormData(sdkCommand = SdkCommand.IGNORE)
358
  public class SdkCommandUseCreateIgnoreField extends ExtendedForm.SdkCommandUseCreateField {
359
    public SdkCommandUseCreateIgnoreField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
360
      super(container);
361
    }
362
  }
363
364
  @Replace
365
  public class SdkCommandUseUseNoneField extends ExtendedForm.SdkCommandUseUseField {
366
    public SdkCommandUseUseNoneField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
367
      super(container);
368
    }
369
  }
370
371
  @Replace
372
  @FormData(sdkCommand = SdkCommand.CREATE)
373
  public class SdkCommandUseUseCreateField extends ExtendedForm.SdkCommandUseUseField {
374
    public SdkCommandUseUseCreateField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
375
      super(container);
376
    }
377
  }
378
379
  @Replace
380
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
381
  public class SdkCommandUseUseUseField extends ExtendedForm.SdkCommandUseUseField {
382
    public SdkCommandUseUseUseField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
383
      super(container);
384
    }
385
  }
386
387
  @Replace
388
  @FormData(sdkCommand = SdkCommand.IGNORE)
389
  public class SdkCommandUseUseIgnoreField extends ExtendedForm.SdkCommandUseUseField {
390
    public SdkCommandUseUseIgnoreField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
391
      super(container);
392
    }
393
  }
394
395
  @Replace
396
  public class SdkCommandUseIgnoreNoneField extends ExtendedForm.SdkCommandUseIgnoreField {
397
    public SdkCommandUseIgnoreNoneField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
398
      super(container);
399
    }
400
  }
401
402
  @Replace
403
  @FormData(sdkCommand = SdkCommand.CREATE)
404
  public class SdkCommandUseIgnoreCreateField extends ExtendedForm.SdkCommandUseIgnoreField {
405
    public SdkCommandUseIgnoreCreateField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
406
      super(container);
407
    }
408
  }
409
410
  @Replace
411
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
412
  public class SdkCommandUseIgnoreUseField extends ExtendedForm.SdkCommandUseIgnoreField {
413
    public SdkCommandUseIgnoreUseField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
414
      super(container);
415
    }
416
  }
417
418
  @Replace
419
  @FormData(sdkCommand = SdkCommand.IGNORE)
420
  public class SdkCommandUseIgnoreIgnoreField extends ExtendedForm.SdkCommandUseIgnoreField {
421
    public SdkCommandUseIgnoreIgnoreField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
422
      super(container);
423
    }
424
  }
425
426
  /* ########################################################################
427
   * replacing fields that are ignoring a form data (SdkCommand IGNORE)
428
   * expectation: replacing form field data must be created if the replacement
429
   *              field is not annotated with SdkCommand.IGNORE. There is no
430
   *              special parent field data handling required.
431
   * ########################################################################
432
   */
433
  @Replace
434
  public class SdkCommandIgnoreNoneNoneField extends ExtendedForm.SdkCommandIgnoreNoneField {
435
    public SdkCommandIgnoreNoneNoneField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
436
      super(container);
437
    }
438
  }
439
440
  @Replace
441
  @FormData(sdkCommand = SdkCommand.CREATE)
442
  public class SdkCommandIgnoreNoneCreateField extends ExtendedForm.SdkCommandIgnoreNoneField {
443
    public SdkCommandIgnoreNoneCreateField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
444
      super(container);
445
    }
446
  }
447
448
  @Replace
449
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
450
  public class SdkCommandIgnoreNoneUseField extends ExtendedForm.SdkCommandIgnoreNoneField {
451
    public SdkCommandIgnoreNoneUseField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
452
      super(container);
453
    }
454
  }
455
456
  @Replace
457
  @FormData(sdkCommand = SdkCommand.IGNORE)
458
  public class SdkCommandIgnoreNoneIgnoreField extends ExtendedForm.SdkCommandIgnoreNoneField {
459
    public SdkCommandIgnoreNoneIgnoreField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
460
      super(container);
461
    }
462
  }
463
464
  @Replace
465
  public class SdkCommandIgnoreCreateNoneField extends ExtendedForm.SdkCommandIgnoreCreateField {
466
    public SdkCommandIgnoreCreateNoneField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
467
      super(container);
468
    }
469
  }
470
471
  @Replace
472
  @FormData(sdkCommand = SdkCommand.CREATE)
473
  public class SdkCommandIgnoreCreateCreateField extends ExtendedForm.SdkCommandIgnoreCreateField {
474
    public SdkCommandIgnoreCreateCreateField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
475
      super(container);
476
    }
477
  }
478
479
  @Replace
480
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
481
  public class SdkCommandIgnoreCreateUseField extends ExtendedForm.SdkCommandIgnoreCreateField {
482
    public SdkCommandIgnoreCreateUseField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
483
      super(container);
484
    }
485
  }
486
487
  @Replace
488
  @FormData(sdkCommand = SdkCommand.IGNORE)
489
  public class SdkCommandIgnoreCreateIgnoreField extends ExtendedForm.SdkCommandIgnoreCreateField {
490
    public SdkCommandIgnoreCreateIgnoreField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
491
      super(container);
492
    }
493
  }
494
495
  @Replace
496
  public class SdkCommandIgnoreUseNoneField extends ExtendedForm.SdkCommandIgnoreUseField {
497
    public SdkCommandIgnoreUseNoneField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
498
      super(container);
499
    }
500
  }
501
502
  @Replace
503
  @FormData(sdkCommand = SdkCommand.CREATE)
504
  public class SdkCommandIgnoreUseCreateField extends ExtendedForm.SdkCommandIgnoreUseField {
505
    public SdkCommandIgnoreUseCreateField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
506
      super(container);
507
    }
508
  }
509
510
  @Replace
511
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
512
  public class SdkCommandIgnoreUseUseField extends ExtendedForm.SdkCommandIgnoreUseField {
513
    public SdkCommandIgnoreUseUseField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
514
      super(container);
515
    }
516
  }
517
518
  @Replace
519
  @FormData(sdkCommand = SdkCommand.IGNORE)
520
  public class SdkCommandIgnoreUseIgnoreField extends ExtendedForm.SdkCommandIgnoreUseField {
521
    public SdkCommandIgnoreUseIgnoreField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
522
      super(container);
523
    }
524
  }
525
526
  @Replace
527
  public class SdkCommandIgnoreIgnoreNoneField extends ExtendedForm.SdkCommandIgnoreIgnoreField {
528
    public SdkCommandIgnoreIgnoreNoneField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
529
      super(container);
530
    }
531
  }
532
533
  @Replace
534
  @FormData(sdkCommand = SdkCommand.CREATE)
535
  public class SdkCommandIgnoreIgnoreCreateField extends ExtendedForm.SdkCommandIgnoreIgnoreField {
536
    public SdkCommandIgnoreIgnoreCreateField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
537
      super(container);
538
    }
539
  }
540
541
  @Replace
542
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
543
  public class SdkCommandIgnoreIgnoreUseField extends ExtendedForm.SdkCommandIgnoreIgnoreField {
544
    public SdkCommandIgnoreIgnoreUseField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
545
      super(container);
546
    }
547
  }
548
549
  @Replace
550
  @FormData(sdkCommand = SdkCommand.IGNORE)
551
  public class SdkCommandIgnoreIgnoreIgnoreField extends ExtendedForm.SdkCommandIgnoreIgnoreField {
552
    public SdkCommandIgnoreIgnoreIgnoreField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
553
      super(container);
554
    }
555
  }
556
557
  /* ########################################################################
558
   * additional tests
559
   * ########################################################################
560
   */
561
  @Replace
562
  public class NameExExField extends NameExField {
563
564
    private String m_stringProperty;
565
566
    public NameExExField(GroupBox container) {
567
      super(container);
568
    }
569
570
    @FormData
571
    public String getStringProperty() {
572
      return m_stringProperty;
573
    }
574
575
    @FormData
576
    public void setStringProperty(String stringProperty) {
577
      m_stringProperty = stringProperty;
578
    }
579
580
    @Override
581
    protected int getConfiguredMaxLength() {
582
      return 15;
583
    }
584
  }
585
586
  @Replace
587
  public class IgnoringGroupBoxExNoneNoneField extends ExtendedForm.IgnoringGroupBoxExNoneField {
588
589
    public IgnoringGroupBoxExNoneNoneField(BaseForm.MainBox.IgnoringGroupBox container) {
590
      super(container);
591
    }
592
  }
593
594
  @Replace
595
  @FormData(sdkCommand = SdkCommand.CREATE)
596
  public class IgnoringGroupBoxExNoneCreateField extends ExtendedForm.IgnoringGroupBoxExNoneField {
597
598
    public IgnoringGroupBoxExNoneCreateField(BaseForm.MainBox.IgnoringGroupBox container) {
599
      super(container);
600
    }
601
  }
602
603
  @Replace
604
  public class IgnoringGroupBoxExCreateNoneField extends ExtendedForm.IgnoringGroupBoxExCreateField {
605
606
    public IgnoringGroupBoxExCreateNoneField(BaseForm.MainBox.IgnoringGroupBox container) {
607
      super(container);
608
    }
609
  }
610
}
(-)resources/operation/formData/formdata.client/src/formdata/client/ui/forms/replace/ExtendedForm.java (+276 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.client.ui.forms.replace;
12
13
import org.eclipse.scout.commons.annotations.FormData;
14
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
15
import org.eclipse.scout.commons.annotations.InjectFieldTo;
16
import org.eclipse.scout.commons.annotations.Order;
17
import org.eclipse.scout.commons.annotations.Replace;
18
import org.eclipse.scout.commons.exception.ProcessingException;
19
import org.eclipse.scout.rt.client.ui.form.fields.stringfield.AbstractStringField;
20
import org.eclipse.scout.rt.shared.data.form.ValidationRule;
21
import org.eclipse.scout.rt.shared.services.common.code.ICodeType;
22
23
import formdata.shared.services.process.replace.ExtendedFormData;
24
import formdata.shared.services.process.replace.UsingFormFieldData;
25
26
@FormData(value = ExtendedFormData.class, sdkCommand = SdkCommand.CREATE)
27
public class ExtendedForm extends BaseForm {
28
29
  public ExtendedForm() throws ProcessingException {
30
    super();
31
  }
32
33
  /* ##########################################################################
34
   * injecting additional field
35
   * ##########################################################################
36
   */
37
  @Order(20)
38
  @InjectFieldTo(BaseForm.MainBox.class)
39
  public class FirstNameField extends AbstractStringField {
40
  }
41
42
  /* ##########################################################################
43
   * replacing fields that are creating a form data (without explicitly
44
   * defining a @FormData annotation)
45
   * expectation: replacing form field data must be created and it must be a
46
   *              subclass of the parent field's form field data. Hence any
47
   *              @FormData annotation available on the field replacements are
48
   *              ignored.
49
   * ##########################################################################
50
   */
51
  @Replace
52
  public class SdkCommandNoneNoneField extends BaseForm.MainBox.NoneFormDataFieldsGroupBox.SdkCommandNoneField {
53
    public SdkCommandNoneNoneField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
54
      container.super();
55
    }
56
  }
57
58
  @Replace
59
  @FormData(sdkCommand = SdkCommand.CREATE)
60
  public class SdkCommandNoneCreateField extends BaseForm.MainBox.NoneFormDataFieldsGroupBox.SdkCommandNoneField {
61
    public SdkCommandNoneCreateField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
62
      container.super();
63
    }
64
  }
65
66
  @Replace
67
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
68
  public class SdkCommandNoneUseField extends BaseForm.MainBox.NoneFormDataFieldsGroupBox.SdkCommandNoneField {
69
    public SdkCommandNoneUseField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
70
      container.super();
71
    }
72
  }
73
74
  @Replace
75
  @FormData(sdkCommand = SdkCommand.IGNORE)
76
  public class SdkCommandNoneIgnoreField extends BaseForm.MainBox.NoneFormDataFieldsGroupBox.SdkCommandNoneField {
77
    public SdkCommandNoneIgnoreField(BaseForm.MainBox.NoneFormDataFieldsGroupBox container) {
78
      container.super();
79
    }
80
  }
81
82
  /* ##########################################################################
83
   * replacing fields that are creating a form data (SdkCommand CREATE)
84
   * expectation: replacing form field data must be created and it must be a
85
   *              subclass of the parent field's form field data. Hence any
86
   *              @FormData annotation available on the field replacements are
87
   *              ignored.
88
   * ##########################################################################
89
   */
90
  @Replace
91
  public class SdkCommandCreateNoneField extends BaseForm.MainBox.CreatingFormDataFieldsGroupBox.SdkCommandCreateField {
92
    public SdkCommandCreateNoneField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
93
      container.super();
94
    }
95
  }
96
97
  @Replace
98
  @FormData(sdkCommand = SdkCommand.CREATE)
99
  public class SdkCommandCreateCreateField extends BaseForm.MainBox.CreatingFormDataFieldsGroupBox.SdkCommandCreateField {
100
    public SdkCommandCreateCreateField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
101
      container.super();
102
    }
103
  }
104
105
  @Replace
106
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
107
  public class SdkCommandCreateUseField extends BaseForm.MainBox.CreatingFormDataFieldsGroupBox.SdkCommandCreateField {
108
    public SdkCommandCreateUseField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
109
      container.super();
110
    }
111
  }
112
113
  @Replace
114
  @FormData(sdkCommand = SdkCommand.IGNORE)
115
  public class SdkCommandCreateIgnoreField extends BaseForm.MainBox.CreatingFormDataFieldsGroupBox.SdkCommandCreateField {
116
    public SdkCommandCreateIgnoreField(BaseForm.MainBox.CreatingFormDataFieldsGroupBox container) {
117
      container.super();
118
    }
119
  }
120
121
  /* ##########################################################################
122
   * replacing fields that are using a form data (SdkCommand USE)
123
   * expectation: replacing form field data must be created and it must be a
124
   *              subclass of the parent field's form field data. Hence any
125
   *              @FormData annotation available on the field replacements are
126
   *              ignored.
127
   * ##########################################################################
128
   */
129
  @Replace
130
  public class SdkCommandUseNoneField extends BaseForm.MainBox.UsingFormDataFieldsGroupBox.SdkCommandUseField {
131
    public SdkCommandUseNoneField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
132
      container.super();
133
    }
134
  }
135
136
  @Replace
137
  @FormData(sdkCommand = SdkCommand.CREATE)
138
  public class SdkCommandUseCreateField extends BaseForm.MainBox.UsingFormDataFieldsGroupBox.SdkCommandUseField {
139
    public SdkCommandUseCreateField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
140
      container.super();
141
    }
142
  }
143
144
  @Replace
145
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
146
  public class SdkCommandUseUseField extends BaseForm.MainBox.UsingFormDataFieldsGroupBox.SdkCommandUseField {
147
    public SdkCommandUseUseField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
148
      container.super();
149
    }
150
  }
151
152
  @Replace
153
  @FormData(sdkCommand = SdkCommand.IGNORE)
154
  public class SdkCommandUseIgnoreField extends BaseForm.MainBox.UsingFormDataFieldsGroupBox.SdkCommandUseField {
155
    public SdkCommandUseIgnoreField(BaseForm.MainBox.UsingFormDataFieldsGroupBox container) {
156
      container.super();
157
    }
158
  }
159
160
  /* ########################################################################
161
   * replacing fields that are ignoring a form data (SdkCommand IGNORE)
162
   * expectation: replacing form field data must be created if the replacement
163
   *              field is not annotated with SdkCommand.IGNORE. There is no
164
   *              special parent field data handling required.
165
   * ########################################################################
166
   */
167
  @Replace
168
  public class SdkCommandIgnoreNoneField extends BaseForm.MainBox.IgnoringFormDataFieldsGroupBox.SdkCommandIgnoreField {
169
    public SdkCommandIgnoreNoneField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
170
      container.super();
171
    }
172
  }
173
174
  @Replace
175
  @FormData(sdkCommand = SdkCommand.CREATE)
176
  public class SdkCommandIgnoreCreateField extends BaseForm.MainBox.IgnoringFormDataFieldsGroupBox.SdkCommandIgnoreField {
177
    public SdkCommandIgnoreCreateField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
178
      container.super();
179
    }
180
  }
181
182
  @Replace
183
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
184
  public class SdkCommandIgnoreUseField extends BaseForm.MainBox.IgnoringFormDataFieldsGroupBox.SdkCommandIgnoreField {
185
    public SdkCommandIgnoreUseField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
186
      container.super();
187
    }
188
  }
189
190
  @Replace
191
  @FormData(sdkCommand = SdkCommand.IGNORE)
192
  public class SdkCommandIgnoreIgnoreField extends BaseForm.MainBox.IgnoringFormDataFieldsGroupBox.SdkCommandIgnoreField {
193
    public SdkCommandIgnoreIgnoreField(BaseForm.MainBox.IgnoringFormDataFieldsGroupBox container) {
194
      container.super();
195
    }
196
  }
197
198
  /* ########################################################################
199
   * additional tests
200
   * ########################################################################
201
   */
202
  @Replace
203
  public class NameExField extends BaseForm.MainBox.GroupBox.NameField {
204
205
    public NameExField(BaseForm.MainBox.GroupBox container) {
206
      container.super();
207
    }
208
209
    @Override
210
    protected boolean getConfiguredMandatory() {
211
      return false;
212
    }
213
214
    @Override
215
    protected int getConfiguredMaxLength() {
216
      return 100;
217
    }
218
  }
219
220
  @Replace
221
  public class SmartExField extends BaseForm.MainBox.GroupBox.SmartField {
222
223
    public SmartExField(BaseForm.MainBox.GroupBox container) {
224
      container.super();
225
    }
226
227
    @Override
228
    @ValidationRule(value = ValidationRule.CODE_TYPE, skip = true)
229
    protected Class<? extends ICodeType<?>> getConfiguredCodeType() {
230
      return super.getConfiguredCodeType();
231
    }
232
  }
233
234
  @Replace
235
  public class IgnoringGroupBoxExNoneField extends BaseForm.MainBox.IgnoringGroupBox.IgnoringGroupBoxField {
236
237
    public IgnoringGroupBoxExNoneField(BaseForm.MainBox.IgnoringGroupBox container) {
238
      container.super();
239
    }
240
  }
241
242
  @Replace
243
  @FormData(sdkCommand = SdkCommand.CREATE)
244
  public class IgnoringGroupBoxExCreateField extends BaseForm.MainBox.IgnoringGroupBox.IgnoringGroupBoxField {
245
246
    public IgnoringGroupBoxExCreateField(BaseForm.MainBox.IgnoringGroupBox container) {
247
      container.super();
248
    }
249
  }
250
251
  @Replace
252
  @FormData(sdkCommand = SdkCommand.USE, value = UsingFormFieldData.class)
253
  public class IgnoringGroupBoxExUseField extends BaseForm.MainBox.IgnoringGroupBox.IgnoringGroupBoxField {
254
255
    public IgnoringGroupBoxExUseField(BaseForm.MainBox.IgnoringGroupBox container) {
256
      container.super();
257
    }
258
  }
259
260
  @Replace
261
  @FormData(sdkCommand = SdkCommand.IGNORE)
262
  public class IgnoringGroupBoxExIgnoreField extends BaseForm.MainBox.IgnoringGroupBox.IgnoringGroupBoxField {
263
264
    public IgnoringGroupBoxExIgnoreField(BaseForm.MainBox.IgnoringGroupBox container) {
265
      container.super();
266
    }
267
  }
268
269
  @Replace
270
  public class CloseExButton extends BaseForm.MainBox.CloseButton {
271
272
    public CloseExButton(BaseForm.MainBox container) {
273
      container.super();
274
    }
275
  }
276
}
(-)resources/operation/formData/formdata.client/src/formdata/client/ui/forms/replace/TableFieldBaseForm.java (+71 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.client.ui.forms.replace;
12
13
import org.eclipse.scout.commons.annotations.FormData;
14
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
15
import org.eclipse.scout.commons.annotations.Order;
16
import org.eclipse.scout.commons.exception.ProcessingException;
17
import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
18
import org.eclipse.scout.rt.client.ui.basic.table.ITable;
19
import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
20
import org.eclipse.scout.rt.client.ui.form.AbstractForm;
21
import org.eclipse.scout.rt.client.ui.form.fields.groupbox.AbstractGroupBox;
22
import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
23
import org.eclipse.scout.rt.shared.data.form.fields.tablefield.AbstractTableFieldBeanData;
24
25
import formdata.shared.services.process.replace.TableFieldBaseFormData;
26
27
@FormData(value = TableFieldBaseFormData.class, sdkCommand = SdkCommand.CREATE)
28
public class TableFieldBaseForm extends AbstractForm {
29
30
  /**
31
   * @throws ProcessingException
32
   */
33
  public TableFieldBaseForm() throws ProcessingException {
34
    super();
35
  }
36
37
  @Order(10.0)
38
  public class MainBox extends AbstractGroupBox {
39
40
    @Order(10.0)
41
    @FormData(sdkCommand = SdkCommand.USE, value = AbstractTableFieldBeanData.class)
42
    public class TableField extends AbstractTableField<TableField.Table> {
43
44
      public class Table extends AbstractTable {
45
46
        @Order(10.0)
47
        public class FirstColumn extends AbstractStringColumn {
48
49
        }
50
51
        @Order(20.0)
52
        public class SecondColumn extends AbstractStringColumn {
53
54
        }
55
      }
56
    }
57
58
    @Order(20.0)
59
    @FormData(sdkCommand = SdkCommand.USE, value = AbstractTableFieldBeanData.class)
60
    public class EmptyTableField extends AbstractTableField<EmptyTableField.Table> {
61
62
      public class Table extends AbstractTable {
63
      }
64
    }
65
66
    @Order(30.0)
67
    @FormData(sdkCommand = SdkCommand.USE, value = AbstractTableFieldBeanData.class)
68
    public class NoTableField extends AbstractTableField<ITable> {
69
    }
70
  }
71
}
(-)resources/operation/formData/formdata.client/src/formdata/client/ui/forms/replace/TableFieldExForm.java (+85 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package formdata.client.ui.forms.replace;
12
13
import org.eclipse.scout.commons.annotations.FormData;
14
import org.eclipse.scout.commons.annotations.FormData.SdkCommand;
15
import org.eclipse.scout.commons.annotations.Order;
16
import org.eclipse.scout.commons.annotations.Replace;
17
import org.eclipse.scout.commons.exception.ProcessingException;
18
import org.eclipse.scout.rt.client.ui.basic.table.AbstractTable;
19
import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractBooleanColumn;
20
import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
21
22
import formdata.shared.services.process.replace.TableFieldExFormData;
23
24
/**
25
 *
26
 */
27
@FormData(value = TableFieldExFormData.class, sdkCommand = SdkCommand.CREATE)
28
public class TableFieldExForm extends TableFieldBaseForm {
29
30
  public TableFieldExForm() throws ProcessingException {
31
    super();
32
  }
33
34
  @Replace
35
  public class TableExtendedField extends TableFieldBaseForm.MainBox.TableField {
36
37
    public TableExtendedField(TableFieldBaseForm.MainBox container) {
38
      container.super();
39
    }
40
41
    public class TableEx extends Table {
42
43
      @Order(30)
44
      @Replace
45
      public class FirstExtendedColumn extends FirstColumn {
46
47
      }
48
49
      @Order(40)
50
      public class BooleanColumn extends AbstractBooleanColumn {
51
52
      }
53
    }
54
  }
55
56
  @Replace
57
  public class EmptyTableExtendedField extends TableFieldBaseForm.MainBox.EmptyTableField {
58
59
    public EmptyTableExtendedField(TableFieldBaseForm.MainBox container) {
60
      container.super();
61
    }
62
63
    public class TableEx extends Table {
64
65
      public class SingleColumn extends AbstractStringColumn {
66
67
      }
68
    }
69
  }
70
71
  @Replace
72
  public class NoTableExtendedField extends TableFieldBaseForm.MainBox.NoTableField {
73
74
    public NoTableExtendedField(TableFieldBaseForm.MainBox container) {
75
      container.super();
76
    }
77
78
    public class Table extends AbstractTable {
79
80
      public class NewColumn extends AbstractStringColumn {
81
82
      }
83
    }
84
  }
85
}
(-)src/org/eclipse/scout/sdk/internal/test/operation/formdata/_SuiteFormData.java (-2 / +3 lines)
Lines 17-31 Link Here
17
//@SuiteClasses({FormWithTemplateTest.class, TemplateFormDataTest.class})
17
//@SuiteClasses({FormWithTemplateTest.class, TemplateFormDataTest.class})
18
@SuiteClasses({
18
@SuiteClasses({
19
    ExternalCheckboxFieldTest.class,
19
    ExternalCheckboxFieldTest.class,
20
    ExternalGroupboxTest.class,
20
    ExternalTableFieldTest.class,
21
    ExternalTableFieldTest.class,
21
    FormPropertiesTest.class,
22
    FormPropertiesTest.class,
22
    FormWithGroupboxesTest.class,
23
    FormWithGroupboxesTest.class,
23
    FormWithTemplateTest.class,
24
    FormWithTemplateTest.class,
24
    IgnoredFieldsFormTest.class,
25
    IgnoredFieldsFormTest.class,
25
    ListBoxFormTest.class,
26
    ListBoxFormTest.class,
27
    ReplaceFormFiledTest.class,
26
    SimpleFormTest.class,
28
    SimpleFormTest.class,
27
    TableFieldFormTest.class,
29
    TableFieldFormTest.class})
28
    ExternalGroupboxTest.class})
29
public class _SuiteFormData {
30
public class _SuiteFormData {
30
31
31
}
32
}
(-)src/org/eclipse/scout/sdk/internal/test/operation/formdata/ReplaceFormFiledTest.java (+998 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 BSI Business Systems Integration AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     BSI Business Systems Integration AG - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.scout.sdk.internal.test.operation.formdata;
12
13
import static org.junit.Assert.assertEquals;
14
import static org.junit.Assert.assertFalse;
15
import static org.junit.Assert.assertNotNull;
16
import static org.junit.Assert.assertTrue;
17
18
import java.util.HashMap;
19
import java.util.Map;
20
21
import javax.annotation.Generated;
22
23
import org.eclipse.core.resources.IProject;
24
import org.eclipse.jdt.core.IMethod;
25
import org.eclipse.jdt.core.ISourceRange;
26
import org.eclipse.jdt.core.IType;
27
import org.eclipse.scout.sdk.jobs.OperationJob;
28
import org.eclipse.scout.sdk.operation.form.formdata.FormDataUpdateOperation;
29
import org.eclipse.scout.sdk.test.AbstractScoutSdkTest;
30
import org.eclipse.scout.sdk.util.type.TypeUtility;
31
import org.junit.BeforeClass;
32
import org.junit.Test;
33
34
public class ReplaceFormFiledTest extends AbstractScoutSdkTest {
35
36
  private static IType s_baseFormData;
37
  private static IType s_extendedFormData;
38
  private static IType s_extendedExtendedFormData;
39
  private static Map<String, String> s_validationRules;
40
41
  @BeforeClass
42
  public static void setUpWorkspace() throws Exception {
43
    setupWorkspace("operation/formData", "formdata.shared", "formdata.client");
44
45
    IProject sharedProject = getProject("formdata.shared");
46
    assertNotNull(sharedProject);
47
48
    s_baseFormData = updateFormData(sharedProject, "formdata.client.ui.forms.replace.BaseForm", "formdata.shared.services.process.replace.BaseFormData", "AbstractFormData");
49
    s_extendedFormData = updateFormData(sharedProject, "formdata.client.ui.forms.replace.ExtendedForm", "formdata.shared.services.process.replace.ExtendedFormData", "BaseFormData");
50
    s_extendedExtendedFormData = updateFormData(sharedProject, "formdata.client.ui.forms.replace.ExtendedExtendedForm", "formdata.shared.services.process.replace.ExtendedExtendedFormData", "ExtendedFormData");
51
52
    s_validationRules = new HashMap<String, String>();
53
    s_validationRules.put("ValidationRule.MANDATORY", "\"mandatory\"");
54
    s_validationRules.put("ValidationRule.MIN_VALUE", "\"minValue\"");
55
    s_validationRules.put("ValidationRule.MAX_VALUE", "\"maxValue\"");
56
    s_validationRules.put("ValidationRule.MIN_LENGTH", "\"minLength\"");
57
    s_validationRules.put("ValidationRule.MAX_LENGTH", "\"maxLength\"");
58
    s_validationRules.put("ValidationRule.CODE_TYPE", "\"codeType\"");
59
    s_validationRules.put("ValidationRule.LOOKUP_CALL", "\"lookupCall\"");
60
    s_validationRules.put("ValidationRule.REGEX", "\"regex\"");
61
    s_validationRules.put("ValidationRule.MASTER_VALUE_FIELD", "\"masterValueField\"");
62
    s_validationRules.put("ValidationRule.MASTER_VALUE_REQUIRED", "\"masterValueRequired\"");
63
    s_validationRules.put("ValidationRule.ZERO_NULL_EQUALITY", "\"zeroNullEquality\"");
64
  }
65
66
  private static IType updateFormData(IProject sharedProject, String formFqcn, String formDataFqcn, String formDataSuperClassName) throws Exception {
67
    IType form = TypeUtility.getType(formFqcn);
68
    assertTrue(TypeUtility.exists(form));
69
70
    FormDataUpdateOperation op = new FormDataUpdateOperation(form);
71
    OperationJob job = new OperationJob(op);
72
    job.schedule();
73
    job.join();
74
    buildWorkspace();
75
    IType formData = op.getFormDataType();
76
    assertTrue(TypeUtility.exists(formData));
77
    assertEquals(formDataFqcn, formData.getFullyQualifiedName());
78
    assertEquals(formDataSuperClassName, formData.getSuperclassName());
79
    return formData;
80
  }
81
82
  private static void assertValidationRules(IType type, String... expectedLines) throws Exception {
83
    IMethod initValidationRulesMethod = TypeUtility.getMethod(type, "initValidationRules");
84
85
    if (expectedLines == null || expectedLines.length == 0) {
86
      assertFalse(TypeUtility.exists(initValidationRulesMethod));
87
      return;
88
    }
89
90
    // validation rules are expected. Check contents.
91
    assertTrue(TypeUtility.exists(initValidationRulesMethod));
92
93
    String source = initValidationRulesMethod.getSource();
94
    ISourceRange range = TypeUtility.getContentRange(initValidationRulesMethod);
95
    source = initValidationRulesMethod.getOpenable().getBuffer().getText(range.getOffset(), range.getLength());
96
97
    assertNotNull(source);
98
99
    source = source.replace("super.initValidationRules(ruleMap);", "");
100
    for (String line : expectedLines) {
101
      source = source.replace(line, "");
102
103
      // inline constants
104
      for (Map.Entry<String, String> rule : s_validationRules.entrySet()) {
105
        line = line.replace(rule.getKey(), rule.getValue());
106
      }
107
      source = source.replace(line, "");
108
    }
109
110
    source = source.trim();
111
    assertEquals("", source);
112
  }
113
114
  /* ##########################################################################
115
   * BaseForm tests
116
   * ##########################################################################
117
   */
118
  @Test
119
  public void testBaseFormName() throws Exception {
120
    IType type = s_baseFormData.getType("Name");
121
    assertTrue(TypeUtility.exists(type));
122
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
123
    assertValidationRules(type,
124
        "ruleMap.put(ValidationRule.MANDATORY, true);",
125
        "ruleMap.put(ValidationRule.MAX_LENGTH, 60);");
126
  }
127
128
  @Test
129
  public void testBaseFormSmart() throws Exception {
130
    IType type = s_baseFormData.getType("Smart");
131
    assertTrue(TypeUtility.exists(type));
132
    assertEquals("AbstractValueFieldData<Long>", type.getSuperclassName());
133
    assertValidationRules(type,
134
        "ruleMap.put(ValidationRule.CODE_TYPE, TestingCodeType.class);",
135
        "ruleMap.put(ValidationRule.ZERO_NULL_EQUALITY, true);");
136
  }
137
138
  @Test
139
  public void testBaseFormLookup() throws Exception {
140
    IType type = s_baseFormData.getType("Lookup");
141
    assertTrue(TypeUtility.exists(type));
142
    assertEquals("AbstractValueFieldData<Long>", type.getSuperclassName());
143
    assertValidationRules(type,
144
        "ruleMap.put(ValidationRule.LOOKUP_CALL, TestingLookupCall.class);",
145
        "ruleMap.put(ValidationRule.ZERO_NULL_EQUALITY, true);");
146
  }
147
148
  @Test
149
  public void testBaseFormDataIgnoringGroupBox() throws Exception {
150
    IType type = s_baseFormData.getType("IgnoringGroupBox");
151
    assertFalse(TypeUtility.exists(type));
152
  }
153
154
  @Test
155
  public void testBaseFormDataClose() throws Exception {
156
    IType type = s_baseFormData.getType("Close");
157
    assertFalse(TypeUtility.exists(type));
158
  }
159
160
  @Test
161
  @Generated("Replace Field Test Generator")
162
  public void testBaseFormDataSdkCommandNone() throws Exception {
163
    IType type = s_baseFormData.getType("SdkCommandNone");
164
    assertTrue(TypeUtility.exists(type));
165
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
166
    assertValidationRules(type,
167
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
168
  }
169
170
  @Test
171
  @Generated("Replace Field Test Generator")
172
  public void testBaseFormDataSdkCommandCreate() throws Exception {
173
    IType type = s_baseFormData.getType("SdkCommandCreate");
174
    assertTrue(TypeUtility.exists(type));
175
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
176
    assertValidationRules(type,
177
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
178
  }
179
180
  @Test
181
  @Generated("Replace Field Test Generator")
182
  public void testBaseFormDataSdkCommandUse() throws Exception {
183
    IType type = s_baseFormData.getType("SdkCommandUse");
184
    assertTrue(TypeUtility.exists(type));
185
    assertEquals("UsingFormFieldData", type.getSuperclassName());
186
    assertValidationRules(type,
187
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
188
  }
189
190
  @Test
191
  @Generated("Replace Field Test Generator")
192
  public void testBaseFormDataSdkCommandIgnore() throws Exception {
193
    IType type = s_baseFormData.getType("SdkCommandIgnore");
194
    assertFalse(TypeUtility.exists(type));
195
  }
196
197
  /* ##########################################################################
198
   * ExtendedForm tests
199
   * ##########################################################################
200
   */
201
  @Test
202
  public void testExtendedFormFirstname() throws Exception {
203
    IType type = s_extendedFormData.getType("FirstName");
204
    assertTrue(TypeUtility.exists(type));
205
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
206
    assertValidationRules(type,
207
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
208
  }
209
210
  @Test
211
  public void testExtendedFormNameEx() throws Exception {
212
    IType type = s_extendedFormData.getType("NameEx");
213
    assertTrue(TypeUtility.exists(type));
214
    assertEquals("BaseFormData.Name", type.getSuperclassName());
215
    assertValidationRules(type,
216
        "ruleMap.put(ValidationRule.MANDATORY, false);",
217
        "ruleMap.put(ValidationRule.MAX_LENGTH, 100);");
218
  }
219
220
  @Test
221
  public void testExtendedFormSmartEx() throws Exception {
222
    IType type = s_extendedFormData.getType("SmartEx");
223
    assertTrue(TypeUtility.exists(type));
224
    assertEquals("BaseFormData.Smart", type.getSuperclassName());
225
    assertValidationRules(type,
226
        "ruleMap.remove(ValidationRule.CODE_TYPE);");
227
  }
228
229
  @Test
230
  public void testExtendedFormDataIgnoringGroupBoxExNone() throws Exception {
231
    IType type = s_extendedFormData.getType("IgnoringGroupBoxExNone");
232
    assertFalse(TypeUtility.exists(type));
233
  }
234
235
  @Test
236
  public void testExtendedFormDataIgnoringGroupBoxExWithCreate() throws Exception {
237
    IType type = s_extendedFormData.getType("IgnoringGroupBoxExCreate");
238
    assertTrue(TypeUtility.exists(type));
239
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
240
    assertValidationRules(type,
241
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
242
  }
243
244
  @Test
245
  public void testExtendedFormDataIgnoringGroupBoxExUse() throws Exception {
246
    IType type = s_extendedFormData.getType("IgnoringGroupBoxExUse");
247
    assertTrue(TypeUtility.exists(type));
248
    assertEquals("UsingFormFieldData", type.getSuperclassName());
249
    assertValidationRules(type,
250
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
251
  }
252
253
  @Test
254
  public void testExtendedFormDataIgnoringGroupBoxExIgnore() throws Exception {
255
    IType type = s_extendedFormData.getType("IgnoringGroupBoxExIgnore");
256
    assertFalse(TypeUtility.exists(type));
257
  }
258
259
  @Test
260
  public void testExtendedFormDataCloseEx() throws Exception {
261
    IType type = s_extendedFormData.getType("CloseEx");
262
    assertFalse(TypeUtility.exists(type));
263
  }
264
265
  @Test
266
  public void testExtendedFormIgnoringGroupBoxExNone() throws Exception {
267
    IType type = s_extendedFormData.getType("IgnoringGroupBoxExNone");
268
    assertFalse(TypeUtility.exists(type));
269
  }
270
271
  @Test
272
  @Generated("Replace Field Test Generator")
273
  public void testExtendedFormDataSdkCommandNoneNone() throws Exception {
274
    IType type = s_extendedFormData.getType("SdkCommandNoneNone");
275
    assertTrue(TypeUtility.exists(type));
276
    assertEquals("BaseFormData.SdkCommandNone", type.getSuperclassName());
277
    assertValidationRules(type);
278
  }
279
280
  @Test
281
  @Generated("Replace Field Test Generator")
282
  public void testExtendedFormDataSdkCommandNoneCreate() throws Exception {
283
    IType type = s_extendedFormData.getType("SdkCommandNoneCreate");
284
    assertTrue(TypeUtility.exists(type));
285
    assertEquals("BaseFormData.SdkCommandNone", type.getSuperclassName());
286
    assertValidationRules(type);
287
  }
288
289
  @Test
290
  @Generated("Replace Field Test Generator")
291
  public void testExtendedFormDataSdkCommandNoneUse() throws Exception {
292
    IType type = s_extendedFormData.getType("SdkCommandNoneUse");
293
    assertTrue(TypeUtility.exists(type));
294
    assertEquals("BaseFormData.SdkCommandNone", type.getSuperclassName());
295
    assertValidationRules(type);
296
  }
297
298
  @Test
299
  @Generated("Replace Field Test Generator")
300
  public void testExtendedFormDataSdkCommandNoneIgnore() throws Exception {
301
    IType type = s_extendedFormData.getType("SdkCommandNoneIgnore");
302
    assertTrue(TypeUtility.exists(type));
303
    assertEquals("BaseFormData.SdkCommandNone", type.getSuperclassName());
304
    assertValidationRules(type);
305
  }
306
307
  @Test
308
  @Generated("Replace Field Test Generator")
309
  public void testExtendedFormDataSdkCommandCreateNone() throws Exception {
310
    IType type = s_extendedFormData.getType("SdkCommandCreateNone");
311
    assertTrue(TypeUtility.exists(type));
312
    assertEquals("BaseFormData.SdkCommandCreate", type.getSuperclassName());
313
    assertValidationRules(type);
314
  }
315
316
  @Test
317
  @Generated("Replace Field Test Generator")
318
  public void testExtendedFormDataSdkCommandCreateCreate() throws Exception {
319
    IType type = s_extendedFormData.getType("SdkCommandCreateCreate");
320
    assertTrue(TypeUtility.exists(type));
321
    assertEquals("BaseFormData.SdkCommandCreate", type.getSuperclassName());
322
    assertValidationRules(type);
323
  }
324
325
  @Test
326
  @Generated("Replace Field Test Generator")
327
  public void testExtendedFormDataSdkCommandCreateUse() throws Exception {
328
    IType type = s_extendedFormData.getType("SdkCommandCreateUse");
329
    assertTrue(TypeUtility.exists(type));
330
    assertEquals("BaseFormData.SdkCommandCreate", type.getSuperclassName());
331
    assertValidationRules(type);
332
  }
333
334
  @Test
335
  @Generated("Replace Field Test Generator")
336
  public void testExtendedFormDataSdkCommandCreateIgnore() throws Exception {
337
    IType type = s_extendedFormData.getType("SdkCommandCreateIgnore");
338
    assertTrue(TypeUtility.exists(type));
339
    assertEquals("BaseFormData.SdkCommandCreate", type.getSuperclassName());
340
    assertValidationRules(type);
341
  }
342
343
  @Test
344
  @Generated("Replace Field Test Generator")
345
  public void testExtendedFormDataSdkCommandUseNone() throws Exception {
346
    IType type = s_extendedFormData.getType("SdkCommandUseNone");
347
    assertTrue(TypeUtility.exists(type));
348
    assertEquals("BaseFormData.SdkCommandUse", type.getSuperclassName());
349
    assertValidationRules(type);
350
  }
351
352
  @Test
353
  @Generated("Replace Field Test Generator")
354
  public void testExtendedFormDataSdkCommandUseCreate() throws Exception {
355
    IType type = s_extendedFormData.getType("SdkCommandUseCreate");
356
    assertTrue(TypeUtility.exists(type));
357
    assertEquals("BaseFormData.SdkCommandUse", type.getSuperclassName());
358
    assertValidationRules(type);
359
  }
360
361
  @Test
362
  @Generated("Replace Field Test Generator")
363
  public void testExtendedFormDataSdkCommandUseUse() throws Exception {
364
    IType type = s_extendedFormData.getType("SdkCommandUseUse");
365
    assertTrue(TypeUtility.exists(type));
366
    assertEquals("BaseFormData.SdkCommandUse", type.getSuperclassName());
367
    assertValidationRules(type);
368
  }
369
370
  @Test
371
  @Generated("Replace Field Test Generator")
372
  public void testExtendedFormDataSdkCommandUseIgnore() throws Exception {
373
    IType type = s_extendedFormData.getType("SdkCommandUseIgnore");
374
    assertTrue(TypeUtility.exists(type));
375
    assertEquals("BaseFormData.SdkCommandUse", type.getSuperclassName());
376
    assertValidationRules(type);
377
  }
378
379
  @Test
380
  @Generated("Replace Field Test Generator")
381
  public void testExtendedFormDataSdkCommandIgnoreNone() throws Exception {
382
    IType type = s_extendedFormData.getType("SdkCommandIgnoreNone");
383
    assertFalse(TypeUtility.exists(type));
384
  }
385
386
  @Test
387
  @Generated("Replace Field Test Generator")
388
  public void testExtendedFormDataSdkCommandIgnoreCreate() throws Exception {
389
    IType type = s_extendedFormData.getType("SdkCommandIgnoreCreate");
390
    assertTrue(TypeUtility.exists(type));
391
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
392
    assertValidationRules(type,
393
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
394
  }
395
396
  @Test
397
  @Generated("Replace Field Test Generator")
398
  public void testExtendedFormDataSdkCommandIgnoreUse() throws Exception {
399
    IType type = s_extendedFormData.getType("SdkCommandIgnoreUse");
400
    assertTrue(TypeUtility.exists(type));
401
    assertEquals("UsingFormFieldData", type.getSuperclassName());
402
    assertValidationRules(type,
403
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
404
  }
405
406
  @Test
407
  @Generated("Replace Field Test Generator")
408
  public void testExtendedFormDataSdkCommandIgnoreIgnore() throws Exception {
409
    IType type = s_extendedFormData.getType("SdkCommandIgnoreIgnore");
410
    assertFalse(TypeUtility.exists(type));
411
  }
412
413
  /* ##########################################################################
414
   * ExtendedExtendedForm tests
415
   * ##########################################################################
416
   */
417
  @Test
418
  public void testExtendedExtendedFormNameExEx() throws Exception {
419
    IType type = s_extendedExtendedFormData.getType("NameExEx");
420
    assertTrue(TypeUtility.exists(type));
421
    assertEquals("ExtendedFormData.NameEx", type.getSuperclassName());
422
    assertValidationRules(type,
423
        "ruleMap.put(ValidationRule.MAX_LENGTH, 15);");
424
  }
425
426
  @Test
427
  @Generated("Replace Field Test Generator")
428
  public void testExtendedExtendedFormDataSdkCommandNoneNoneNone() throws Exception {
429
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneNoneNone");
430
    assertTrue(TypeUtility.exists(type));
431
    assertEquals("ExtendedFormData.SdkCommandNoneNone", type.getSuperclassName());
432
    assertValidationRules(type);
433
  }
434
435
  @Test
436
  @Generated("Replace Field Test Generator")
437
  public void testExtendedExtendedFormDataSdkCommandNoneNoneCreate() throws Exception {
438
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneNoneCreate");
439
    assertTrue(TypeUtility.exists(type));
440
    assertEquals("ExtendedFormData.SdkCommandNoneNone", type.getSuperclassName());
441
    assertValidationRules(type);
442
  }
443
444
  @Test
445
  @Generated("Replace Field Test Generator")
446
  public void testExtendedExtendedFormDataSdkCommandNoneNoneUse() throws Exception {
447
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneNoneUse");
448
    assertTrue(TypeUtility.exists(type));
449
    assertEquals("ExtendedFormData.SdkCommandNoneNone", type.getSuperclassName());
450
    assertValidationRules(type);
451
  }
452
453
  @Test
454
  @Generated("Replace Field Test Generator")
455
  public void testExtendedExtendedFormDataSdkCommandNoneNoneIgnore() throws Exception {
456
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneNoneIgnore");
457
    assertTrue(TypeUtility.exists(type));
458
    assertEquals("ExtendedFormData.SdkCommandNoneNone", type.getSuperclassName());
459
    assertValidationRules(type);
460
  }
461
462
  @Test
463
  @Generated("Replace Field Test Generator")
464
  public void testExtendedExtendedFormDataSdkCommandNoneCreateNone() throws Exception {
465
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneCreateNone");
466
    assertTrue(TypeUtility.exists(type));
467
    assertEquals("ExtendedFormData.SdkCommandNoneCreate", type.getSuperclassName());
468
    assertValidationRules(type);
469
  }
470
471
  @Test
472
  @Generated("Replace Field Test Generator")
473
  public void testExtendedExtendedFormDataSdkCommandNoneCreateCreate() throws Exception {
474
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneCreateCreate");
475
    assertTrue(TypeUtility.exists(type));
476
    assertEquals("ExtendedFormData.SdkCommandNoneCreate", type.getSuperclassName());
477
    assertValidationRules(type);
478
  }
479
480
  @Test
481
  @Generated("Replace Field Test Generator")
482
  public void testExtendedExtendedFormDataSdkCommandNoneCreateUse() throws Exception {
483
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneCreateUse");
484
    assertTrue(TypeUtility.exists(type));
485
    assertEquals("ExtendedFormData.SdkCommandNoneCreate", type.getSuperclassName());
486
    assertValidationRules(type);
487
  }
488
489
  @Test
490
  @Generated("Replace Field Test Generator")
491
  public void testExtendedExtendedFormDataSdkCommandNoneCreateIgnore() throws Exception {
492
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneCreateIgnore");
493
    assertTrue(TypeUtility.exists(type));
494
    assertEquals("ExtendedFormData.SdkCommandNoneCreate", type.getSuperclassName());
495
    assertValidationRules(type);
496
  }
497
498
  @Test
499
  @Generated("Replace Field Test Generator")
500
  public void testExtendedExtendedFormDataSdkCommandNoneUseNone() throws Exception {
501
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneUseNone");
502
    assertTrue(TypeUtility.exists(type));
503
    assertEquals("ExtendedFormData.SdkCommandNoneUse", type.getSuperclassName());
504
    assertValidationRules(type);
505
  }
506
507
  @Test
508
  @Generated("Replace Field Test Generator")
509
  public void testExtendedExtendedFormDataSdkCommandNoneUseCreate() throws Exception {
510
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneUseCreate");
511
    assertTrue(TypeUtility.exists(type));
512
    assertEquals("ExtendedFormData.SdkCommandNoneUse", type.getSuperclassName());
513
    assertValidationRules(type);
514
  }
515
516
  @Test
517
  @Generated("Replace Field Test Generator")
518
  public void testExtendedExtendedFormDataSdkCommandNoneUseUse() throws Exception {
519
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneUseUse");
520
    assertTrue(TypeUtility.exists(type));
521
    assertEquals("ExtendedFormData.SdkCommandNoneUse", type.getSuperclassName());
522
    assertValidationRules(type);
523
  }
524
525
  @Test
526
  @Generated("Replace Field Test Generator")
527
  public void testExtendedExtendedFormDataSdkCommandNoneUseIgnore() throws Exception {
528
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneUseIgnore");
529
    assertTrue(TypeUtility.exists(type));
530
    assertEquals("ExtendedFormData.SdkCommandNoneUse", type.getSuperclassName());
531
    assertValidationRules(type);
532
  }
533
534
  @Test
535
  @Generated("Replace Field Test Generator")
536
  public void testExtendedExtendedFormDataSdkCommandNoneIgnoreNone() throws Exception {
537
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneIgnoreNone");
538
    assertTrue(TypeUtility.exists(type));
539
    assertEquals("ExtendedFormData.SdkCommandNoneIgnore", type.getSuperclassName());
540
    assertValidationRules(type);
541
  }
542
543
  @Test
544
  @Generated("Replace Field Test Generator")
545
  public void testExtendedExtendedFormDataSdkCommandNoneIgnoreCreate() throws Exception {
546
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneIgnoreCreate");
547
    assertTrue(TypeUtility.exists(type));
548
    assertEquals("ExtendedFormData.SdkCommandNoneIgnore", type.getSuperclassName());
549
    assertValidationRules(type);
550
  }
551
552
  @Test
553
  @Generated("Replace Field Test Generator")
554
  public void testExtendedExtendedFormDataSdkCommandNoneIgnoreUse() throws Exception {
555
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneIgnoreUse");
556
    assertTrue(TypeUtility.exists(type));
557
    assertEquals("ExtendedFormData.SdkCommandNoneIgnore", type.getSuperclassName());
558
    assertValidationRules(type);
559
  }
560
561
  @Test
562
  @Generated("Replace Field Test Generator")
563
  public void testExtendedExtendedFormDataSdkCommandNoneIgnoreIgnore() throws Exception {
564
    IType type = s_extendedExtendedFormData.getType("SdkCommandNoneIgnoreIgnore");
565
    assertTrue(TypeUtility.exists(type));
566
    assertEquals("ExtendedFormData.SdkCommandNoneIgnore", type.getSuperclassName());
567
    assertValidationRules(type);
568
  }
569
570
  @Test
571
  @Generated("Replace Field Test Generator")
572
  public void testExtendedExtendedFormDataSdkCommandCreateNoneNone() throws Exception {
573
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateNoneNone");
574
    assertTrue(TypeUtility.exists(type));
575
    assertEquals("ExtendedFormData.SdkCommandCreateNone", type.getSuperclassName());
576
    assertValidationRules(type);
577
  }
578
579
  @Test
580
  @Generated("Replace Field Test Generator")
581
  public void testExtendedExtendedFormDataSdkCommandCreateNoneCreate() throws Exception {
582
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateNoneCreate");
583
    assertTrue(TypeUtility.exists(type));
584
    assertEquals("ExtendedFormData.SdkCommandCreateNone", type.getSuperclassName());
585
    assertValidationRules(type);
586
  }
587
588
  @Test
589
  @Generated("Replace Field Test Generator")
590
  public void testExtendedExtendedFormDataSdkCommandCreateNoneUse() throws Exception {
591
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateNoneUse");
592
    assertTrue(TypeUtility.exists(type));
593
    assertEquals("ExtendedFormData.SdkCommandCreateNone", type.getSuperclassName());
594
    assertValidationRules(type);
595
  }
596
597
  @Test
598
  @Generated("Replace Field Test Generator")
599
  public void testExtendedExtendedFormDataSdkCommandCreateNoneIgnore() throws Exception {
600
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateNoneIgnore");
601
    assertTrue(TypeUtility.exists(type));
602
    assertEquals("ExtendedFormData.SdkCommandCreateNone", type.getSuperclassName());
603
    assertValidationRules(type);
604
  }
605
606
  @Test
607
  @Generated("Replace Field Test Generator")
608
  public void testExtendedExtendedFormDataSdkCommandCreateCreateNone() throws Exception {
609
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateCreateNone");
610
    assertTrue(TypeUtility.exists(type));
611
    assertEquals("ExtendedFormData.SdkCommandCreateCreate", type.getSuperclassName());
612
    assertValidationRules(type);
613
  }
614
615
  @Test
616
  @Generated("Replace Field Test Generator")
617
  public void testExtendedExtendedFormDataSdkCommandCreateCreateCreate() throws Exception {
618
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateCreateCreate");
619
    assertTrue(TypeUtility.exists(type));
620
    assertEquals("ExtendedFormData.SdkCommandCreateCreate", type.getSuperclassName());
621
    assertValidationRules(type);
622
  }
623
624
  @Test
625
  @Generated("Replace Field Test Generator")
626
  public void testExtendedExtendedFormDataSdkCommandCreateCreateUse() throws Exception {
627
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateCreateUse");
628
    assertTrue(TypeUtility.exists(type));
629
    assertEquals("ExtendedFormData.SdkCommandCreateCreate", type.getSuperclassName());
630
    assertValidationRules(type);
631
  }
632
633
  @Test
634
  @Generated("Replace Field Test Generator")
635
  public void testExtendedExtendedFormDataSdkCommandCreateCreateIgnore() throws Exception {
636
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateCreateIgnore");
637
    assertTrue(TypeUtility.exists(type));
638
    assertEquals("ExtendedFormData.SdkCommandCreateCreate", type.getSuperclassName());
639
    assertValidationRules(type);
640
  }
641
642
  @Test
643
  @Generated("Replace Field Test Generator")
644
  public void testExtendedExtendedFormDataSdkCommandCreateUseNone() throws Exception {
645
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateUseNone");
646
    assertTrue(TypeUtility.exists(type));
647
    assertEquals("ExtendedFormData.SdkCommandCreateUse", type.getSuperclassName());
648
    assertValidationRules(type);
649
  }
650
651
  @Test
652
  @Generated("Replace Field Test Generator")
653
  public void testExtendedExtendedFormDataSdkCommandCreateUseCreate() throws Exception {
654
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateUseCreate");
655
    assertTrue(TypeUtility.exists(type));
656
    assertEquals("ExtendedFormData.SdkCommandCreateUse", type.getSuperclassName());
657
    assertValidationRules(type);
658
  }
659
660
  @Test
661
  @Generated("Replace Field Test Generator")
662
  public void testExtendedExtendedFormDataSdkCommandCreateUseUse() throws Exception {
663
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateUseUse");
664
    assertTrue(TypeUtility.exists(type));
665
    assertEquals("ExtendedFormData.SdkCommandCreateUse", type.getSuperclassName());
666
    assertValidationRules(type);
667
  }
668
669
  @Test
670
  @Generated("Replace Field Test Generator")
671
  public void testExtendedExtendedFormDataSdkCommandCreateUseIgnore() throws Exception {
672
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateUseIgnore");
673
    assertTrue(TypeUtility.exists(type));
674
    assertEquals("ExtendedFormData.SdkCommandCreateUse", type.getSuperclassName());
675
    assertValidationRules(type);
676
  }
677
678
  @Test
679
  @Generated("Replace Field Test Generator")
680
  public void testExtendedExtendedFormDataSdkCommandCreateIgnoreNone() throws Exception {
681
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateIgnoreNone");
682
    assertTrue(TypeUtility.exists(type));
683
    assertEquals("ExtendedFormData.SdkCommandCreateIgnore", type.getSuperclassName());
684
    assertValidationRules(type);
685
  }
686
687
  @Test
688
  @Generated("Replace Field Test Generator")
689
  public void testExtendedExtendedFormDataSdkCommandCreateIgnoreCreate() throws Exception {
690
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateIgnoreCreate");
691
    assertTrue(TypeUtility.exists(type));
692
    assertEquals("ExtendedFormData.SdkCommandCreateIgnore", type.getSuperclassName());
693
    assertValidationRules(type);
694
  }
695
696
  @Test
697
  @Generated("Replace Field Test Generator")
698
  public void testExtendedExtendedFormDataSdkCommandCreateIgnoreUse() throws Exception {
699
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateIgnoreUse");
700
    assertTrue(TypeUtility.exists(type));
701
    assertEquals("ExtendedFormData.SdkCommandCreateIgnore", type.getSuperclassName());
702
    assertValidationRules(type);
703
  }
704
705
  @Test
706
  @Generated("Replace Field Test Generator")
707
  public void testExtendedExtendedFormDataSdkCommandCreateIgnoreIgnore() throws Exception {
708
    IType type = s_extendedExtendedFormData.getType("SdkCommandCreateIgnoreIgnore");
709
    assertTrue(TypeUtility.exists(type));
710
    assertEquals("ExtendedFormData.SdkCommandCreateIgnore", type.getSuperclassName());
711
    assertValidationRules(type);
712
  }
713
714
  @Test
715
  @Generated("Replace Field Test Generator")
716
  public void testExtendedExtendedFormDataSdkCommandUseNoneNone() throws Exception {
717
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseNoneNone");
718
    assertTrue(TypeUtility.exists(type));
719
    assertEquals("ExtendedFormData.SdkCommandUseNone", type.getSuperclassName());
720
    assertValidationRules(type);
721
  }
722
723
  @Test
724
  @Generated("Replace Field Test Generator")
725
  public void testExtendedExtendedFormDataSdkCommandUseNoneCreate() throws Exception {
726
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseNoneCreate");
727
    assertTrue(TypeUtility.exists(type));
728
    assertEquals("ExtendedFormData.SdkCommandUseNone", type.getSuperclassName());
729
    assertValidationRules(type);
730
  }
731
732
  @Test
733
  @Generated("Replace Field Test Generator")
734
  public void testExtendedExtendedFormDataSdkCommandUseNoneUse() throws Exception {
735
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseNoneUse");
736
    assertTrue(TypeUtility.exists(type));
737
    assertEquals("ExtendedFormData.SdkCommandUseNone", type.getSuperclassName());
738
    assertValidationRules(type);
739
  }
740
741
  @Test
742
  @Generated("Replace Field Test Generator")
743
  public void testExtendedExtendedFormDataSdkCommandUseNoneIgnore() throws Exception {
744
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseNoneIgnore");
745
    assertTrue(TypeUtility.exists(type));
746
    assertEquals("ExtendedFormData.SdkCommandUseNone", type.getSuperclassName());
747
    assertValidationRules(type);
748
  }
749
750
  @Test
751
  @Generated("Replace Field Test Generator")
752
  public void testExtendedExtendedFormDataSdkCommandUseCreateNone() throws Exception {
753
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseCreateNone");
754
    assertTrue(TypeUtility.exists(type));
755
    assertEquals("ExtendedFormData.SdkCommandUseCreate", type.getSuperclassName());
756
    assertValidationRules(type);
757
  }
758
759
  @Test
760
  @Generated("Replace Field Test Generator")
761
  public void testExtendedExtendedFormDataSdkCommandUseCreateCreate() throws Exception {
762
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseCreateCreate");
763
    assertTrue(TypeUtility.exists(type));
764
    assertEquals("ExtendedFormData.SdkCommandUseCreate", type.getSuperclassName());
765
    assertValidationRules(type);
766
  }
767
768
  @Test
769
  @Generated("Replace Field Test Generator")
770
  public void testExtendedExtendedFormDataSdkCommandUseCreateUse() throws Exception {
771
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseCreateUse");
772
    assertTrue(TypeUtility.exists(type));
773
    assertEquals("ExtendedFormData.SdkCommandUseCreate", type.getSuperclassName());
774
    assertValidationRules(type);
775
  }
776
777
  @Test
778
  @Generated("Replace Field Test Generator")
779
  public void testExtendedExtendedFormDataSdkCommandUseCreateIgnore() throws Exception {
780
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseCreateIgnore");
781
    assertTrue(TypeUtility.exists(type));
782
    assertEquals("ExtendedFormData.SdkCommandUseCreate", type.getSuperclassName());
783
    assertValidationRules(type);
784
  }
785
786
  @Test
787
  @Generated("Replace Field Test Generator")
788
  public void testExtendedExtendedFormDataSdkCommandUseUseNone() throws Exception {
789
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseUseNone");
790
    assertTrue(TypeUtility.exists(type));
791
    assertEquals("ExtendedFormData.SdkCommandUseUse", type.getSuperclassName());
792
    assertValidationRules(type);
793
  }
794
795
  @Test
796
  @Generated("Replace Field Test Generator")
797
  public void testExtendedExtendedFormDataSdkCommandUseUseCreate() throws Exception {
798
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseUseCreate");
799
    assertTrue(TypeUtility.exists(type));
800
    assertEquals("ExtendedFormData.SdkCommandUseUse", type.getSuperclassName());
801
    assertValidationRules(type);
802
  }
803
804
  @Test
805
  @Generated("Replace Field Test Generator")
806
  public void testExtendedExtendedFormDataSdkCommandUseUseUse() throws Exception {
807
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseUseUse");
808
    assertTrue(TypeUtility.exists(type));
809
    assertEquals("ExtendedFormData.SdkCommandUseUse", type.getSuperclassName());
810
    assertValidationRules(type);
811
  }
812
813
  @Test
814
  @Generated("Replace Field Test Generator")
815
  public void testExtendedExtendedFormDataSdkCommandUseUseIgnore() throws Exception {
816
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseUseIgnore");
817
    assertTrue(TypeUtility.exists(type));
818
    assertEquals("ExtendedFormData.SdkCommandUseUse", type.getSuperclassName());
819
    assertValidationRules(type);
820
  }
821
822
  @Test
823
  @Generated("Replace Field Test Generator")
824
  public void testExtendedExtendedFormDataSdkCommandUseIgnoreNone() throws Exception {
825
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseIgnoreNone");
826
    assertTrue(TypeUtility.exists(type));
827
    assertEquals("ExtendedFormData.SdkCommandUseIgnore", type.getSuperclassName());
828
    assertValidationRules(type);
829
  }
830
831
  @Test
832
  @Generated("Replace Field Test Generator")
833
  public void testExtendedExtendedFormDataSdkCommandUseIgnoreCreate() throws Exception {
834
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseIgnoreCreate");
835
    assertTrue(TypeUtility.exists(type));
836
    assertEquals("ExtendedFormData.SdkCommandUseIgnore", type.getSuperclassName());
837
    assertValidationRules(type);
838
  }
839
840
  @Test
841
  @Generated("Replace Field Test Generator")
842
  public void testExtendedExtendedFormDataSdkCommandUseIgnoreUse() throws Exception {
843
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseIgnoreUse");
844
    assertTrue(TypeUtility.exists(type));
845
    assertEquals("ExtendedFormData.SdkCommandUseIgnore", type.getSuperclassName());
846
    assertValidationRules(type);
847
  }
848
849
  @Test
850
  @Generated("Replace Field Test Generator")
851
  public void testExtendedExtendedFormDataSdkCommandUseIgnoreIgnore() throws Exception {
852
    IType type = s_extendedExtendedFormData.getType("SdkCommandUseIgnoreIgnore");
853
    assertTrue(TypeUtility.exists(type));
854
    assertEquals("ExtendedFormData.SdkCommandUseIgnore", type.getSuperclassName());
855
    assertValidationRules(type);
856
  }
857
858
  @Test
859
  @Generated("Replace Field Test Generator")
860
  public void testExtendedExtendedFormDataSdkCommandIgnoreNoneNone() throws Exception {
861
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreNoneNone");
862
    assertFalse(TypeUtility.exists(type));
863
  }
864
865
  @Test
866
  @Generated("Replace Field Test Generator")
867
  public void testExtendedExtendedFormDataSdkCommandIgnoreNoneCreate() throws Exception {
868
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreNoneCreate");
869
    assertTrue(TypeUtility.exists(type));
870
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
871
    assertValidationRules(type,
872
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
873
  }
874
875
  @Test
876
  @Generated("Replace Field Test Generator")
877
  public void testExtendedExtendedFormDataSdkCommandIgnoreNoneUse() throws Exception {
878
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreNoneUse");
879
    assertTrue(TypeUtility.exists(type));
880
    assertEquals("UsingFormFieldData", type.getSuperclassName());
881
    assertValidationRules(type,
882
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
883
  }
884
885
  @Test
886
  @Generated("Replace Field Test Generator")
887
  public void testExtendedExtendedFormDataSdkCommandIgnoreNoneIgnore() throws Exception {
888
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreNoneIgnore");
889
    assertFalse(TypeUtility.exists(type));
890
  }
891
892
  @Test
893
  @Generated("Replace Field Test Generator")
894
  public void testExtendedExtendedFormDataSdkCommandIgnoreCreateNone() throws Exception {
895
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreCreateNone");
896
    assertTrue(TypeUtility.exists(type));
897
    assertEquals("ExtendedFormData.SdkCommandIgnoreCreate", type.getSuperclassName());
898
    assertValidationRules(type);
899
  }
900
901
  @Test
902
  @Generated("Replace Field Test Generator")
903
  public void testExtendedExtendedFormDataSdkCommandIgnoreCreateCreate() throws Exception {
904
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreCreateCreate");
905
    assertTrue(TypeUtility.exists(type));
906
    assertEquals("ExtendedFormData.SdkCommandIgnoreCreate", type.getSuperclassName());
907
    assertValidationRules(type);
908
  }
909
910
  @Test
911
  @Generated("Replace Field Test Generator")
912
  public void testExtendedExtendedFormDataSdkCommandIgnoreCreateUse() throws Exception {
913
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreCreateUse");
914
    assertTrue(TypeUtility.exists(type));
915
    assertEquals("ExtendedFormData.SdkCommandIgnoreCreate", type.getSuperclassName());
916
    assertValidationRules(type);
917
  }
918
919
  @Test
920
  @Generated("Replace Field Test Generator")
921
  public void testExtendedExtendedFormDataSdkCommandIgnoreCreateIgnore() throws Exception {
922
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreCreateIgnore");
923
    assertTrue(TypeUtility.exists(type));
924
    assertEquals("ExtendedFormData.SdkCommandIgnoreCreate", type.getSuperclassName());
925
    assertValidationRules(type);
926
  }
927
928
  @Test
929
  @Generated("Replace Field Test Generator")
930
  public void testExtendedExtendedFormDataSdkCommandIgnoreUseNone() throws Exception {
931
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreUseNone");
932
    assertTrue(TypeUtility.exists(type));
933
    assertEquals("ExtendedFormData.SdkCommandIgnoreUse", type.getSuperclassName());
934
    assertValidationRules(type);
935
  }
936
937
  @Test
938
  @Generated("Replace Field Test Generator")
939
  public void testExtendedExtendedFormDataSdkCommandIgnoreUseCreate() throws Exception {
940
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreUseCreate");
941
    assertTrue(TypeUtility.exists(type));
942
    assertEquals("ExtendedFormData.SdkCommandIgnoreUse", type.getSuperclassName());
943
    assertValidationRules(type);
944
  }
945
946
  @Test
947
  @Generated("Replace Field Test Generator")
948
  public void testExtendedExtendedFormDataSdkCommandIgnoreUseUse() throws Exception {
949
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreUseUse");
950
    assertTrue(TypeUtility.exists(type));
951
    assertEquals("ExtendedFormData.SdkCommandIgnoreUse", type.getSuperclassName());
952
    assertValidationRules(type);
953
  }
954
955
  @Test
956
  @Generated("Replace Field Test Generator")
957
  public void testExtendedExtendedFormDataSdkCommandIgnoreUseIgnore() throws Exception {
958
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreUseIgnore");
959
    assertTrue(TypeUtility.exists(type));
960
    assertEquals("ExtendedFormData.SdkCommandIgnoreUse", type.getSuperclassName());
961
    assertValidationRules(type);
962
  }
963
964
  @Test
965
  @Generated("Replace Field Test Generator")
966
  public void testExtendedExtendedFormDataSdkCommandIgnoreIgnoreNone() throws Exception {
967
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreIgnoreNone");
968
    assertFalse(TypeUtility.exists(type));
969
  }
970
971
  @Test
972
  @Generated("Replace Field Test Generator")
973
  public void testExtendedExtendedFormDataSdkCommandIgnoreIgnoreCreate() throws Exception {
974
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreIgnoreCreate");
975
    assertTrue(TypeUtility.exists(type));
976
    assertEquals("AbstractValueFieldData<String>", type.getSuperclassName());
977
    assertValidationRules(type,
978
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
979
  }
980
981
  @Test
982
  @Generated("Replace Field Test Generator")
983
  public void testExtendedExtendedFormDataSdkCommandIgnoreIgnoreUse() throws Exception {
984
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreIgnoreUse");
985
    assertTrue(TypeUtility.exists(type));
986
    assertEquals("UsingFormFieldData", type.getSuperclassName());
987
    assertValidationRules(type,
988
        "ruleMap.put(ValidationRule.MAX_LENGTH, 4000);");
989
  }
990
991
  @Test
992
  @Generated("Replace Field Test Generator")
993
  public void testExtendedExtendedFormDataSdkCommandIgnoreIgnoreIgnore() throws Exception {
994
    IType type = s_extendedExtendedFormData.getType("SdkCommandIgnoreIgnoreIgnore");
995
    assertFalse(TypeUtility.exists(type));
996
  }
997
998
}
(-)src/org/eclipse/scout/rt/shared/data/form/fields/AbstractFormFieldData.java (-6 / +39 lines)
Lines 15-20 Link Here
15
import java.util.Map;
15
import java.util.Map;
16
16
17
import org.eclipse.scout.commons.ConfigurationUtility;
17
import org.eclipse.scout.commons.ConfigurationUtility;
18
import org.eclipse.scout.commons.annotations.Replace;
18
import org.eclipse.scout.commons.logger.IScoutLogger;
19
import org.eclipse.scout.commons.logger.IScoutLogger;
19
import org.eclipse.scout.commons.logger.ScoutLogManager;
20
import org.eclipse.scout.commons.logger.ScoutLogManager;
20
import org.eclipse.scout.rt.shared.data.form.FormDataUtility;
21
import org.eclipse.scout.rt.shared.data.form.FormDataUtility;
Lines 24-29 Link Here
24
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormFieldData.class);
25
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormFieldData.class);
25
  private static final long serialVersionUID = 1L;
26
  private static final long serialVersionUID = 1L;
26
27
28
  private Map<Class<?>, Class<? extends AbstractFormFieldData>> m_fieldDataReplacements;
27
  private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
29
  private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
28
  private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
30
  private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
29
  private boolean m_valueSet;
31
  private boolean m_valueSet;
Lines 39-45 Link Here
39
41
40
  private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
42
  private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
41
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
43
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
42
    return ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
44
    Class<AbstractFormFieldData>[] fca = ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
45
    return ConfigurationUtility.removeReplacedClasses(fca);
43
  }
46
  }
44
47
45
  protected void initConfig() {
48
  protected void initConfig() {
Lines 71-76 Link Here
71
    }// end for
74
    }// end for
72
    if (map.size() > 0) {
75
    if (map.size() > 0) {
73
      m_fieldMap = map;
76
      m_fieldMap = map;
77
      Map<Class<?>, Class<? extends AbstractFormFieldData>> replacements = ConfigurationUtility.getReplacementMapping(fieldArray);
78
      if (!replacements.isEmpty()) {
79
        m_fieldDataReplacements = replacements;
80
      }
74
    }
81
    }
75
  }
82
  }
76
83
Lines 84-90 Link Here
84
  }
91
  }
85
92
86
  public String getFieldId() {
93
  public String getFieldId() {
87
    String s = getClass().getName();
94
    Class<?> c = getClass();
95
    while (c.isAnnotationPresent(Replace.class)) {
96
      c = c.getSuperclass();
97
    }
98
    String s = c.getName();
88
    int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
99
    int i = Math.max(s.lastIndexOf('$'), s.lastIndexOf('.'));
89
    s = s.substring(i + 1);
100
    s = s.substring(i + 1);
90
    return s;
101
    return s;
Lines 126-135 Link Here
126
  }
137
  }
127
138
128
  public AbstractFormFieldData getFieldById(String id) {
139
  public AbstractFormFieldData getFieldById(String id) {
129
    String fieldDataId = FormDataUtility.getFieldDataId(id);
130
    if (m_fieldMap == null) {
140
    if (m_fieldMap == null) {
131
      return null;
141
      return null;
132
    }
142
    }
143
    String fieldDataId = FormDataUtility.getFieldDataId(id);
133
    for (AbstractFormFieldData f : m_fieldMap.values()) {
144
    for (AbstractFormFieldData f : m_fieldMap.values()) {
134
      if (f.getFieldId().equals(fieldDataId)) {
145
      if (f.getFieldId().equals(fieldDataId)) {
135
        return f;
146
        return f;
Lines 143-163 Link Here
143
    if (m_fieldMap == null) {
154
    if (m_fieldMap == null) {
144
      return null;
155
      return null;
145
    }
156
    }
146
    return (T) m_fieldMap.get(c);
157
    Class<? extends T> clazz = getReplacingFieldDataClass(c);
158
    return (T) m_fieldMap.get(clazz);
147
  }
159
  }
148
160
149
  public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
161
  public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
162
    Class<? extends T> clazz = getReplacingFieldDataClass(c);
150
    if (v == null) {
163
    if (v == null) {
151
      if (m_fieldMap != null) {
164
      if (m_fieldMap != null) {
152
        m_fieldMap.remove(c);
165
        m_fieldMap.remove(clazz);
153
      }
166
      }
154
    }
167
    }
155
    else {
168
    else {
156
      if (m_fieldMap == null) {
169
      if (m_fieldMap == null) {
157
        m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
170
        m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
158
      }
171
      }
159
      m_fieldMap.put(c, v);
172
      m_fieldMap.put(clazz, v);
173
    }
174
  }
175
176
  /**
177
   * Checks whether the form field data with the given class has been replaced by another field. If so, the replacing
178
   * form field data's class is returned. Otherwise the given class itself.
179
   * 
180
   * @param c
181
   * @return Returns the possibly available replacing field data class for the given class.
182
   * @see Replace
183
   * @since 3.8.2
184
   */
185
  private <T> Class<? extends T> getReplacingFieldDataClass(Class<T> c) {
186
    if (m_fieldDataReplacements != null) {
187
      @SuppressWarnings("unchecked")
188
      Class<? extends T> replacingFieldClass = (Class<? extends T>) m_fieldDataReplacements.get(c);
189
      if (replacingFieldClass != null) {
190
        return replacingFieldClass;
191
      }
160
    }
192
    }
193
    return c;
161
  }
194
  }
162
195
163
  public AbstractFormFieldData[] getFields() {
196
  public AbstractFormFieldData[] getFields() {
(-)src/org/eclipse/scout/rt/shared/data/form/AbstractFormData.java (-4 / +33 lines)
Lines 19-24 Link Here
19
import org.eclipse.scout.commons.ClassIdentifier;
19
import org.eclipse.scout.commons.ClassIdentifier;
20
import org.eclipse.scout.commons.CloneUtility;
20
import org.eclipse.scout.commons.CloneUtility;
21
import org.eclipse.scout.commons.ConfigurationUtility;
21
import org.eclipse.scout.commons.ConfigurationUtility;
22
import org.eclipse.scout.commons.annotations.Replace;
22
import org.eclipse.scout.commons.exception.ProcessingException;
23
import org.eclipse.scout.commons.exception.ProcessingException;
23
import org.eclipse.scout.commons.logger.IScoutLogger;
24
import org.eclipse.scout.commons.logger.IScoutLogger;
24
import org.eclipse.scout.commons.logger.ScoutLogManager;
25
import org.eclipse.scout.commons.logger.ScoutLogManager;
Lines 29-34 Link Here
29
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormData.class);
30
  private static final IScoutLogger LOG = ScoutLogManager.getLogger(AbstractFormData.class);
30
  private static final long serialVersionUID = 1L;
31
  private static final long serialVersionUID = 1L;
31
32
33
  private Map<Class<?>, Class<? extends AbstractFormFieldData>> m_fieldDataReplacements;
32
  private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
34
  private Map<Class<? extends AbstractPropertyData>, AbstractPropertyData> m_propertyMap;
33
  private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
35
  private Map<Class<? extends AbstractFormFieldData>, AbstractFormFieldData> m_fieldMap;
34
36
Lines 43-49 Link Here
43
45
44
  private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
46
  private Class<? extends AbstractFormFieldData>[] getConfiguredFieldDatas() {
45
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
47
    Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
46
    return ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
48
    Class<AbstractFormFieldData>[] fca = ConfigurationUtility.filterClasses(dca, AbstractFormFieldData.class);
49
    return ConfigurationUtility.removeReplacedClasses(fca);
47
  }
50
  }
48
51
49
  protected void initConfig() {
52
  protected void initConfig() {
Lines 63-68 Link Here
63
     // add fields
66
     // add fields
64
    m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
67
    m_fieldMap = new HashMap<Class<? extends AbstractFormFieldData>, AbstractFormFieldData>();
65
    Class<? extends AbstractFormFieldData>[] fieldArray = getConfiguredFieldDatas();
68
    Class<? extends AbstractFormFieldData>[] fieldArray = getConfiguredFieldDatas();
69
    Map<Class<?>, Class<? extends AbstractFormFieldData>> replacements = ConfigurationUtility.getReplacementMapping(fieldArray);
70
    if (!replacements.isEmpty()) {
71
      m_fieldDataReplacements = replacements;
72
    }
66
    for (int i = 0; i < fieldArray.length; i++) {
73
    for (int i = 0; i < fieldArray.length; i++) {
67
      AbstractFormFieldData f;
74
      AbstractFormFieldData f;
68
      try {
75
      try {
Lines 114-129 Link Here
114
121
115
  @SuppressWarnings("unchecked")
122
  @SuppressWarnings("unchecked")
116
  public <T extends AbstractFormFieldData> T getFieldByClass(Class<T> c) {
123
  public <T extends AbstractFormFieldData> T getFieldByClass(Class<T> c) {
117
    return (T) m_fieldMap.get(c);
124
    Class<? extends T> clazz = getReplacingFieldDataClass(c);
125
    return (T) m_fieldMap.get(clazz);
118
  }
126
  }
119
127
120
  public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
128
  public <T extends AbstractFormFieldData> void setFieldByClass(Class<T> c, T v) {
129
    Class<? extends T> clazz = getReplacingFieldDataClass(c);
121
    if (v == null) {
130
    if (v == null) {
122
      m_fieldMap.remove(c);
131
      m_fieldMap.remove(clazz);
123
    }
132
    }
124
    else {
133
    else {
125
      m_fieldMap.put(c, v);
134
      m_fieldMap.put(clazz, v);
135
    }
136
  }
137
138
  /**
139
   * Checks whether the form field data with the given class has been replaced by another field. If so, the replacing
140
   * form field data's class is returned. Otherwise the given class itself.
141
   * 
142
   * @param c
143
   * @return Returns the possibly available replacing field data class for the given class.
144
   * @see Replace
145
   * @since 3.8.2
146
   */
147
  private <T extends AbstractFormFieldData> Class<? extends T> getReplacingFieldDataClass(Class<T> c) {
148
    if (m_fieldDataReplacements != null) {
149
      @SuppressWarnings("unchecked")
150
      Class<T> replacingFieldDataClass = (Class<T>) m_fieldDataReplacements.get(c);
151
      if (replacingFieldDataClass != null) {
152
        return replacingFieldDataClass;
153
      }
126
    }
154
    }
155
    return c;
127
  }
156
  }
128
157
129
  /**
158
  /**

Return to bug 399380