1 16 package org.apache.pluto.portlet.admin.bean; 17 18 import org.apache.pluto.portlet.admin.BaseAdminObject; 19 20 28 public class PortletTO extends BaseAdminObject implements Comparable { 29 private static final String CLASS_NAME = "PortletTO"; 30 private String _name = ""; 31 private String _value = null; 33 private int _row = 1; 35 private int _col = 1; 36 37 40 public PortletTO(){ 41 super(CLASS_NAME); 42 } 43 44 52 public PortletTO(String name, String value, int row, int col) { 53 super(CLASS_NAME); 54 _name = name; 55 _value = value; 56 _row = row; 57 _col = col; 58 } 59 60 61 64 public int getCol() { 65 return _col; 66 } 67 70 public void setCol(int col) { 71 _col = col; 72 } 73 76 public String getName() { 77 return _name; 78 } 79 82 public void setName(String name) { 83 _name = name; 84 } 85 88 public int getRow() { 89 return _row; 90 } 91 94 public void setRow(int row) { 95 _row = row; 96 } 97 100 public String getValue() { 101 return _value; 102 } 103 106 public void setValue(String value) { 107 _value = value; 108 } 109 110 111 public String toString() { 112 StringBuffer sb = new StringBuffer (); 113 sb.append("portlet["); 114 sb.append(_name); 115 sb.append("="); 116 sb.append(_value); 117 sb.append(" ; row: "); 118 sb.append(_row); 119 sb.append(" col: "); 120 sb.append(_col); 121 sb.append("] "); 122 return sb.toString(); 123 } 124 130 public int compareTo(Object p_portlet) { 131 int retVal = 0; 132 PortletTO portlet = (PortletTO)p_portlet; 133 int p_row = portlet.getRow(); 134 if (_row > p_row) { 135 retVal = 1; 136 } else if (_row < p_row){ 137 retVal = -1; 138 } else { 139 int p_col = portlet.getCol(); 140 if (_col > p_col) { 141 retVal = 1; 142 } else if (_col < p_col) { 143 retVal = -1; 144 } 145 } 146 return retVal; 147 } 148 } 149 | Popular Tags |