KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > views > IncludeWrapper


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso.views;
5
6 import com.terracottatech.config.Include;
7 import com.terracottatech.config.OnLoad;
8
9 public class IncludeWrapper {
10   private InstrumentedClassesWrapper m_parent;
11   private int m_index;
12   
13   IncludeWrapper(InstrumentedClassesWrapper parent, int index) {
14     m_parent = parent;
15     m_index = index;
16   }
17   
18   void remove() {
19     m_parent.removeInclude(m_index);
20   }
21   
22   InstrumentedClassesWrapper getParent() {
23     return m_parent;
24   }
25   
26   Include getInclude() {
27     return m_parent.getIncludeArray(m_index);
28   }
29   
30   void setClassExpression(String JavaDoc classExpression) {
31     getInclude().setClassExpression(classExpression);
32   }
33   
34   String JavaDoc getClassExpression() {
35     return getInclude().getClassExpression();
36   }
37   
38   void setHonorTransient(boolean honor) {
39     Include include = getInclude();
40
41     if(honor) {
42       include.setHonorTransient(honor);
43     } else {
44       if(include.isSetHonorTransient()) {
45         include.unsetHonorTransient();
46       }
47     }
48   }
49   
50    boolean getHonorTransient() {
51      return getInclude().getHonorTransient();
52    }
53    
54   boolean isSetOnLoad() {
55     return getInclude().isSetOnLoad();
56   }
57   
58   void unsetOnLoad() {
59     Include include = getInclude();
60     if(include.isSetOnLoad()) {
61       include.unsetOnLoad();
62     }
63   }
64   
65   OnLoad ensureOnLoad() {
66     Include include = getInclude();
67     OnLoad onload = include.getOnLoad();
68     return onload != null ? onload : include.addNewOnLoad();
69   }
70   
71   boolean isSetOnLoadExecute() {
72     OnLoad onload = getInclude().getOnLoad();
73     return onload != null && onload.isSetExecute();
74   }
75   
76   void setOnLoadExecute(String JavaDoc code) {
77     OnLoad onload = ensureOnLoad();
78     onload.setExecute(code);
79     if(onload.isSetMethod()) {
80       onload.unsetMethod();
81     }
82   }
83
84   boolean isSetOnLoadMethod() {
85     OnLoad onload = getInclude().getOnLoad();
86     return onload != null && onload.isSetMethod();
87   }
88   
89   void setOnLoadMethod(String JavaDoc method) {
90     OnLoad onload = ensureOnLoad();
91     onload.setMethod(method);
92     if(onload.isSetExecute()) {
93       onload.unsetExecute();
94     }
95   }
96
97   public String JavaDoc toString() {
98     return getClassExpression();
99   }
100 }
101
Popular Tags