コード例 #1
0
  public String processDrop(DropEvent ev) {
    String sTableClassifier = (String) ev.getDropValue();
    FacesContext context = FacesContext.getCurrentInstance();
    // from the list of all available metrics (name in all available metrics must be unique)
    String sDroppedMetricName =
        context.getExternalContext().getRequestParameterMap().get("droppedMetricName").toString();
    String sType = this.mapMetricNameType.get(sDroppedMetricName);

    List<MetricBean> lMT = null;
    UIComponent uiParent = null;
    // for classification 'very good'
    if (sTableClassifier.equals("tableVeryGood")) {
      lMT = lVeryGoodMT;
      uiParent = this.getComponent("pConfigVeryGood");
    }
    if (sTableClassifier.equals("tableGood")) {
      lMT = lVeryGoodMT;
      uiParent = this.getComponent("pConfigGood");
    }
    if (sTableClassifier.equals("tableBad")) {
      lMT = lBadMT;
      uiParent = this.getComponent("pConfigBad");
    }
    if (sTableClassifier.equals("tableVeryBad")) {
      lMT = lVeryBadMT;
      uiParent = this.getComponent("pConfigVeryBad");
    }

    // check the rules if this metric may be added for the table
    if (helperMetricNameAddable(sDroppedMetricName, lMT)) {
      // create a new (gui) metric bean. an auto-id is being created
      MetricBean m = new MetricBean(sDroppedMetricName, sType);
      // add this bean for being the element that's configured
      this.mbToConfigure = m;
      // create the used config UI components as selectors, dropdown boxes, etc.
      helperCreateUICompsForMetricConfig(m, uiParent);
    }

    return "reload-page";
  }