basicsPanel.add(basicsForm);
// operations
VerticalPanel operationsPanel = new VerticalPanel();
operationsPanel.setStyleName("fill-layout-width");
final Code code = new Code(Code.Language.JAVASCRIPT, false);
operationsPanel.add(code);
// form tabs
TabPanel forms = new TabPanel();
forms.setStyleName("default-tabpanel");
forms.add(basicsPanel, Console.CONSTANTS.common_label_attributes());
forms.add(operationsPanel, Console.CONSTANTS.common_label_operations());
forms.selectTab(0);
// update operations upon selection
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
code.clear();
AuditLogItem item = selectionModel.getSelectedObject();
if (item != null) {
JSONArray jsonArray = JSONParser.parseStrict(item.getOperations().getPayload()).isArray();
if (jsonArray != null) {
String stringify = stringify(jsonArray.getJavaScriptObject());
code.setValue(SafeHtmlUtils.fromString(stringify));
}
}
}
});