예제 #1
0
  public WF_SimpleCounter(
      String targetId, String label, String descriptionT, WF_Context myContext, boolean isVisible) {
    super(
        label,
        descriptionT,
        myContext,
        LayoutInflater.from(myContext.getContext()).inflate(R.layout.selection_field_normal, null),
        isVisible);

    gs = GlobalState.getInstance(myContext.getContext());
    myTarget = gs.getArtLista().getVariableInstance(targetId);
    if (myTarget == null) {
      o.addRow("");
      o.addRedText("Missing target variable " + targetId + " in SimpleCounter");
    } else {
      List<String> listElems = gs.getArtLista().getListElements(myTarget.getBackingDataSet());
      int count = 0;
      if (listElems != null) count = listElems.size();
      Variable noOfAvslutade = gs.getArtLista().getVariableInstance("noOfAvslutade");
      noOfAvslutade.setValue(count + "");
      this.addVariable(noOfAvslutade, true, null, true);
      this.refreshOutputFields();
    }
  }