@Override protected void onPrepareResults(OrienteerDataTable<ODocument, String> table, OClass oClass, IModel<DisplayMode> modeModel) { table.addCommand(new EditODocumentsCommand(table, modeModel, oClass)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); } });
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { table.visitChildren(OrienteerDataTable.MetaContextItem.class, new IVisitor<OrienteerDataTable.MetaContextItem<ODocument, ?>, Void>() { @Override public void component(MetaContextItem<ODocument, ?> rowItem, IVisit<Void> visit) { ODocument doc = rowItem.getModelObject(); if(doc.isDirty()) { if(doc.getIdentity().isNew()) SaveODocumentCommand.realizeMandatory(doc); doc.save(); } visit.dontGoDeeper(); } }); if(forceCommit) { ODatabaseDocument db = getDatabase(); boolean active = db.getTransaction().isActive(); db.commit(); if(active) db.begin(); } super.onClick(targetOptional); }
table.addCommand(new SaveODocumentsCommand(table, modeModel).add(securityBehaviour)); table.addCommand(new CopyODocumentCommand(table, linkedClass).add(securityBehaviour)); table.addCommand(new DeleteODocumentCommand(table, linkedClass).add(securityBehaviour)); table.addCommand(new SaveODocumentsCommand(table, modeModel).add(securityBehaviour));
public OQueryModelResultsPanel(String id, OQueryModel<ODocument> queryModel) { super(id, queryModel); OClass oClass = queryModel.probeOClass(20); OQueryDataProvider<ODocument> provider = new OQueryDataProvider<>(queryModel); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); List<? extends IColumn<ODocument, String>> columns = oClassIntrospector.getColumnsFor(oClass, true, modeModel); GenericTablePanel<ODocument> tablePanel = new GenericTablePanel<ODocument>("tablePanel", columns, provider, 20); OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.addCommand(new EditODocumentsCommand(table, modeModel, oClass)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new DeleteODocumentCommand(table, oClass)); table.addCommand(new ExportCommand<>(table, new ResourceModel("sql.results"))); add(tablePanel); }
table.addCommand(new CreateEdgeCommand(new ResourceModel("command.create"),table, getModel()).setBootstrapType(BootstrapType.PRIMARY)); table.addCommand(new EditODocumentsCommand(table, modeModel, commonParent)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new DeleteEdgeCommand(table, getModel())); table.addCommand(new ExportCommand<>(table, new StringResourceModel("export.filename.edges", new ODocumentNameModel(model))));
@Override protected void onInitialize() { super.onInitialize(); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); String sql = "select expand(bothV()) from " + getModelObject().getIdentity(); OQueryDataProvider<ODocument> provider = new OQueryDataProvider<>(sql); OClass commonParent = provider.probeOClass(20); GenericTablePanel<ODocument> tablePanel = new GenericTablePanel<>("vertices", createColumns(commonParent, modeModel), provider, //setParameter does not work here 2 ); OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.addCommand(new EditODocumentsCommand(table, modeModel, commonParent)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new ExportCommand<>(table, new StringResourceModel("export.filename.vertices", new ODocumentNameModel(getModel())))); add(tablePanel); add(DisableIfDocumentNotSavedBehavior.INSTANCE, UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE); }
@SuppressWarnings("unchecked") public AbstractCalculatedDocumentsWidget(String id, IModel<T> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); final String sql = getSql(); GenericTablePanel<ODocument> tablePanel; if(!Strings.isEmpty(sql)) { OQueryDataProvider<ODocument> provider = newDataProvider(sql); OClass expectedClass = getExpectedClass(provider); if(expectedClass!=null) { oClassIntrospector.defineDefaultSorting(provider, expectedClass); List<? extends IColumn<ODocument, String>> columns = oClassIntrospector.getColumnsFor(expectedClass, true, modeModel); tablePanel = new GenericTablePanel<>("tablePanel", columns, provider, 20); OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.addCommand(new EditODocumentsCommand(table, modeModel, expectedClass)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new DeleteODocumentCommand(table, expectedClass)); table.addCommand(new ExportCommand<>(table, getTitleModel())); } else { tablePanel = new GenericTablePanel<>("tablePanel", new ResourceModel("error.class.not.defined")); } } else { tablePanel = new GenericTablePanel<>("tablePanel", new ResourceModel("error.query.not.defined")); } add(tablePanel); }
public GraphNeighborsWidget(String id, IModel<ODocument> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); OQueryDataProvider<ODocument> provider = new OQueryDataProvider<ODocument>("select expand(both().asSet()) from "+getModelObject().getIdentity()); OClass commonParent = provider.probeOClass(20); if(commonParent==null) commonParent = getSchema().getClass("V"); List<IColumn<ODocument, String>> columns = oClassIntrospector.getColumnsFor(commonParent, true, modeModel); GenericTablePanel<ODocument> tablePanel = new GenericTablePanel<ODocument>("neighbors", columns, provider, 20); OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.addCommand(new CreateVertexCommand(table, getModel())); table.addCommand(new CreateEdgeCommand(table, getModel())); table.addCommand(new UnlinkVertexCommand(table, getModel())); table.addCommand(new DeleteVertexCommand(table, getModel())); table.addCommand(new EditODocumentsCommand(table, modeModel, commonParent)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new ExportCommand<>(table, new StringResourceModel("export.filename.neighbors", new ODocumentNameModel(model)))); add(tablePanel); add(DisableIfDocumentNotSavedBehavior.INSTANCE,UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE); }
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); } }); }