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.DistributedMethods;
07: import com.terracottatech.config.DsoApplication;
08:
09: public class DistributedMethodsWrapper {
10: private DsoApplication fApp;
11: private DistributedMethodWrapper[] children;
12:
13: DistributedMethodsWrapper(DsoApplication dsoApp) {
14: fApp = dsoApp;
15: }
16:
17: DistributedMethodWrapper[] createDistributedMethodWrappers() {
18: int count = sizeOfMethodExpressionArray();
19:
20: children = new DistributedMethodWrapper[count];
21: for (int i = 0; i < count; i++) {
22: children[i] = new DistributedMethodWrapper(this , i);
23: }
24:
25: return children;
26: }
27:
28: DistributedMethodWrapper[] getChildren() {
29: return children;
30: }
31:
32: DistributedMethodWrapper getChildAt(int index) {
33: return children != null ? children[index] : null;
34: }
35:
36: int sizeOfMethodExpressionArray() {
37: DistributedMethods distributedMethods = fApp
38: .getDistributedMethods();
39: return distributedMethods != null ? distributedMethods
40: .sizeOfMethodExpressionArray() : 0;
41: }
42:
43: String getMethodExpressionArray(int i) {
44: DistributedMethods distributedMethods = fApp
45: .getDistributedMethods();
46: return distributedMethods != null ? distributedMethods
47: .getMethodExpressionArray(i).getStringValue() : null;
48: }
49:
50: void removeMethodExpression(int i) {
51: DistributedMethods distributedMethods = fApp
52: .getDistributedMethods();
53: if (distributedMethods != null) {
54: distributedMethods.removeMethodExpression(i);
55: }
56: if (sizeOfMethodExpressionArray() == 0) {
57: fApp.unsetDistributedMethods();
58: }
59: }
60: }
|