_subjectField = new EditField("Subject:", "");
add(_subjectField);
_messageField = new EditField("Message:", "");
add(_messageField);
add(new SeparatorField());
final LabelField attachmentText = new LabelField("Attachments");
add(attachmentText);
// Create table components
_view = new TableView(_app.getMessageParts());
final TableController controller =
new TableController(_app.getMessageParts(), _view);
controller.setFocusPolicy(TableController.ROW_FOCUS);
_view.setController(controller);
// Set the highlight style for the view
_view.setDataTemplateFocus(BackgroundFactory
.createLinearGradientBackground(Color.LIGHTBLUE,
Color.LIGHTBLUE, Color.BLUE, Color.BLUE));
// Create a data template that will format the model data as an array of
// LabelFields
final DataTemplate dataTemplate = new DataTemplate(_view, 1, 1) {
public Field[] getDataFields(final int modelRowIndex) {
final MessagePart message =
(MessagePart) _app.getMessageParts().getRow(
modelRowIndex);
final Field[] fields =
{ new LabelField(message.getContentLocation(),
Field.NON_FOCUSABLE | DrawStyle.ELLIPSIS) };
return fields;
}
};