List of usage examples for org.apache.wicket.ajax AjaxRequestTarget add
void add(Component... components);
From source file:au.org.theark.study.web.component.global.subject.SearchResultListPanel.java
License:Open Source License
private AjaxLink buildLink(final SubjectVO subject) { ArkBusyAjaxLink link = new ArkBusyAjaxLink(Constants.SUBJECT_UID) { @Override//ww w. j av a 2 s . c o m public void onClick(AjaxRequestTarget target) { Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); // subject.getLinkSubjectStudy().setStudy(iArkCommonService.getStudy(sessionStudyId)); // We specify the type of person here as Subject SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID, subject.getLinkSubjectStudy().getStudy().getId()); SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID, subject.getLinkSubjectStudy().getPerson().getId()); SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.PERSON_TYPE, au.org.theark.core.Constants.PERSON_CONTEXT_TYPE_SUBJECT); SubjectVO subjectFromBackend = new SubjectVO(); Collection<SubjectVO> subjects = iArkCommonService.getSubject(subject); for (SubjectVO subjectVO2 : subjects) { subjectFromBackend = subjectVO2; break; } // Available/assigned child studies List<Study> availableChildStudies = new ArrayList<Study>(0); List<Study> selectedChildStudies = new ArrayList<Study>(0); if (subjectFromBackend.getLinkSubjectStudy().getStudy().getParentStudy() != null) { availableChildStudies = iStudyService .getChildStudyListOfParent(subjectFromBackend.getLinkSubjectStudy().getStudy()); selectedChildStudies = iArkCommonService.getAssignedChildStudyListForPerson( subjectFromBackend.getLinkSubjectStudy().getStudy(), subjectFromBackend.getLinkSubjectStudy().getPerson()); } // ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, arkCrudContainerVO); subjectFromBackend.setStudyList(subjectContainerForm.getModelObject().getStudyList()); subjectContainerForm.setModelObject(subjectFromBackend); subjectContainerForm.getModelObject().setAvailableChildStudies(availableChildStudies); subjectContainerForm.getModelObject().setSelectedChildStudies(selectedChildStudies); // Set SubjectUID into context SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.SUBJECTUID, subjectFromBackend.getLinkSubjectStudy().getSubjectUID()); ContextHelper contextHelper = new ContextHelper(); contextHelper.setStudyContextLabel(target, subjectFromBackend.getLinkSubjectStudy().getStudy().getName(), arkContextMarkup); contextHelper.setSubjectContextLabel(target, subjectFromBackend.getLinkSubjectStudy().getSubjectUID(), arkContextMarkup); // Set Study Logo StudyHelper studyHelper = new StudyHelper(); studyHelper.setStudyLogo(subjectFromBackend.getLinkSubjectStudy().getStudy(), target, studyNameMarkup, studyLogoMarkup); //Move to subject Tab ListIterator<ITab> lIter = mainTabs.getTabs().listIterator(); while (lIter.hasNext()) { int index = lIter.nextIndex(); ITab currentTab = lIter.next(); System.out.println("TAB: " + currentTab.getTitle().toString()); if (currentTab.getTitle().getObject() == au.org.theark.core.Constants.ARK_MODULE_SUBJECT) { mainTabs.setSelectedTab(index); break; } } target.add(mainTabs); } }; Label nameLinkLabel = new Label(Constants.SUBJECT_KEY_LBL, subject.getLinkSubjectStudy().getSubjectUID()); link.add(nameLinkLabel); return link; }
From source file:au.org.theark.study.web.component.global.subject.SearchResultListPanel.java
License:Open Source License
/**After select a parent validate the pedigree for circular relationships and create new parent relationship in database. * @param subject//from w w w . j a v a 2 s.co m * @param modalWindow * @param relatives * @param feedbackPanel * @param target */ private void processParentSelection(final SubjectVO subject, final AbstractDetailModalWindow modalWindow, final List<RelationshipVo> relatives, final FeedbackPanel feedbackPanel, AjaxRequestTarget target) { LinkSubjectPedigree pedigreeRelationship = new LinkSubjectPedigree(); Long sessionStudyId = (Long) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); Study study = iArkCommonService.getStudy(sessionStudyId); String subjectUID = (String) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.SUBJECTUID); String parentUID = subject.getLinkSubjectStudy().getSubjectUID(); // Circular validation StringBuilder pedigree = new StringBuilder(); ArrayList<String> dummyParents = new ArrayList<String>(); boolean firstLine = true; List<RelationshipVo> existingRelatives = new ArrayList<RelationshipVo>(); existingRelatives.addAll(relatives); RelationshipVo proband = new RelationshipVo(); proband.setIndividualId(subjectUID); for (RelationshipVo relative : existingRelatives) { if ("Father".equalsIgnoreCase(relative.getRelationship())) { proband.setFatherId(relative.getIndividualId()); } if ("Mother".equalsIgnoreCase(relative.getRelationship())) { proband.setMotherId(relative.getIndividualId()); } } if (subject.getLinkSubjectStudy().getPerson().getGenderType().getName().startsWith("M")) { proband.setFatherId(parentUID); } else if (subject.getLinkSubjectStudy().getPerson().getGenderType().getName().startsWith("F")) { proband.setMotherId(parentUID); } existingRelatives.add(proband); List<RelationshipVo> newRelatives = iStudyService.generateSubjectPedigreeRelativeList(parentUID, sessionStudyId); RelationshipVo parent = new RelationshipVo(); parent.setIndividualId(parentUID); for (RelationshipVo relative : newRelatives) { if ("Father".equalsIgnoreCase(relative.getRelationship())) { parent.setFatherId(relative.getIndividualId()); } if ("Mother".equalsIgnoreCase(relative.getRelationship())) { parent.setMotherId(relative.getIndividualId()); } } newRelatives.add(parent); for (RelationshipVo relative : newRelatives) { if (!existingRelatives.contains(relative)) { existingRelatives.add(relative); } else { for (RelationshipVo existingRelative : existingRelatives) { if (relative.getIndividualId().equals(existingRelative.getIndividualId())) { if (existingRelative.getFatherId() == null) { existingRelative.setFatherId(relative.getFatherId()); } if (existingRelative.getMotherId() == null) { existingRelative.setMotherId(relative.getMotherId()); } } } } } for (RelationshipVo relative : existingRelatives) { String dummyParent = "D-"; String father = relative.getFatherId(); String mother = relative.getMotherId(); String individual = relative.getIndividualId(); if (father != null) { dummyParent = dummyParent + father; } if (mother != null) { dummyParent = dummyParent + mother; } if (!"D-".equals(dummyParent) && !dummyParents.contains(dummyParent)) { dummyParents.add(dummyParent); if (father != null) { if (firstLine) { pedigree.append(father + " " + dummyParent); firstLine = false; } else { pedigree.append("\n" + father + " " + dummyParent); } } if (mother != null) { if (firstLine) { pedigree.append(mother + " " + dummyParent); firstLine = false; } else { pedigree.append("\n" + mother + " " + dummyParent); } } pedigree.append("\n" + dummyParent + " " + individual); } else if (!"D-".equals(dummyParent)) { if (firstLine) { pedigree.append(dummyParent + " " + individual); firstLine = false; } else { pedigree.append("\n" + dummyParent + " " + individual); } } } //TODO comment this block to disable circular validations for inbred relatives Set<String> circularUIDs = PedigreeUploadValidator.getCircularUIDs(pedigree); if (circularUIDs.size() > 0) { this.error("Performing this action will create a circular relationship in the pedigree."); StringBuffer sb = new StringBuffer( "The proposed action will cause a pedigree cycle involving subjects with UID:"); boolean first = true; for (String uid : circularUIDs) { if (first) { sb.append(uid); first = false; } else { sb.append(", " + uid); } } sb.append("."); this.error(sb.toString()); target.add(feedbackPanel); return; } // Assign new parent relationships SubjectVO criteriaSubjectVo = new SubjectVO(); criteriaSubjectVo.getLinkSubjectStudy().setStudy(study); criteriaSubjectVo.getLinkSubjectStudy().setSubjectUID(subjectUID); Collection<SubjectVO> subjects = iArkCommonService.getSubject(criteriaSubjectVo); SubjectVO subjectVo = subjects.iterator().next(); pedigreeRelationship.setSubject(subjectVo.getLinkSubjectStudy()); criteriaSubjectVo.getLinkSubjectStudy().setSubjectUID(parentUID); subjects = iArkCommonService.getSubject(criteriaSubjectVo); subjectVo = subjects.iterator().next(); pedigreeRelationship.setRelative(subjectVo.getLinkSubjectStudy()); String gender = subject.getLinkSubjectStudy().getPerson().getGenderType().getName(); List<Relationship> relationships = iArkCommonService.getFamilyRelationships(); for (Relationship relationship : relationships) { if ("Male".equalsIgnoreCase(gender) && "Father".equalsIgnoreCase(relationship.getName())) { pedigreeRelationship.setRelationship(relationship); break; } if ("Female".equalsIgnoreCase(gender) && "Mother".equalsIgnoreCase(relationship.getName())) { pedigreeRelationship.setRelationship(relationship); break; } } iStudyService.create(pedigreeRelationship); modalWindow.close(target); }
From source file:au.org.theark.study.web.component.global.subject.SubjectContainerPanel.java
License:Open Source License
@SuppressWarnings("unchecked") protected WebMarkupContainer initialiseSearchResults(AbstractDetailModalWindow modalWindow, final String gender, final List<RelationshipVo> relatives) { searchResultsPanel = new SearchResultListPanel("searchResults", arkContextMarkup, containerForm, arkCrudContainerVO, studyNameMarkup, studyLogoMarkup, mainTabs); searchResultsPanel.setOutputMarkupId(true); if (sessionStudyId != null) { LinkSubjectStudy linkSubjectStudy = new LinkSubjectStudy(); linkSubjectStudy.setStudy(study); //containerForm.getModelObject().setLinkSubjectStudy(linkSubjectStudy); }//from w w w .ja v a2 s .com // Data providor to paginate resultList subjectProvider = new ArkDataProvider<SubjectVO, IArkCommonService>(iArkCommonService) { private static final long serialVersionUID = 1L; private GenderType genderType; { Collection<GenderType> genderTypes = service.getGenderTypes(); for (GenderType type : genderTypes) { if (gender.equalsIgnoreCase(type.getName())) { this.genderType = type; break; } } } public int size() { String subjectUID = (String) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.SUBJECTUID); model.getObject().getRelativeUIDs().add(subjectUID); //TODO comment this block to check inbred relatives for (RelationshipVo relationshipVo : relatives) { model.getObject().getRelativeUIDs().add(relationshipVo.getIndividualId()); } model.getObject().getLinkSubjectStudy().getPerson().setGenderType(genderType); return (int) service.getStudySubjectCount(model.getObject()); } public Iterator<SubjectVO> iterator(int first, int count) { List<SubjectVO> listSubjects = new ArrayList<SubjectVO>(); if (isActionPermitted()) { model.getObject().getLinkSubjectStudy().getPerson().setGenderType(genderType); String subjectUID = (String) SecurityUtils.getSubject().getSession() .getAttribute(au.org.theark.core.Constants.SUBJECTUID); model.getObject().getRelativeUIDs().add(subjectUID); //TODO comment this block to check inbred relatives for (RelationshipVo relationshipVo : relatives) { model.getObject().getRelativeUIDs().add(relationshipVo.getIndividualId()); } listSubjects = iArkCommonService.searchPageableSubjects(model.getObject(), first, count); } return listSubjects.iterator(); } }; subjectProvider.setModel(this.cpModel); dataView = searchResultsPanel.buildDataView(subjectProvider, modalWindow, relatives, feedBackPanel); 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(searchResultsPanel); } }; resultsWmc.add(pageNavigator); List<IColumn<SubjectVO>> columns = new ArrayList<IColumn<SubjectVO>>(); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("SubjectUID"), "subjectUID")); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Study"), "linkSubjectStudy.study.name")); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Full Name"), "subjectFullName")); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Last Name History"), "linkSubjectStudy.person.descriptiveLastNameHistory")); columns.add(new ExportableDateColumn<SubjectVO>(Model.of("Date Of Birth"), "linkSubjectStudy.person.dateOfBirth", au.org.theark.core.Constants.DD_MM_YYYY)); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Vital Status"), "linkSubjectStudy.person.vitalStatus.name")); columns.add( new ExportableTextColumn<SubjectVO>(Model.of("Gender"), "linkSubjectStudy.person.genderType.name")); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Subject Status"), "linkSubjectStudy.subjectStatus.name")); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Consent Status"), "linkSubjectStudy.consentStatus.name")); columns.add(new ExportableTextColumn<SubjectVO>(Model.of("Other IDs"), "linkSubjectStudy.person.descriptiveOtherIDs")); DataTable table = new DataTable("datatable", columns, dataView.getDataProvider(), iArkCommonService.getUserConfig(au.org.theark.core.Constants.CONFIG_ROWS_PER_PAGE).getIntValue()); List<String> headers = new ArrayList<String>(0); headers.add("SubjectUID"); headers.add("Study"); headers.add("Full Name"); headers.add("Last Name History"); headers.add("Date of Birth"); headers.add("Vital Status"); headers.add("Gender"); headers.add("Subject Status"); headers.add("Consent Status"); headers.add("Other IDs"); String filename = "subjects"; RepeatingView toolbars = new RepeatingView("toolbars"); ExportToolbar<String> exportToolBar = new ExportToolbar<String>(table, headers, filename); toolbars.add(new Component[] { exportToolBar }); resultsWmc.add(toolbars); resultsWmc.add(dataView); searchResultsPanel.add(resultsWmc); arkCrudContainerVO.getSearchResultPanelContainer().add(searchResultsPanel); return arkCrudContainerVO.getSearchResultPanelContainer(); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
public void initialiseDetailForm() { studySummaryLabel = new Label("studySummaryLabel"); studySummaryLabel.setOutputMarkupId(true); totalSubjectsLabel = new Label("totalSubjectsLabel"); totalSubjectsLabel.setOutputMarkupId(true); studyIdTxtFld = new TextField<String>(Constants.STUDY_ID); studyIdTxtFld.setEnabled(false);//from ww w . j a v a2 s. c o m studyNameTxtFld = new TextField<String>(Constants.STUDY_NAME); studyNameTxtFld.setRequired(true); studyNameTxtFld.add(new ArkDefaultFormFocusBehavior()); studyDescriptionTxtArea = new TextArea<String>(Constants.STUDY_DESCRIPTION); estYearOfCompletionTxtFld = new TextField<String>(Constants.STUDY_ESTIMATED_YEAR_OF_COMPLETION); principalContactTxtFld = new TextField<String>(Constants.STUDY_CONTACT_PERSON); principalContactPhoneTxtFld = new TextField<String>(Constants.STUDY_CONTACT_PERSON_PHONE); chiefInvestigatorTxtFld = new TextField<String>(Constants.STUDY_CHIEF_INVESTIGATOR); coInvestigatorTxtFld = new TextField<String>(Constants.STUDY_CO_INVESTIGATOR); // Container for SubjectUID auto-generation yes/no autoSubjectUidContainer = new WebMarkupContainer("autoSubjectUidContainer"); autoSubjectUidContainer.setOutputMarkupPlaceholderTag(true); autoBiospecimenUidContainer = new WebMarkupContainer("autoBiospecimenUidContainer"); autoBiospecimenUidContainer.setOutputMarkupPlaceholderTag(true); autoBiocollectionUidContainer = new WebMarkupContainer("autoBiocollectionUidContainer"); autoBiocollectionUidContainer.setOutputMarkupPlaceholderTag(true); // Create new DateTextField and assign date format dateOfApplicationDp = new DateTextField(Constants.STUDY_SEARCH_DOA, au.org.theark.core.Constants.DD_MM_YYYY); ArkDatePicker datePicker = new ArkDatePicker(); datePicker.bind(dateOfApplicationDp); dateOfApplicationDp.add(datePicker); CompoundPropertyModel<StudyModelVO> studyCmpModel = (CompoundPropertyModel<StudyModelVO>) containerForm .getModel(); // details.getCpm(); initStudyStatusDropDown(studyCmpModel); autoGenSubIdChkBox = new CheckBox(Constants.STUDY_AUTO_GENERATE_SUBJECTUID); autoGenSubIdChkBox.setVisible(true); autoGenSubIdChkBox.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { // Check what was selected and then toggle boolean autoGenerateSubjectUId = containerForm.getModelObject().getStudy() .getAutoGenerateSubjectUid(); subjectUidContainer.setEnabled(false); if (autoGenerateSubjectUId) { subjectUidContainer.setEnabled(true); } target.add(subjectUidContainer); } }); autoGenSubIdChkBox.setOutputMarkupId(true); autoGenBiocollectionIdChkBox = new CheckBox(Constants.STUDY_AUTO_GENERATE_BIOCOLLECTIONUID); autoGenBiocollectionIdChkBox.setVisible(true); autoGenBiocollectionIdChkBox.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { // Check what was selected and then toggle boolean autoGenerateBiocollectionUId = containerForm.getModelObject().getStudy() .getAutoGenerateBiocollectionUid(); bioCollectionUidContainer.setEnabled(false); if (autoGenerateBiocollectionUId) { bioCollectionUidContainer.setEnabled(true); } target.add(bioCollectionUidContainer); } }); autoGenBiocollectionIdChkBox.setOutputMarkupId(true); autoGenBiospecimenIdChkBox = new CheckBox(Constants.STUDY_AUTO_GENERATE_BIOSPECIMENUID); autoGenBiospecimenIdChkBox.setVisible(true); autoGenBiospecimenIdChkBox.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { // Check what was selected and then toggle boolean autoGenerateBiospecimenUId = containerForm.getModelObject().getStudy() .getAutoGenerateBiospecimenUid(); biospecimenUidContainer.setEnabled(false); if (autoGenerateBiospecimenUId) { biospecimenUidContainer.setEnabled(true); } target.add(biospecimenUidContainer); } }); autoGenBiospecimenIdChkBox.setOutputMarkupId(true); autoConsentChkBox = new CheckBox(Constants.STUDY_AUTO_CONSENT); autoConsentChkBox.setVisible(true); studyCrudVO.setStudyLogoUploadContainer(new WebMarkupContainer("studyLogoUploadContainer")); studyCrudVO.getStudyLogoUploadContainer().setOutputMarkupPlaceholderTag(true); // fileUpload for logo fileUploadField = new FileUploadField(Constants.STUDY_FILENAME); clearLogoButton = new AjaxButton("clearLogoButton") { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { fileUploadField.clearInput(); target.add(fileUploadField); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { fileUploadField.clearInput(); target.add(fileUploadField); } }; clearLogoButton.add(new AttributeModifier("title", new Model<String>("Clear Attachment"))); studyCrudVO.getStudyLogoUploadContainer().add(fileUploadField); studyCrudVO.getStudyLogoUploadContainer().add(clearLogoButton); initStudyLogo(); initSubjectUid(); initBioCollectionUid(); initBiospecimenUid(); initParentStudyDdc(); initArkModulePalette(); initSubjectFileUpload(); newChildStudyButton = new ArkBusyAjaxButton("newChildStudy") { private static final long serialVersionUID = 1666656098281624401L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // Make the details panel visible, disabling delete button (if found) // AjaxButton ajaxButton = (AjaxButton) editButtonContainer.get("delete"); AjaxButton ajaxButton = (AjaxButton) studyCrudVO.getEditButtonContainer().get("delete"); if (ajaxButton != null) { ajaxButton.setEnabled(false); target.add(ajaxButton); } StudyModelVO newVo = new StudyModelVO(); Study study = newVo.getStudy(); Study parentStudy = containerForm.getModelObject().getStudy(); study.setId(null); study.setDescription("Child study of " + parentStudy.getName()); study.setParentStudy(parentStudy); study.setName(null); // Modules of parent Collection<ArkModule> availableArkModules = containerForm.getModelObject().getAvailableArkModules(); newVo.setAvailableArkModules(availableArkModules); Collection<ArkModule> selectedArkModules = containerForm.getModelObject().getSelectedArkModules(); newVo.setSelectedArkModules(selectedArkModules); // Set auto-generated patterns to that of the parent study study.setAutoGenerateSubjectUid(parentStudy.getAutoGenerateSubjectUid()); study.setSubjectUidPrefix(parentStudy.getSubjectUidPrefix()); study.setSubjectUidToken(parentStudy.getSubjectUidToken()); study.setSubjectUidPadChar(parentStudy.getSubjectUidPadChar()); study.setSubjectUidStart(parentStudy.getSubjectUidStart()); subjectUidExampleTxt = iArkCommonService.getSubjectUidExample(parentStudy); // Set BioCollection template BioCollectionUidTemplate parentBioCollectionUidTemplate = iArkCommonService .getBioCollectionUidTemplate(parentStudy); if (parentBioCollectionUidTemplate != null) { BioCollectionUidTemplate bioCollectionUidTemplate = new BioCollectionUidTemplate(); bioCollectionUidTemplate .setBioCollectionUidPrefix(parentBioCollectionUidTemplate.getBioCollectionUidPrefix()); bioCollectionUidTemplate .setBioCollectionUidToken(parentBioCollectionUidTemplate.getBioCollectionUidToken()); bioCollectionUidTemplate.setBioCollectionUidPadChar( parentBioCollectionUidTemplate.getBioCollectionUidPadChar()); bioCollectionUidTemplate.setStudy(study); containerForm.getModelObject().setBioCollectionUidTemplate(bioCollectionUidTemplate); bioCollectionUidExampleTxt = getBiocollectionUidExample(); } else { containerForm.getModelObject().setBioCollectionUidTemplate(new BioCollectionUidTemplate()); initBioCollectionUid(); } // Set Biospecimen template BiospecimenUidTemplate parentBiospecimenUidTemplate = iArkCommonService .getBiospecimenUidTemplate(parentStudy); if (parentBiospecimenUidTemplate != null) { BiospecimenUidTemplate biospecimenUidTemplate = new BiospecimenUidTemplate(); biospecimenUidTemplate .setBiospecimenUidPrefix(parentBiospecimenUidTemplate.getBiospecimenUidPrefix()); biospecimenUidTemplate .setBiospecimenUidToken(parentBiospecimenUidTemplate.getBiospecimenUidToken()); biospecimenUidTemplate .setBiospecimenUidPadChar(parentBiospecimenUidTemplate.getBiospecimenUidPadChar()); biospecimenUidTemplate.setStudy(study); containerForm.getModelObject().setBiospecimenUidTemplate(biospecimenUidTemplate); biospecimenUidExampleTxt = getBiospecimenUidExample(); } else { containerForm.getModelObject().setBiospecimenUidTemplate(new BiospecimenUidTemplate()); initBiospecimenUid(); } study.setAutoGenerateBiocollectionUid(parentStudy.getAutoGenerateBiocollectionUid()); study.setAutoGenerateBiospecimenUid(parentStudy.getAutoGenerateBiospecimenUid()); autoGenSubIdChkBox.setEnabled(false); autoGenBiocollectionIdChkBox.setEnabled(false); autoGenBiospecimenIdChkBox.setEnabled(false); subjectUidContainer.setEnabled(false); biospecimenUidContainer.setEnabled(false); bioCollectionUidContainer.setEnabled(false); containerForm.setDefaultModelObject(newVo); target.add(studyCrudVO.getDetailPanelFormContainer()); // Hide Summary details on new studyCrudVO.getSummaryContainer().setVisible(false); target.add(studyCrudVO.getSummaryContainer()); getAutoSubjectUidContainer().setEnabled(false); getAutoBiocollectionUidContainer().setEnabled(false); getAutoBiospecimenUidContainer().setEnabled(false); getSubjectUidContainer().setEnabled(false); // bioCollectionUidContainer.setEnabled(false); // biospecimenUidContainer.setEnabled(false); target.add(getAutoSubjectUidContainer()); target.add(getAutoBiocollectionUidContainer()); target.add(getAutoBiospecimenUidContainer()); target.add(getSubjectUidContainer()); target.add(bioCollectionUidContainer); target.add(biospecimenUidContainer); // hide new child study button this.setVisible(false); target.add(this); } @Override public boolean isVisible() { Study study = null; Study parentStudy = null; if (containerForm.getModelObject().getStudy() != null) { study = containerForm.getModelObject().getStudy(); parentStudy = containerForm.getModelObject().getStudy().getParentStudy(); } return (ArkPermissionHelper.isActionPermitted(Constants.NEW) && !isNew() && (parentStudy == null || study == parentStudy)); } @Override protected void onError(final AjaxRequestTarget target, Form<?> form) { target.add(feedBackPanel); } }; historyButtonPanel = new HistoryButtonPanel(containerForm, studyCrudVO.getEditButtonContainer(), studyCrudVO.getDetailPanelFormContainer()); attachValidators(); addComponents(); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initSubjectUid() { // Container for SubjectUID auto-generation details subjectUidContainer = new WebMarkupContainer("subjectUidContainer"); subjectUidContainer.setOutputMarkupPlaceholderTag(true); // Label showing example auto-generated Subject UIDs subjectUidExampleTxt = iArkCommonService.getSubjectUidExample(containerForm.getModelObject().getStudy()); if (subjectUidExampleTxt == null || subjectUidExampleTxt.length() == 0) { subjectUidExampleTxt = Constants.SUBJECTUID_EXAMPLE; }//from w ww .j a v a 2 s.c o m subjectUidExampleLbl = new Label("study.subjectUid.example", new PropertyModel<String>(this, "subjectUidExampleTxt")); subjectUidExampleLbl.setOutputMarkupId(true); subjectUidExampleLbl.setDefaultModelObject(containerForm.getModelObject().getSubjectUidExample()); subjectUidExampleLbl.setVisible(true); // Subject UID prefix (e.g. three char representation of the Study name subjectUidPrefixTxtFld = new TextField<String>(au.org.theark.study.web.Constants.SUBJECT_UID_PREFIX); subjectUidPrefixTxtFld.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); } }); // Token to separate the string (e.g. "-") subjectUidTokenTxtFld = new TextField<String>("subjectUidToken"); subjectUidTokenTxtFld.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); } }); subjectUidTokenTxtFld.setVisible(false); // Token selection initSubjectUidTokenDropDown(); // How many padded chars in SubjectUID incrementor initSubjectUidPadCharsDropDown(); // If the Study wishes to start the incrementor at a particular value subjectUidStartTxtFld = new TextField<Integer>(au.org.theark.study.web.Constants.SUBJECT_UID_START, Integer.class); subjectUidStartTxtFld.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { subjectUidExampleTxt = getSubjectUidExample(); target.add(subjectUidExampleLbl); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initBioCollectionUid() { /* BioCollection UID Container and related controls */ bioCollectionUidContainer = new WebMarkupContainer("bioCollectionUidContainer"); bioCollectionUidContainer.setOutputMarkupPlaceholderTag(true); // Label showing example auto-generated BioCollection UIDs bioCollectionUidExampleTxt = getBiocollectionUidExample(); if (bioCollectionUidExampleTxt == null || bioCollectionUidExampleTxt.length() == 0) { bioCollectionUidExampleTxt = Constants.BIOCOLLECTIONUID_EXAMPLE; }//from ww w .j av a 2 s. c om bioCollectionUidPrefixTxtFld = new TextField<String>("bioCollectionUidTemplate.bioCollectionUidPrefix"); bioCollectionUidPrefixTxtFld.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { bioCollectionUidExampleTxt = getBiocollectionUidExample(); target.add(bioCollectionUidExampleLbl); } }); initBioCollectionUidTokenDropDown(); initBioCollectionUidPadCharDdc(); bioCollectionUidExampleLbl = new Label("study.bioCollectionUid.example", new PropertyModel<String>(this, "bioCollectionUidExampleTxt")); bioCollectionUidExampleLbl.setOutputMarkupId(true); bioCollectionUidExampleLbl .setDefaultModelObject(containerForm.getModelObject().getBioCollectionUidExample()); bioCollectionUidExampleLbl.setVisible(true); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initBioCollectionUidTokenDropDown() { List<BioCollectionUidToken> bioCollectionUidToken = iArkCommonService.getBioCollectionUidToken(); ChoiceRenderer<BioCollectionUidToken> choiceRenderer = new ChoiceRenderer<BioCollectionUidToken>( Constants.NAME, Constants.ID); bioCollectionUidTokenDdc = new DropDownChoice<BioCollectionUidToken>( "bioCollectionUidTemplate.bioCollectionUidToken", bioCollectionUidToken, choiceRenderer); bioCollectionUidTokenDdc.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override// ww w . j av a 2s . c o m protected void onUpdate(AjaxRequestTarget target) { bioCollectionUidExampleTxt = getBiocollectionUidExample(); target.add(bioCollectionUidExampleLbl); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initBioCollectionUidPadCharDdc() { List<BioCollectionUidPadChar> bioCollectionUidPadChar = new ArrayList<BioCollectionUidPadChar>(0); bioCollectionUidPadChar = iArkCommonService.getBioCollectionUidPadChar(); ChoiceRenderer<BioCollectionUidPadChar> choiceRenderer = new ChoiceRenderer<BioCollectionUidPadChar>( Constants.NAME, Constants.ID); bioCollectionUidPadCharDdc = new DropDownChoice<BioCollectionUidPadChar>( "bioCollectionUidTemplate.bioCollectionUidPadChar", bioCollectionUidPadChar, choiceRenderer); bioCollectionUidPadCharDdc.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override/*from w ww.ja v a2s .co m*/ protected void onUpdate(AjaxRequestTarget target) { bioCollectionUidExampleTxt = getBiocollectionUidExample(); target.add(bioCollectionUidExampleLbl); } }); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initBiospecimenUid() { // Label showing example auto-generated Biospecimen UIDs biospecimenUidExampleTxt = getBiospecimenUidExample(); if (bioCollectionUidExampleTxt == null || bioCollectionUidExampleTxt.length() == 0) { bioCollectionUidExampleTxt = Constants.BIOSPECIMENUID_EXAMPLE; }//www . j a va 2 s . com biospecimenUidContainer = new WebMarkupContainer("biospecimenUidContainer"); biospecimenUidContainer.setOutputMarkupPlaceholderTag(true); biospecimenUidPrefixTxtFld = new TextField<String>("biospecimenUidTemplate.biospecimenUidPrefix"); biospecimenUidPrefixTxtFld.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; protected void onUpdate(AjaxRequestTarget target) { biospecimenUidExampleTxt = getBiospecimenUidExample(); target.add(biospecimenUidExampleLbl); } }); // Token to separate the string (e.g. "-") biospecimentUidTokenTxtFld = new TextField<String>("biospecimenUidTemplate.biospecimenUidToken"); biospecimentUidTokenTxtFld.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { biospecimenUidExampleTxt = getBiocollectionUidExample(); target.add(biospecimenUidExampleLbl); } }); biospecimenUidExampleLbl = new Label("biospecimenUid.example", new PropertyModel<String>(this, "biospecimenUidExampleTxt")); biospecimenUidExampleLbl.setOutputMarkupId(true); biospecimenUidExampleLbl.setVisible(true); initBiospecimenUidTokenDropDown(); initBiospecimenUidPadCharDdc(); }
From source file:au.org.theark.study.web.component.managestudy.form.DetailForm.java
License:Open Source License
private void initBiospecimenUidTokenDropDown() { List<BiospecimenUidToken> biospecimenUidTokens = new ArrayList<BiospecimenUidToken>(0); biospecimenUidTokens = iArkCommonService.getBiospecimenUidTokens(); ChoiceRenderer<BiospecimenUidToken> choiceRenderer = new ChoiceRenderer<BiospecimenUidToken>(Constants.NAME, Constants.ID);/*from w w w. j a va 2 s.co m*/ biospecimenUidTokenDdc = new DropDownChoice<BiospecimenUidToken>( "biospecimenUidTemplate.biospecimenUidToken", biospecimenUidTokens, choiceRenderer); biospecimenUidTokenDdc.add(new AjaxFormComponentUpdatingBehavior("onChange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { biospecimenUidExampleTxt = getBiospecimenUidExample(); target.add(biospecimenUidExampleLbl); } }); }