public class PictureUploadPolicy extends DefaultUploadPolicy implements ActionListener, ImageObserver
UploadPolicy.createTopPanel(JButton, JButton, JButton, JUploadPanel)
. It contains a
preview picture panel, and two additional buttons to rotate the selected picture in one direction or the
other.
debugFile, debugOk, debugOut, DIALOG_MESSAGE_MAX_LINE_LENGTH, httpUploadParameterName, httpUploadParameterType, lastResponseMessage, patternError, patternSuccess, patternWarning
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
DEFAULT_AFTER_UPLOAD_TARGET, DEFAULT_AFTER_UPLOAD_URL, DEFAULT_ALBUM_ID, DEFAULT_ALLOW_HTTP_PERSISTENT, DEFAULT_ALLOWED_FILE_EXTENSIONS, DEFAULT_BROWSING_DIRECTORY, DEFAULT_DATE_FORMAT, DEFAULT_DEBUG_LEVEL, DEFAULT_FILE_CHOOSER_ICON_FROM_FILE_CONTENT, DEFAULT_FILE_CHOOSER_ICON_SIZE, DEFAULT_FILE_CHOOSER_IMAGE_PREVIEW, DEFAULT_FILE_FILTER_NAME, DEFAULT_FILE_LIST_VIEW_MODE, DEFAULT_FILENAME_ENCODING, DEFAULT_FORMDATA, DEFAULT_FTP_CREATE_DIRECTORY_STRUCTURE, DEFAULT_FTP_TRANSFERT_BINARY, DEFAULT_FTP_TRANSFERT_PASSIVE, DEFAULT_HIGH_QUALITY_PREVIEW, DEFAULT_HTTP_UPLOAD_PARAMETER_NAME, DEFAULT_HTTP_UPLOAD_PARAMETER_TYPE, DEFAULT_KEEP_ORIG_EXTENSION, DEFAULT_LANG, DEFAULT_LOOK_AND_FEEL, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_HEIGHT, DEFAULT_MAX_WIDTH, DEFAULT_NB_FILES_PER_REQUEST, DEFAULT_PICTURE_COMPRESSION_QUALITY, DEFAULT_PICTURE_TRANSMIT_METADATA, DEFAULT_POST_URL, DEFAULT_READ_COOKIE_FROM_NAVIGATOR, DEFAULT_READ_USER_AGENT_FROM_NAVIGATOR, DEFAULT_REAL_MAX_HEIGHT, DEFAULT_REAL_MAX_WIDTH, DEFAULT_RETRY_MAX_NUMBER_OF, DEFAULT_RETRY_NB_SECONDS_BETWEEN, DEFAULT_SEND_MD5_SUM, DEFAULT_SERVER_PROTOCOL, DEFAULT_SHOW_LOGWINDOW, DEFAULT_SHOW_STATUSBAR, DEFAULT_SPECIFIC_HEADERS, DEFAULT_SSL_VERIFY_CERT, DEFAULT_STORE_BUFFERED_IMAGE, DEFAULT_STRING_UPLOAD_ERROR, DEFAULT_STRING_UPLOAD_SUCCESS, DEFAULT_STRING_UPLOAD_WARNING, DEFAULT_TARGET_PICTURE_FORMAT, DEFAULT_UPLOAD_POLICY, DEFAULT_URL_TO_SEND_ERROR_TO, EXEC_STATUS_READY, EXEC_STATUS_UPLOADING, HTTPUPLOADPARAMETERTYPE_ARRAY, HTTPUPLOADPARAMETERTYPE_ITERATION, HTTPUPLOADPARAMETERTYPE_ONE_FILE, PROP_AFTER_UPLOAD_TARGET, PROP_AFTER_UPLOAD_URL, PROP_ALBUM_ID, PROP_ALLOW_HTTP_PERSISTENT, PROP_ALLOWED_FILE_EXTENSIONS, PROP_BROWSING_DIRECTORY, PROP_DEBUG_LEVEL, PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT, PROP_FILE_CHOOSER_ICON_SIZE, PROP_FILE_CHOOSER_IMAGE_PREVIEW, PROP_FILE_FILTER_NAME, PROP_FILE_LIST_VIEW_MODE, PROP_FILENAME_ENCODING, PROP_FORMDATA, PROP_FTP_CREATE_DIRECTORY_STRUCTURE, PROP_FTP_TRANSFERT_BINARY, PROP_FTP_TRANSFERT_PASSIVE, PROP_HIGH_QUALITY_PREVIEW, PROP_HTTP_UPLOAD_PARAMETER_NAME, PROP_HTTP_UPLOAD_PARAMETER_TYPE, PROP_KEEP_ORIG_EXTENSION, PROP_LANG, PROP_LOOK_AND_FEEL, PROP_MAX_CHUNK_SIZE, PROP_MAX_FILE_SIZE, PROP_MAX_HEIGHT, PROP_MAX_WIDTH, PROP_NB_FILES_PER_REQUEST, PROP_PICTURE_COMPRESSION_QUALITY, PROP_PICTURE_TRANSMIT_METADATA, PROP_POST_URL, PROP_READ_COOKIE_FROM_NAVIGATOR, PROP_READ_USER_AGENT_FROM_NAVIGATOR, PROP_REAL_MAX_HEIGHT, PROP_REAL_MAX_WIDTH, PROP_RETRY_MAX_NUMBER_OF, PROP_RETRY_NB_SECONDS_BETWEEN, PROP_SEND_MD5_SUM, PROP_SERVER_PROTOCOL, PROP_SHOW_LOGWINDOW, PROP_SHOW_STATUSBAR, PROP_SPECIFIC_HEADERS, PROP_SSL_VERIFY_CERT, PROP_STORE_BUFFERED_IMAGE, PROP_STRING_UPLOAD_ERROR, PROP_STRING_UPLOAD_SUCCESS, PROP_STRING_UPLOAD_WARNING, PROP_TARGET_PICTURE_FORMAT, PROP_UPLOAD_POLICY, PROP_URL_TO_SEND_ERROR_TO, SHOWLOGWINDOW_FALSE, SHOWLOGWINDOW_ONERROR, SHOWLOGWINDOW_TRUE
Constructor and Description |
---|
PictureUploadPolicy(JUploadContext juploadContext)
The standard constructor, which transmit most informations to the super.Constructor().
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
This method handles the clicks on the rotation buttons.
|
boolean |
beforeUpload()
Execute any action, that must be done before upload.
|
JUploadFileChooser |
createFileChooser()
Creates the file chooser, from the default implementation, then add an accessory to preview pictures.
|
FileData |
createFileData(File file)
This methods actually returns a
PictureFileData instance. |
JPanel |
createTopPanel(JButton browse,
JButton remove,
JButton removeAll,
JUploadPanel jUploadPanel)
This method override the default topPanel, and adds:
Two rotation buttons, to rotate the currently selected picture. |
void |
displayParameterStatus()
This method displays the applet parameter list, according to the current debugLevel.
|
Icon |
fileViewGetIcon(File file)
Returns an icon, calculated from the image content.
|
boolean |
getFileChooserImagePreview()
Getter for fileChooserImagePreview.
|
boolean |
getHighQualityPreview() |
ImageFileConversionInfo |
getImageFileConversionInfo() |
boolean |
getKeepOrigExtension() |
int |
getMaxHeight() |
int |
getMaxWidth() |
float |
getPictureCompressionQuality() |
boolean |
getPictureTransmitMetadata() |
int |
getRealMaxHeight() |
int |
getRealMaxWidth() |
String |
getTargetPictureFormat() |
String |
getUploadFilename(FileData fileData,
int index)
Get the original name of the file on the disk.
|
boolean |
imageUpdate(Image arg0,
int arg1,
int arg2,
int arg3,
int arg4,
int arg5)
Implementation of the ImageObserver interface
|
void |
onFileDoubleClicked(FileData pictureFileData)
Open the 'big' preview dialog box.
|
void |
onFileSelected(FileData fileData)
Default implementation of the
UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData) . |
Cursor |
setCursor(Cursor cursor)
Calls the
DefaultUploadPolicy.setCursor(Cursor) method, then set the picture panel specific cursor. |
void |
setFileChooserImagePreview(boolean fileChooserImagePreview)
Setter for fileChooserIconFromFileContent.
|
void |
setProperty(String prop,
String value)
This method manages the applet parameters that are specific to this class.
|
Cursor |
setWaitCursor()
Calls the
DefaultUploadPolicy.setWaitCursor() method, then erases the picture panel specific cursor. |
addComponentsToJUploadPanel, addHeader, addMsgToDebugLog, afterFileDropped, afterUpload, alert, alertStr, checkUploadSuccess, confirmDialogStr, createProgressPanel, createStatusBar, deleteLog, displayDebug, displayErr, displayErr, displayErr, displayErr, displayInfo, displayWarn, fileFilterAccept, fileFilterGetDescription, formatMessage, getAfterUploadTarget, getAfterUploadURL, getAllowedFileExtensions, getAllowHttpPersistent, getContext, getCurrentBrowsingDirectory, getDateFormat, getDebugLevel, getEncodedFilename, getFileChooserIconFromFileContent, getFileChooserIconSize, getFileFilterName, getFileListViewMode, getFilenameEncoding, getFormdata, getFtpCreateDirectoryStructure, getFtpTransfertBinary, getFtpTransfertPassive, getHttpUploadParameterName, getHttpUploadParameterType, getLastException, getLastResponseBody, getLastResponseMessage, getLocale, getLocalizedString, getLookAndFeel, getMaxChunkSize, getMaxFileSize, getNbFilesPerRequest, getPostURL, getReadCookieFromNavigator, getReadUserAgentFromNavigator, getRetryMaxNumberOf, getRetryNbSecondsBetween, getSendMD5Sum, getServerProtocol, getShowLogWindow, getSpecificHeaders, getSslVerifyCert, getStringUploadError, getStringUploadSuccess, getStringUploadWarning, getUploadName, getUrlToSendErrorTo, onAppendHeader, sendDebugInformation, setAfterUploadURL, setAllowedFileExtensions, setAllowHttpPersistent, setCurrentBrowsingDirectory, setCurrentBrowsingDirectory, setDebugLevel, setDebugLevel, setFileChooserIconFromFileContent, setFileChooserIconSize, setFileFilterName, setFileListViewMode, setFilenameEncoding, setFtpCreateDirectoryStructure, setFtpTransfertBinary, setFtpTransfertPassive, setHttpUploadParameterName, setHttpUploadParameterType, setLang, setLastException, setLookAndFeel, setMaxChunkSize, setMaxFileSize, setNbFilesPerRequest, setPostURL, setReadCookieFromNavigator, setReadUserAgentFromNavigator, setRetryMaxNumberOf, setRetryNbSecondsBetween, setSendMD5Sum, setServerProtocol, setShowLogWindow, setShowStatusbar, setSpecificHeaders, setSslVerifyCert, setStringUploadError, setStringUploadSuccess, setStringUploadWarning, setUrlToSendErrorTo, start, updateButtonState
public PictureUploadPolicy(JUploadContext juploadContext) throws JUploadException
juploadContext
- Reference to the current applet. Allows access to javascript functions.JUploadException
public FileData createFileData(File file) throws JUploadExceptionStopAddingFiles
PictureFileData
instance. It allows only pictures: if the file is not a
picture, this method returns null, thus preventing the file to be added to the list of files to be uploaded.createFileData
in interface UploadPolicy
createFileData
in class DefaultUploadPolicy
file
- The file selected by the user (called once for each added file).PictureFileData
or null if file is not a picture.JUploadExceptionStopAddingFiles
- If the users choosed to stop adding. This occurs when the
DefaultUploadPolicy.fileFilterAccept(File)
method returns false, and the user then choose to stop adding
files.wjhk.jupload2.policies.UploadPolicy#createFileData(File,File)
public JPanel createTopPanel(JButton browse, JButton remove, JButton removeAll, JUploadPanel jUploadPanel)
createTopPanel
in interface UploadPolicy
createTopPanel
in class DefaultUploadPolicy
browse
- The default browse button.remove
- The default removeSelected button.removeAll
- The default removeAll button.jUploadPanel
- The panel that contains all objects.UploadPolicy.createTopPanel(JButton, JButton, JButton, JUploadPanel)
public void actionPerformed(ActionEvent e)
DefaultUploadPolicy
.actionPerformed
in interface ActionListener
ActionListener.actionPerformed(java.awt.event.ActionEvent)
public void onFileSelected(FileData fileData)
DefaultUploadPolicy
UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData)
. Nothing's done.onFileSelected
in interface UploadPolicy
onFileSelected
in class DefaultUploadPolicy
UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData)
public void onFileDoubleClicked(FileData pictureFileData)
onFileDoubleClicked
in interface UploadPolicy
onFileDoubleClicked
in class DefaultUploadPolicy
UploadPolicy.onFileDoubleClicked(FileData)
public boolean beforeUpload()
UploadPolicy
PictureUploadPolicy
disable the
rotation buttons during buttons. The DefaultUploadPolicy.beforeUpload()
method just returns true.beforeUpload
in interface UploadPolicy
beforeUpload
in class DefaultUploadPolicy
UploadPolicy.beforeUpload()
public boolean getFileChooserImagePreview()
UploadPolicy.PROP_FILE_CHOOSER_IMAGE_PREVIEW
public void setFileChooserImagePreview(boolean fileChooserImagePreview)
fileChooserImagePreview
- new value to store, for the applet parameter: fileChooserImagePreview.UploadPolicy.PROP_FILE_CHOOSER_IMAGE_PREVIEW
public boolean getHighQualityPreview()
public int getMaxHeight()
public int getMaxWidth()
public float getPictureCompressionQuality()
public boolean getPictureTransmitMetadata()
public int getRealMaxHeight()
public int getRealMaxWidth()
public String getTargetPictureFormat()
public ImageFileConversionInfo getImageFileConversionInfo()
public boolean getKeepOrigExtension()
true
, if the the original file extension should be keptfalse
, if the the original file extension should be changed to the target picture
format, that the file has been converted topublic void setProperty(String prop, String value) throws JUploadException
setProperty
in interface UploadPolicy
setProperty
in class DefaultUploadPolicy
prop
- The property which value should changevalue
- The new value for this property. If invalid, the default value is used.JUploadException
JUploadExceptionStopAddingFiles
- indicates that the applet should stop strying adding the current file
selection. Useful for instance, when a user drop a directory, full of unallowed file: it's
annoying for the user to click 'Ok' for each file in the alert box.UploadPolicy.setProperty(java.lang.String, java.lang.String)
public void displayParameterStatus()
DefaultUploadPolicy
DefaultUploadPolicy.setDebugLevel(int)
method. It should be override by any subclasses, that should display its own
parameters, then call super.displayParameterStatus().displayParameterStatus
in interface UploadPolicy
displayParameterStatus
in class DefaultUploadPolicy
DefaultUploadPolicy.displayParameterStatus()
public Cursor setWaitCursor()
DefaultUploadPolicy.setWaitCursor()
method, then erases the picture panel specific cursor.setWaitCursor
in interface UploadPolicy
setWaitCursor
in class DefaultUploadPolicy
DefaultUploadPolicy.setCursor(Cursor)
public Cursor setCursor(Cursor cursor)
DefaultUploadPolicy.setCursor(Cursor)
method, then set the picture panel specific cursor.setCursor
in interface UploadPolicy
setCursor
in class DefaultUploadPolicy
cursor
- The cursor that must be set.DefaultUploadPolicy.setCursor(Cursor)
public JUploadFileChooser createFileChooser()
createFileChooser
in interface UploadPolicy
createFileChooser
in class DefaultUploadPolicy
UploadPolicy.createFileChooser()
public Icon fileViewGetIcon(File file)
fileViewGetIcon
in interface UploadPolicy
fileViewGetIcon
in class DefaultUploadPolicy
file
- The file from which the icon should represent.UploadPolicy.fileViewGetIcon(File)
,
UploadPolicy.PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT
public String getUploadFilename(FileData fileData, int index) throws JUploadException
UploadPolicy
getUploadFilename
in interface UploadPolicy
getUploadFilename
in class DefaultUploadPolicy
fileData
- The file data whose upload file name must be calculated.index
- index of the file in the current request to the server (from 0 to n)JUploadException
DefaultUploadPolicy.getUploadFilename(wjhk.jupload2.filedata.FileData, int)
public boolean imageUpdate(Image arg0, int arg1, int arg2, int arg3, int arg4, int arg5)
imageUpdate
in interface ImageObserver
arg0
- arg1
- arg2
- arg3
- arg4
- arg5
- Copyright © 2015. All rights reserved.