java-gnome version 4.1.1

org.gnome.gtk
Class ProgressBar

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Widget
                  extended by org.gnome.gtk.ProgressBar
All Implemented Interfaces:
Orientable

public class ProgressBar
extends Widget
implements Orientable

A Widget that displays the progress of a task as a visual bar. This is principally used to give feedback to a user that things are actually happening when some computationally intensive or long running task is taking place. You can use a ProgressBar in two ways. Usually you know what fraction of a task is complete and that is what you want to display as a steadily increasing bar. On the other hand, if the total duration of the task is unknown or unpredictable, you can still indicate progress is being made by having the bar "pulse" back and forth.

Note that like most things in GTK, most of the code that actually updates the ProgressBar will not run until control is returned to the main loop. Keep that in mind if you're wondering why the bar hasn't "updated".

Since:
4.0.3
Author:
Andrew Cowie, Vreixo Formoso, Bruno Dusausoy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
 
Constructor Summary
ProgressBar()
          Instantiate a new ProgressBar.
 
Method Summary
 double getFraction()
          Get the current progress bar fraction
 Orientation getOrientation()
          Get the orientation of this Orientable.
 double getPulseStep()
          Get the current progress bar pulse step
 String getText()
          Getting the text superimposed on the ProgressBar itself.
 void pulse()
          Causes the ProgressBar to enter "activity mode", used to indicate that the application is making progress but in a way that can't be strictly quantized.
 void setFraction(double fraction)
          Set the fraction of the ProgressBar that shows as completed or "filled-in".
 void setOrientation(Orientation orientation)
          Set the orientation of this Orientable.
 void setPulseStep(double fraction)
          Set the progress bar pulse step.
 void setText(String text)
          Cause text to appear superimposed on the ProgressBar itself.
 
Methods inherited from class org.gnome.gtk.Widget
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgressBar

public ProgressBar()
Instantiate a new ProgressBar.

Since:
4.0.3
Method Detail

getFraction

public double getFraction()
Get the current progress bar fraction

Since:
4.0.10

getOrientation

public Orientation getOrientation()
Description copied from interface: Orientable
Get the orientation of this Orientable.

Specified by:
getOrientation in interface Orientable

getPulseStep

public double getPulseStep()
Get the current progress bar pulse step

Since:
4.0.10

getText

public String getText()
Getting the text superimposed on the ProgressBar itself.

Since:
4.0.10

pulse

public void pulse()
Causes the ProgressBar to enter "activity mode", used to indicate that the application is making progress but in a way that can't be strictly quantized.

An example of this is web: most URLs addressable via http:// are files of known size, and so when downloading them, a web browser can report exactly what percentage has been downloaded relative to the file size that was psssed in the initial HTTP header. Dynamic web pages, on the other hand (ie, your average PHP or JSP script), do not have a known size at the time the HTTP headers are sent, and so the web browser doesn't know ahead of time how many bytes are on the way. In this scenario, all the application can do is "pulse" the ProgressBar back and forth to indicate that traffic is continuing to arrive but that the percentage complete is not known, and that is what this method is for.

Each time this method is invoked, the a little block inside the ProgressBar is moved a small amount. You should therefore call this method fairly frequently (ie with reasonably small time intervals) to cause the effect of the block moving back and forward along the ProgressBar.

Since:
4.0.7

setFraction

public void setFraction(double fraction)
Set the fraction of the ProgressBar that shows as completed or "filled-in".

Parameters:
fraction - a value between 0.0 (not started) and 1.0 (fully complete)
Throws:
IllegalArgumentException - If fraction is greater than 1.0 or less than 0.0
Since:
4.0.3

setOrientation

public void setOrientation(Orientation orientation)
Description copied from interface: Orientable
Set the orientation of this Orientable.

Specified by:
setOrientation in interface Orientable

setPulseStep

public void setPulseStep(double fraction)
Set the progress bar pulse step. That means the amount of progress to perform each time pulse(); is called.

Parameters:
fraction - a value between 0.0 and 1.0
Throws:
IllegalArgumentException - If fraction is greater than 1.0 or less than 0.0
Since:
4.0.10

setText

public void setText(String text)
Cause text to appear superimposed on the ProgressBar itself.

Parameters:
text - Use null if you want to clear any text there.
Since:
4.0.3


java-gnome