01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.views;
05:
06: import com.terracottatech.config.DsoApplication;
07: import com.terracottatech.config.TransientFields;
08:
09: public class TransientFieldsWrapper {
10: private DsoApplication fApp;
11: private TransientFieldWrapper[] children;
12:
13: TransientFieldsWrapper(DsoApplication dsoApp) {
14: fApp = dsoApp;
15: }
16:
17: TransientFieldWrapper[] createTransientFieldWrappers() {
18: int count = sizeOfFieldNameArray();
19: children = new TransientFieldWrapper[count];
20:
21: for (int i = 0; i < count; i++) {
22: children[i] = new TransientFieldWrapper(this , i);
23: }
24:
25: return children;
26: }
27:
28: TransientFieldWrapper[] getChildren() {
29: return children;
30: }
31:
32: TransientFieldWrapper getChildAt(int index) {
33: return children != null ? children[index] : null;
34: }
35:
36: int sizeOfFieldNameArray() {
37: TransientFields transientFields = fApp.getTransientFields();
38: return transientFields != null ? transientFields
39: .sizeOfFieldNameArray() : 0;
40: }
41:
42: String getFieldNameArray(int i) {
43: TransientFields transientFields = fApp.getTransientFields();
44: return transientFields != null ? transientFields
45: .getFieldNameArray(i) : null;
46: }
47:
48: void removeFieldName(int i) {
49: TransientFields transientFields = fApp.getTransientFields();
50: if (transientFields != null) {
51: transientFields.removeFieldName(i);
52: }
53: if (sizeOfFieldNameArray() == 0) {
54: fApp.unsetTransientFields();
55: }
56: }
57: }
|