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.view.View;
020import org.kuali.rice.krad.uif.widget.LightBox;
021
022/**
023 * Field that encloses a link element
024 * 
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027public class LinkField extends FieldBase {
028        private static final long serialVersionUID = -1908504471910271148L;
029
030        private String linkLabel;
031        private String target;
032        private String hrefText;
033        private LightBox lightBox;
034
035        public LinkField() {
036      super();
037        }
038
039        /**
040         * The following initialization is performed:
041     *
042         * <ul>
043         * <li>Set the linkLabel if blank to the Field label</li>
044         * </ul>
045         *
046         * @see org.kuali.rice.krad.uif.component.ComponentBase#performInitialization(org.kuali.rice.krad.uif.view.View, java.lang.Object)
047         */
048        @Override
049        public void performInitialization(View view, Object model) {
050                super.performInitialization(view, model);
051
052                if (StringUtils.isBlank(linkLabel)) {
053                        linkLabel = this.getLabel();
054                }
055        }
056
057        public String getLinkLabel() {
058                return this.linkLabel;
059        }
060
061        public void setLinkLabel(String linkLabel) {
062                this.linkLabel = linkLabel;
063        }
064
065        public String getTarget() {
066                return this.target;
067        }
068
069        public void setTarget(String target) {
070                this.target = target;
071        }
072
073        public String getHrefText() {
074                return this.hrefText;
075        }
076
077        public void setHrefText(String hrefText) {
078                this.hrefText = hrefText;
079        }
080
081        /**
082         * @param lightBox the lightBox to set
083         */
084        public void setLightBox(LightBox lightBox) {
085                this.lightBox = lightBox;
086        }
087
088        /**
089         * @return the lightBox
090         */
091        public LightBox getLightBox() {
092                return lightBox;
093        }
094        
095    /**
096     * @see org.kuali.rice.krad.uif.component.ScriptEventSupport#getSupportsOnClick()
097     */
098    public boolean getSupportsOnClick() {
099        return true;
100    }   
101
102}