Beispiel #1
0
  private void initCustomFieldDataListPanel() {
    cfdProvider.setCriteriaModel(
        new PropertyModel<CustomFieldDisplay>(cpModel, "customFieldGroup"));
    List<CustomField> selectedList =
        iPhenotypicService.getCustomFieldsLinkedToCustomFieldGroup(
            getModelObject().getCustomFieldGroup());
    Boolean disableEditButton = false;
    if (getModelObject().getCustomFieldGroup().getPublished()) {
      for (CustomField customField : selectedList) {
        if (customField.getCustomFieldHasData()) {
          disableEditButton = true;
          break;
        }
      }
    }

    CustomFieldDisplayListPanel cfdListPanel =
        new CustomFieldDisplayListPanel(
            "cfdListPanel", feedBackPanel, arkCrudContainerVO, disableEditButton);
    cfdListPanel.setOutputMarkupId(true);
    cfdListPanel.initialisePanel();
    dataView = cfdListPanel.buildDataView(cfdProvider);
    dataView.setItemsPerPage(iArkCommonService.getRowsPerPage());

    AjaxPagingNavigator pageNavigator =
        new AjaxPagingNavigator("cfDisplayNavigator", dataView) {

          private static final long serialVersionUID = 1L;

          @Override
          protected void onAjaxEvent(AjaxRequestTarget target) {
            target.add(arkCrudContainerVO.getWmcForCustomFieldDisplayListPanel());
          }
        };
    cfdListPanel.addOrReplace(pageNavigator);
    cfdListPanel.addOrReplace(dataView);
    arkCrudContainerVO.getWmcForCustomFieldDisplayListPanel().addOrReplace(cfdListPanel);
  }
Beispiel #2
0
  /*
   * (non-Javadoc)
   *
   * @see au.org.theark.core.web.form.AbstractDetailForm#onDeleteConfirmed(org.apache.wicket.ajax.AjaxRequestTarget, java.lang.String)
   */
  @Override
  protected void onDeleteConfirmed(AjaxRequestTarget target, String selection) {
    // Get a list of CustomFields for the given group
    ArrayList<CustomField> selectedList =
        (ArrayList)
            iPhenotypicService.getCustomFieldsLinkedToCustomFieldGroup(
                getModelObject().getCustomFieldGroup());

    Boolean allowDelete = true;
    for (CustomField customField : selectedList) {
      if (customField.getCustomFieldHasData()) {
        allowDelete = false;
        break;
      }
    }
    if (allowDelete) {
      iPhenotypicService.deleteCustomFieldGroup(getModelObject());
      this.info("Data Set has been deleted successfully.");
      editCancelProcess(target);

    } else {
      this.error("This Data Set cannot be deleted.");
    }
  }