protected void updateChosenKeysIndex() {
   List<Component> rowsList = rows.getChildren();
   for (Component component : rowsList) {
     Component child = component.getLastChild();
     if (child instanceof Selectbox) {
       Selectbox selectbox = (Selectbox) child;
       int index = Integer.parseInt(selectbox.getId());
       chosenKeysIndex[index] = selectbox.getSelectedIndex();
     }
   }
 }
  public PrimaryKeyController(
      BPMNMinerController bpmnMinerController, List<PrimaryKeyData> pKeyData)
      throws IOException, NoEntityException {
    this.bpmnMinerController = bpmnMinerController;

    this.primaryKeyW =
        (Window)
            bpmnMinerController
                .portalContext
                .getUI()
                .createComponent(
                    getClass().getClassLoader(), "zul/selectPrimaryKey.zul", null, null);
    this.primaryKeyW.setTitle("Select Primary Keys");

    this.cancelButton = (Button) this.primaryKeyW.getFellow("cancelButton");
    this.nextButton = (Button) this.primaryKeyW.getFellow("okButton");

    this.cancelButton.addEventListener(
        "onClick",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            cancel();
          }
        });
    this.nextButton.addEventListener(
        "onClick",
        new EventListener<Event>() {
          public void onEvent(Event event) throws Exception {
            next();
          }
        });

    this.rows = (Rows) this.primaryKeyW.getFellow("rows");

    this.data = pKeyData;
    chosenKeysIndex = new int[data.size()];
    int dataIndex = 0;
    // create a new property item for each event type
    for (PrimaryKeyData currentData : data) {

      chosenKeysIndex[dataIndex] = 0;

      // build a list of all keys (sets of attribute names)
      String[] keyList =
          new String
              [currentData
                  .primaryKeys
                  .length]; // change if user can select any attributes for identifiers
      for (int i = 0; i < currentData.primaryKeys.length; i++) {
        HashSet<String> attr = currentData.primaryKeys[i];
        keyList[i] = DiscoverERmodel.keyToString(attr);
      }

      Row row = new Row();
      row.setParent(rows);

      Label activity = new Label(currentData.name);
      activity.setParent(row);

      if (keyList.length > 1) {
        Selectbox selectbox = new Selectbox();
        selectbox.setModel(new ListModelArray<Object>(keyList));
        selectbox.setId("" + dataIndex);
        selectbox.setParent(row);
      } else {
        Label key = new Label(Arrays.toString(keyList));
        key.setParent(row);
      }

      dataIndex++;
    }

    this.primaryKeyW.doModal();
  }