Ejemplo n.º 1
0
  public void buildTabs(final WebMarkupContainer arkContextMarkup) {
    ArkModule arkModule =
        iArkCommonService.getArkModuleByName(au.org.theark.core.Constants.ARK_MODULE_PHENOTYPIC);
    List<ArkFunction> arkFunctionList = iArkCommonService.getModuleFunction(arkModule);
    for (final ArkFunction menuArkFunction : arkFunctionList) {
      AbstractTab tab =
          new AbstractTab(new StringResourceModel(menuArkFunction.getResourceKey(), this, null)) {
            @Override
            public Panel getPanel(final String panelId) {
              return panelToReturn(menuArkFunction, panelId);
            }
          };
      moduleSubTabsList.add(tab);
    }

    ArkAjaxTabbedPanel moduleTabbedPanel =
        new ArkAjaxTabbedPanel(Constants.PHENOTYPIC_SUBMENU, moduleSubTabsList);
    add(moduleTabbedPanel);
  }
Ejemplo n.º 2
0
  protected Panel panelToReturn(final ArkFunction arkFunction, String panelId) {
    Panel panelToReturn = null;

    // Clear cache to determine permissions
    processAuthorizationCache(au.org.theark.core.Constants.ARK_MODULE_PHENOTYPIC, arkFunction);

    if (arkFunction
        .getName()
        .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_DATA_CATEGORY)) {
      panelToReturn = new PhenoDataCategoryContainerPanel(panelId, false, arkFunction);
    } else if (arkFunction
        .getName()
        .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_DATA_DICTIONARY)) {
      panelToReturn = new PhenoDataDictionaryContainerPanel(panelId, true, arkFunction);
    } else if (arkFunction
        .getName()
        .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_DATA_DICTIONARY_UPLOAD)) {
      panelToReturn = new PhenoDataSetCategoryFieldUploadContainerPanel(panelId, arkFunction);
    } else if (arkFunction
        .getName()
        .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_PHENO_COLLECTION)) {
      panelToReturn = new DataDictionaryGroupContainerPanel(panelId, arkFunction);
    } else if (arkFunction
        .getName()
        .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_FIELD_DATA)) {
      panelToReturn = new PhenoCollectionDataEntryContainerPanel(panelId).initialisePanel();
    } else if (arkFunction
        .getName()
        .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_FIELD_DATA_UPLOAD)) {
      // panelToReturn = new FieldDataUploadContainerPanel(panelId); //OLD Code
      // panelToReturn = new PhenoDataUploadContainerPanel(panelId);
      panelToReturn = new PhenoDataUploadContainerPanel(panelId, arkFunction);
    }
    /*	TODO trav put new uploader here
     *
     * else if (arkFunction.getName().equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_FIELD_DATA_UPLOAD)) {
    		//panelToReturn = new FieldDataUploadContainerPanel(panelId); //OLD Code
    		panelToReturn = new PhenoDataUploadContainerPanel(panelId);
    	}
    */

    return panelToReturn;
  }
Ejemplo n.º 3
0
  @SuppressWarnings({"serial", "unchecked"})
  public void buildTabs() {

    List<ITab> moduleSubTabsList = new ArrayList<ITab>();

    ArkModule arkModule = iArkCommonService.getArkModuleByName(Constants.ARK_MODULE_SUBJECT);
    List<ArkFunction> arkFunctionList =
        iArkCommonService.getModuleFunction(
            arkModule); // Gets a list of ArkFunctions for the given Module

    for (final ArkFunction menuArkFunction : arkFunctionList) {

      moduleSubTabsList.add(
          new AbstractTab(new StringResourceModel(menuArkFunction.getResourceKey(), this, null)) {
            @Override
            public Panel getPanel(String panelId) {
              Panel panelToReturn = null; // Set
              if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn =
                    new SubjectContainerPanel(
                        panelId, arkContextMarkup, null, null); // Note the constructor
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_PHONE)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new PhoneContainerPanel(panelId);
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_ADDRESS)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new AddressContainerPanel(panelId);
              }
              // Add contact panel
              else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_CONTACT)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new ContactContainerPanel(panelId);
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_CONSENT)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new ConsentContainerPanel(panelId);
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(au.org.theark.core.Constants.FUNCTION_KEY_VALUE_ATTACHMENT)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new AttachmentsContainerPanel(panelId);
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(
                      au.org.theark.core.Constants.FUNCTION_KEY_VALUE_STUDY_STUDY_DATA_UPLOAD)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new SubjectUploadContainerPanel(panelId, menuArkFunction);
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(
                      au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CORRESPONDENCE)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new CorrespondenceContainerPanel(panelId);
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(
                      au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_FIELD)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                // useCustomFieldDisplay = true
                panelToReturn =
                    new CustomFieldContainerPanel(
                        panelId,
                        true,
                        iArkCommonService.getArkFunctionByName(
                            au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_FIELD));
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(
                      au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_DATA)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn = new SubjectCustomDataContainerPanel(panelId).initialisePanel();
              } else if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(
                      au.org.theark.core.Constants
                          .FUNCTION_KEY_VALUE_SUBJECT_CUSTOM_FIELD_UPLOAD)) {
                processAuthorizationCache(
                    au.org.theark.core.Constants.ARK_MODULE_SUBJECT, menuArkFunction);
                panelToReturn =
                    new CustomFieldUploadContainerPanel(
                        panelId,
                        iArkCommonService.getArkFunctionByName(
                            au.org.theark.core.Constants.FUNCTION_KEY_VALUE_SUBJECT));
              }
              return panelToReturn;
            }

            @Override
            public boolean isVisible() {
              // Subject Upload only visible to parent studies
              if (menuArkFunction
                  .getName()
                  .equalsIgnoreCase(
                      au.org.theark.core.Constants.FUNCTION_KEY_VALUE_STUDY_STUDY_DATA_UPLOAD)) {
                return (!childStudy);
              }
              return true;
            }
          });
    }

    ArkAjaxTabbedPanel moduleTabbedPanel =
        new ArkAjaxTabbedPanel(Constants.MENU_SUBJECT_SUBMENU, moduleSubTabsList);
    add(moduleTabbedPanel);
  }