KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * All content copyright (c) 2003-2007 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.DsoApplication;
7 import com.terracottatech.config.Root;
8 import com.terracottatech.config.Roots;
9
10 public class RootsWrapper {
11   private DsoApplication fApp;
12   
13   RootsWrapper(DsoApplication app) {
14     fApp = app;
15   }
16   
17   int sizeOfRootArray() {
18     Roots roots = fApp.getRoots();
19     return roots != null ? roots.sizeOfRootArray() : 0;
20   }
21   
22   Root getRootArray(int i) {
23     Roots roots = fApp.getRoots();
24     if(roots != null) {
25       return roots.getRootArray(i);
26     }
27     return null;
28   }
29   
30   void removeRoot(int i) {
31     Roots roots = fApp.getRoots();
32     if(roots != null) {
33       roots.removeRoot(i);
34     }
35     if(sizeOfRootArray() == 0) {
36       fApp.unsetRoots();
37     }
38   }
39 }
40
Popular Tags