1 9 package org.jboss.portal.server.theme; 10 11 18 public final class RegionOrientation 19 { 20 23 public static final RegionOrientation VERTICAL = new RegionOrientation("vertical"); 24 25 28 public static final RegionOrientation HORIZONTAL = new RegionOrientation("horizontal"); 29 30 private final String m_orient; 31 32 private RegionOrientation() 33 { 34 this("vertical"); 35 } 36 37 private RegionOrientation(String orient) 38 { 39 m_orient = orient; 40 } 41 42 public String toString() 43 { 44 return m_orient; 45 } 46 47 public boolean equals(Object o) 48 { 49 if (this == o) 50 { 51 return true; 52 } 53 if (!(o instanceof RegionOrientation)) 54 { 55 return false; 56 } 57 58 final RegionOrientation orientation = (RegionOrientation)o; 59 60 if (m_orient != null ? !m_orient.equals(orientation.m_orient) : orientation.m_orient != null) 61 { 62 return false; 63 } 64 65 return true; 66 } 67 68 public int hashCode() 69 { 70 return (m_orient != null ? m_orient.hashCode() : 0); 71 } 72 73 80 public static RegionOrientation parseOrientation(String orientation) 81 { 82 if (orientation != null) 83 { 84 if (orientation.equalsIgnoreCase(VERTICAL.toString())) 85 { 86 return VERTICAL; 87 } 88 if (orientation.equalsIgnoreCase(HORIZONTAL.toString())) 89 { 90 return HORIZONTAL; 91 } 92 } 93 94 throw new IllegalArgumentException ("invalid orientation: " + orientation); 95 } 96 } 97 | Popular Tags |