de.fhg.igd.ui
Class ProgressIterator

java.lang.Object
  extended byde.fhg.igd.ui.ProgressIterator
All Implemented Interfaces:
Iterator

public class ProgressIterator
extends Object
implements Iterator

This iterator wraps around an iterator and illustrates the progress by means of a ProgressBar.

Version:
"$Id: ProgressIterator.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Volker Roth

Field Summary
protected  AnimatedIcon anim_
          The animated icon.
static String ANIM_NAME
          The name of the animation that is played.
static String AUDIO_NAME
          The name of the audio file that is played once the process finished.
private  int current_
          The current item number.
protected  JFrame frame_
          The frame that holds the progress bar.
private  Iterator i_
          The wrapped iterator.
private  int max_
          The max number of items.
protected  JProgressBar pbar_
          The progress bar that shows the progress of this Iterator.
protected  String title_
          The title of the frame that shows the progress bar.
 
Constructor Summary
ProgressIterator(Iterator i, String title)
          Creates an iterator that wraps around the given iterator and illustrates the progress by means of a ProgressBar.
 
Method Summary
protected  void advance()
           
protected  void close()
           
 int getMaximum()
          Returns the maximum number of elements or -1 if this Iterator is not yet properly initialized.
 boolean hasNext()
           
protected  void init()
           
static void main(String[] argv)
           
 Object next()
           
 void remove()
           
 void setMaximum(int max)
          Sets the max number of elements.
 void setMaximum(Iterator i)
          Computes the maximum number of items from the given iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANIM_NAME

public static final String ANIM_NAME
The name of the animation that is played. The name must omit the trailing extension, e.g. ".anim".

See Also:
Constant Field Values

AUDIO_NAME

public static final String AUDIO_NAME
The name of the audio file that is played once the process finished.

See Also:
Constant Field Values

i_

private Iterator i_
The wrapped iterator.


max_

private int max_
The max number of items.


current_

private int current_
The current item number.


frame_

protected JFrame frame_
The frame that holds the progress bar.


pbar_

protected JProgressBar pbar_
The progress bar that shows the progress of this Iterator.


anim_

protected AnimatedIcon anim_
The animated icon.


title_

protected String title_
The title of the frame that shows the progress bar.

Constructor Detail

ProgressIterator

public ProgressIterator(Iterator i,
                        String title)
Creates an iterator that wraps around the given iterator and illustrates the progress by means of a ProgressBar. Before this instance can be used it must be initialized with a maximum number of items.

Parameters:
i - The wrapped Iterator.
title - The title of the frame in which the progress bar is shown.
Method Detail

setMaximum

public void setMaximum(int max)
Sets the max number of elements.

Parameters:
max - The maximum number of elements.

setMaximum

public void setMaximum(Iterator i)
Computes the maximum number of items from the given iterator.

Parameters:
i - The Iterator that is used to find the maximum number of items by simply iterating through it and counting.

getMaximum

public int getMaximum()
Returns the maximum number of elements or -1 if this Iterator is not yet properly initialized.

Returns:
The maximum number of elements.

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

next

public Object next()
            throws NoSuchElementException
Specified by:
next in interface Iterator
Throws:
NoSuchElementException

remove

public void remove()
Specified by:
remove in interface Iterator

advance

protected void advance()

init

protected void init()

close

protected void close()

main

public static void main(String[] argv)


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.