001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
003: */
004: package org.terracotta.dso.views;
005:
006: import com.terracottatech.config.Include;
007: import com.terracottatech.config.OnLoad;
008:
009: public class IncludeWrapper {
010: private InstrumentedClassesWrapper m_parent;
011: private int m_index;
012:
013: IncludeWrapper(InstrumentedClassesWrapper parent, int index) {
014: m_parent = parent;
015: m_index = index;
016: }
017:
018: int getIndex() {
019: return m_index;
020: }
021:
022: void remove() {
023: m_parent.removeInclude(m_index);
024: }
025:
026: InstrumentedClassesWrapper getParent() {
027: return m_parent;
028: }
029:
030: Include getInclude() {
031: return m_parent.getIncludeArray(m_index);
032: }
033:
034: void setClassExpression(String classExpression) {
035: getInclude().setClassExpression(classExpression);
036: }
037:
038: String getClassExpression() {
039: return getInclude().getClassExpression();
040: }
041:
042: void setHonorTransient(boolean honor) {
043: Include include = getInclude();
044:
045: if (honor) {
046: include.setHonorTransient(honor);
047: } else {
048: if (include.isSetHonorTransient()) {
049: include.unsetHonorTransient();
050: }
051: }
052: }
053:
054: boolean getHonorTransient() {
055: return getInclude().getHonorTransient();
056: }
057:
058: boolean isSetOnLoad() {
059: return getInclude().isSetOnLoad();
060: }
061:
062: void unsetOnLoad() {
063: Include include = getInclude();
064: if (include.isSetOnLoad()) {
065: include.unsetOnLoad();
066: }
067: }
068:
069: OnLoad ensureOnLoad() {
070: Include include = getInclude();
071: OnLoad onload = include.getOnLoad();
072: return onload != null ? onload : include.addNewOnLoad();
073: }
074:
075: boolean isSetOnLoadExecute() {
076: OnLoad onload = getInclude().getOnLoad();
077: return onload != null && onload.isSetExecute();
078: }
079:
080: void setOnLoadExecute(String code) {
081: OnLoad onload = ensureOnLoad();
082: onload.setExecute(code);
083: if (onload.isSetMethod()) {
084: onload.unsetMethod();
085: }
086: }
087:
088: boolean isSetOnLoadMethod() {
089: OnLoad onload = getInclude().getOnLoad();
090: return onload != null && onload.isSetMethod();
091: }
092:
093: void setOnLoadMethod(String method) {
094: OnLoad onload = ensureOnLoad();
095: onload.setMethod(method);
096: if (onload.isSetExecute()) {
097: onload.unsetExecute();
098: }
099: }
100:
101: public String toString() {
102: return getClassExpression();
103: }
104: }
|