001/*
002    Licensed to the Apache Software Foundation (ASF) under one
003    or more contributor license agreements.  See the NOTICE file
004    distributed with this work for additional information
005    regarding copyright ownership.  The ASF licenses this file
006    to you under the Apache License, Version 2.0 (the
007    "License"); you may not use this file except in compliance
008    with the License.  You may obtain a copy of the License at
009
010       http://www.apache.org/licenses/LICENSE-2.0
011
012    Unless required by applicable law or agreed to in writing,
013    software distributed under the License is distributed on an
014    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015    KIND, either express or implied.  See the License for the
016    specific language governing permissions and limitations
017    under the License.  
018 */
019package org.apache.wiki.ui.progress;
020
021/**
022 *  Provides access to an progress item.
023 *
024 *  @since  2.6
025 */
026public abstract class ProgressItem
027{
028    /**
029     *  Status: The PI is created.
030     */
031    public static final int CREATED  = 0;
032    
033    /** Status: The PI is started. */
034    public static final int STARTED  = 1;
035    
036    /** Status: The PI is stopped. */
037    public static final int STOPPED  = 2;
038    
039    /** Status: The PI is finished. */
040    public static final int FINISHED = 3;
041
042    protected int m_state = CREATED;
043
044    /**
045     *  Get the state of the ProgressItem.
046     *  @return CREATED, STARTED, STOPPED or FINISHED.
047     */
048    public int getState()
049    {
050        return m_state;
051    }
052
053    /**
054     *  Sets the state of the ProgressItem.
055     *  
056     *  @param state One of the CREATED, STARTED, STOPPED or FINISHED.
057     */
058    public void setState( int state )
059    {
060        m_state = state;
061    }
062
063    /**
064     *  Returns the progress in percents.
065     *  @return An integer 0-100.
066     */
067    public abstract int getProgress();
068}