public void setModified(boolean modified) { ((DatasourceImplementation) datasource).setModified(modified); }
@Override @SuppressWarnings("unchecked") public void actionPerform(Component component) { Map<String, Object> editorParams = new HashMap<>(); editorParams.put("metaClass", entityMeta.getName()); editorParams.put("autocommit", Boolean.FALSE); MetaProperty inverseProperty = metaProperty.getInverse(); if (inverseProperty != null) { editorParams.put("parentProperty", inverseProperty.getName()); } editorParams.put("parent", item); if (metaProperty.getType() == MetaProperty.Type.COMPOSITION) { editorParams.put("parentDs", entitiesDs); } Editor editor = (Editor) openWindow("entityInspector.edit", OPEN_TYPE, editorParams); editor.addCloseListener(actionId -> { if (COMMIT_ACTION_ID.equals(actionId) && metaProperty.getType() == MetaProperty.Type.ASSOCIATION) { boolean modified = entitiesDs.isModified(); entitiesDs.addItem(editor.getItem()); ((DatasourceImplementation) entitiesDs).setModified(modified); } }); } }
protected void handleEditorCommit(Entity editorItem, Entity rowItem, String columnId) { MetaPropertyPath mpp = rowItem.getMetaClass().getPropertyPath(columnId); if (mpp == null) { throw new IllegalStateException(String.format("Unable to find metaproperty %s for class %s", columnId, rowItem.getMetaClass())); } if (mpp.getRange().isClass()) { DatasourceImplementation ds = ((DatasourceImplementation) table.getDatasource()); boolean modifiedInTable = ds.getItemsToUpdate().contains(rowItem); boolean ownerDsModified = ds.isModified(); rowItem.setValueEx(columnId, null); rowItem.setValueEx(columnId, editorItem); // restore modified for owner datasource // remove from items to update if it was not modified before setValue if (!modifiedInTable) { ds.getItemsToUpdate().remove(rowItem); } ds.setModified(ownerDsModified); } else { //noinspection unchecked table.getDatasource().updateItem(editorItem); } }
protected void subscribeCreateActionCloseHandler(CreateAction createAction) { createAction.setAfterWindowClosedHandler(((window, closeActionId) -> { if (!COMMIT_ACTION_ID.equals(closeActionId)) { Report newReport = (Report) ((Editor) window).getItem(); if (!PersistenceHelper.isNew(newReport)) { DataSupplier dataSupplier = getDsContext().getDataSupplier(); Report reloadedReport = dataSupplier.reload(newReport, reportDs.getView()); boolean modified = reportDs.isModified(); reportDs.addItem(reloadedReport); ((DatasourceImplementation) reportDs).setModified(modified); } } })); } }
((DatasourceImplementation) masterDs).setModified(isModified); } else { if (parentItem != null) {
/** * Sets value to the component without triggering change listeners for ContainerValueSource and without changing * a modify state of Datasource. * * @param item value */ protected void setValueSilently(V item) { boolean modified = false; if (getDatasource() != null) { modified = getDatasource().isModified(); } else { ((ContainerValueSource) getValueSource()).getContainer().mute(); } setValue(item); if (getDatasource() != null) { ((DatasourceImplementation) getDatasource()).setModified(modified); } else { ((ContainerValueSource) getValueSource()).getContainer().unmute(); } }
((DatasourceImplementation) userDs).setModified(true) ); } else { ((DatasourceImplementation) userDs).setModified(true) ); } else {
boolean modified = filesDs.isModified(); filesDs.addItem(fdesc); ((DatasourceImplementation) filesDs).setModified(modified);
ownerDs.getItemsToUpdate().remove(getDatasource().getItem()); ownerDs.setModified(ownerDsModified); } else if (ownerCollectionCont != null) { ownerCollectionCont.unmute();
((DatasourceImplementation) ds).setModified(false);