List of usage examples for org.apache.wicket.ajax AjaxRequestTarget add
void add(Component... components);
From source file:au.org.theark.phenotypic.web.component.phenodatadictionary.PhenoDataDictionaryContainerPanel.java
License:Open Source License
protected WebMarkupContainer initialiseSearchResults() { SearchResultListPanel searchResultListPanel = new SearchResultListPanel("resultListPanel", cpModel, arkCrudContainerVO, feedBackPanel); // Data providor to paginate resultList phenoDataSetFieldProvider = new ArkDataProvider2<PhenoDataSetField, PhenoDataSetField>() { private static final long serialVersionUID = 1L; public int size() { return (int) iPhenotypicService.getPhenoFieldCount(criteriaModel.getObject()); }/* ww w . ja va2 s . com*/ public Iterator<PhenoDataSetField> iterator(int first, int count) { List<PhenoDataSetField> listCustomFields = new ArrayList<PhenoDataSetField>(); if (isActionPermitted()) { listCustomFields = iPhenotypicService.searchPageablePhenoFields(criteriaModel.getObject(), first, count); } return listCustomFields.iterator(); } }; // Set the criteria for the data provider phenoDataSetFieldProvider .setCriteriaModel(new PropertyModel<PhenoDataSetField>(cpModel, "phenoDataSetField")); dataView = searchResultListPanel.buildDataView(phenoDataSetFieldProvider); dataView.setItemsPerPage( iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue()); AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("navigator", dataView) { private static final long serialVersionUID = 1L; @Override protected void onAjaxEvent(AjaxRequestTarget target) { target.add(arkCrudContainerVO.getSearchResultPanelContainer()); } }; searchResultListPanel.add(pageNavigator); searchResultListPanel.add(dataView); arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultListPanel); return arkCrudContainerVO.getSearchResultPanelContainer(); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoCollectionListForm.java
License:Open Source License
private void initPhenoFieldGroupDdc() { LinkSubjectStudy linkSubjectStudy = cpModel.getObject().getPhenoDataSetCollection().getLinkSubjectStudy(); List<PhenoDataSetGroup> pheDataSetGroupLst = iPhenotypicService .getPhenoDataSetGroupsByLinkSubjectStudy(linkSubjectStudy); ChoiceRenderer<PhenoDataSetGroup> renderer = new ChoiceRenderer<PhenoDataSetGroup>("name", "id"); phenoDataSetFieldGroupDdc = new DropDownChoice<PhenoDataSetGroup>("pheDataSetGroupSelected", pheDataSetGroupLst);//w w w .j a va2 s.co m phenoDataSetFieldGroupDdc.setChoiceRenderer(renderer); phenoDataSetFieldGroupDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; protected void onUpdate(AjaxRequestTarget target) { categoryPanel.remove(pickedPhenoDataSetCategoryDdc); //Create list of PickedPhenoDataSetCategories here for the hierarchy view of the category. List<PickedPhenoDataSetCategory> pickedPhenoDataSetCategories = populatePickedPhenoDataSetCategoriesFromdisplayListForPhenoDataSetGroup( phenoDataSetFieldGroupDdc.getModelObject()); List<PickedPhenoDataSetCategory> pickedPhenoDataSetCategoriesHierachical = PhenoDataSetCategoryOrderingHelper .getInstance().orderHierarchicalyphenoDatasetCategories(pickedPhenoDataSetCategories); ChoiceRenderer renderer = new ChoiceRenderer("phenoDataSetCategory.name", "phenoDataSetCategory.id") { @Override public Object getDisplayValue(Object object) { PickedPhenoDataSetCategory pickedCat = (PickedPhenoDataSetCategory) object; return PhenoDataSetCategoryOrderingHelper.getInstance().preTextDecider(pickedCat) + super.getDisplayValue(object); } }; pickedPhenoDataSetCategoryDdc = new DropDownChoice<PickedPhenoDataSetCategory>( "pickedPhenoDataSetCategory", pickedPhenoDataSetCategoriesHierachical, renderer); pickedPhenoDataSetCategoryDdc.setOutputMarkupId(true); categoryPanel.add(pickedPhenoDataSetCategoryDdc); target.add(pickedPhenoDataSetCategoryDdc); target.add(categoryPanel); // Enable getData button when customFieldGroup actually selected getDataButton.setEnabled(phenoDataSetFieldGroupDdc.getValue() != null && !phenoDataSetFieldGroupDdc.getValue().isEmpty() && pickedPhenoDataSetCategoryDdc.getValue() != null && !pickedPhenoDataSetCategoryDdc.getValue().isEmpty()); target.add(getDataButton); target.add(feedbackPanel); } }); addOrReplace(phenoDataSetFieldGroupDdc); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoCollectionListForm.java
License:Open Source License
private void initialiseDataView() { dataViewListWMC = new WebMarkupContainer("dataViewListWMC"); dataViewListWMC.setOutputMarkupId(true); // Data provider to paginate resultList PhenoCollectionProvider = new ArkDataProvider2<PhenoDataCollectionVO, PhenoDataSetCollection>() { private static final long serialVersionUID = 1L; public int size() { return (int) iPhenotypicService.getPhenoCollectionCount(criteriaModel.getObject()); }/*from www.ja va2 s .c o m*/ public Iterator<PhenoDataSetCollection> iterator(int first, int count) { List<PhenoDataSetCollection> phenoCollectionList = new ArrayList<PhenoDataSetCollection>(); if (ArkPermissionHelper.isActionPermitted(au.org.theark.core.Constants.SEARCH)) { criteriaModel.getObject().setArkFunction( iArkCommonService.getArkFunctionByName(Constants.FUNCTION_KEY_VALUE_PHENO_COLLECTION)); phenoCollectionList = iPhenotypicService .searchPageablePhenoCollections(criteriaModel.getObject(), first, count); } return phenoCollectionList.iterator(); } }; // Set the criteria into the data provider's model PhenoCollectionProvider.setCriteriaModel(cpModel); dataView = buildDataView(PhenoCollectionProvider); dataView.setItemsPerPage(iArkCommonService.getUserConfig(Constants.CONFIG_ROWS_PER_PAGE).getIntValue()); AjaxPagingNavigator pageNavigator = new AjaxPagingNavigator("navigator", dataView) { private static final long serialVersionUID = 1L; @Override protected void onAjaxEvent(AjaxRequestTarget target) { target.add(dataViewListWMC); } }; dataViewListWMC.add(pageNavigator); dataViewListWMC.add(dataView); add(dataViewListWMC); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoCollectionListForm.java
License:Open Source License
private void initialiseGetDataButton() { getDataButton = new AjaxButton("getData") { private static final long serialVersionUID = 1L; @Override/* www .j a va 2s . c om*/ public boolean isEnabled() { return (true); } @Override public boolean isVisible() { boolean isVisible = true; String sessionSubjectUID = (String) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.SUBJECTUID); isVisible = (ArkPermissionHelper.isActionPermitted(au.org.theark.core.Constants.SEARCH) && sessionSubjectUID != null); return isVisible; } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (phenoDataSetFieldGroupDdc.getValue().isEmpty() || pickedPhenoDataSetCategoryDdc.getValue().isEmpty()) { error("Please select the Data Set and Category first"); } else { LinkSubjectStudy linkSubjectStudy = cpModel.getObject().getPhenoDataSetCollection() .getLinkSubjectStudy(); List<PhenoDataSetGroup> phenoDataSetGroupList = new ArrayList<PhenoDataSetGroup>(0); PhenoDataSetGroup pdsg = iPhenotypicService .getPhenoFieldGroupById(new Long(phenoDataSetFieldGroupDdc.getValue())); phenoDataSetGroupList.add(pdsg); PhenoDataSetCategory phenoDataSetCategory = iPhenotypicService .getPhenoDataSetCategoryById(new Long(pickedPhenoDataSetCategoryDdc.getValue())); List<PhenoDataSetField> phenoSetFields = iPhenotypicService .getPhenoDataSetFieldsLinkedToPhenoDataSetFieldGroupAndPhenoDataSetCategory(pdsg, phenoDataSetCategory); List<String> subjectUids = new ArrayList<String>(0); subjectUids.add(linkSubjectStudy.getSubjectUID()); List<List<String>> dataSet = iPhenotypicService.getPhenoDataAsMatrix( linkSubjectStudy.getStudy(), subjectUids, phenoSetFields, phenoDataSetGroupList, phenoDataSetCategory); phenoDataView = new DataTablePanel("phenoDataView", dataSet); PhenoCollectionListForm.this.addOrReplace(phenoDataView); target.add(phenoDataView); } target.add(feedbackPanel); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { this.error("Unexpected error: Unable to proceed with New"); target.add(feedbackPanel); } }; getDataButton.setDefaultFormProcessing(false); add(getDataButton); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoCollectionListForm.java
License:Open Source License
protected void onNew(AjaxRequestTarget target) { // Needs CREATE permission AND at least one published CustomFieldGroup (Questionnaire) to select from boolean hasQuestionnaires = false; /*henoDataSetGroup questionnaire=new questionnaire.setArkFunction(cpModel.getObject().getArkFunction()); questionnaire.setStudy(cpModel.getObject().getPhenoDataSetCollection().getLinkSubjectStudy().getStudy()); questionnaire.setPublished(true);*/ //hasQuestionnaires = (iArkCommonService.getCustomFieldGroupCount(questionnaire) > 0); hasQuestionnaires = (iPhenotypicService.getPhenoFieldGroupCount( cpModel.getObject().getPhenoDataSetCollection().getLinkSubjectStudy().getStudy(), cpModel.getObject().getArkFunction(), true) > 0); if (hasQuestionnaires) { // Set new Biospecimen into model, then show modalWindow to save CompoundPropertyModel<PhenoDataCollectionVO> newModel = new CompoundPropertyModel<PhenoDataCollectionVO>( new PhenoDataCollectionVO()); newModel.getObject().getPhenoDataSetCollection() .setLinkSubjectStudy(cpModel.getObject().getPhenoDataSetCollection().getLinkSubjectStudy()); // the following should be replaced by a real "Questionnaire" selection when the new form is presented //newModel.getObject().getPhenoDataSetCollection().setQuestionnaire(questionnaire); //newModel.getObject().setPhenoDataSetGroup(questionnaire); showModalWindow(target, newModel); // listDetailsForm); } else {//from www. j a v a2s . c o m this.error( "No published Questionnaires exist. Please create and publish at least one Questionnaire for the study."); } // refresh the feedback messages target.add(feedbackPanel); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoCollectionListForm.java
License:Open Source License
protected void showModalWindow(AjaxRequestTarget target, CompoundPropertyModel<PhenoDataCollectionVO> cpModel) { cpModel.getObject().setArkFunction(iArkCommonService .getArkFunctionByName(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_PHENO_COLLECTION)); modalContentPanel = new PhenoDataEntryModalDetailPanel("content", modalWindow, cpModel); // Set the modalWindow title and content modalWindow.setTitle("Subject Dataset Details"); modalWindow.setContent(modalContentPanel); modalWindow.repaintComponent(getDataButton); // 2015-09-29 set windows call back modalWindow.setWindowClosedCallback(new WindowClosedCallback() { private static final long serialVersionUID = 1L; @Override//from w w w . ja va2 s.c o m public void onClose(AjaxRequestTarget target) { initPhenoFieldGroupDdc(); target.add(phenoDataSetFieldGroupDdc); } }); modalWindow.show(target); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoDataEntryModalDetailForm.java
License:Open Source License
private void initPhenoDataSetFieldCategoryDdc(PhenoDataSetGroup phenoDataSetGroup) { List<PickedPhenoDataSetCategory> pickedPhenoDataSetCategories = populatePickedPhenoDataSetCategoriesFromdisplayListForPhenoDataSetGroup( phenoDataSetGroup);//from ww w .ja va2 s . com List<PickedPhenoDataSetCategory> pickedPhenoDataSetCategoriesHierachical = PhenoDataSetCategoryOrderingHelper .getInstance().orderHierarchicalyphenoDatasetCategories(pickedPhenoDataSetCategories); ChoiceRenderer renderer = new ChoiceRenderer("phenoDataSetCategory.name", "phenoDataSetCategory.id") { @Override public Object getDisplayValue(Object object) { PickedPhenoDataSetCategory pickedCat = (PickedPhenoDataSetCategory) object; return PhenoDataSetCategoryOrderingHelper.getInstance().preTextDecider(pickedCat) + super.getDisplayValue(object); } }; pickedPhenoDataSetCategoryDdc = new DropDownChoice<PickedPhenoDataSetCategory>("pickedPhenoDataSetCategory", new PropertyModel<PickedPhenoDataSetCategory>(cpModel, "pickedPhenoDataSetCategory"), pickedPhenoDataSetCategoriesHierachical, renderer); pickedPhenoDataSetCategoryDdc.setOutputMarkupId(true); pickedPhenoDataSetCategoryDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { //Remove dataEntryWMC.remove(phenoCollectionDataEntryPanel); dataEntryWMC.remove(dataEntryNavigator); arkCrudContainerVo.getDetailPanelFormContainer().remove(dataEntryWMC); //Create if (pickedPhenoDataSetCategoryDdc.getModelObject() != null) { initialisePhenoCollectionDataEntry( pickedPhenoDataSetCategoryDdc.getModelObject().getPhenoDataSetCategory()); } //Add dataEntryWMC.add(phenoCollectionDataEntryPanel); dataEntryWMC.add(dataEntryNavigator); arkCrudContainerVo.getDetailPanelFormContainer().add(dataEntryWMC); //target target.add(phenoCollectionDataEntryPanel); target.add(dataEntryNavigator); target.add(dataEntryWMC); } }); }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoDataEntryModalDetailForm.java
License:Open Source License
private boolean initialisePhenoCollectionDataEntry(PhenoDataSetCategory phenoDataSetCategory) { boolean replacePanel = false; //if (!(phenoCollectionDataEntryPanel instanceof PhenoDataDataViewPanel)) { CompoundPropertyModel<PhenoDataCollectionVO> phenoDataCpModel = new CompoundPropertyModel<PhenoDataCollectionVO>( new PhenoDataCollectionVO()); phenoDataCpModel.getObject().setPhenoDataSetCollection(cpModel.getObject().getPhenoDataSetCollection()); phenoDataCpModel.getObject().getPhenoDataSetCollection() .setQuestionnaire(cpModel.getObject().getPhenoDataSetCollection().getQuestionnaire()); phenoDataCpModel.getObject().setArkFunction(cpModel.getObject().getArkFunction()); PhenoDataDataViewPanel phenoCFDataEntryPanel; if (phenoDataSetCategory != null) { phenoCFDataEntryPanel = new PhenoDataDataViewPanel("phenoCFDataEntryPanel", phenoDataCpModel) .initialisePanel(iArkCommonService .getUserConfig(au.org.theark.core.Constants.CONFIG_CUSTOM_FIELDS_PER_PAGE) .getIntValue(), phenoDataSetCategory); } else {/* w w w. jav a 2 s .c om*/ phenoCFDataEntryPanel = new PhenoDataDataViewPanel("phenoCFDataEntryPanel", phenoDataCpModel) .initialisePanel(iArkCommonService .getUserConfig(au.org.theark.core.Constants.CONFIG_CUSTOM_FIELDS_PER_PAGE) .getIntValue(), null); } dataEntryNavigator = new AjaxPagingNavigator("dataEntryNavigator", phenoCFDataEntryPanel.getDataView()) { private static final long serialVersionUID = 1L; @Override protected void onAjaxEvent(AjaxRequestTarget target) { target.add(dataEntryWMC); } }; //dataEntryNavigator = new ArkAjaxPagingNavigator("dataEntryNavigator", phenoCFDataEntryPanel.getDataView(), dataEntryWMC, jQueryLabel); phenoCollectionDataEntryPanel = phenoCFDataEntryPanel; //replacePanel = true; //} return replacePanel; }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoDataEntryModalDetailForm.java
License:Open Source License
private void initQuestionnaireDdc() { // Get a list of questionnaires for the subject in context by default PhenoDataSetGroup pfgForStudyCriteria = cpModel.getObject().getPhenoDataSetGroup(); pfgForStudyCriteria//from w w w . ja va2s. co m .setStudy(cpModel.getObject().getPhenoDataSetCollection().getLinkSubjectStudy().getStudy()); // NB: Assumes that CustomFieldGroup will always be used for criteria (not a true entity) pfgForStudyCriteria.setArkFunction(cpModel.getObject().getArkFunction()); pfgForStudyCriteria.setPublished(true); //make sure that we don't return non-published Questionnaires List<PhenoDataSetGroup> questionnaireList = iPhenotypicService.getPhenoDataSetGroups(pfgForStudyCriteria, 0, Integer.MAX_VALUE); //List<CustomFieldGroup> questionnaireList = iArkCommonService.getCustomFieldGroups(pfgForStudyCriteria, 0, Integer.MAX_VALUE); ChoiceRenderer<PhenoDataSetGroup> choiceRenderer = new ChoiceRenderer<PhenoDataSetGroup>( Constants.PHENO_COLLECTION_NAME, Constants.PHENO_COLLECTION_ID); questionnaireDdc = new DropDownChoice<PhenoDataSetGroup>("phenoDataSetCollection.questionnaire", (List<PhenoDataSetGroup>) questionnaireList, choiceRenderer); questionnaireDdc.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { categoryPanel.remove(pickedPhenoDataSetCategoryDdc); initPhenoDataSetFieldCategoryDdc(questionnaireDdc.getModelObject()); categoryPanel.add(pickedPhenoDataSetCategoryDdc); target.add(pickedPhenoDataSetCategoryDdc); target.add(categoryPanel); } }); if (!isNew()) { questionnaireDdc.setEnabled(false); //can't change questionnaire after creating the phenoCollection } }
From source file:au.org.theark.phenotypic.web.component.phenodataentry.form.PhenoDataEntryModalDetailForm.java
License:Open Source License
@Override protected void onDeleteConfirmed(AjaxRequestTarget target, Form<?> form) { iPhenotypicService.deletePhenoCollection(cpModel.getObject().getPhenoDataSetCollection()); // Base containerForm for pheno data entry unfortunately way up the chain...thus a lot of getParent() calls. Not the neatest method by any means PhenoCollectionDataEntryContainerPanel containerPanel = (PhenoCollectionDataEntryContainerPanel) this .getParent().getParent().getParent().getParent().getParent().getParent(); containerPanel.info(/*w w w. ja v a 2 s .c om*/ "Subject Dataset " + cpModel.getObject().getPhenoDataSetCollection().getQuestionnaire().getName() + " was deleted successfully"); target.add(containerPanel.getFeedbackPanel()); onClose(target); processErrors(target); }