Search in sources :

Example 1 with Init

use of org.zkoss.bind.annotation.Init in project collect by openforis.

the class NewSurveyParametersPopUpVM method init.

@Init(superclass = false)
public void init() {
    super.init();
    form = new HashMap<String, Object>();
    nameValidator = new SurveyNameValidator(surveyManager, SURVEY_NAME_FIELD, true);
    initLanguageModel();
    initTemplatesModel();
    initUserGroupsModel();
    form.put(USER_GROUP_FIELD_NAME, getDefaultPublicUserGroupItem());
}
Also used : SurveyNameValidator(org.openforis.collect.designer.form.validator.SurveyNameValidator) Init(org.zkoss.bind.annotation.Init)

Example 2 with Init

use of org.zkoss.bind.annotation.Init in project collect by openforis.

the class PreviewPopUpVM method init.

@Init(superclass = false)
public void init(@ExecutionArgParam("surveyId") String surveyId, @ExecutionArgParam("work") String work, @ExecutionArgParam("rootEntityId") String rootEntityId, @ExecutionArgParam("versionId") String versionId, @ExecutionArgParam("locale") String locale, @ExecutionArgParam("recordStep") String recordStep) throws URISyntaxException {
    super.init();
    URIBuilder uriBuilder = new URIBuilder(Resources.Page.PREVIEW_PATH.getLocation());
    uriBuilder.addParameter("preview", "true");
    uriBuilder.addParameter("surveyId", surveyId);
    uriBuilder.addParameter("work", work);
    uriBuilder.addParameter("rootEntityId", rootEntityId);
    uriBuilder.addParameter("locale", locale);
    if (StringUtils.isNotBlank(versionId)) {
        uriBuilder.addParameter("versionId", versionId);
    }
    uriBuilder.addParameter("recordStep", recordStep);
    this.uri = uriBuilder.build().toString();
}
Also used : URIBuilder(org.apache.http.client.utils.URIBuilder) Init(org.zkoss.bind.annotation.Init)

Example 3 with Init

use of org.zkoss.bind.annotation.Init in project collect by openforis.

the class SurveyExportParametersVM method init.

@Init
public void init(@ExecutionArgParam("survey") SurveySummary survey) {
    this.surveySummary = survey;
    this.formObject = new SurveyExportParametersFormObject();
    String outputFormat = (survey.getTarget() == COLLECT_EARTH ? EARTH : DESKTOP).name();
    this.formObject.setOutputFormat(outputFormat);
    this.formObject.setType((survey.isNotLinkedToPublishedSurvey() ? TEMPORARY : PUBLISHED).name());
    this.formObject.setRdbDialect(RdbDialect.STANDARD.name());
    this.formObject.setRdbDateTimeFormat(DEFAULT_DATE_TIME_FORMAT);
    this.formObject.setRdbTargetSchemaName(survey.getName());
    this.formObject.setLanguageCode(survey.getDefaultLanguage());
    this.tempForm = new SimpleForm();
}
Also used : SimpleForm(org.zkoss.bind.SimpleForm) Init(org.zkoss.bind.annotation.Init)

Example 4 with Init

use of org.zkoss.bind.annotation.Init in project collect by openforis.

the class SurveyLanguageVM method init.

@Init
public void init() {
    languages = new ArrayList<LabelledItem>();
    List<String> codes = Languages.getCodes(Standard.ISO_639_1);
    for (String code : codes) {
        LabelledItem item = new LabelledItem(code, Labels.getLabel(code));
        languages.add(item);
    }
    Collections.sort(languages, new LabelComparator());
    assignedLanguages = getSurveyAssignedLanguages();
}
Also used : LabelledItem(org.openforis.collect.designer.model.LabelledItem) LabelComparator(org.openforis.collect.designer.model.LabelledItem.LabelComparator) Init(org.zkoss.bind.annotation.Init)

Example 5 with Init

use of org.zkoss.bind.annotation.Init in project collect by openforis.

the class SchemaTreePopUpVM method init.

@Init(superclass = false)
public void init(@ExecutionArgParam("rootEntity") EntityDefinition rootEntity, @ExecutionArgParam("version") ModelVersion version, @ExecutionArgParam("includedNodePredicate") Predicate<SurveyObject> includedNodePredicate, @ExecutionArgParam("includeRootEntity") boolean includeRootEntity, @ExecutionArgParam("includeEmptyNodes") boolean includeEmtptyNodes, @ExecutionArgParam("disabledNodePredicate") Predicate<SurveyObject> disabledNodePredicate, @ExecutionArgParam("selectableNodePredicate") Predicate<SurveyObject> selectableNodePredicate, @ExecutionArgParam("selection") SurveyObject selection, @ExecutionArgParam("allowEmptySelection") boolean allowEmptySelection) {
    super.init();
    SurveyObjectTreeModelCreator modelCreator = new UITreeModelCreator(version, disabledNodePredicate, includedNodePredicate, includeRootEntity, includeEmtptyNodes, currentLanguageCode);
    this.treeModel = modelCreator.createModel(rootEntity);
    this.treeModel.openAllItems();
    this.selectableNodePredicate = selectableNodePredicate;
    this.disabledNodePredicate = disabledNodePredicate;
    this.allowEmptySelection = allowEmptySelection;
    if (selection != null) {
        this.selectedNode = selection;
        this.treeModel.select(selection);
        this.treeModel.showSelectedNode();
    }
}
Also used : SurveyObjectTreeModelCreator(org.openforis.collect.designer.component.SurveyObjectTreeModelCreator) UITreeModelCreator(org.openforis.collect.designer.component.UITreeModelCreator) Init(org.zkoss.bind.annotation.Init)

Aggregations

Init (org.zkoss.bind.annotation.Init)7 SurveyNameValidator (org.openforis.collect.designer.form.validator.SurveyNameValidator)2 URIBuilder (org.apache.http.client.utils.URIBuilder)1 SurveyObjectTreeModelCreator (org.openforis.collect.designer.component.SurveyObjectTreeModelCreator)1 UITreeModelCreator (org.openforis.collect.designer.component.UITreeModelCreator)1 LabelledItem (org.openforis.collect.designer.model.LabelledItem)1 LabelComparator (org.openforis.collect.designer.model.LabelledItem.LabelComparator)1 SessionStatus (org.openforis.collect.designer.session.SessionStatus)1 SurveyType (org.openforis.collect.designer.viewmodel.SurveyBaseVM.SurveyType)1 SimpleForm (org.zkoss.bind.SimpleForm)1