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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.portal;
1819/***20 * Trivial implementation of PortletSetConstraints21 *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 */25publicclassBasePortletSetConstraintsextends java.util.HashMap
26 implements PortletSet.Constraints
27 {
28/*** Get the column the portlet should be displayed in29 *30 * @return a positive column number or null31 */32public Integer getColumn()
33 {
34 Object column = get("column");
35if (column instanceof String)
36 {
37try38 {
39 column = new Integer(Integer.parseInt((String)column));
40 put("column", column);
41 }
42catch (Exception e)
43 {
44 remove("column");
45 column=null;
46 }
47 }
48return (Integer)column;
49 }
5051/*** Set the column the portlet should be displayed in. This52 * integer must be positive53 *54 * @param col the column position55 */56publicvoid setColumn(Integer col) throws IllegalArgumentException
57 {
58if (col.intValue() < 0)
59 {
60thrownew IllegalArgumentException("Column coordinate must be positive");
61 }
6263 put("column",col);
64 }
6566/*** Get the row the portlet should be displayed in67 *68 * @return a positive row number or null69 */70public Integer getRow()
71 {
72 Object row = get("row");
73if (row instanceof String)
74 {
75try76 {
77 row = new Integer(Integer.parseInt((String)row));
78 put("row", row);
79 }
80catch (Exception e)
81 {
82 remove("row");
83 row = null;
84 }
85 }
86return (Integer)row;
87 }
8889/*** Set the row the portlet should be displayed in. This90 * integer must be positive91 *92 * @param row the column position93 */94publicvoid setRow(Integer row) throws IllegalArgumentException
95 {
96if (row.intValue() < 0)
97 {
98thrownew IllegalArgumentException("Row coordinate must be positive");
99 }
100101 put("row",row);
102 }
103 }