public ListAllODocumentsWidget(String id, IModel<OClass> model,
IModel<ODocument> widgetDocumentModel) {
super(id, model, widgetDocumentModel);
IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel();
String className = getModelObject().getName();
String sql = "select from " + className;
OQueryDataProvider<ODocument> provider = new OQueryDataProvider<>(sql);
oClassIntrospector.defineDefaultSorting(provider, getModelObject());
GenericTablePanel<ODocument> tablePanel =
new GenericTablePanel<>("tablePanel", oClassIntrospector.getColumnsFor(getModelObject(), true, modeModel), provider, 20);
final OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable();
table.getCommandsToolbar().setDefaultModel(getModel());
table.addCommand(new CreateODocumentCommand(table, getModel()));
table.addCommand(new EditODocumentsCommand(table, modeModel, getModel()));
table.addCommand(new SaveODocumentsCommand(table, modeModel));
table.addCommand(new CopyODocumentCommand(table, getModel()));
table.addCommand(new DeleteODocumentCommand(table, getModel()));
table.addCommand(new ExportCommand<>(table, new PropertyModel<String>(model, "name")));
add(tablePanel);
add(UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE);
addCommand(new BookmarkablePageLinkCommand<OClass>(newCommandId(), "command.gotoClass", OClassPage.class) {
@Override
public PageParameters getPageParameters() {
return OClassPage.preparePageParameters(ListAllODocumentsWidget.this.getModelObject(), DisplayMode.VIEW);
}
});
}