예제 #1
0
  public AddNodeWindow(AbstractQuestionRelation p) {
    this.setParent(p);

    // create ui from template
    Executions.createComponents("/WEB-INF/zk/survey/design/AddNodeWindow.zul", this, null);
    Selectors.wireVariables(this, this, Selectors.newVariableResolvers(getClass(), Div.class));
    Selectors.wireComponents(this, this, false);
    Selectors.wireEventListeners(this, this);

    // type box and default selection
    ntds = nodeRO.getNodeTypeDescriptions();
    ListModelList<String> typeModel = new ListModelList<String>();
    for (Map<String, String> ntd : ntds) {
      String nodeTypeLabel = ntd.get("label");
      typeModel.add(nodeTypeLabel);
    }
    String defaultContactType = p.getQuestion().getDefaultNewContactType();
    if (defaultContactType != null) {
      Map<String, String> ntd = GeneralUtil.getNodeDescription(ntds, defaultContactType);
      if (ntd != null) {
        String nodeTypeLabel = ntd.get("label");
        typeModel.addToSelection(nodeTypeLabel);
      }
    }
    typeBox.setModel(typeModel);
    onNodeTypeChanged();

    this.setWidth("200px");
    this.setVflex("1");
    this.setClosable(true);
  }
예제 #2
0
 private void doWriteComponentsToBeanVer(TVerifikasi tVerifikasi) {
   if (listbox_NamaPelaksana.getSelectedItem() != null) {
     Listitem itempelaksana = listbox_NamaPelaksana.getSelectedItem();
     ListModelList lml = (ListModelList) listbox_NamaPelaksana.getListModel();
     VHrEmployeePelaksana vHrEmployeePelaksana =
         (VHrEmployeePelaksana) lml.get(itempelaksana.getIndex());
     if (!vHrEmployeePelaksana.getEmployee_name().equalsIgnoreCase("Silakan pilih")) {
       tVerifikasi.setNik_pelaksana(vHrEmployeePelaksana.getEmployee_no());
     }
     if (!vHrEmployeePelaksana.getEmployee_no().equalsIgnoreCase("555")) {
       tVerifikasi.setNik_pelaksana(vHrEmployeePelaksana.getEmployee_no());
     }
   }
 }
예제 #3
0
  public void onCreate$window_Permohonan(Event event) throws Exception {

    if (logger.isDebugEnabled()) {
      logger.debug("--> " + event.toString());
    }

    doCheckRights();

    Map<String, Object> args = getCreationArgsMap(event);

    if (args.containsKey("tPermohonan")) {
      TPermohonan tPermohonan = (TPermohonan) args.get("tPermohonan");
      settPermohonan(tPermohonan);
    } else {
      settPermohonan(null);
    }

    if (args.containsKey("permohonanBaruCtrl")) {
      permohonanBaruCtrl = (PermohonanBaruCtrl) args.get("permohonanBaruCtrl");
    } else {
      permohonanBaruCtrl = null;
    }

    if (args.containsKey("listbox_DaftarPermohonan")) {
      listbox_DaftarPermohonan = (Listbox) args.get("listbox_DaftarPermohonan");
    } else {
      listbox_DaftarPermohonan = null;
    }
    if (getPelaksanaanGangguanService().getEmployeeName() != null) {
      ListModelList lmlNamaPelaksana =
          new ListModelList(getPelaksanaanGangguanService().getEmployeeName());
      VHrEmployeePelaksana pelaksana = new VHrEmployeePelaksana();
      pelaksana.setEmployee_name("Silakan pilih");
      pelaksana.setEmployee_no("555");
      lmlNamaPelaksana.add(0, pelaksana);
      listbox_NamaPelaksana.setModel(lmlNamaPelaksana);
      listbox_NamaPelaksana.setItemRenderer(new PelaksanaListModelItemRenderer());
    }
    doShowDialog(gettPermohonan(), gettVerifikasi());
  }
예제 #4
0
  /**
   * *********************************************************** Create
   * ***********************************************************
   */
  @SuppressWarnings("rawtypes")
  private void onNodeTypeChanged() {
    ListModelList typeModel = (ListModelList) typeBox.getModel();
    Set selections = typeModel.getSelection();
    if (selections.isEmpty()) return;
    String selection = (String) selections.iterator().next();
    logger.info("Node type set to: " + selection);

    Map<String, String> ntd = GeneralUtil.getNodeDescriptionByLabel(ntds, selection);
    String nodeType = ntd.get("type");
    if (nodeType.equals(Constants.NODE_TYPE_USER)) {
      firstNameRow.setVisible(true);
      firstNameBox.setConstraint("no empty");
      lastNameRow.setVisible(true);
      lastNameBox.setConstraint("no empty");
      midNameRow.setVisible(true);
    } else {
      firstNameRow.setVisible(false);
      firstNameBox.setConstraint("");
      lastNameRow.setVisible(false);
      lastNameBox.setConstraint("");
      midNameRow.setVisible(false);
    }
  }
예제 #5
0
  private void doSimpan() throws InterruptedException {

    TPermohonan tPermohonan = gettPermohonan();
    Mttr mttr = new Mttr();
    doWriteComponentsToBean(tPermohonan, mttr);

    try {
      String uploadeFileName = null;
      if (getUploadMedia() != null) {
        uploadeFileName = getUploadMedia().getName();
      }
      getPermohonanService()
          .simpanAllTPermohonan(
              uploadeFileName,
              tPermohonan,
              mttr,
              getUserWorkspace().getUserSession().getEmployeeRole());
      TVerifikasi tVerifikasi =
          getPermohonanService()
              .getTVerifikasiByTIdossVerifikasiId(gettPermohonan().getT_idoss_permohonan_id());
      doWriteComponentsToBeanVer(tVerifikasi);
      getVerifikasiService().saveOrUpdateTVerifikasi(tVerifikasi);

    } catch (DataAccessException e) {
      String message = e.getMessage();
      String title = Labels.getLabel("message_Error");
      MultiLineMessageBox.doSetTemplate();
      MultiLineMessageBox.show(message, title, MultiLineMessageBox.OK, "ERROR", true);
    }

    ListModelList lml = (ListModelList) listbox_DaftarPermohonan.getListModel();

    // Check if the object is new or updated
    // -1 means that the obj is not in the list, so it's new.
    if (lml.indexOf(tPermohonan) == -1) {
      lml.add(tPermohonan);
    } else {
      lml.set(lml.indexOf(tPermohonan), tPermohonan);
    }
    lml.sort(new TPermohonanComparator(), true);
  }