View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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 at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * 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 and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.uif.field;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.krad.uif.component.Component;
20  import org.kuali.rice.krad.uif.view.View;
21  
22  /**
23   * Field that encloses an image element
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public class ImageField extends FieldBase {
28      private static final long serialVersionUID = -7994212503770623408L;
29  
30      private String source;
31      private String altText;
32      private String height;
33      private String width;
34  
35      private boolean captionHeaderAboveImage;
36  
37      private String captionHeaderText;
38      private HeaderField captionHeader;
39  
40      private String cutlineText;
41      private MessageField cutline;
42  
43      public ImageField() {
44          super();
45      }
46  
47      public void performFinalize(View view, Object model, Component parent) {
48          super.performFinalize(view, model, parent);
49  
50          if (StringUtils.isNotBlank(captionHeaderText)) {
51              captionHeader.setHeaderText(captionHeaderText);
52          }
53  
54          if (StringUtils.isNotBlank(cutlineText)) {
55              cutline.setMessageText(cutlineText);
56          }
57      }
58  
59      public String getSource() {
60          return this.source;
61      }
62  
63      public void setSource(String source) {
64          this.source = source;
65      }
66  
67      public String getAltText() {
68          return this.altText;
69      }
70  
71      public void setAltText(String altText) {
72          this.altText = altText;
73      }
74  
75      public String getHeight() {
76          return this.height;
77      }
78  
79      public void setHeight(String height) {
80          this.height = height;
81      }
82  
83      public void setWidth(String width) {
84          this.width = width;
85      }
86  
87      public String getWidth() {
88          return width;
89      }
90  
91      public String getCaptionHeaderText() {
92          return captionHeaderText;
93      }
94  
95      public void setCaptionHeaderText(String captionHeaderText) {
96          this.captionHeaderText = captionHeaderText;
97      }
98  
99      public HeaderField getCaptionHeader() {
100         return captionHeader;
101     }
102 
103     public void setCaptionHeader(HeaderField captionHeader) {
104         this.captionHeader = captionHeader;
105     }
106 
107     public String getCutlineText() {
108         return cutlineText;
109     }
110 
111     public void setCutlineText(String cutlineText) {
112         this.cutlineText = cutlineText;
113     }
114 
115     public MessageField getCutline() {
116         return cutline;
117     }
118 
119     /**
120      * A cutline is the text describing the image in detail (this is also often confusingly called a caption).
121      */
122     public void setCutline(MessageField cutline) {
123         this.cutline = cutline;
124     }
125 
126     public boolean isCaptionHeaderAboveImage() {
127         return captionHeaderAboveImage;
128     }
129 
130     public void setCaptionHeaderAboveImage(boolean captionHeaderAboveImage) {
131         this.captionHeaderAboveImage = captionHeaderAboveImage;
132     }
133 }