001    /*
002     * This file is part of the Echo Point Project.  This project is a
003     * collection of Components that have extended the Echo Web Application
004     * Framework Version 3.
005     *
006     * Version: MPL 1.1
007     *
008     * The contents of this file are subject to the Mozilla Public License Version
009     * 1.1 (the "License"); you may not use this file except in compliance with
010     * the License. You may obtain a copy of the License at
011     * http://www.mozilla.org/MPL/
012     *
013     * Software distributed under the License is distributed on an "AS IS" basis,
014     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015     * for the specific language governing rights and limitations under the
016     * License.
017     */
018    
019    package echopoint.jquery;
020    
021    import nextapp.echo.app.*;
022    import echopoint.able.Sizeable;
023    import echopoint.able.Alignable;
024    
025    /**
026     * The <code>Clock</code> class is a <code>Component</code>
027     * that presents the current time.
028     * It is based on the jQuery plugin jClock
029     *
030     * @author Hans Holmlund - 2009-03-23
031     * @version $Id: Clock.java 168 2009-04-29 11:30:52Z hansho $
032     */
033    public class Clock extends Component implements Sizeable, Alignable {
034    
035        public static final String PROPERTY_INSETS = "insets";
036        public static final String PROPERTY_BORDER = "border";
037    
038        /**
039         * Returns the <code>Border</code> that encloses the entire <code>Clock</code>.
040         *
041         * @return the border
042         */
043        public Border getBorder() {
044            return (Border) get(PROPERTY_BORDER);
045        }
046    
047        /**
048         * Returns the default inset between the border and cells of the
049         * <code>Clock</code>. This value will be overridden for a child
050         * component if a setting is specified in its <code>ColumnLayoutData</code>.
051         *
052         * @return the inset
053         */
054        public Insets getInsets() {
055            return (Insets) get(PROPERTY_INSETS);
056        }
057    
058             /**
059         * Sets the <code>Border</code> that encloses the entire <code>Clock</code>.
060         *
061         * @param newValue the new border
062         */
063        public void setBorder(Border newValue) {
064            set(PROPERTY_BORDER, newValue);
065        }
066    
067        /**
068         * Sets the inset between the border and cells of the <code>Clock</code>.
069         * This value will be overridden for a child component if a setting is
070         * specified in its <code>ColumnLayoutData</code>.
071         *
072         * @param newValue the new inset
073         */
074        public void setInsets(Insets newValue) {
075            set(PROPERTY_INSETS, newValue);
076        }
077    
078        /**
079         * Sets the width extent of the Clock component.
080         *
081         * @param newValue - the new width extent of the Clock component
082         */
083        public void setWidth(Extent newValue) {
084            set(PROPERTY_WIDTH,newValue);
085        }
086    
087        /**
088         * Returns the width extent of the Clock component.
089         * @return the width extent of the Clock component.
090         */
091        public Extent getWidth() {
092            return (Extent) get(PROPERTY_WIDTH);
093        }
094    
095        /**
096         * Sets the height extent of the Clock component.
097         *
098         * @param newValue - the new height extent of the Clock component
099         */
100        public void setHeight(Extent newValue) {
101            set(PROPERTY_HEIGHT,newValue);
102        }
103    
104        /**
105         * Returns the height extent of Clock component.
106         *
107         * @return the height extent of Clock component.
108         */
109        public Extent getHeight() {
110            return (Extent) get(PROPERTY_HEIGHT);
111        }
112    
113            /**
114         * Returns the alignment of the Clock component.
115         *
116         * @return the alignment
117         */
118        public Alignment getAlignment() {
119            return (Alignment) get(PROPERTY_ALIGNMENT);
120        }
121    
122        /**
123         * Sets the alignment of the Clock component.
124         *
125         * @param newValue the new alignment
126         */
127        public void setAlignment(Alignment newValue) {
128            set(PROPERTY_ALIGNMENT, newValue);
129        }
130    }