|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wjhk.jupload2.policies.DefaultUploadPolicy wjhk.jupload2.policies.PictureUploadPolicy
public class PictureUploadPolicy
This class add handling of pictures to upload.
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.
Field Summary |
---|
Fields inherited from class wjhk.jupload2.policies.DefaultUploadPolicy |
---|
cookie, debugFile, debugOk, debugOut, patternError, patternSuccess, patternWarning, userAgent |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
PictureUploadPolicy(wjhk.jupload2.context.JUploadContext juploadContext)
The standard constructor, which transmit most informations to the super.Constructor(). |
Method Summary | |
---|---|
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,
File root)
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()
|
wjhk.jupload2.filedata.helper.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. |
(package private) void |
setHighQualityPreview(boolean highQualityPreview)
|
(package private) void |
setKeepOrigExtension(boolean keepOrigExtension)
|
(package private) void |
setMaxHeight(int maxHeight)
|
(package private) void |
setMaxWidth(int maxWidth)
|
(package private) void |
setPictureCompressionQuality(float pictureCompressionQuality)
|
(package private) void |
setPictureTransmitMetadata(boolean pictureTransmitMetadata)
|
void |
setProperty(String prop,
String value)
This method manages the applet parameters that are specific to this class. |
(package private) void |
setRealMaxHeight(int realMaxHeight)
|
(package private) void |
setRealMaxWidth(int realMaxWidth)
|
(package private) void |
setTargetPictureFormat(String targetPictureFormat)
we expect e.g. |
Cursor |
setWaitCursor()
Calls the DefaultUploadPolicy.setWaitCursor() method, then erases
the picture panel specific cursor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PictureUploadPolicy(wjhk.jupload2.context.JUploadContext juploadContext) throws JUploadException
juploadContext
- Reference to the current applet. Allows access to
javascript functions.
JUploadException
Method Detail |
---|
public FileData createFileData(File file, File root) 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).root
- An optional toplevel directory of a hierarchy (can be null).
PictureFileData
or null if file is not a
picture.
JUploadExceptionStopAddingFiles
- The exception is not really an
error. It allows an easy way to indicates that the applet
should stop adding files when the user clicked on the
'Cancel' button.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()
void setHighQualityPreview(boolean highQualityPreview)
highQualityPreview
- the highQualityPreview to setpublic int getMaxHeight()
void setMaxHeight(int maxHeight)
maxHeight
- the maxHeight to setpublic int getMaxWidth()
void setMaxWidth(int maxWidth)
maxWidth
- the maxWidth to setpublic float getPictureCompressionQuality()
void setPictureCompressionQuality(float pictureCompressionQuality)
pictureCompressionQuality
- The new value for picture compression.pictureCompressionQuality
public boolean getPictureTransmitMetadata()
void setPictureTransmitMetadata(boolean pictureTransmitMetadata)
pictureTransmitMetadata
- The new value for this attribute.pictureTransmitMetadata
public int getRealMaxHeight()
void setRealMaxHeight(int realMaxHeight)
realMaxHeight
- the realMaxHeight to setpublic int getRealMaxWidth()
void setRealMaxWidth(int realMaxWidth)
realMaxWidth
- the realMaxWidth to setpublic String getTargetPictureFormat()
public wjhk.jupload2.filedata.helper.ImageFileConversionInfo getImageFileConversionInfo()
void setTargetPictureFormat(String targetPictureFormat) throws JUploadException
targetPictureFormat
- the targetPictureFormat to set
JUploadException
- if the conversionList is erroneouspublic 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 tovoid setKeepOrigExtension(boolean keepOrigExtension) throws JUploadException
keepOrigExtension
- if the original file extension should be kept '
true
', or changed 'false
' (if the
image was converted)
JUploadException
public 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
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |