use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.
the class SchemaVM method cancelChangesToEditedNodeInPopUp.
@GlobalCommand
public void cancelChangesToEditedNodeInPopUp(@ContextParam(ContextType.BINDER) Binder binder) {
Component nodeFormContainer = getNodeEditorForm();
NodeDefinitionVM<?> vm = ComponentUtil.getViewModel(nodeFormContainer);
vm.undoLastChanges();
closeNodeEditPopUp();
}
use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.
the class SurveySelectVM method closeSurveyImportPopUp.
@GlobalCommand
public void closeSurveyImportPopUp(@BindingParam("successfullyImported") Boolean successfullyImported) {
Binder binder = null;
if (surveyImportPopUp != null) {
binder = ComponentUtil.getBinder(surveyImportPopUp);
SurveyImportVM vm = (SurveyImportVM) binder.getViewModel();
vm.reset();
}
closePopUp(surveyImportPopUp);
surveyImportPopUp = null;
if (successfullyImported != null && successfullyImported.booleanValue()) {
reloadSurveySummaries(binder);
}
}
use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.
the class SurveySelectVM method updateSurveyList.
@GlobalCommand
public void updateSurveyList() {
if (surveyImportPopUp != null || jobStatusPopUp != null) {
// skip survey list update
return;
}
try {
List<SurveySummary> newSummaries = loadSurveySummaries(null);
if (summaries == null) {
summaries = newSummaries;
} else {
for (SurveySummary newSummary : newSummaries) {
SurveySummary oldSummary = findSummary(newSummary.getId(), newSummary.isPublished(), newSummary.isTemporary());
if (oldSummary == null) {
// TODO handle this??
} else {
oldSummary.setRecordValidationProcessStatus(newSummary.getRecordValidationProcessStatus());
BindUtils.postNotifyChange(null, null, oldSummary, "recordValidationProgressStatus");
BindUtils.postNotifyChange(null, null, oldSummary, "recordValidationInProgress");
BindUtils.postNotifyChange(null, null, oldSummary, "recordValidationProgressPercent");
}
}
}
} catch (Exception e) {
return;
}
}
use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.
the class SchemaVM method editedNodeChanged.
@GlobalCommand
public void editedNodeChanged(@ContextParam(ContextType.VIEW) Component view, @BindingParam("parentEntity") EntityDefinition parentEntity, @BindingParam("node") SurveyObject editedNode, @BindingParam("newItem") Boolean newNode) {
if (parentEntity == null && editedNode instanceof EntityDefinition) {
// root entity
EntityDefinition rootEntity = (EntityDefinition) editedNode;
updateRootTabLabel(view, rootEntity);
} else {
if (newNode) {
// editing tab or nested node definition
// update tree node
selectedTreeNode.setDetached(false);
BindUtils.postNotifyChange(null, null, selectedTreeNode, "detached");
this.newNode = false;
notifyChange("newNode");
selectTreeNode(editedNode);
}
notifyChange("editedNodePath");
// to be called when not notifying changes on treeModel
refreshSelectedTreeNode(view);
}
}
use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.
the class SchemaVM method applyChangesToEditedNodeInPopUp.
@GlobalCommand
public void applyChangesToEditedNodeInPopUp(@ContextParam(ContextType.BINDER) Binder binder) {
Component nodeFormContainer = getNodeEditorForm();
NodeDefinitionVM<?> vm = ComponentUtil.getViewModel(nodeFormContainer);
vm.dispatchValidateCommand(ComponentUtil.getBinder(nodeFormContainer));
if (vm.isCurrentFormValid()) {
vm.commitChanges(binder);
closeNodeEditPopUp();
} else {
checkCanLeaveForm(new CanLeaveFormConfirmHandler() {
@Override
public void onOk(boolean confirmed) {
closeNodeEditPopUp();
}
});
}
}
Aggregations