|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.smartgwt.client.core.JsObject
com.smartgwt.client.core.DataClass
com.smartgwt.client.core.RefDataClass
com.smartgwt.client.widgets.form.fields.FormItem
com.smartgwt.client.widgets.form.fields.CanvasItem
com.smartgwt.client.widgets.form.fields.FileItem
public class FileItem
Binary data interface for use in DynamicForms. Allows users to select a single file for upload. In read-only mode (canEdit:false) displays the contents of "imageFile" fields.
Editable mode
See the Upload Overview for information on using this control.
Read-only mode
Displays one of two UIs, according to the value of showFileInline. If showFileInline is false, this
Item displays the View and Download icons and the filename. Otherwise, it streams the image-file and displays it
inline.
Upload overview and related methods| Field Summary |
|---|
| Fields inherited from class com.smartgwt.client.core.JsObject |
|---|
jsObj |
| Constructor Summary | |
|---|---|
FileItem()
|
|
FileItem(JavaScriptObject jsObj)
|
|
FileItem(String name)
|
|
FileItem(String name,
String title)
|
|
| Method Summary | |
|---|---|
Boolean |
getMultiple()
When true, allow the file-selection dialog shelled by the browser to select multiple files. |
static FileItem |
getOrCreateRef(JavaScriptObject jsObj)
|
Boolean |
getShowFileInline()
Indicates whether to stream the image and display it inline or to display the View and Download icons. |
void |
setJavaScriptObject(JavaScriptObject jsObj)
|
void |
setMultiple(Boolean multiple)
When true, allow the file-selection dialog shelled by the browser to select multiple files. |
void |
setShowFileInline(Boolean showFileInline)
Indicates whether to stream the image and display it inline or to display the View and Download icons. |
| Methods inherited from class com.smartgwt.client.widgets.form.fields.CanvasItem |
|---|
addShowValueHandler, createCanvas, getApplyPromptToCanvas, getAutoDestroy, getCanvas, getEditCriteriaInInnerForm, getOverflow, getPrompt, getShouldSaveValue, hasAdvancedCriteria, setApplyPromptToCanvas, setAutoDestroy, setCanEditCriterionPredicate, setCanvas, setCriterionGetter, setCriterionSetter, setEditCriteriaInInnerForm, setOverflow, setPrompt, setShouldSaveValue, setupCanvasConstructor, storeValue, storeValue, storeValue |
| Methods inherited from class com.smartgwt.client.core.RefDataClass |
|---|
getRef, getRef |
| Methods inherited from class com.smartgwt.client.core.DataClass |
|---|
doAddHandler, fireEvent, getAttributeAsDoubleArray, getAttributeAsIntArray, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute |
| Methods inherited from class com.smartgwt.client.core.JsObject |
|---|
setJsObj |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Constructor Detail |
|---|
public FileItem()
public FileItem(JavaScriptObject jsObj)
public FileItem(String name)
public FileItem(String name,
String title)
| Method Detail |
|---|
public static FileItem getOrCreateRef(JavaScriptObject jsObj)
public void setJavaScriptObject(JavaScriptObject jsObj)
setJavaScriptObject in class CanvasItempublic void setMultiple(Boolean multiple)
Support is not full-cycle at the server - that is, there are server APIs for retrieving each file that was uploaded, but no built-in support for storing multiple files against a single DataSource field. However, you can write custom server DMI code to do something with the files - for instance, you could create multiple new DataSource records for each file via a server DMI like this below:
String fileNameStr = (String)dsRequest.getValues().get("image_filename").toString();
String[] fileNames = fileNameStr.split(", ");
List files = dsRequest.getUploadedFiles();
for (int i = 0; i < files.size(); i++) {
ISCFileItem file = (ISCFileItem)files.get(i);
InputStream fileData = file.getInputStream();
DSRequest inner = new DSRequest("mediaLibrary", "add");
Map values = new HashMap();
values.put("title", dsRequest.getValues().get("title"));
values.put("image", fileData);
values.put("image_filename", fileNames[i]);
values.put("image_filesize", file.getSize());
values.put("image_date_created", new Date());
inner.setValues(values);
inner.execute();
}
DSResponse dsResponse = new DSResponse();
dsResponse.setStatus(0);
return dsResponse;
multiple - multiple Default value is truepublic Boolean getMultiple()
Support is not full-cycle at the server - that is, there are server APIs for retrieving each file that was uploaded, but no built-in support for storing multiple files against a single DataSource field. However, you can write custom server DMI code to do something with the files - for instance, you could create multiple new DataSource records for each file via a server DMI like this below:
String fileNameStr = (String)dsRequest.getValues().get("image_filename").toString();
String[] fileNames = fileNameStr.split(", ");
List files = dsRequest.getUploadedFiles();
for (int i = 0; i < files.size(); i++) {
ISCFileItem file = (ISCFileItem)files.get(i);
InputStream fileData = file.getInputStream();
DSRequest inner = new DSRequest("mediaLibrary", "add");
Map values = new HashMap();
values.put("title", dsRequest.getValues().get("title"));
values.put("image", fileData);
values.put("image_filename", fileNames[i]);
values.put("image_filesize", file.getSize());
values.put("image_date_created", new Date());
inner.setValues(values);
inner.execute();
}
DSResponse dsResponse = new DSResponse();
dsResponse.setStatus(0);
return dsResponse;
public void setShowFileInline(Boolean showFileInline)
showFileInline - showFileInline Default value is nullpublic Boolean getShowFileInline()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||