@Listen("onClick = #btn_confirmar")
  public void alterarOperador() {
    Map<String, Object> arguments = (Map) rw_dadosOperador.getValue();
    Operador op = (Operador) arguments.get("funAlterar");
    lb_operador = (Listbox) arguments.get("lb_operador");
    String pass = tb_insira_password.getText();
    List<Operador> list =
        operadorDao.obtemPorUsername(tb_username.getText(), tb_password.getText());
    if (!list.isEmpty() && op.getId() != list.get(0).getId()) {
      Clients.showNotification(
          "Um operador ja foi cadrastado com esse username", "error", null, null, 2000);
    } else {
      if (!tb_password.getText().equals(pass)) {
        Clients.showNotification("o password deve ser igual", "error", null, null, 2000);

      } else {
        ListModelList<Operador> lista = (ListModelList) lb_operador.getModel();
        lista.remove(op);
        setValues(op);
        operadorDao.update(op);
        lista.add(0, op);
        operadorWin.detach();
        ;
        Clients.showNotification("Dados do operador " + op.getNome() + " foram alterados");
      }
    }
  }
Example #2
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);
  }
Example #3
0
  @AfterCompose
  public void doAfterCompose(
      @ContextParam(ContextType.VIEW) Component view,
      @ExecutionArgParam("map") Map<String, Object> parameters) {
    Selectors.wireComponents(view, this, false);
    this.view = view;
    userName = FHSessionUtil.getCurrentUser().getUserLoginID();
    listBoxViewModel = new ListboxViewModel();
    allReordsInDB = new ListModelList<>();
    getDataRecordList();
    for (Jobdetails up : allReords) {
      allReordsInDB.add(up);
    }
    // allReordsInDB.setMultiple(true);
    listBoxViewModel.setModel(allReordsInDB);

    // loadUserTabs();
    if (usertabs != null && listBoxViewModel.getModel().size() > 0) {
      if (selectedItem != null) loadDetailPageTab(selectedItem);
      else {
        selectedItem = new Jobdetails();
        loadDetailPageTab(selectedItem);
      }
    } else {
      selectedItem = new Jobdetails();
      loadDetailPageTab(selectedItem);
    }
  }
 @Listen("onClick = image#bottomBtn")
 public void bottomBtnClick(MouseEvent event) {
   if (logger.isDebugEnabled()) logger.debug(" bottomBtn button event = " + event);
   if (selectedCharts.getSelectedItem() != null) {
     String item = selectedChartsModel.remove(selectedCharts.getSelectedIndex());
     selectedChartsModel.add(item);
   }
 }
 @Listen("onClick = image#chooseBtn")
 public void chooseBtnClick(MouseEvent event) {
   if (logger.isDebugEnabled()) logger.debug(" chooseBtn button event = " + event);
   // if its not null and we dont have it
   if (allCharts.getSelectedItem() != null
       && !selectedChartsModel.contains(allCharts.getSelectedItem().getLabel())) {
     selectedChartsModel.add(allCharts.getSelectedItem().getLabel());
   }
 }
 private void addEventFilter(String event, boolean showinfo) {
   if (!eventFilterModel.contains(eventFilterModel)) {
     eventFilterModel.add(event);
   }
   if (showinfo) {
     eventFilterModel.addToSelection(event);
   } else {
     eventFilterModel.removeFromSelection(event);
   }
 }
 @Listen("onClick = image#downBtn")
 public void downBtnClick(MouseEvent event) {
   if (logger.isDebugEnabled()) logger.debug(" downBtn button event = " + event);
   if (selectedCharts.getSelectedItem() != null) {
     int pos = selectedCharts.getSelectedIndex();
     // dont go past the bottom!
     if (pos == selectedChartsModel.size() - 1) return;
     String item = selectedChartsModel.remove(selectedCharts.getSelectedIndex());
     selectedChartsModel.add(pos + 1, item);
   }
 }
  // click events
  public void onClick$btnAddEmployee(ForwardEvent fe) {

    String firstName = txtFirstName.getText();
    String lastName = txtLastName.getText();
    int iAge = Integer.parseInt(intAge.getText());

    Employee employee = new Employee(firstName, lastName, iAge);

    if (!_model.add(employee)) {
      reportError(Messages.getString("EmployeeController.0"), employee);
    }
  }
Example #9
0
  @Command
  @NotifyChange("*")
  public void refresh() {
    getDataRecordList();
    allReordsInDB.removeAll(allReordsInDB);
    for (Jobdetails up : allReords) {
      allReordsInDB.add(up);
    }
    listBoxViewModel.setModel(allReordsInDB);

    if (usertabs != null && listBoxViewModel.getModel().size() > 0) {
      this.selectedItem = (Jobdetails) listBoxViewModel.getModel().get(0);
      loadDetailPageTab(selectedItem);
    }
  }
  @Listen("onClick = #btn_confirmarLeitor")
  public void alterarleitor() {

    Map<String, Object> arguments = (Map) rw_dadosLeitor.getValue();
    Leitor leitor = (Leitor) arguments.get("funAlterar");
    lb_leitor = (Listbox) arguments.get("lb_leitor");
    ListModelList<Leitor> lista = (ListModelList) lb_leitor.getModel();
    lista.remove(leitor);
    setValuesLeitor(leitor);
    leitorDao.update(leitor);
    lista.add(0, leitor);
    winAlterarLeitor.detach();
    ;
    Clients.showNotification("Dados do leitor" + leitor.getNome() + " foram alterados");
  }
Example #11
0
  /**
   * Saves the components to table. <br>
   *
   * @throws InterruptedException
   */
  public void doSave() throws InterruptedException {

    final SecRole aRole = getRole();

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // force validation, if on, than execute by component.getValue()
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if (!isValidationOn()) {
      doSetValidation();
    }

    // fill the object with the components data
    doWriteComponentsToBean(aRole);

    // save it to database
    try {
      getSecurityService().saveOrUpdate(aRole);
    } catch (DataAccessException e) {
      ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString());

      // Reset to init values
      doResetInitValues();

      doReadOnly();
      btnCtrl.setBtnStatus_Save();
      return;
    }

    // now synchronize the listBox
    ListModelList lml = (ListModelList) listBoxSecRoles.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(aRole) == -1) {
      lml.add(aRole);
    } else {
      lml.set(lml.indexOf(aRole), aRole);
    }

    doReadOnly();
    btnCtrl.setBtnStatus_Save();

    // init the old values vars new
    doStoreInitValues();
  }
Example #12
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);
  }
Example #13
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());
  }
 private void addInfo(String info) {
   infoModel.add(0, info);
   while (infoModel.size() > 100) {
     infoModel.remove(infoModel.size() - 1);
   }
 }
Example #15
0
  public ListModelList<InvoiceCheck> getInvoices() throws Exception {
    if (user != null) {
      auditLogger.log(INVOICE_OVERVIEW, user);
      FiscalPeriod period = DateHelper.getPeriodTillDate(balanceDate);
      List<Cost> sentAndPaidInvoicesInPeriod = costDao.getInvoicesSentAndPaid(period);
      invoices = new ListModelList<>();

      int currentYear = DateHelper.getYear(new Date());

      for (Cost cost : sentAndPaidInvoicesInPeriod) {
        InvoiceCheck invoiceCheck = new InvoiceCheck();
        if (cost.getCostType().equals(INVOICE_SENT)) {
          invoiceCheck.setDateSent(cost.getDate());
          invoiceCheck.setInvoiceNumber(getInvoiceNumber(cost.getDescription()));
          invoiceCheck.setNetAmount(cost.getAmount());
          invoiceCheck.setVatAmount(cost.getVat());
          totalIncome = totalIncome.add(cost.getAmount());
          invoices.add(invoiceCheck);
        } else {
          if (!invoiceCheck.isPaymentFromPreviousYear()) {}
        }
      }
      for (Cost cost : sentAndPaidInvoicesInPeriod) {
        if (cost.getCostType().equals(INVOICE_PAID)) {

          Iterator<InvoiceCheck> sentInvoices = invoices.iterator();
          boolean hasMatchingInvoice = false;
          while (sentInvoices.hasNext()) {
            InvoiceCheck invoiceCheck = sentInvoices.next();
            if (cost.getDescription().contains(invoiceCheck.getInvoiceNumber())) {
              invoiceCheck.setDateReceived(cost.getDate());
              invoiceCheck.setDescriptionReceived(cost.getDescription());
              invoiceCheck.setGrossAmount(cost.getAmount());
              if (cost.getAmount()
                  .equals(invoiceCheck.getNetAmount().add(invoiceCheck.getVatAmount()))) {
                invoiceCheck.setInvoiceNumber(invoiceCheck.getInvoiceNumber() + " ok");
              }
              hasMatchingInvoice = true;
              break;
            } else {

            }
          }
          if (!hasMatchingInvoice) {
            paidInvoicesWithoutMatch = paidInvoicesWithoutMatch.add(cost.getAmount());
          }
        }
      }
      Iterator<InvoiceCheck> sentInvoices = invoices.iterator();
      while (sentInvoices.hasNext()) {
        InvoiceCheck invoiceCheck = sentInvoices.next();
        if (invoiceCheck.getDateReceived() == null) {
          unpaidInvoicesFromThisYear =
              unpaidInvoicesFromThisYear.add(
                  invoiceCheck.getNetAmount().add(invoiceCheck.getVatAmount()));
        }
      }
      BookValue bookValuePreviousYear =
          bookValueDao.getBookValue(BalanceType.INVOICES_TO_BE_PAID, currentYear - 1);
      if (bookValuePreviousYear != null) {
        unpaidInvoicesFromPreviousYear = bookValuePreviousYear.getSaldo();
      }
    } else {
      Executions.sendRedirect("login.zul");
    }
    return invoices;
  }