public abstract class Configurable<T> extends Object
setOption(String, Object)
method that will allow for a configuration option
to be set at any level.Constructor and Description |
---|
Configurable() |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.json.client.JSONObject |
getOptions()
Retrieve all of the options that have been configured for this instance
as a JSONObject.
|
T |
setOption(String path,
Object value)
Set an option on the object at any level, using "/" characters to designate which
level of option you'd like to set.
|
public T setOption(String path, Object value)
Uploader uploader = new Uploader();
uploader.setOption("/upload_url", "http://widgetcorp.com/uploads.php");
uploader.setOption("/post_params/post_param_name_1", "Photo Upload");
uploader.setOption("/post_params/post_param_name_2", "User 24");
Would result in initializing the SWFUpload component like the following:
new SWFUpload({
upload_url: "http://widgetcorp.com/uploads.php",
post_params: {
post_param_name_1: "Photo Upload",
post_param_name_2: "User 24"
}
});
Note that the beginning "/" is optional, so uploader.setOption("/thing", "piglet")
is
equivalent to uploader.setOption("thing", "piglet")
.
For details on available options see the SWFUpload reference.
Important note: this method is only intended to support additional options of the SWFUpload API
that may not have explicit wrapper methods available in the GWT Uploader API. For all of the standard
configuration options it is important to use the appropriate setter methods instead in order
for the Ajax/DOM implementation to function properly as well. E.g. instead of doing this:
uploader.setOption("upload_url", "http://widgetcorp.com/uploads.php");
Do this instead:
uploader.setUploadURL("http://widgetcorp.com/uploads.php");
path
- The path to the option to set (e.g. "/title/text");value
- The value to set for the option (can be a String, Number, Boolean, or JSONObject)Configurable
instance for convenient method chaining.public com.google.gwt.json.client.JSONObject getOptions()
Copyright © 2016. All Rights Reserved.