use of org.jowidgets.cap.ui.api.model.IDataModel in project jo-client-platform by jo-source.
the class BeanRelationTreeModelImpl method clear.
@Override
public void clear() {
root.clear();
for (final Object relationModelObject : relationNodes.values()) {
final IBeanRelationNodeModel<?, ?> relationModel = (IBeanRelationNodeModel<?, ?>) relationModelObject;
relationModel.dispose();
}
for (final IDataModel dataModel : externalDataModels) {
dataModel.clear();
}
relationNodes.clear();
if (selection != null && !selection.getSelection().isEmpty()) {
setSelection(null);
}
}
use of org.jowidgets.cap.ui.api.model.IDataModel in project jo-client-platform by jo-source.
the class BeanRelationTreeModelImpl method load.
@Override
public void load() {
clear();
root.load();
for (final IDataModel dataModel : externalDataModels) {
dataModel.load();
}
}
use of org.jowidgets.cap.ui.api.model.IDataModel in project jo-client-platform by jo-source.
the class AbstractDataModelCommand method checkEnabledState.
private void checkEnabledState() {
if (dataModels.size() == 0) {
enabledChecker.setEnabledState(NO_DATA_NODE_STATE.get());
return;
} else {
for (final IDataModel dataModel : dataModels) {
final IEnabledState vetoEnabledState = getVetoEnabledState(dataModel);
if (!vetoEnabledState.isEnabled()) {
enabledChecker.setEnabledState(vetoEnabledState);
return;
}
}
for (final IDataModel dataModel : dataModels) {
final IEnabledState enabledState = getEnabledState(dataModel);
if (enabledState.isEnabled()) {
enabledChecker.setEnabledState(EnabledState.ENABLED);
return;
}
enabledChecker.setEnabledState(enabledState);
}
}
}
use of org.jowidgets.cap.ui.api.model.IDataModel in project jo-client-platform by jo-source.
the class DataModelContextImpl method permitChangeAsync.
@Override
public void permitChangeAsync(final IChangeResponse changeRespose, final ICallback<Boolean> callback) {
Assert.paramHasType(changeRespose, ChangeResponseImpl.class, "changeRespose");
final ChangeResponseImpl changeResponseImpl = (ChangeResponseImpl) changeRespose;
final DataModelChangeType changeType = changeResponseImpl.getChangeType();
final Set<IDataModel> relevantModels = getRelevantModels(changeType);
if (hasInvalidChanged(relevantModels)) {
if (shouldDataBeRefused()) {
for (final IDataModel model : relevantModels) {
model.undo();
}
callback.call(Boolean.TRUE);
hasAsyncRequest = false;
return;
} else {
callback.call(Boolean.FALSE);
hasAsyncRequest = false;
return;
}
} else if (hasChanged(relevantModels)) {
final QuestionResult questionResult = shouldDataBeSaved();
if (QuestionResult.YES == questionResult) {
// do the save
doSave(changeResponseImpl, callback);
return;
}
if (QuestionResult.CANCEL == questionResult) {
// to not permit in case of cancel
callback.call(Boolean.FALSE);
hasAsyncRequest = false;
return;
} else {
// do not save, do refuse, in this case permit the change
for (final IDataModel model : relevantModels) {
model.undo();
}
callback.call(Boolean.TRUE);
hasAsyncRequest = false;
return;
}
}
hasAsyncRequest = false;
}
use of org.jowidgets.cap.ui.api.model.IDataModel in project jo-client-platform by jo-source.
the class BeanRelationTreeModelImpl method cancelExecutions.
@Override
public void cancelExecutions() {
root.cancelExecutions();
for (final Object relationModelObject : relationNodes.values()) {
final IBeanRelationNodeModel<?, ?> relationModel = (IBeanRelationNodeModel<?, ?>) relationModelObject;
relationModel.cancelExecutions();
}
for (final IDataModel dataModel : externalDataModels) {
dataModel.cancelExecutions();
}
}
Aggregations