View Javadoc

1   package org.catacomb.druid.gui.edit;
2   
3   import org.catacomb.interlish.structure.TargetStore;
4   import org.catacomb.interlish.structure.TargetStoreUser;
5   import org.catacomb.interlish.structure.Viewer;
6   import org.catacomb.report.E;
7   
8   
9   
10  public class Effect implements Viewer, TargetStoreUser {
11  
12      String targetID;
13  
14      Object target;
15  
16      TargetStore targetStore;
17  
18  
19      public Effect() {
20          this(null);
21      }
22  
23  
24      public Effect(String s) {
25          targetID = s;
26      }
27  
28  
29      public void setTargetStore(TargetStore ts) {
30          targetStore = ts;
31      }
32  
33  
34      public String getTargetID() {
35          return targetID;
36      }
37  
38      public void apply(boolean b) {
39          E.override();
40      }
41  
42      public void apply(String s) {
43          E.override();
44      }
45  
46  
47      public Object getTarget() {
48          if (targetID == null || targetID.equals("null")) {
49  
50          } else {
51              if (target == null) {
52                  if (targetStore == null) {
53                      E.error("no target store in effect " + this);
54                  } else {
55                      if (targetID.indexOf(",") > 0) {
56                          String[] sa = targetID.split(",");
57                          Object[] ret = new Object[sa.length];
58                          int iret = 0;
59                          for (String s : sa) {
60                              ret[iret++] = targetStore.get(s.trim());
61                          }
62                          target = ret;
63  
64  
65                      } else {
66                          target = targetStore.get(targetID);
67                      }
68                  }
69  
70              }
71          }
72          return target;
73      }
74  
75  
76  
77  }