wjhk.jupload2.gui
Class JUploadPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by wjhk.jupload2.gui.JUploadPanel
All Implemented Interfaces:
ActionListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class JUploadPanel
extends JPanel
implements ActionListener, MouseListener

Main code for the applet (or frame) creation. It contains all creation of necessary elements, and calls to UploadPolicy methods to allow easy personalization.
This class remain in the current project structure, even if it's not really used any more. The original reason for this class was that the code would work from within a navigator (an applet) or from a standard java application.
This compatibility is no more maintained, as a lot of code suppose access to navigator parameters. Hope it will be restored...

Version:
$Revision: 891 $
Author:
William JinHua Kwong
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
JUploadPanel(JUploadTextArea logWindow, UploadPolicy uploadPolicyParam)
          Standard constructor.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void clearLogWindow()
          Clear the current log window content.
 void copyLogWindow()
          Copy the log window content into the clipboard.
 void doBrowse()
          Reaction to a click on the browse button.
 void doRemove()
          Reaction to a click on the remove button.
 void doRemoveAll()
          Reaction to a click on the removeAll button.
 void doStartUpload()
          Reaction to a click on the upload button.
 void doStopUpload()
          Reaction to a click on the stop button.
 JButton getBrowseButton()
           
 DnDListener getDndListener()
           
 wjhk.jupload2.gui.filepanel.FilePanel getFilePanel()
           
 JScrollPane getJLogWindowPane()
          The component that contains the log window.
protected  JUploadTextArea getLogWindow()
          Get the log window, that is: the component where messages (debug, info, error...) are written.
 JProgressBar getPreparationProgressBar()
           
 JButton getRemoveAllButton()
           
 JButton getRemoveButton()
           
 JLabel getStatusLabel()
           
 JButton getStopButton()
           
 JButton getUploadButton()
           
 JProgressBar getUploadProgressBar()
           
 boolean maybeOpenPopupMenu(MouseEvent mouseEvent)
          This method opens the popup menu, if the mouseEvent is relevant.
 void mouseClicked(MouseEvent mouseEvent)
           
 void mouseEntered(MouseEvent mouseEvent)
           
 void mouseExited(MouseEvent mouseEvent)
           
 void mousePressed(MouseEvent mouseEvent)
           
 void mouseReleased(MouseEvent mouseEvent)
           
 void setFilePanel(wjhk.jupload2.gui.filepanel.FilePanel filePanel)
          Standard setter for filePanel.
 void showOrHideLogWindow()
          This methods show or hides the logWindow, depending on the following applet parameters.
 void updateButtonState()
          Select or unselect the applet buttons
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JUploadPanel

public JUploadPanel(JUploadTextArea logWindow,
                    UploadPolicy uploadPolicyParam)
             throws Exception
Standard constructor.

Parameters:
logWindow - The log window that should already have been created. This allows putting text into it, before the effective creation of the layout.
uploadPolicyParam - The current UploadPolicy. Null if a new one must be created.
Throws:
Exception
Method Detail

showOrHideLogWindow

public void showOrHideLogWindow()
This methods show or hides the logWindow, depending on the following applet parameters. The following conditions must be met, to hide the log window:
  • showLogWindow (must be False)
  • debugLevel (must be 0 or less)

  • doBrowse

    public void doBrowse()
    Reaction to a click on the browse button.


    doRemove

    public void doRemove()
    Reaction to a click on the remove button. This method actually removes the selected files in the file list.


    doRemoveAll

    public void doRemoveAll()
    Reaction to a click on the removeAll button. This method actually removes all the files in the file list.


    doStartUpload

    public void doStartUpload()
    Reaction to a click on the upload button. This method can be called from outside to start the upload.


    doStopUpload

    public void doStopUpload()
    Reaction to a click on the stop button. This stops the running on upload. This method can be called from outside to start the upload.


    actionPerformed

    public void actionPerformed(ActionEvent e)
    Specified by:
    actionPerformed in interface ActionListener
    See Also:
    ActionListener.actionPerformed(java.awt.event.ActionEvent)

    mouseClicked

    public void mouseClicked(MouseEvent mouseEvent)
    Specified by:
    mouseClicked in interface MouseListener
    See Also:
    MouseListener.mouseClicked(java.awt.event.MouseEvent)

    mouseEntered

    public void mouseEntered(MouseEvent mouseEvent)
    Specified by:
    mouseEntered in interface MouseListener
    See Also:
    MouseListener.mouseEntered(java.awt.event.MouseEvent)

    mouseExited

    public void mouseExited(MouseEvent mouseEvent)
    Specified by:
    mouseExited in interface MouseListener
    See Also:
    MouseListener.mouseExited(java.awt.event.MouseEvent)

    mousePressed

    public void mousePressed(MouseEvent mouseEvent)
    Specified by:
    mousePressed in interface MouseListener
    See Also:
    MouseListener.mousePressed(java.awt.event.MouseEvent)

    mouseReleased

    public void mouseReleased(MouseEvent mouseEvent)
    Specified by:
    mouseReleased in interface MouseListener
    See Also:
    MouseListener.mouseReleased(java.awt.event.MouseEvent)

    maybeOpenPopupMenu

    public boolean maybeOpenPopupMenu(MouseEvent mouseEvent)
    This method opens the popup menu, if the mouseEvent is relevant. In this case it returns true. Otherwise, it does nothing and returns false.

    Parameters:
    mouseEvent - The triggered mouse event.
    Returns:
    true if the popup menu was opened, false otherwise.

    updateButtonState

    public void updateButtonState()
    Select or unselect the applet buttons


    clearLogWindow

    public void clearLogWindow()
    Clear the current log window content.


    copyLogWindow

    public void copyLogWindow()
    Copy the log window content into the clipboard. Allows easy access to the debug output.


    getBrowseButton

    public JButton getBrowseButton()
    Returns:
    the browseButton

    getDndListener

    public DnDListener getDndListener()
    Returns:
    the dndListener

    getFilePanel

    public wjhk.jupload2.gui.filepanel.FilePanel getFilePanel()
    Returns:
    the filePanel

    getJLogWindowPane

    public JScrollPane getJLogWindowPane()
    The component that contains the log window. It is used to display the content of the log window, with the relevant scroll bars.

    Returns:
    the jLogWindowPane

    getLogWindow

    protected JUploadTextArea getLogWindow()
    Get the log window, that is: the component where messages (debug, info, error...) are written. You should not use this component directly, but:

    Returns:
    the logWindow

    getPreparationProgressBar

    public JProgressBar getPreparationProgressBar()
    Returns:
    the preparationProgressBar

    getUploadProgressBar

    public JProgressBar getUploadProgressBar()
    Returns:
    the uploadProgressBar

    getRemoveAllButton

    public JButton getRemoveAllButton()
    Returns:
    the removeAllButton

    getRemoveButton

    public JButton getRemoveButton()
    Returns:
    the removeButton

    getStatusLabel

    public JLabel getStatusLabel()
    Returns:
    the statusLabel

    getStopButton

    public JButton getStopButton()
    Returns:
    the stopButton

    getUploadButton

    public JButton getUploadButton()
    Returns:
    the uploadButton

    setFilePanel

    public void setFilePanel(wjhk.jupload2.gui.filepanel.FilePanel filePanel)
    Standard setter for filePanel.

    Parameters:
    filePanel -