public class DefaultJUploadContext extends Object implements JUploadContext
JUploadPanel
, which contains the real code, and
some technical stuff that depend on the technical context (mainly applet or stand alone application). UploadPolicy
. This class should not be changed, in order
to remain compatible with next JUpload releases. JUploadContext
interface are implemented. Those who actually can't be coded here, just
generate a UnsupportedOperationException exception.Constructor and Description |
---|
DefaultJUploadContext() |
Modifier and Type | Method and Description |
---|---|
void |
displayDebug(String debug,
int minDebugLevel)
|
void |
displayErr(String err)
|
void |
displayInfo(String info)
Call to
UploadPolicy.displayInfo(String) |
void |
displayURL(String url,
boolean success)
Just throws a UnsupportedOperationException exception.
|
void |
displayWarn(String warn)
Call to
UploadPolicy.displayWarn(String) |
JApplet |
getApplet()
Just throws a UnsupportedOperationException exception.
|
String |
getBuildDate() |
int |
getBuildNumber() |
Cursor |
getCursor()
Just throws a UnsupportedOperationException exception.
|
String |
getDetailedVersionMessage() |
Frame |
getFrame()
Returns the current frame.
|
String |
getLastModified() |
JUploadTextArea |
getLogWindow()
Retrieves the current log window of this applet.
|
String |
getMimeType(String fileExtension)
Returns the mime type associated with the given file extension.
|
boolean |
getParameter(String key,
boolean def)
Just throws a UnsupportedOperationException exception.
|
FilePanel.FileListViewMode |
getParameter(String key,
FilePanel.FileListViewMode def)
Just throws a UnsupportedOperationException exception.
|
float |
getParameter(String key,
float def)
Just throws a UnsupportedOperationException exception.
|
int |
getParameter(String key,
int def)
Just throws a UnsupportedOperationException exception.
|
long |
getParameter(String key,
long def)
Just throws a UnsupportedOperationException exception.
|
String |
getParameter(String key,
String def)
Just throws a UnsupportedOperationException exception.
|
static Properties |
getSvnProperties()
Helper function, to get the Revision number, if available.
|
String |
getSvnRevision() |
JUploadPanel |
getUploadPanel()
Retrieves the current upload panel.
|
UploadPolicy |
getUploadPolicy()
Retrieves the current upload policy.
|
String |
getVersion() |
void |
init(Frame frame,
RootPaneContainer rootPaneContainer)
Reaction on the start of the applet: creation of each specific item of the GUI, and the upload policy.
|
String |
normalizeURL(String url)
Just throws a UnsupportedOperationException exception.
|
boolean |
parseBoolean(String value,
boolean def)
This function try to parse value as a boolean.
|
FilePanel.FileListViewMode |
parseFileListViewMode(String value,
FilePanel.FileListViewMode def)
This function try to parse value as a
FilePanel.FileListViewMode . |
float |
parseFloat(String value,
float def)
This function try to parse value as a float number.
|
int |
parseInt(String value,
int def)
This function try to parse value as an integer.
|
long |
parseLong(String value,
long def)
This function try to parse value as a Long.
|
void |
readCookieFromNavigator(Vector<String> headers)
Just throws a UnsupportedOperationException exception.
|
void |
readUserAgentFromNavigator(Vector<String> headers)
Just throws a UnsupportedOperationException exception.
|
void |
registerUnload(Object object,
String method)
Register a callback to be executed during applet termination.
|
void |
runUnload()
Runs all callback that must be called when releasing the applet.
|
Cursor |
setCursor(Cursor cursor)
Just throws a UnsupportedOperationException exception.
|
void |
setProperty(String prop,
String value)
This allow runtime modifications of properties, from javascript.
|
Cursor |
setWaitCursor()
Sets the wait cursor on the current application (applet, executable...).
|
void |
showStatus(String status)
Just throws a UnsupportedOperationException exception.
|
String |
startUpload()
Public method that can be called by Javascript to start upload
|
void |
unload()
This method is called when the applet is unloaded (actually, when it is stopped). it is registered as a callback
in the
init(Frame, RootPaneContainer) , here above. |
public void init(Frame frame, RootPaneContainer rootPaneContainer)
JUploadContextApplet
needs to have set theApplet, to be able to properly execute some method calls that are in the init() method. So
we can not do this initialization in the constructor of DefaultJUploadContext.frame
- The frame that contains the application. Mainly used to attached modal dialog.rootPaneContainer
- The mother window (JApplet, JFrame...), which contains the rootPaneContainer. Used to
set the JUploadPanel
in it.public void unload()
init(Frame, RootPaneContainer)
, here above.public String getDetailedVersionMessage()
getDetailedVersionMessage
in interface JUploadContext
public String getVersion()
getVersion
in interface JUploadContext
public String getSvnRevision()
getSvnRevision
in interface JUploadContext
public String getLastModified()
getLastModified
in interface JUploadContext
public String getBuildDate()
getBuildDate
in interface JUploadContext
public int getBuildNumber()
getBuildNumber
in interface JUploadContext
public JUploadTextArea getLogWindow()
getLogWindow
in interface JUploadContext
JUploadPanel.showOrHideLogWindow()
public String getMimeType(String fileExtension)
getMimeType
in interface JUploadContext
fileExtension
- The file extension, in any case.public JUploadPanel getUploadPanel()
getUploadPanel
in interface JUploadContext
public UploadPolicy getUploadPolicy() throws JUploadException
getUploadPolicy
in interface JUploadContext
JUploadException
public void setProperty(String prop, String value)
setProperty
in interface JUploadContext
prop
- The property name that must be set.value
- The value of this property.public String startUpload()
startUpload
in interface JUploadContext
JavascriptHandler
javadoc.public void displayErr(String err)
err
- The error text to be displayed.public void displayInfo(String info)
UploadPolicy.displayInfo(String)
info
- The info text to displaypublic void displayWarn(String warn)
UploadPolicy.displayWarn(String)
warn
- The error text to be displayed.public void displayDebug(String debug, int minDebugLevel)
debug
- The debug message.minDebugLevel
- The minimum level that debug level should have, to display this message. Values can go from
0 to 100.public static Properties getSvnProperties()
public void registerUnload(Object object, String method)
registerUnload
in interface JUploadContext
object
- The Object instance to be registeredmethod
- The Method of that object to be registered. The method must be of type void and must not take any
parameters and must be public.public void runUnload()
runUnload
in interface JUploadContext
public int parseInt(String value, int def)
parseInt
in interface JUploadContext
value
- The string value, that must be parseddef
- The default valuepublic float parseFloat(String value, float def)
parseFloat
in interface JUploadContext
value
- The string value, that must be parseddef
- The default valuepublic long parseLong(String value, long def)
parseLong
in interface JUploadContext
value
- The string value, that must be parseddef
- The default valuepublic boolean parseBoolean(String value, boolean def)
parseBoolean
in interface JUploadContext
value
- The new value for this property. If invalid, the default value is used.def
- The default value: used if value is invalid.public FilePanel.FileListViewMode parseFileListViewMode(String value, FilePanel.FileListViewMode def)
FilePanel.FileListViewMode
. If value is not a correct
FilePanel.FileListViewMode
, a warning is logged, and def is returned.parseFileListViewMode
in interface JUploadContext
value
- The new value for this property. If invalid, the default value is used.def
- The default value: used if value is invalid.FilePanel.FileListViewMode
value of value, or def if value is not a valid
FilePanel.FileListViewMode
.public Cursor setWaitCursor()
JUploadContext
setWaitCursor
in interface JUploadContext
JUploadContext.setCursor(Cursor)
public void displayURL(String url, boolean success)
displayURL
in interface JUploadContext
url
- success
- public JApplet getApplet()
getApplet
in interface JUploadContext
public Frame getFrame()
JUploadContext
getFrame
in interface JUploadContext
JUploadContext.getFrame()
public Cursor getCursor()
getCursor
in interface JUploadContext
UploadPolicy.setCursor(Cursor)
public String getParameter(String key, String def)
getParameter
in interface JUploadContext
key
- def
- public int getParameter(String key, int def)
getParameter
in interface JUploadContext
key
- def
- public float getParameter(String key, float def)
getParameter
in interface JUploadContext
key
- def
- public long getParameter(String key, long def)
getParameter
in interface JUploadContext
key
- def
- public boolean getParameter(String key, boolean def)
getParameter
in interface JUploadContext
key
- def
- public FilePanel.FileListViewMode getParameter(String key, FilePanel.FileListViewMode def)
getParameter
in interface JUploadContext
key
- def
- public String normalizeURL(String url) throws JUploadException
normalizeURL
in interface JUploadContext
url
- JUploadException
public void readCookieFromNavigator(Vector<String> headers)
readCookieFromNavigator
in interface JUploadContext
headers
- public void readUserAgentFromNavigator(Vector<String> headers)
readUserAgentFromNavigator
in interface JUploadContext
headers
- public Cursor setCursor(Cursor cursor)
setCursor
in interface JUploadContext
cursor
- UploadPolicy.setCursor(Cursor)
public void showStatus(String status)
showStatus
in interface JUploadContext
status
- Copyright © 2015. All rights reserved.