...
2d. Content Editing Methods
Editing media content falls broadly into two categories at this time: editable text and uploaded files. Future work may include custom editors for specific media types (an equations editor, for example).
Editable Text
To add an editable text field, create a prompt in the Page tool message bundle and add code similar to the following:
Code Block | ||||
---|---|---|---|---|
| ||||
UIMessage.make(tofill, "edit-label", "st_plain_text_label");
String content = contentItem.getEditContent();
if ((content == null) && (contentItem.getId() != null)) {
byte[] bytes = contentItem.getContent();
content = new String (bytes);
}
UIInput.make(tofill, "edit-input-textarea", "#{uploaditem.content}", content);
|
This field can be used to either create and edit existing text, or allow information to be cut and pasted (typically XML, though not required).
Upload File
All support for uploading of files is already present in Sousa. To indicate that this element is based on an uploaded file, create a prompt in the Page tool message bundle and force the UIInput into existence as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
// Set up the file upload field.
UIMessage.make(tofill, "edit-label", "st_csv_file_label");
UIInput.make(tofill, "edit-input-file", null, "");
|
2e. Parameter Editing Methods
...