001    /**
002     * Copyright 2005-2012 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     */
016    package org.kuali.rice.krad.uif.widget;
017    
018    /**
019     * Growls sets up settings for growls global to the current view and its pages
020     * Some basic options of the plugin are exposed through this class, however additional options
021     * can be passed through setComponentOptions as usual.
022     * However, the header and theme option is set by the growl processing in PageGroup
023     * automatically.
024     * See the jquery jGrowl plugin for more details.
025     *
026     * @author Kuali Rice Team (rice.collab@kuali.org)
027     */
028    public class Growls extends WidgetBase {
029        private static final long serialVersionUID = -8701090110933484411L;
030    
031        private boolean sticky;
032        private int timeShown;
033        private String position;
034    
035        /**
036         * If true, the growl will stick to the page until the user dismisses it
037         *
038         * @return the sticky
039         */
040        public boolean isSticky() {
041            return this.sticky;
042        }
043    
044        /**
045         * @param sticky the sticky to set
046         */
047        public void setSticky(boolean sticky) {
048            this.sticky = sticky;
049            this.getComponentOptions().put("sticky", Boolean.toString(sticky));
050        }
051    
052        /**
053         * The time growls are shown in milliseconds
054         *
055         * @return the timeShown
056         */
057        public int getTimeShown() {
058            return this.timeShown;
059        }
060    
061        /**
062         * @param timeShown the timeShown to set
063         */
064        public void setTimeShown(int timeShown) {
065            this.timeShown = timeShown;
066            this.getComponentOptions().put("life", Integer.toString(timeShown));
067        }
068    
069        /**
070         * The position for the growls to appear in the window
071         * There are five options available: top-left, top-right, bottom-left, bottom-right, center.
072         *
073         * @return the position
074         */
075        public String getPosition() {
076            return this.position;
077        }
078    
079        /**
080         * @param position the position to set
081         */
082        public void setPosition(String position) {
083            this.position = position;
084            this.getComponentOptions().put("position", position);
085        }
086    }