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 package echopoint;
019
020 import echopoint.internal.AbstractContainer;
021 import nextapp.echo.app.Color;
022
023 /**
024 * A simple colour based progress bar component. Unlike the original EPNG
025 * progress bar component, this is very light-weight and does not require
026 * compositing images on the server.
027 *
028 * <p><b>Note:</b> Development of this component was sponsored by <a
029 * href='http://tcnbroadcasting.com/index.jsp' target='_top'>TCN
030 * Broadcasting</a>. We are grateful for their support and sponsorship.</p>
031 *
032 * @author Rakesh Vidyadharan 2008-11-6
033 * @version $Id: ProgressBar.java 80 2008-11-07 03:35:20Z sptrakesh $
034 */
035 public class ProgressBar extends AbstractContainer
036 {
037 private static final long serialVersionUID = 1l;
038
039 /**
040 * The property used to set the background colour of the variable width
041 * progress bar element.
042 */
043 public static final String PROPERTY_BAR_BACKGROUND = "barBackground";
044
045 /** The property used to indicate the progress percentage value. */
046 public static final String PROPERTY_PERCENTAGE = "percentage";
047
048 /** The property used to display an optional text value in the bar. */
049 public static final String PROPERTY_TEXT = "text";
050
051 /**
052 * Return the value of {@link #PROPERTY_BAR_BACKGROUND} property.
053 *
054 * @return The background colour for the variable width bar.
055 */
056 public Color getBarBackground()
057 {
058 return (Color) get( PROPERTY_BAR_BACKGROUND );
059 }
060
061 /**
062 * Set the value of the {@link #PROPERTY_BAR_BACKGROUND} property.
063 *
064 * @param background The background colour for the variable width bar.
065 */
066 public void setBarBackground( final Color background )
067 {
068 set( PROPERTY_BAR_BACKGROUND, background );
069 }
070
071 /**
072 * Return the value of {@link #PROPERTY_PERCENTAGE} property.
073 *
074 * @return The percentage complete to be represented.
075 */
076 public int getPercentage()
077 {
078 return (Integer) get( PROPERTY_PERCENTAGE );
079 }
080
081 /**
082 * Set the value of the {@link #PROPERTY_PERCENTAGE} property.
083 *
084 * @param percentage The percentage complete that is to be depicted.
085 */
086 public void setPercentage( final int percentage )
087 {
088 set( PROPERTY_PERCENTAGE, percentage );
089 }
090
091 /**
092 * Return the value of {@link #PROPERTY_TEXT} property.
093 *
094 * @return The optional text to be displayed in the progress bar.
095 */
096 public String getText()
097 {
098 return (String) get( PROPERTY_TEXT );
099 }
100
101 /**
102 * Set the value of the {@link #PROPERTY_TEXT} property.
103 *
104 * @param text The optional text to be displayed in the progress bar.
105 */
106 public void setText( final String text )
107 {
108 set( PROPERTY_TEXT, text );
109 }
110 }