View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.jetspeed.om.page;
19  
20  import java.util.List;
21  import java.util.Map;
22  
23  /***
24   * <p>A <code>Fragment</code> is the basic element handled by the aggregation
25   * engine to compose the final portal page. It represents a reserved screen
26   * area whose layout is managed by a specified component.</p>
27   * <p>The component that is responsible for the layout policy of the fragment
28   * is defined by two properties:<p>
29   * <ul>
30   *   <li><b>type</b>: defines the general class of layout component, enabling
31   *       the engine to retrieve its exact defintion from its component
32   *       repository.
33   *   </li>
34   *   <li><b>name</b>: this is the exact name of the component. This name must
35   *       be unique within a portal instance for a specific component type.
36   *   </li>
37   * </ul>
38   * <p>In addition to specifying the component responsible for the layout,
39   * the fragment also stores contextual information used for rendering:</p>
40   * <p>Finally the fragment also holds layout and rendering properties that
41   *   may be used by a parent fragment to layout all its inner fragments in
42   *   an appropriate fashion.</p>
43   *
44   * @version $Id: Fragment.java 516448 2007-03-09 16:25:47Z ate $
45   */
46  public interface Fragment extends BaseElement, java.io.Serializable
47  {
48      /***
49       * A fragment of type PORTLET is considered to be a compliant portlet
50       * in the sense of the JSR 168.
51       */
52       public String PORTLET = "portlet";
53  
54      /***
55       * A fragment of type LAYOUT is a specific JSR 168 compliant portlet
56       * that knows how to layout a Page and depends on the Jetspeed
57       * layout service.
58       */
59       public String LAYOUT = "layout";
60  
61      /***
62       * row standard layout property name
63       */
64       public String ROW_PROPERTY_NAME = "row";
65  
66      /***
67       * column standard layout property name
68       */
69       public String COLUMN_PROPERTY_NAME = "column";
70  
71      /***
72       * sizes standard layout property name
73       */
74       public String SIZES_PROPERTY_NAME = "sizes";
75  
76      /***
77       * x coordinate standard layout property name
78       */
79       public String X_PROPERTY_NAME = "x";
80  
81      /***
82       * y coordinate standard layout property name
83       */
84       public String Y_PROPERTY_NAME = "y";
85  
86      /***
87       * z coordinate standard layout property name
88       */
89       public String Z_PROPERTY_NAME = "z";
90  
91      /***
92       * width standard layout property name
93       */
94       public String WIDTH_PROPERTY_NAME = "width";
95  
96      /***
97       * height standard layout property name
98       */
99       public String HEIGHT_PROPERTY_NAME = "height";
100 
101     /***
102      * Returns the administrative name of this fragment. This name should map
103      * to a component name in the component repository defined by the type
104      * attribute.
105      * If the name is not mapped to any component, the fragment is discarded
106      * from the rendering process, as well as any inner fragment.
107      *
108      * @return the administrative name
109      */
110     public String getName();
111 
112     /***
113      * Binds an administrative name to this fragment
114      *
115      * @param name the administrative name
116      */
117     public void setName(String name);
118 
119     /***
120      * Returns the type of the class bound to this fragment
121      */
122     public String getType();
123 
124     /***
125      * Binds a type to this fragment
126      *
127      * @param type the type
128      */
129     public void setType(String type);
130 
131     /***
132      * Returns the name of the skin associated to this fragment
133      */
134     public String getSkin();
135 
136     /***
137      * Defines the skin for this fragment. This skin should be
138      * known by the portal.
139      *
140      * @param skinName the name of the new skin applied to this fragment
141      */
142     public void setSkin(String skinName);
143 
144     /***
145      * Returns the name of the decorator bound to this fragment
146      */
147     public String getDecorator();
148 
149     /***
150      * Defines the decorator for this fragment. This decorator should be
151      * known by the portal.
152      *
153      * @param decoratorName the name of the decorator applied to this fragment
154      */
155     public void setDecorator(String decoratorName);
156 
157     /***
158      * Returns the display state of this fragment. The state may have the
159      * following values: "Normal","Minimized","Maximized","Hidden"
160      */
161     public String getState();
162 
163     /***
164      * Sets the display state of this fragment.
165      * Valid states are: "Normal","Minimized","Maximized","Hidden"
166      *
167      * @param state the new fragment state
168      */
169     public void setState(String state);
170 
171     /***
172      * Returns the display mode of this fragment. The mode may have the
173      * following values: "View","Edit","Help","Config","Print","Custom"
174      */
175     public String getMode();
176 
177     /***
178      * Sets the display mode of this fragment.
179      * Valid modes are: "View","Edit","Help","Config","Print","Custom"
180      *
181      * @param mode the new fragment mode
182      */
183     public void setMode(String mode);
184 
185     /***
186      * Returns all fragments used in this node. This may be
187      * a page fragment or even directly a portlet fragment
188      *
189      * @return a collection containing Fragment objects
190      */
191     public List getFragments();
192 
193     /***
194      * getProperty
195      *
196      * Get named property value.
197      *
198      * @param propName property name
199      * @return value
200      */
201     public String getProperty(String propName);
202     
203     /***
204      * getIntProperty
205      * 
206      * Get named property value as integer.
207      *
208      * @param propName property name
209      * @return int value
210      */
211     public int getIntProperty(String propName);
212     
213     /***
214      * getFloatProperty
215      * 
216      * Get named property value as float.
217      *
218      * @param propName property name
219      * @return float value
220      */
221     public float getFloatProperty(String propName);
222     
223     /***
224      * getProperties
225      * 
226      * Get writable Map of properties by name.
227      *
228      * @return properties map
229      */
230     public Map getProperties();
231 
232     /***
233      * get layout row property
234      *
235      * @return row layout property
236      **/
237     public int getLayoutRow();
238 
239     /***
240      * set the layout row property
241      *
242      * @param row
243      */
244     public void setLayoutRow(int row);
245 
246     /***
247      * get layout column property
248      *
249      * @return column layout property
250      **/
251     public int getLayoutColumn();
252 
253     /***
254      * set the layout column property
255      * 
256      * @param column
257      */
258     public void setLayoutColumn(int column);
259     
260     /***
261      * get layout sizes property, (i.e. "25%,75%")
262      * 
263      * @return sizes layout property
264      **/
265     public String getLayoutSizes();
266     
267     /***
268      * set the layout sizes
269      * 
270      * @param sizes
271      */
272     public void setLayoutSizes(String sizes);
273     
274     /***
275      * get layout x coordinate property
276      *
277      * @return the x coordinate value
278      **/
279     public float getLayoutX();
280 
281     /***
282      * set the layout x coordinate property
283      *
284      * @param x the coordinate value
285      */
286     public void setLayoutX(float x);
287 
288     /***
289      * get layout y coordinate property
290      *
291      * @return the y coordinate value
292      **/
293     public float getLayoutY();
294 
295     /***
296      * set the layout y coordinate property
297      *
298      * @param y the coordinate value
299      */
300     public void setLayoutY(float y);
301 
302     /***
303      * get layout z coordinate property
304      *
305      * @return the z coordinate value
306      **/
307     public float getLayoutZ();
308 
309     /***
310      * set the layout z coordinate property
311      *
312      * @param z the coordinate value
313      */
314     public void setLayoutZ(float z);
315 
316     /***
317      * get layout width property
318      *
319      * @return the width value
320      **/
321     public float getLayoutWidth();
322 
323     /***
324      * set the layout width property
325      *
326      * @param width the value
327      */
328     public void setLayoutWidth(float width);
329 
330     /***
331      * get layout height property
332      *
333      * @return the height value
334      **/
335     public float getLayoutHeight();
336 
337     /***
338      * set the layout height property
339      *
340      * @param height the value
341      */
342     public void setLayoutHeight(float height);
343 
344     /***
345      * Test if this fragment is actually a reference to an external fragment.
346      *
347      * @return true is this element is a reference
348      */
349     public boolean isReference();
350 
351     /***
352      * Get collection of fragment preference objects used
353      * to initialize user preferences
354      * 
355      * @return list of FragmentPreference objects
356      */
357     public List getPreferences();    
358 
359     /***
360      * Set collection of fragment preference objects
361      * 
362      * @param preferences list of FragmentPreference objects
363      */
364     public void setPreferences(List preferences);    
365 }