1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.portal;
18
19 /***
20 * Trivial implementation of PortletSetConstraints
21 *
22 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
23 * @version $Id: BasePortletSetConstraints.java,v 1.3 2004/02/23 04:05:35 jford Exp $
24 */
25 public class BasePortletSetConstraints extends java.util.HashMap
26 implements PortletSet.Constraints
27 {
28 /*** Get the column the portlet should be displayed in
29 *
30 * @return a positive column number or null
31 */
32 public Integer getColumn()
33 {
34 Object column = get("column");
35 if (column instanceof String)
36 {
37 try
38 {
39 column = new Integer(Integer.parseInt((String)column));
40 put("column", column);
41 }
42 catch (Exception e)
43 {
44 remove("column");
45 column=null;
46 }
47 }
48 return (Integer)column;
49 }
50
51 /*** Set the column the portlet should be displayed in. This
52 * integer must be positive
53 *
54 * @param col the column position
55 */
56 public void setColumn(Integer col) throws IllegalArgumentException
57 {
58 if (col.intValue() < 0)
59 {
60 throw new IllegalArgumentException("Column coordinate must be positive");
61 }
62
63 put("column",col);
64 }
65
66 /*** Get the row the portlet should be displayed in
67 *
68 * @return a positive row number or null
69 */
70 public Integer getRow()
71 {
72 Object row = get("row");
73 if (row instanceof String)
74 {
75 try
76 {
77 row = new Integer(Integer.parseInt((String)row));
78 put("row", row);
79 }
80 catch (Exception e)
81 {
82 remove("row");
83 row = null;
84 }
85 }
86 return (Integer)row;
87 }
88
89 /*** Set the row the portlet should be displayed in. This
90 * integer must be positive
91 *
92 * @param row the column position
93 */
94 public void setRow(Integer row) throws IllegalArgumentException
95 {
96 if (row.intValue() < 0)
97 {
98 throw new IllegalArgumentException("Row coordinate must be positive");
99 }
100
101 put("row",row);
102 }
103 }