KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > layout > PortletBean


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//--------------------------
13
// PortletBean
14
//--------------------------
15
// Jérôme Bédat 15.12.2000
16
//--------------------------
17

18 package org.jahia.layout;
19
20 /**
21  * This class defines the bean that contains all the variables for a portlet.
22  * @author Jerome Bedat
23  */

24 public class PortletBean
25 {
26     public static final int NO_CONTAINER_ID = -1;
27
28     private int PortletID = 0;
29     private int PortletSourceID = 0;
30
31     private int PortletW = 0;
32     private int PortletH = 0;
33     private int PortletColumn = 0;
34     private int PortletRow = 0;
35
36     private int containerID = NO_CONTAINER_ID ; // this is used to store the container ID if
37
// this bean was loaded from a container.
38
// This allows for some optimization in
39
// management of objects.
40

41     private boolean modified = false; // set to true as soon as values are
42
// set in the bean...
43

44
45     /**
46      * Real constructor, sets ALL member variables without exception. This
47      * contructor is used by all the constructors below.
48      */

49     public PortletBean( int PortletID, int PortletSourceID, int PortletW, int PortletH,
50                         int PortletColumn, int PortletRow, int containerID)
51     {
52         this.PortletID = PortletID;
53         this.PortletSourceID = PortletSourceID;
54         this.PortletW = PortletW;
55         this.PortletH = PortletH;
56         this.PortletColumn = PortletColumn;
57         this.PortletRow = PortletRow;
58
59         this.containerID = containerID;
60     }
61
62     /**
63      * PortletBean All Params except container ID
64      *
65      * @author Jérôme Bédat
66      *
67      */

68     public PortletBean( int PortletID, int PortletSourceID, int PortletW, int PortletH,
69                         int PortletColumn, int PortletRow)
70     {
71         this(PortletID, PortletSourceID, PortletW,
72              PortletH, PortletColumn, PortletRow, NO_CONTAINER_ID);
73
74     } // end Constructor
75

76     /**
77      * This is a tool constructor. All parameters are strings and automatic
78      * conversion is done here. Version with container ID
79      *
80      * @author Serge Huber
81      *
82      */

83     public PortletBean( String JavaDoc PortletID, String JavaDoc PortletSourceID, String JavaDoc PortletW, String JavaDoc PortletH,
84                         String JavaDoc PortletColumn, String JavaDoc PortletRow, int containerID)
85     {
86         this( Integer.parseInt(PortletID),
87                 Integer.parseInt(PortletSourceID),
88                 Integer.parseInt(PortletW),
89                 Integer.parseInt(PortletH),
90                 Integer.parseInt(PortletColumn),
91                 Integer.parseInt(PortletRow),
92                 containerID
93             );
94
95     } // end Constructor
96

97     /**
98      * This is a tool constructor. All parameters are strings and automatic
99      * conversion is done here. Version without container ID
100      *
101      * @author Serge Huber
102      *
103      */

104     public PortletBean( String JavaDoc PortletID, String JavaDoc PortletSourceID, String JavaDoc PortletW, String JavaDoc PortletH,
105                         String JavaDoc PortletColumn, String JavaDoc PortletRow)
106     {
107         this( Integer.parseInt(PortletID),
108                 Integer.parseInt(PortletSourceID),
109                 Integer.parseInt(PortletW),
110                 Integer.parseInt(PortletH),
111                 Integer.parseInt(PortletColumn),
112                 Integer.parseInt(PortletRow),
113                 NO_CONTAINER_ID
114             );
115     } // end Constructor
116

117     /**
118      * PortletBean HTML Params
119      *
120      * @author Jérôme Bédat
121      *
122      */

123     public PortletBean( int PortletID, int PortletSourceID,
124                         int PortletColumn, int PortletRow)
125     {
126         this(PortletID, PortletSourceID, 0, 0,
127              PortletColumn, PortletRow, NO_CONTAINER_ID);
128
129     } // end Constructor
130

131     /**
132      * This constructor is used by the event listener, in order to create new PortletBeans
133      * that have never been stored before. This is a first time object until it will be
134      * stored in persistant storage later.
135      * @author Serge Huber.
136      */

137     public PortletBean(int portletSourceID) {
138
139         this(portletSourceID, portletSourceID,
140              0, 0,
141              0, 0, NO_CONTAINER_ID);
142     }
143
144
145     public int getPortletID() { return PortletID; }
146     public int getPortletSourceID() { return PortletSourceID; }
147     public int getPortletW() { return PortletW; }
148     public int getPortletH() { return PortletH; }
149     public int getPortletColumn() { return PortletColumn; }
150     public int getPortletRow() { return PortletRow; }
151
152     public void setPortletW (int w) { this.PortletW = w; modified = true; }
153     public void setPortletH (int h) { this.PortletH = h; modified = true; }
154     public void setPortletColumn (int column) { this.PortletColumn = column; modified = true;}
155     public void setPortletRow (int row) { this.PortletRow = row; modified = true;}
156
157     public int getContainerID() { return containerID; }
158     public boolean isModified() { return modified; }
159
160 }
161
Popular Tags