View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.portal;
18  
19  //standard java stuff
20  import java.util.Map;
21  import java.util.Enumeration;
22  
23  /***
24   * The PortletSet is basically a wrapper around an array of portlets. It provides
25   * runtime context for a set of portlets.
26   * A portlet can get its current set by calling via its PortletConfig
27   * 
28   * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
29   * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
30   * @version $Id: PortletSet.java,v 1.26 2004/02/23 04:05:35 jford Exp $
31   */
32  public interface PortletSet extends Portlet
33  {
34      /***
35       * Return the current controller for this set
36       */
37      public PortletController getController();
38  
39      /***
40       * Set the controller for this set
41       */
42      public void setController(PortletController controller);
43  
44      /***
45       * Returns the number of portlets currently stored in this set
46       */
47      public int size();
48  
49      /***
50       * Returns the portlet set as an array.
51       */
52      public Portlet[] toArray();
53  
54      /***
55       * Returns the Portlet at position pos
56       */
57      public Portlet getPortletAt(int pos);
58  
59      /***
60       * Returns the Portlet with the given id
61       */
62      public Portlet getPortletByID(String id);
63  
64      /***
65      Returns the Portlet with the given name
66      */
67      public Portlet getPortletByName(String name);
68  
69      /***
70       * Returns the portlet set as an Enumeration
71       */
72      public Enumeration getPortlets();
73  
74      /***
75       * Add a portlet to this set.It updates its config to modify the current set
76       */
77      public void addPortlet(Portlet portlet);
78  
79      /***
80       * Add a portlet to this set.It updates its config to modify the current set
81       */
82      public void addPortlet(Portlet portlet, int position);
83  
84      /***
85       * Add a portlet to this set.It updates its config to modify the current set
86       */
87      public void addPortlet(Portlet portlet, Constraints constraints);
88  
89      /***
90       * Add a portlet to this set.It updates its config to modify the current set
91       */
92      public void addPortlet(Portlet portlet, Constraints constraints, int position);
93  
94      /***
95       * The PortletSetConstraints is used to associate layout constraints with a 
96       * Portlet within a Set. These constraints may be used by the PortletController
97       * to render the layout of any given PortletSet correctly.
98       */
99      public interface Constraints extends Map
100     {   
101         /*** Get the column the portlet should be displayed in
102          *
103          * @return a positive column number or null
104          */
105         public Integer getColumn();
106         
107         /*** Set the column the portlet should be displayed in. This
108          *  integer must be positive
109          *
110          * @param col the column position
111          */
112         public void setColumn(Integer col) throws IllegalArgumentException;
113         
114         /*** Get the row the portlet should be displayed in
115          *
116          * @return a positive row number or null
117          */
118         public Integer getRow();
119         
120         /*** Set the row the portlet should be displayed in. This
121          *  integer must be positive
122          *
123          * @param row the column position
124          */
125         public void setRow(Integer row) throws IllegalArgumentException;
126     }
127 }