Exemplo n.º 1
0
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);
    Session session =
        ServiceLocator.getNeracaDenormalHome().getSessionFactory().getCurrentSession();

    session.beginTransaction();

    List<hibernate.homendomain.NeracaDenormal> dnhbm =
        session.createQuery("from hibernate.homendomain.NeracaDenormal").list();

    session.getTransaction().commit();
    //		System.out.println(ServiceLocator.getNeracaDenormalHome().findById(1));
    final Component parent = comp;
    List<NeracaDenormal> l = new ArrayList<NeracaDenormal>();
    for (hibernate.homendomain.NeracaDenormal dnn : dnhbm) {
      l.add(
          new NeracaDenormal(
              dnn.getDaerah(),
              dnn.getTahun(),
              dnn.getLaporan(),
              dnn.getId0(),
              dnn.getId1(),
              dnn.getId2(),
              dnn.getId3(),
              dnn.getId4(),
              dnn.getUraian(),
              dnn.getRupiah(),
              dnn.getTipeInput()));
    }
    //		l.addAll(NeracaDao.getNeracas());
    final List<Integer> idxParentAdd = Arrays.asList(2, 6, 11, 15);
    final List<Integer> idxLastDetail = Arrays.asList(4, 8, 13, 17);
    final ListModelList<NeracaDenormal> listModel = new ListModelList<NeracaDenormal>(l);
    grid1.setModel(listModel);
    NeracaRowRenderer nrr =
        new NeracaRowRenderer(listModel, grid1, idxParentAdd, idxLastDetail, btnSave);
    grid1.setRowRenderer(nrr);
  }
Exemplo n.º 2
0
  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();
  }