KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > generator > ContentCall


1 package de.webman.generator;
2
3 /**
4     * Zuordnung Content - Dokument
5     * @author $Author: alex $
6     * @version $Revision: 1.2 $
7 */

8 public class ContentCall
9 {
10
11     /**
12         Verweis zurück auf den aktuellen statischen Kontext des laufenden Threads
13     */

14     private GeneratorContext context;
15
16     /** Content */
17     private SiteContent content;
18
19     /** Aufrufendes Dokument */
20     private SiteDocument doc;
21
22     /** Zeiger auf Präsentations-Komponente */
23     private SiteContentIntegration integration;
24     
25     /** Content-Node am dem der Content hängt */
26     private SiteContentNode node;
27         
28     /** Primary Content Id, falls der Content ein GruppenContent ist */
29     private int primId;
30     
31     /** call per Reference ? */
32     private boolean perReference;
33     
34     /** Struktur-Contents ? */
35     private boolean isStructureContents;
36     
37     /** Primary-Contents ? */
38     private boolean isPrimaryContents;
39     
40     public ContentCall (GeneratorContext context,
41                 SiteContent content,
42                 SiteDocument doc,
43                 SiteContentIntegration integration,
44                 SiteContentNode node,
45                 int primId,
46                 boolean isPrim,
47                 boolean isRef,
48                 boolean isStructure)
49     {
50
51         this.context = context != null ? context : GeneratorContext.setup ();
52         this.content = content;
53         this.doc = doc;
54         this.integration = integration;
55         this.node = node;
56         this.primId = primId;
57         this.perReference = isRef;
58         this.isPrimaryContents = isPrim;
59         this.isStructureContents = isStructure;
60     }
61     
62     public boolean isPrimaryContent()
63     {
64         return isPrimaryContents;
65     }
66     
67     public void setPrimaryContent(boolean isPrimary)
68     {
69         isPrimaryContents = isPrimary;
70     }
71     
72     public SiteContent getContent()
73     {
74         return content;
75     }
76     
77     public boolean isPerReference()
78     {
79         return perReference;
80     }
81     
82     public void setPerReference(boolean isRef)
83     {
84         perReference = isRef;
85     }
86     
87     public boolean isStructureContent()
88     {
89         return isStructureContents;
90     }
91
92     public void setStructureContent(boolean isStructure)
93     {
94         isStructureContents = isStructure;
95     }
96     
97     public int getPrimaryId()
98     {
99         return primId;
100     }
101     
102     public SiteDocument getDocument()
103     {
104         return doc;
105     }
106     
107     public String JavaDoc getInfo ()
108     {
109         String JavaDoc info = isPrimaryContents ? "primary" : isStructureContents ? "struct" : "normal";
110         if (perReference) return info + " / ref"; else return info;
111     }
112     
113     public String JavaDoc docName ()
114     {
115         SiteNode node = doc.getAnchor();
116         if (node == null) return doc.getShortName();
117         if ((primId < 0) || (node.getParent() == null)) return node.getPath() + doc.getShortName();
118         String JavaDoc nodeName = content.getShortName() != null ? content.getShortName() : "id_" + primId;
119         return node.getParent().getPath() + nodeName + "/" + doc.getShortName();
120     }
121 }
122
Popular Tags