me.holz
Class UploadStatusBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by me.holz.UploadStatusBar
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class UploadStatusBar
extends java.awt.Panel
implements java.awt.event.ActionListener

A single upload in the UploadStatusShelf. It keeps track of its status all by itself, draws itself in the right position and listens to the events of the cancel button.

Since:
1.0
Version:
1.1, 01/13/2012
Author:
Mischa Holz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
UploadStatusBar(UploadStatusShelf auss, java.lang.String ahost, java.io.File afile, java.lang.String auid, java.lang.String auploadPath)
          Creates an instance of the class and starts the upload of the file afile.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          Gets called when the cancel button is pressed and aborts the corresponding upload by setting running to false.
 UploadStatusBar getMe()
          Returns the current instance of this class to pass it to the thread.
 void paint(java.awt.Graphics g)
          Gets called when the component has to redraw itself.
 void removeMe(java.lang.String aresponse)
          Removes this component from the UploadStatusShelf, which recieves the HTML response aresponse.
 void updateSize()
          Updates the size and the position of the components in the bar.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UploadStatusBar

public UploadStatusBar(UploadStatusShelf auss,
                       java.lang.String ahost,
                       java.io.File afile,
                       java.lang.String auid,
                       java.lang.String auploadPath)
Creates an instance of the class and starts the upload of the file afile.

Parameters:
auss - the instance of the UploadStatusShelf to which this bar belongs.
ahost - the path to the main.php which ends with /
afile - the file to upload to the server
auid - the CONTENIDO id of the current user
auploadPath - the relative path to upload to the CONTENIDO backend
Method Detail

updateSize

public void updateSize()
Updates the size and the position of the components in the bar.


removeMe

public void removeMe(java.lang.String aresponse)
Removes this component from the UploadStatusShelf, which recieves the HTML response aresponse.

Parameters:
aresponse - the response of the Webserver after finishing the upload

getMe

public UploadStatusBar getMe()
Returns the current instance of this class to pass it to the thread.

Returns:
this

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Gets called when the cancel button is pressed and aborts the corresponding upload by setting running to false. It also changes the status label to reflect the status to the user.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

paint

public void paint(java.awt.Graphics g)
Gets called when the component has to redraw itself. It calls super.draw(g), updates the size of the components within it and draws the borders of the upload bar.

Overrides:
paint in class java.awt.Container