Example usage for org.apache.wicket.markup.html WebMarkupContainer get

List of usage examples for org.apache.wicket.markup.html WebMarkupContainer get

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html WebMarkupContainer get.

Prototype

@Override
public final Component get(String path) 

Source Link

Document

Get a child component by looking it up with the given path.

Usage

From source file:au.org.theark.core.web.form.AbstractWizardForm.java

License:Open Source License

protected void onNextError(AjaxRequestTarget target, Form<?> form) {
    log.debug("next.onError");
    // Wizard steps are contained within a WebMarkupContainer
    WebMarkupContainer wmc = (WebMarkupContainer) get("wizardFormContainer");
    AbstractWizardStepPanel currentStep = (AbstractWizardStepPanel) wmc.get("step");
    currentStep.onStepOutNextError(AbstractWizardForm.this, target);
}

From source file:au.org.theark.core.web.form.AbstractWizardForm.java

License:Open Source License

/**
 * Warn the current step panel we are going out by next, and ask which is the next step.
 * //from  ww w  .  ja  va2 s  .c  o  m
 * @param target
 */
protected void gotoNext(AjaxRequestTarget target) {
    // Wizard steps are contained within a WebMarkupContainer
    WebMarkupContainer wmc = (WebMarkupContainer) get("wizardFormContainer");
    AbstractWizardStepPanel currentStep = (AbstractWizardStepPanel) wmc.get("step");

    log.debug("gotoNext.currentStep={}", currentStep.getClass().getName());

    // Handle wizard step state on Next press
    currentStep.onStepOutNext(AbstractWizardForm.this, target);
    currentStep.handleWizardState(this, target);

    AbstractWizardStepPanel next = currentStep.getNextStep();
    if (next != null) {
        next.onStepInNext(AbstractWizardForm.this, target);
        currentStep.replaceWith(next);

        // If no more steps, on final step
        if (next.getNextStep() == null) {
            nextButton.setEnabled(false);
            cancelLink.setEnabled(false);
            finishButton.setEnabled(true);
            arkExcelWorkSheetAsGrid.setEnabled(false);
            target.add(arkExcelWorkSheetAsGrid);
        }

        target.add(wizardButtonContainer);
    }
    target.add(wmc);
    target.add(feedBackPanel);

}

From source file:au.org.theark.core.web.form.AbstractWizardForm.java

License:Open Source License

/**
 * Warn the current step panel we are going out by previous, and ask which is the previous step.
 * /*from w w  w  .j a v  a 2s .  c o m*/
 * @param target
 */
protected void gotoPrevious(AjaxRequestTarget target) {
    WebMarkupContainer wmc = (WebMarkupContainer) get("wizardFormContainer");
    AbstractWizardStepPanel currentStep = (AbstractWizardStepPanel) wmc.get("step");
    log.debug("gotoPrevious.currentStep={}", currentStep.getClass().getName());
    currentStep.onStepOutPrevious(AbstractWizardForm.this, target);

    AbstractWizardStepPanel previous = currentStep.getPreviousStep();
    if (previous != null) {
        currentStep.replaceWith(previous);
        previous.onStepInPrevious(this, target);
        previous.handleWizardState(this, target);
    }
    target.add(wmc);
    target.add(feedBackPanel);
}

From source file:au.org.theark.study.web.component.address.form.DetailForm.java

License:Open Source License

@Override
protected void onSave(Form<AddressVO> containerForm, AjaxRequestTarget target) {
    Long personSessionId = (Long) SecurityUtils.getSubject().getSession()
            .getAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID);
    StringBuffer feedBackMessageStr = new StringBuffer();
    // Get the person and set it on the AddressVO.
    try {//from   ww  w.j ava  2s  .  c om
        Person person = iStudyService.getPerson(personSessionId);

        List<State> statesForThisCountry = iArkCommonService
                .getStates(containerForm.getModelObject().getAddress().getCountry());
        if (statesForThisCountry.isEmpty()) {
            containerForm.getModelObject().getAddress().setState(null);
        } else {
            containerForm.getModelObject().getAddress().setOtherState(null);
        }
        //         otherStateInvalidError.setVisible(false);
        WebMarkupContainer wmcStateSelector = (WebMarkupContainer) arkCrudContainerVO
                .getDetailPanelFormContainer().get(Constants.STATE_SELECTOR_WMC);
        Label otherStateInvalidError = (Label) wmcStateSelector.get("address.otherStateInvalidError");
        otherStateInvalidError.setVisible(false);

        containerForm.getModelObject().getAddress().setPerson(person);
        if (containerForm.getModelObject().getAddress().getId() == null) {
            if (containerForm.getModelObject().getAddress().getPreferredMailingAddress()) {
                // Update any other preferredMailingAddresses to false
                iStudyService.setPreferredMailingAdressToFalse(person);
            }

            iStudyService.create(containerForm.getModelObject().getAddress());
            feedBackMessageStr.append("Address was successfully added and linked to Subject: ");
        } else {
            if (containerForm.getModelObject().getAddress().getPreferredMailingAddress()) {
                // Update any other preferredMailingAddresses to false
                iStudyService.setPreferredMailingAdressToFalse(person);
            }

            iStudyService.update(containerForm.getModelObject().getAddress());
            feedBackMessageStr.append("Address was successfully updated and linked to Subject: ");
        }

        if (person.getFirstName() != null && person.getLastName() != null) {
            feedBackMessageStr.append(person.getFirstName() + " " + person.getLastName());
        } else {
            Long studyId = (Long) SecurityUtils.getSubject().getSession()
                    .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);
            Study study = iArkCommonService.getStudy(studyId);
            String uid = iArkCommonService.getSubject(person.getId(), study).getSubjectUID();
            feedBackMessageStr.append(uid);
        }
        this.info(feedBackMessageStr.toString());
        processErrors(target);
        onSavePostProcess(target);
        // Invoke backend to persist the AddressVO
    } catch (EntityNotFoundException e) {
        this.error("The Specified subject is not available any more in the system. Please re-do the operation");
    } catch (ArkSystemException e) {
        this.error("A system error has occured, Pleas contact support.");
    }
}

From source file:au.org.theark.study.web.component.address.form.SearchForm.java

License:Open Source License

public void updateDetailFormPrerender(Address address) {
    // Ensure we update the CountyStateChoices in DetailsForm
    // like what happens via DetailForm's updateStateChoices(..)
    List<State> stateList = iArkCommonService.getStates(address.getCountry());
    WebMarkupContainer wmcStateSelector = (WebMarkupContainer) arkCrudContainerVO.getDetailPanelFormContainer()
            .get(Constants.STATE_SELECTOR_WMC);
    DropDownChoice<State> detailStateSelector = (DropDownChoice<State>) wmcStateSelector.get("address.state");
    Label otherStateInvalidError = (Label) wmcStateSelector.get("address.otherStateInvalidError");
    TextField<String> otherState = (TextField<String>) wmcStateSelector.get("address.otherState");

    if (stateList != null && stateList.size() > 0) {
        detailStateSelector.getChoices().clear();
        detailStateSelector.setChoices(stateList);
        detailStateSelector.setVisible(true);
        otherState.setVisible(false);//from w w w. j  av a 2  s .c o m
        //ARK-748 
        //Ignore the new Address objects from state validation and hide the other state validation label
        if (getModelObject().getAddress().getId() != null && otherState.getModelObject() != null
                && !otherState.getModelObject().isEmpty()) {
            //alert the user
            otherStateInvalidError = new Label("address.otherStateInvalidError",
                    "Previously uploaded value " + otherState.getModelObject() + " was invalid.");
            otherStateInvalidError.add(new Behavior() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 7964297415151363039L;

                @Override
                public void onComponentTag(Component component, ComponentTag tag) {
                    super.onComponentTag(component, tag);
                    tag.put("class", "fieldErrorMessage");//or something like ("style"; "color-red")
                }
            });
            wmcStateSelector.addOrReplace(otherStateInvalidError);
        } else {
            otherStateInvalidError.setVisible(false);
        }
    } else {
        // hide it
        detailStateSelector.setVisible(false);
        otherState.setVisible(true);
        otherStateInvalidError.setVisible(false);
    }
}

From source file:au.org.theark.study.web.component.contact.ContactContainerPanel.java

License:Open Source License

/**
 * //w  w  w.j a v  a2 s .  co m
 * @param address
 */
private void updateDetailFormPrerender(Address address) {
    // Ensure we update the CountyStateChoices in DetailsForm
    // like what happens via DetailForm's updateStateChoices(..)
    List<State> stateList = iArkCommonService.getStates(address.getCountry());
    WebMarkupContainer wmcStateSelector = (WebMarkupContainer) arkCrudContainerVO.getDetailPanelFormContainer()
            .get(Constants.STATE_SELECTOR_WMC);
    DropDownChoice<State> detailStateSelector = (DropDownChoice<State>) wmcStateSelector
            .get("addressVo.address.state");
    Label otherStateInvalidError = (Label) wmcStateSelector.get("addressVo.address.otherStateInvalidError");
    TextField<String> otherState = (TextField<String>) wmcStateSelector.get("addressVo.address.otherState");

    if (stateList != null && stateList.size() > 0) {
        detailStateSelector.getChoices().clear();
        detailStateSelector.setChoices(stateList);
        detailStateSelector.setVisible(true);
        otherState.setVisible(false);
        //ARK-748 
        //Ignore the new Address objects from state validation and hide the other state validation label
        if (cpModel.getObject().getAddressVo().getAddress().getId() != null
                && otherState.getModelObject() != null && !otherState.getModelObject().isEmpty()) {
            //alert the user
            otherStateInvalidError = new Label("addressVo.address.otherStateInvalidError",
                    "Previously uploaded value " + otherState.getModelObject() + " was invalid.");
            otherStateInvalidError.add(new Behavior() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 7964297415151363039L;

                @Override
                public void onComponentTag(Component component, ComponentTag tag) {
                    super.onComponentTag(component, tag);
                    tag.put("class", "fieldErrorMessage");//or something like ("style"; "color-red")
                }
            });
            wmcStateSelector.addOrReplace(otherStateInvalidError);
        } else {
            otherStateInvalidError.setVisible(false);
        }
    } else {
        // hide it
        detailStateSelector.setVisible(false);
        otherState.setVisible(true);
        otherStateInvalidError.setVisible(false);
    }
}

From source file:au.org.theark.study.web.component.contact.form.AddressDetailForm.java

License:Open Source License

@Override
protected void onSave(Form<ContactVO> containerForm, AjaxRequestTarget target) {
    Long personSessionId = (Long) SecurityUtils.getSubject().getSession()
            .getAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID);
    StringBuffer feedBackMessageStr = new StringBuffer();
    // Get the person and set it on the AddressVO.
    try {/*from   w w  w  . jav a  2s  .com*/
        Person person = iStudyService.getPerson(personSessionId);

        List<State> statesForThisCountry = iArkCommonService
                .getStates(containerForm.getModelObject().getAddressVo().getAddress().getCountry());
        if (statesForThisCountry.isEmpty()) {
            containerForm.getModelObject().getAddressVo().getAddress().setState(null);
        } else {
            containerForm.getModelObject().getAddressVo().getAddress().setOtherState(null);
        }
        //         otherStateInvalidError.setVisible(false);
        WebMarkupContainer wmcStateSelector = (WebMarkupContainer) arkCrudContainerVO
                .getDetailPanelFormContainer().get(Constants.STATE_SELECTOR_WMC);
        Label otherStateInvalidError = (Label) wmcStateSelector.get("addressVo.address.otherStateInvalidError");
        otherStateInvalidError.setVisible(false);

        containerForm.getModelObject().getAddressVo().getAddress().setPerson(person);
        if (containerForm.getModelObject().getAddressVo().getAddress().getId() == null) {
            if (containerForm.getModelObject().getAddressVo().getAddress().getPreferredMailingAddress()) {
                // Update any other preferredMailingAddresses to false
                iStudyService.setPreferredMailingAdressToFalse(person);
            }

            iStudyService.create(containerForm.getModelObject().getAddressVo().getAddress());
            feedBackMessageStr.append("Address was successfully added and linked to Subject: ");
        } else {
            if (containerForm.getModelObject().getAddressVo().getAddress().getPreferredMailingAddress()) {
                // Update any other preferredMailingAddresses to false
                iStudyService.setPreferredMailingAdressToFalse(person);
            }

            iStudyService.update(containerForm.getModelObject().getAddressVo().getAddress());
            feedBackMessageStr.append("Address was successfully updated and linked to Subject: ");
        }

        if (person.getFirstName() != null && person.getLastName() != null) {
            feedBackMessageStr.append(person.getFirstName() + " " + person.getLastName());
        } else {
            Long studyId = (Long) SecurityUtils.getSubject().getSession()
                    .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);
            Study study = iArkCommonService.getStudy(studyId);
            String uid = iArkCommonService.getSubject(person.getId(), study).getSubjectUID();
            feedBackMessageStr.append(uid);
        }
        this.info(feedBackMessageStr.toString());
        processErrors(target);
        onSavePostProcess(target);
        // Invoke backend to persist the AddressVO
    } catch (EntityNotFoundException e) {
        this.error("The Specified subject is not available any more in the system. Please re-do the operation");
    } catch (ArkSystemException e) {
        this.error("A system error has occured, Pleas contact support.");
    }
}

From source file:au.org.theark.study.web.component.managestudy.form.SearchForm.java

License:Open Source License

@SuppressWarnings("unchecked")
protected void onNew(AjaxRequestTarget target) {
    containerForm.setModelObject(new StudyModelVO());
    Collection<ArkModule> availableArkModules = new ArrayList<ArkModule>();
    availableArkModules = iArkCommonService.getEntityList(ArkModule.class);
    // Hide Admin and Reporting modules from "Available" view
    availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_ADMIN));
    //availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_REPORTING));

    containerForm.getModelObject().setAvailableArkModules(availableArkModules);// ArkModule from database not LDAP.

    Collection<ArkModule> selectedArkModules = new ArrayList<ArkModule>();
    selectedArkModules.add(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_STUDY));
    selectedArkModules.add(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_SUBJECT));
    containerForm.getModelObject().setSelectedArkModules(selectedArkModules);

    // Hide Summary details on new
    studyCrudContainerVO.getSummaryContainer().setVisible(false);
    target.add(studyCrudContainerVO.getSummaryContainer());

    // Show upload item for new Study
    studyCrudContainerVO.getStudyLogoMarkup().setVisible(true);
    studyCrudContainerVO.getStudyLogoUploadContainer().setVisible(true);

    StudyHelper studyHelper = new StudyHelper();
    studyHelper.setStudyLogo(containerForm.getModelObject().getStudy(), target,
            studyCrudContainerVO.getStudyNameMarkup(), studyCrudContainerVO.getStudyLogoMarkup());

    target.add(studyCrudContainerVO.getStudyLogoMarkup());
    target.add(studyCrudContainerVO.getStudyLogoUploadContainer());

    // Clear context items
    ContextHelper contextHelper = new ContextHelper();
    contextHelper.resetContextLabel(target, studyCrudContainerVO.getArkContextMarkup());
    studyNameTxtFld.setEnabled(true);//from   w w w .jav a 2  s .  co  m

    // Default boolean selections
    containerForm.getModelObject().getStudy().setAutoGenerateSubjectUid(false);
    containerForm.getModelObject().getStudy().setAutoConsent(false);

    // TODO: Suggest moving some of this "onNew" code into DetailPanel/DetailForm's onBeforeRender(..)
    // Disable SubjectUID pattern fields by default for New study
    WebMarkupContainer wmc = (WebMarkupContainer) studyCrudContainerVO.getDetailPanelContainer();
    DetailPanel detailsPanel = (DetailPanel) wmc.get("detailPanel");
    DetailForm detailForm = (DetailForm) detailsPanel.get("detailForm");
    WebMarkupContainer autoSubjectUidcontainer = detailForm.getAutoSubjectUidContainer();
    WebMarkupContainer autoBiocollectionContainer = detailForm.getAutoBiocollectionUidContainer();
    WebMarkupContainer autoBiospecimenContainer = detailForm.getAutoBiospecimenUidContainer();
    WebMarkupContainer subjectUidcontainer = detailForm.getSubjectUidContainer();

    // Example auto-generated SubjectUID to "AAA-0000000001" on new
    containerForm.getModelObject().setSubjectUidExample(Constants.SUBJECTUID_EXAMPLE);
    Label subjectUidExampleLbl = detailForm.getSubjectUidExampleLbl();
    subjectUidExampleLbl.setDefaultModelObject(containerForm.getModelObject().getSubjectUidExample());
    target.add(subjectUidExampleLbl);

    autoSubjectUidcontainer.setEnabled(true);
    autoBiocollectionContainer.setEnabled(true);
    autoBiospecimenContainer.setEnabled(true);
    subjectUidcontainer.setEnabled(false);
    target.add(subjectUidcontainer);

    preProcessDetailPanel(target);
}

From source file:au.org.theark.study.web.component.managestudy.SearchResultListPanel.java

License:Open Source License

private AjaxLink<Study> buildLink(final Study study, final WebMarkupContainer searchResultsContainer) {
    ArkBusyAjaxLink<Study> link = new ArkBusyAjaxLink<Study>("studyName") {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override//from   ww w. j  a  v  a2 s . c om
        public void onClick(AjaxRequestTarget target) {
            Subject currentUser = SecurityUtils.getSubject();

            // Place the selected study in session context for the user
            SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID,
                    study.getId());
            SecurityUtils.getSubject().getSession()
                    .removeAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID);
            SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.PERSON_TYPE);
            // Clear out any Subject UID placed in session via LIMS
            SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.SUBJECTUID);

            // Force clearing of Cache to re-load roles for the user for the study
            arkLdapRealm.clearCachedAuthorizationInfo(currentUser.getPrincipals());
            aafRealm.clearCachedAuthorizationInfo(currentUser.getPrincipals());

            Study searchStudy = iArkCommonService.getStudy(study.getId());
            /**************
             * this is code which must not be commented out...was to be utilized to deal with data from WAGER ... 
            //TODO ASAP Dont leave this nasty hack here
            iArkCommonService.convertLimsBiospecimenCustomDataValuesToKeysForThisStudy(searchStudy);~~~
            //TODO ASAP Dont leave this nasty hack here
            iArkCommonService.convertLimsBiocollectionCustomDataValuesToKeysForThisStudy(searchStudy);~~~
            ************/

            Study parentStudy = searchStudy.getParentStudy();

            // Check if the study has been linked to a Main Study and if so get a reference to the main study.
            // studyContainerForm.getModelObject().setLinkedToStudy(linkedToStudy)

            studyContainerForm.getModelObject().setStudy(searchStudy);
            studyContainerForm.getModelObject()
                    .setSubjectUidExample(iArkCommonService.getSubjectUidExample(searchStudy));

            WebMarkupContainer wmc = (WebMarkupContainer) studyCrudContainerVO.getDetailPanelContainer();
            DetailPanel detailsPanel = (DetailPanel) wmc.get("detailPanel");
            DetailForm detailForm = (DetailForm) detailsPanel.get("detailForm");

            // All SubjectUID generator fields grouped within a container(s)
            WebMarkupContainer autoSubjectUidcontainer = detailForm.getAutoSubjectUidContainer();
            WebMarkupContainer autoBiocollectionUidcontainer = detailForm.getAutoBiocollectionUidContainer();
            WebMarkupContainer autoBiospecimenUidcontainer = detailForm.getAutoBiospecimenUidContainer();
            WebMarkupContainer subjectUidcontainer = detailForm.getSubjectUidContainer();

            // Disable all SubjectUID generation fields if subjects exist or is a child study
            if (iArkCommonService.studyHasSubjects(searchStudy) || parentStudy != null) {
                autoSubjectUidcontainer.setEnabled(false);
                subjectUidcontainer.setEnabled(false);
            } else {
                autoSubjectUidcontainer.setEnabled(true);
                if (studyContainerForm.getModelObject().getStudy().getAutoGenerateSubjectUid()) {
                    subjectUidcontainer.setEnabled(true);
                } else {
                    subjectUidcontainer.setEnabled(false);
                }
            }

            // Enable bioSpecimenUidContainer if there are no biospecimens created as yet
            WebMarkupContainer biospecimenUidContainer = detailForm.getBiospecimenUidContainer();
            if (iArkCommonService.studyHasBiospecimen(studyContainerForm.getModelObject().getStudy())) {
                biospecimenUidContainer.setEnabled(false);
                autoBiospecimenUidcontainer.setEnabled(false);
            } else {
                biospecimenUidContainer.setEnabled(parentStudy == null);
                autoBiospecimenUidcontainer.setEnabled(parentStudy == null);
            }

            WebMarkupContainer bioCollectionUidContainer = detailForm.getBioCollectionUidContainer();
            if (iArkCommonService.studyHasBioCollection(studyContainerForm.getModelObject().getStudy())) {
                bioCollectionUidContainer.setEnabled(false);
                autoBiocollectionUidcontainer.setEnabled(false);
            } else {
                bioCollectionUidContainer.setEnabled(parentStudy == null);
                autoBiocollectionUidcontainer.setEnabled(parentStudy == null);
            }

            // Get the Source Modules from database
            Collection<ArkModule> availableArkModules = iArkCommonService.getEntityList(ArkModule.class);
            // Hide Admin and Reporting modules from "Available" view
            availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_ADMIN));
            //availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_REPORTING));

            // Get the Modules for the Study from database
            Collection<ArkModule> arkModulesLinkedToStudy = iArkCommonService
                    .getArkModulesLinkedWithStudy(searchStudy);

            studyContainerForm.getModelObject().setAvailableArkModules(availableArkModules);
            studyContainerForm.getModelObject().setSelectedArkModules(arkModulesLinkedToStudy);

            // Store module names linked to study in session
            for (Iterator iterator = arkModulesLinkedToStudy.iterator(); iterator.hasNext();) {
                ArkModule arkModule = (ArkModule) iterator.next();
                SecurityUtils.getSubject().getSession().setAttribute(arkModule.getName(), arkModule.getName());
            }
            studyCrudContainerVO.getSummaryContainer().setVisible(true);

            // Set Study Logo
            studyHelper = new StudyHelper();
            studyHelper.setStudyLogo(searchStudy, target, studyCrudContainerVO.getStudyNameMarkup(),
                    studyCrudContainerVO.getStudyLogoMarkup());

            // Set Context items
            ContextHelper contextHelper = new ContextHelper();
            contextHelper.resetContextLabel(target, studyCrudContainerVO.getArkContextMarkup());
            contextHelper.setStudyContextLabel(target, searchStudy.getName(),
                    studyCrudContainerVO.getArkContextMarkup());

            target.add(studyCrudContainerVO.getSummaryContainer());
            ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, studyCrudContainerVO);

            // Example auto-generated SubjectUID
            Label subjectUidExampleLbl = detailForm.getSubjectUidExampleLbl();

            // Get the Biospecimen UID Pattern if present for the given study
            BiospecimenUidTemplate biospecimentUidTemplate = null;
            // Get the BioCollection UID pattern if present
            BioCollectionUidTemplate bioCollectionUidTemplate = null;

            if (parentStudy == null || searchStudy == parentStudy) {
                subjectUidExampleLbl.setDefaultModelObject(iArkCommonService.getSubjectUidExample(searchStudy));
                biospecimentUidTemplate = iArkCommonService.getBiospecimenUidTemplate(searchStudy);
                bioCollectionUidTemplate = iArkCommonService.getBioCollectionUidTemplate(searchStudy);
            } else {
                // Disable parent study drop down
                detailForm.getLinkedToStudyDDContainer().setEnabled(false);
                subjectUidExampleLbl.setDefaultModelObject(iArkCommonService.getSubjectUidExample(parentStudy));
                biospecimentUidTemplate = iArkCommonService.getBiospecimenUidTemplate(parentStudy);
                bioCollectionUidTemplate = iArkCommonService.getBioCollectionUidTemplate(parentStudy);
            }

            if (biospecimentUidTemplate != null) {
                studyContainerForm.getModelObject().setBiospecimenUidTemplate(biospecimentUidTemplate);
            }

            if (bioCollectionUidTemplate != null) {
                studyContainerForm.getModelObject().setBioCollectionUidTemplate(bioCollectionUidTemplate);
            }
            target.add(subjectUidExampleLbl);

            boolean isChildStudy = (parentStudy != null && parentStudy != searchStudy);
            detailForm.getSubjectFileUploadContainer().setVisible(isChildStudy);
            detailForm.getSubjectFileUploadContainer().setEnabled(isChildStudy);

            long totalSubjects = iArkCommonService.getCountOfSubjects(searchStudy);
            long totalSubjectsOfParent = iArkCommonService.getCountOfSubjects(searchStudy.getParentStudy());

            studyContainerForm.getModelObject().setTotalSubjects(totalSubjects);
            studyContainerForm.getModelObject().setTotalSubjectsOfParent(totalSubjectsOfParent);

            // Refresh base container form to remove any feedBack messages
            target.add(autoSubjectUidcontainer);
            target.add(subjectUidcontainer);
            target.add(autoBiocollectionUidcontainer);
            target.add(bioCollectionUidContainer);
            target.add(autoBiospecimenUidcontainer);
            target.add(biospecimenUidContainer);
            target.add(studyContainerForm);
            target.add(moduleTabbedPanel);
        }
    };

    // Add the label for the link
    Label studyNameLinkLabel = new Label("studyNameLink", study.getName());
    link.add(studyNameLinkLabel);
    return link;
}

From source file:com.effectivemaven.centrepoint.web.EditPanelConfigurationPageTest.java

License:Apache License

@SuppressWarnings("unchecked")
private void assertForm(String name, String value) {
    wicketTester.assertComponent(EDIT_PANEL_CONFIG_FORM + ":row", RepeatingView.class);
    RepeatingView rv = (RepeatingView) wicketTester
            .getComponentFromLastRenderedPage(EDIT_PANEL_CONFIG_FORM + ":row");
    assert rv.size() == 1;
    WebMarkupContainer c = (WebMarkupContainer) rv.get(0);
    assert name.equals(c.get("name").getDefaultModelObjectAsString());
    TextField<String> field = (TextField<String>) c.get("value");
    assert field.getModelObject() == value;
}