Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chat.filetransfer
Class FileTransferConversationComponent

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 net.java.sip.communicator.impl.gui.main.chat.ChatConversationComponent
                      extended by net.java.sip.communicator.impl.gui.main.chat.filetransfer.FileTransferConversationComponent
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, FileTransferProgressListener, Skinnable
Direct Known Subclasses:
FileHistoryConversationComponent, ReceiveFileConversationComponent, SendFileConversationComponent

public abstract class FileTransferConversationComponent
extends ChatConversationComponent
implements ActionListener, FileTransferProgressListener, Skinnable

The FileTransferConversationComponent is the parent of all file conversation components - for incoming, outgoing and history file transfers.

Author:
Yana Stamcheva, Adam Netocny
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatConversationComponent
ChatConversationComponent.ChatConversationButton
 
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
protected  ChatConversationComponent.ChatConversationButton acceptButton
          The accept button.
protected  ChatConversationComponent.ChatConversationButton cancelButton
          The cancel button.
protected  JLabel fileLabel
          The file label.
protected static int IMAGE_HEIGHT
          Image default height.
protected static int IMAGE_WIDTH
          Image default width.
protected  FileImageLabel imageLabel
          The image label.
protected  ChatConversationComponent.ChatConversationButton openFileButton
          The open file button.
protected  ChatConversationComponent.ChatConversationButton openFolderButton
          The open folder button.
protected  JProgressBar progressBar
          The progress bar.
protected  ChatConversationComponent.ChatConversationButton rejectButton
          The reject button.
protected  ChatConversationComponent.ChatConversationButton retryButton
          The retry button.
protected  JLabel titleLabel
          The title label.
 
Fields inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatConversationComponent
constraints, resources
 
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
FileTransferConversationComponent(Window parentWindow)
          Creates a file conversation component.
 
Method Summary
 void actionPerformed(ActionEvent evt)
          Handles buttons action events.
protected  String getFileLabel(File file)
          Returns the string, showing information for the given file.
protected  String getFileLabel(String fileName, long fileSize)
          Returns the string, showing information for the given file.
protected abstract  String getProgressLabel(String bytesString)
          Returns the label to show on the progress bar.
protected  void hideProgressRelatedComponents()
          Hides all progress related components.
 void loadSkin()
          Reload images and colors.
 void progressChanged(FileTransferProgressEvent event)
          Updates progress bar progress line every time a progress event has been received.
protected  void setCompletedDownloadFile(File file)
          Sets the download file.
protected  void setFileTransfer(FileTransfer fileTransfer, long transferredFileSize)
          Sets the file transfer.
protected  void showErrorMessage(String message)
          Shows the given error message in the error area of this component.
 
Methods inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatConversationComponent
getDate, getDateString, openFile, paintComponent, setWarningStyle
 
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, 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
 

Field Detail

IMAGE_WIDTH

protected static final int IMAGE_WIDTH
Image default width.

See Also:
Constant Field Values

IMAGE_HEIGHT

protected static final int IMAGE_HEIGHT
Image default height.

See Also:
Constant Field Values

imageLabel

protected final FileImageLabel imageLabel
The image label.


titleLabel

protected final JLabel titleLabel
The title label.


fileLabel

protected final JLabel fileLabel
The file label.


cancelButton

protected final ChatConversationComponent.ChatConversationButton cancelButton
The cancel button.


retryButton

protected final ChatConversationComponent.ChatConversationButton retryButton
The retry button.


acceptButton

protected final ChatConversationComponent.ChatConversationButton acceptButton
The accept button.


rejectButton

protected final ChatConversationComponent.ChatConversationButton rejectButton
The reject button.


openFileButton

protected final ChatConversationComponent.ChatConversationButton openFileButton
The open file button.


openFolderButton

protected final ChatConversationComponent.ChatConversationButton openFolderButton
The open folder button.


progressBar

protected final JProgressBar progressBar
The progress bar.

Constructor Detail

FileTransferConversationComponent

public FileTransferConversationComponent(Window parentWindow)
Creates a file conversation component.

Method Detail

showErrorMessage

protected void showErrorMessage(String message)
Shows the given error message in the error area of this component.

Specified by:
showErrorMessage in class ChatConversationComponent
Parameters:
message - the message to show

setCompletedDownloadFile

protected void setCompletedDownloadFile(File file)
Sets the download file.

Parameters:
file - the file that has been downloaded or sent

setFileTransfer

protected void setFileTransfer(FileTransfer fileTransfer,
                               long transferredFileSize)
Sets the file transfer.

Parameters:
fileTransfer - the file transfer
transferredFileSize - the size of the transferred file

actionPerformed

public void actionPerformed(ActionEvent evt)
Handles buttons action events.

Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - the ActionEvent that notified us

progressChanged

public void progressChanged(FileTransferProgressEvent event)
Updates progress bar progress line every time a progress event has been received.

Specified by:
progressChanged in interface FileTransferProgressListener
Parameters:
event - the FileTransferProgressEvent that notified us

getFileLabel

protected String getFileLabel(File file)
Returns the string, showing information for the given file.

Parameters:
file - the file
Returns:
the name of the given file

getFileLabel

protected String getFileLabel(String fileName,
                              long fileSize)
Returns the string, showing information for the given file.

Parameters:
fileName - the name of the file
fileSize - the size of the file
Returns:
the name of the given file

hideProgressRelatedComponents

protected void hideProgressRelatedComponents()
Hides all progress related components.


getProgressLabel

protected abstract String getProgressLabel(String bytesString)
Returns the label to show on the progress bar.

Parameters:
bytesString - the bytes that have been transfered
Returns:
the label to show on the progress bar

loadSkin

public void loadSkin()
Reload images and colors.

Specified by:
loadSkin in interface Skinnable
Overrides:
loadSkin in class ChatConversationComponent

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.