1 16 package com.blandware.atleap.model.core; 17 18 import java.util.ArrayList ; 19 import java.util.List ; 20 21 42 public class Layout extends Localizable { 43 44 46 49 protected String definition; 50 53 protected String name; 54 57 protected String cpDefinition; 58 61 protected List contentPages = new ArrayList (); 62 63 65 75 public String getDefinition() { 76 return definition; 77 } 78 79 84 public void setDefinition(String definition) { 85 this.definition = definition; 86 } 87 88 89 97 public String getCpDefinition() { 98 return cpDefinition; 99 } 100 101 106 public void setCpDefinition(String cpDefinition) { 107 this.cpDefinition = cpDefinition; 108 } 109 110 111 123 public String getName() { 124 return name; 125 } 126 127 132 public void setName(String name) { 133 this.name = name; 134 } 135 136 145 public List getContentPages() { 146 return contentPages; 147 } 148 149 154 public void setContentPages(List contentPages) { 155 this.contentPages = contentPages; 156 } 157 158 163 public void addContentPage(ContentPage contentPage) { 164 contentPage.setLayout(this); 165 contentPages.add(contentPage); 166 } 167 168 174 public ContentPage updateContentPage(ContentPage contentPage) { 175 ContentPage oldContentPage = null; 176 if ( !contentPage.getLayout().equals(this) ) { 177 int index = contentPage.getLayout().contentPages.indexOf(contentPage); 178 if (index != -1) 179 oldContentPage = (ContentPage)contentPage.getLayout().contentPages.remove(index); 180 contentPages.add(contentPage); 181 contentPage.setLayout(this); 182 } 183 return oldContentPage; 184 } 185 186 191 public void removeContentPage(ContentPage contentPage) { 192 contentPages.remove(contentPage); 193 } 194 195 public boolean equals(Object o) { 196 if ( this == o ) { 197 return true; 198 } 199 if ( !(o instanceof Layout) ) { 200 return false; 201 } 202 203 final Layout layout = (Layout) o; 204 205 if ( definition != null ? !definition.equals(layout.definition) : layout.definition != null ) { 206 return false; 207 } 208 209 return true; 210 } 211 212 public int hashCode() { 213 return (definition != null ? definition.hashCode() : 0); 214 } 215 216 } 217 | Popular Tags |