001    package echopoint.able;
002    /* 
003     * This file is part of the Echo Point Project.  This project is a collection
004     * of Components that have extended the Echo Web Application Framework.
005     *
006     * Version: MPL 1.1/GPL 2.0/LGPL 2.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     * Alternatively, the contents of this file may be used under the terms of
019     * either the GNU General Public License Version 2 or later (the "GPL"), or
020     * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
021     * in which case the provisions of the GPL or the LGPL are applicable instead
022     * of those above. If you wish to allow use of your version of this file only
023     * under the terms of either the GPL or the LGPL, and not to allow others to
024     * use your version of this file under the terms of the MPL, indicate your
025     * decision by deleting the provisions above and replace them with the notice
026     * and other provisions required by the GPL or the LGPL. If you do not delete
027     * the provisions above, a recipient may use your version of this file under
028     * the terms of any one of the MPL, the GPL or the LGPL.
029     */
030    import nextapp.echo.app.Color;
031    
032    /**
033     * A <code>Scrollable</code> is a component that can have a a fixed width 
034     * and/or height, and can present scrollbars when the content of 
035     * the component is too large to fit inside.
036     * <p>
037     * <h3>SCROLLBARS</h3>
038     *
039     * Since a <code>Scrollable</code> can be made a fixed size, by setting 
040     * its width and/or height properties, it has support for
041     * a scroll bar policy which controls how scroll bars are used if the content 
042     * of the component will not fit into the fixed size.
043     * <p>
044     * If the scroll bar policy is NEVER, then no scroll bars will be shown 
045     * and the content inside the component will be clipped to the bounding rectangle.
046     * <p>
047     * If the scroll bar policy is ALWAYS, then scroll bars will always be 
048     * shown, regardless of whether the content is too big for the bounding rectangle, 
049     * which allows the user to view all the content.
050     * <p>
051     * If the scroll bar policy is AUTO, then scroll bars will be 
052     * shown when appropriate, ie when the content is too big for the bounding 
053     * rectangle.
054     */
055    public interface Scrollable extends Sizeable {
056    
057            /**
058             * A scroll bar policy that will cause not cause any scroll bar
059             * policy to be applied at all.  Its as if no scroll bar policy
060             * is in place.
061             */
062            public static final int UNDEFINED = 0;
063    
064            /**
065             * A scroll bar policy that will cause scroll bars to never appear,
066             * without regard for whether they are required. Content is 
067             * never clipped even if its to large for the components dimensions.
068             */
069            public static final int NEVER = 1;
070            /**
071              * A scroll bar policy that will cause scroll bars to always appear, 
072              * without regard for whether they are required.
073              */
074            public static final int ALWAYS = 2;
075            /**
076             * A scroll bar policy that will cause scroll bars to be visible if they 
077             * are necessary, and invisible if they are not.
078             */
079            public static final int AUTO = 4;
080            
081            /**
082             * A scroll bar policy that will cause scroll bars to never appear,
083             * without regard for whether they are required. Content will
084             * always be clipped to the components dimensions and the
085             * scollbars are hidden.
086             */
087            public static final int CLIPHIDE = 8;
088            
089            
090    
091            public static final String PROPERTY_SCROLL_BAR_POLICY = "scrollBarPolicy";
092            public static final String PROPERTY_SCROLL_BAR_BASE_COLOR = "scrollBarBaseColor";
093            public static final String PROPERTY_SCROLL_BAR_PROPERTIES = "scrollBarProperties";
094            
095            /**
096             * Returns the ScrollBarPolicy in place
097             * 
098             * This can be one of :
099             * <ul>
100             * <li>NONE</li>
101             * <li>ALWAYS</li>
102             * <li>AUTO</li>
103             * <li>CLIPHIDE</li>
104             * </ul>
105             */
106            public int getScrollBarPolicy();
107    
108            /**
109             * Returns the base color of the ScrollBarProperties associated with this <code>Scrollable</code>
110             * @return the base color of the ScrollBarProperties associated with this <code>Scrollable</code>
111             */
112            public Color getScrollBarBaseColor();
113            
114            /**
115             * Returns the ScrollBarProperties associated with this <code>Scrollable</code>
116             * @return the ScrollBarProperties associated with this <code>Scrollable</code>
117             */
118            public ScrollBarProperties getScrollBarProperties();
119            
120            /**
121             * Sets the scroll bar policy of the component
122             * 
123             * This can be one of :
124             * <ul>
125             * <li>SCOLLBARS_NONE</li>
126             * <li>SCOLLBARS_ALWAYS</li>
127             * <li>SCOLLBARS_AUTO</li>
128             * <li>CLIPHIDE</li>
129             * </ul>
130             */
131            public void setScrollBarPolicy(int newScrollBarPolicy);
132    
133            /**
134             * Sets the base color of the ScrollBarProperties associated with this <code>Scrollable</code>.
135             * If no  ScrollBarProperties is available, then a new one should be created.
136             *
137             * @param newValue - the new base color of ScrollBarProperties to use
138             */
139            public void setScrollBarBaseColor(Color newValue);
140            
141            /**
142             * Sets the ScrollBarProperties associated with this <code>Scrollable</code>
143             * @param newValue - the new ScrollBarProperties to use
144             */
145            public void setScrollBarProperties(ScrollBarProperties newValue);
146            
147    }