|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wjhk.jupload2.context.DefaultJUploadContext
public class DefaultJUploadContext
The Jupload Context. One such context is created at run time. It can be the
Applet, or the 'main' class, depending on the launch type.
It contains the call to the creation of the
JUploadPanel
, which contains the real code, and
some technical stuff that depend on the technical context (mainly applet or
stand alone application).
The functional control of JUpload is done by using UploadPolicy
. This
class should not be changed, in order to remain compatible with next JUpload
releases.
Technical note: This class should be abstract. But it is used by the
build.xml file, to load the version. So all methods of the
JUploadContext
interface are implemented. Those who actually can't be
coded here, just generate a UnsupportedOperationException exception.
Nested Class Summary | |
---|---|
private static class |
DefaultJUploadContext.Callback
This class represent the Callback method. |
Field Summary | |
---|---|
private JavascriptHandler |
jsHandler
variable to hold reference to JavascriptHandler object |
private JUploadPanel |
jUploadPanel
The JUploadPanel, which actually contains all the applet components. |
private JUploadTextArea |
logWindow
The log messages should go there ... |
private java.util.Properties |
mimeTypesProperties
the mime type list, coming from: http://www.mimetype.org/ Thanks to them! |
private static java.lang.String |
RELEASE_VERSION
The version of this applet. |
private java.util.Properties |
svnProperties
The properties, created at build time, by the build.xml ant file. |
private static java.lang.String |
svnPropertiesFilename
The final that contains the SVN properties. |
private java.util.Vector<DefaultJUploadContext.Callback> |
unloadCallbacks
All registered callbacks. |
protected UploadPolicy |
uploadPolicy
The current upload policy. |
Constructor Summary | |
---|---|
DefaultJUploadContext()
|
Method Summary | |
---|---|
void |
displayDebug(java.lang.String debug,
int minDebugLevel)
Call to UploadPolicy.displayDebug(String, int) |
(package private) void |
displayDebugParameterValue(java.lang.String key,
java.lang.String value)
Displays the debug information for the current parameter. |
void |
displayErr(java.lang.String err)
Call to UploadPolicy.displayErr(Exception) |
void |
displayInfo(java.lang.String info)
Call to UploadPolicy.displayInfo(String) |
void |
displayURL(java.lang.String url,
boolean success)
Just throws a UnsupportedOperationException exception. |
void |
displayWarn(java.lang.String warn)
Call to UploadPolicy.displayWarn(String) |
javax.swing.JApplet |
getApplet()
Just throws a UnsupportedOperationException exception. |
java.lang.String |
getBuildDate()
|
int |
getBuildNumber()
|
java.awt.Cursor |
getCursor()
Just throws a UnsupportedOperationException exception. |
java.lang.String |
getLastModified()
|
JUploadTextArea |
getLogWindow()
Retrieves the current log window of this applet. |
java.lang.String |
getMimeType(java.lang.String fileExtension)
Returns the mime type associated with the given file extension. |
boolean |
getParameter(java.lang.String key,
boolean def)
Just throws a UnsupportedOperationException exception. |
float |
getParameter(java.lang.String key,
float def)
Just throws a UnsupportedOperationException exception. |
int |
getParameter(java.lang.String key,
int def)
Just throws a UnsupportedOperationException exception. |
long |
getParameter(java.lang.String key,
long def)
Just throws a UnsupportedOperationException exception. |
java.lang.String |
getParameter(java.lang.String key,
java.lang.String def)
Just throws a UnsupportedOperationException exception. |
static java.util.Properties |
getSvnProperties()
Helper function, to get the Revision number, if available. |
JUploadPanel |
getUploadPanel()
Retrieves the current upload panel. |
UploadPolicy |
getUploadPolicy()
Retrieves the current upload policy. |
java.lang.String |
getVersion()
|
void |
init(javax.swing.RootPaneContainer rootPaneContainer)
Reaction on the start of the applet: creation of each specific item of the GUI, and the upload policy. |
static void |
main(java.lang.String[] args)
Helper function for ant build to retrieve the current version. |
java.lang.String |
normalizeURL(java.lang.String url)
Just throws a UnsupportedOperationException exception. |
boolean |
parseBoolean(java.lang.String value,
boolean def)
This function try to parse value as a boolean. |
float |
parseFloat(java.lang.String value,
float def)
This function try to parse value as a float number. |
int |
parseInt(java.lang.String value,
int def)
This function try to parse value as an integer. |
long |
parseLong(java.lang.String value,
long def)
This function try to parse value as a Long. |
void |
readCookieFromNavigator(java.util.Vector<java.lang.String> headers)
Just throws a UnsupportedOperationException exception. |
void |
readUserAgentFromNavigator(java.util.Vector<java.lang.String> headers)
Just throws a UnsupportedOperationException exception. |
void |
registerUnload(java.lang.Object o,
java.lang.String method)
Register a callback to be executed during applet termination. |
void |
runUnload()
Runs all callback that must be called when releasing the applet. |
java.awt.Cursor |
setCursor(java.awt.Cursor cursor)
Just throws a UnsupportedOperationException exception. |
void |
setProperty(java.lang.String prop,
java.lang.String value)
This allow runtime modifications of properties, from javascript. |
java.awt.Cursor |
setWaitCursor()
Sets the wait cursor on the current application (applet, executable...). |
void |
showStatus(java.lang.String status)
Just throws a UnsupportedOperationException exception. |
java.lang.String |
startUpload()
Public method that can be called by Javascript to start upload |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String svnPropertiesFilename
private java.util.Properties svnProperties
private JavascriptHandler jsHandler
private java.util.Properties mimeTypesProperties
private static final java.lang.String RELEASE_VERSION
protected UploadPolicy uploadPolicy
private JUploadPanel jUploadPanel
private JUploadTextArea logWindow
private java.util.Vector<DefaultJUploadContext.Callback> unloadCallbacks
DefaultJUploadContext.Callback
Constructor Detail |
---|
public DefaultJUploadContext()
Method Detail |
---|
public void init(javax.swing.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.
rootPaneContainer
- The mother window (JApplet, JFrame...), which
contains the rootPaneContainer. Used to set the
JUploadPanel
in it.public java.lang.String getVersion()
getVersion
in interface JUploadContext
public java.lang.String getLastModified()
getLastModified
in interface JUploadContext
public java.lang.String getBuildDate()
getBuildDate
in interface JUploadContext
public int getBuildNumber()
getBuildNumber
in interface JUploadContext
public JUploadTextArea getLogWindow()
getLogWindow
in interface JUploadContext
JUploadPanel.showOrHideLogWindow()
public java.lang.String getMimeType(java.lang.String fileExtension)
getMimeType
in interface JUploadContext
fileExtension
- The file extension, in any case.
public JUploadPanel getUploadPanel()
getUploadPanel
in interface JUploadContext
public UploadPolicy getUploadPolicy()
getUploadPolicy
in interface JUploadContext
public void setProperty(java.lang.String prop, java.lang.String value)
setProperty
in interface JUploadContext
prop
- The property name that must be set.value
- The value of this property.public java.lang.String startUpload()
startUpload
in interface JUploadContext
JavascriptHandler
javadoc.public void displayErr(java.lang.String err)
UploadPolicy.displayErr(Exception)
err
- The error text to be displayed.public void displayInfo(java.lang.String info)
UploadPolicy.displayInfo(String)
info
- The info text to displaypublic void displayWarn(java.lang.String warn)
UploadPolicy.displayWarn(String)
warn
- The error text to be displayed.public void displayDebug(java.lang.String debug, int minDebugLevel)
UploadPolicy.displayDebug(String, int)
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 void main(java.lang.String[] args)
args
- Standard argument for main method. Not used.public static java.util.Properties getSvnProperties()
public void registerUnload(java.lang.Object o, java.lang.String method)
registerUnload
in interface JUploadContext
o
- 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
void displayDebugParameterValue(java.lang.String key, java.lang.String value)
public int parseInt(java.lang.String value, int def)
parseInt
in interface JUploadContext
value
- The string value, that must be parseddef
- The default value
public float parseFloat(java.lang.String value, float def)
parseFloat
in interface JUploadContext
value
- The string value, that must be parseddef
- The default value
public long parseLong(java.lang.String value, long def)
parseLong
in interface JUploadContext
value
- The string value, that must be parseddef
- The default value
public boolean parseBoolean(java.lang.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 java.awt.Cursor setWaitCursor()
JUploadContext
setWaitCursor
in interface JUploadContext
JUploadContext.setCursor(Cursor)
public void displayURL(java.lang.String url, boolean success)
displayURL
in interface JUploadContext
url
- success
- public javax.swing.JApplet getApplet()
getApplet
in interface JUploadContext
public java.awt.Cursor getCursor()
getCursor
in interface JUploadContext
UploadPolicy.setCursor(Cursor)
public java.lang.String getParameter(java.lang.String key, java.lang.String def)
getParameter
in interface JUploadContext
key
- def
-
public int getParameter(java.lang.String key, int def)
getParameter
in interface JUploadContext
key
- def
-
public float getParameter(java.lang.String key, float def)
getParameter
in interface JUploadContext
key
- def
-
public long getParameter(java.lang.String key, long def)
getParameter
in interface JUploadContext
key
- def
-
public boolean getParameter(java.lang.String key, boolean def)
getParameter
in interface JUploadContext
key
- def
-
public java.lang.String normalizeURL(java.lang.String url) throws JUploadException
normalizeURL
in interface JUploadContext
url
-
JUploadException
public void readCookieFromNavigator(java.util.Vector<java.lang.String> headers)
readCookieFromNavigator
in interface JUploadContext
headers
- public void readUserAgentFromNavigator(java.util.Vector<java.lang.String> headers)
readUserAgentFromNavigator
in interface JUploadContext
headers
- public java.awt.Cursor setCursor(java.awt.Cursor cursor)
setCursor
in interface JUploadContext
cursor
-
UploadPolicy.setCursor(Cursor)
public void showStatus(java.lang.String status)
showStatus
in interface JUploadContext
status
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |