001/**
002 * Copyright 2005-2018 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.element;
017
018import org.kuali.rice.krad.datadictionary.parse.BeanTag;
019import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
020import org.kuali.rice.krad.datadictionary.validator.ErrorReport;
021import org.kuali.rice.krad.datadictionary.validator.Validator;
022import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
023
024import java.util.ArrayList;
025
026/**
027 * Content element that encloses an iframe
028 *
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031@BeanTag(name = "iFrame", parent = "Uif-Iframe")
032public class Iframe extends ContentElementBase {
033    private static final long serialVersionUID = 5797473302619055088L;
034
035    private String source;
036    private String height;
037    private String frameborder;
038
039    public Iframe() {
040        super();
041    }
042
043    /**
044     * The IFrame's source
045     *
046     * @return source
047     */
048    @BeanTagAttribute
049    public String getSource() {
050        return this.source;
051    }
052
053    /**
054     * Setter for the IFrame's source
055     *
056     * @param source
057     */
058    public void setSource(String source) {
059        this.source = source;
060    }
061
062    /**
063     * The IFrame's height
064     *
065     * @return height
066     */
067    @BeanTagAttribute
068    public String getHeight() {
069        return this.height;
070    }
071
072    /**
073     * Setter for the IFrame's height
074     *
075     * @param height
076     */
077    public void setHeight(String height) {
078        this.height = height;
079    }
080
081    /**
082     * The IFrame's frame border
083     *
084     * @return frameborder
085     */
086    @BeanTagAttribute
087    public String getFrameborder() {
088        return this.frameborder;
089    }
090
091    /**
092     * Setter for the IFrame's frame border
093     *
094     * @param frameborder
095     */
096    public void setFrameborder(String frameborder) {
097        this.frameborder = frameborder;
098    }
099
100    /**
101     * {@inheritDoc}
102     */
103    @Override
104    public void completeValidation(ValidationTrace tracer) {
105        tracer.addBean(this);
106
107        // Checks that a source is set
108        if (getSource() == null) {
109            if (!Validator.checkExpressions(this, "source")) {
110                String currentValues[] = {"source =" + getSource()};
111                tracer.createError("Source must be set", currentValues);
112            }
113        }
114
115        super.completeValidation(tracer.getCopy());
116    }
117}