001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.uif.field;
017
018import org.apache.commons.lang.StringUtils;
019import org.kuali.rice.krad.uif.component.Component;
020import org.kuali.rice.krad.uif.view.View;
021
022/**
023 * Field that encloses an image element
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027public class ImageField extends FieldBase {
028    private static final long serialVersionUID = -7994212503770623408L;
029
030    private String source;
031    private String altText;
032    private String height;
033    private String width;
034
035    private boolean captionHeaderAboveImage;
036
037    private String captionHeaderText;
038    private HeaderField captionHeader;
039
040    private String cutlineText;
041    private MessageField cutline;
042
043    public ImageField() {
044        super();
045    }
046
047    public void performFinalize(View view, Object model, Component parent) {
048        super.performFinalize(view, model, parent);
049
050        if (StringUtils.isNotBlank(captionHeaderText)) {
051            captionHeader.setHeaderText(captionHeaderText);
052        }
053
054        if (StringUtils.isNotBlank(cutlineText)) {
055            cutline.setMessageText(cutlineText);
056        }
057    }
058
059    public String getSource() {
060        return this.source;
061    }
062
063    public void setSource(String source) {
064        this.source = source;
065    }
066
067    public String getAltText() {
068        return this.altText;
069    }
070
071    public void setAltText(String altText) {
072        this.altText = altText;
073    }
074
075    public String getHeight() {
076        return this.height;
077    }
078
079    public void setHeight(String height) {
080        this.height = height;
081    }
082
083    public void setWidth(String width) {
084        this.width = width;
085    }
086
087    public String getWidth() {
088        return width;
089    }
090
091    public String getCaptionHeaderText() {
092        return captionHeaderText;
093    }
094
095    public void setCaptionHeaderText(String captionHeaderText) {
096        this.captionHeaderText = captionHeaderText;
097    }
098
099    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}