コード例 #1
0
 @Override
 public void onEvent(Event e) {
   // Finish
   if (e.getTarget().getId().equals(ConfirmPanel.A_OK)) {
     dispose();
   } else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) dispose();
 }
コード例 #2
0
 @Override
 public void onEvent(Event event) throws Exception {
   if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) winExportFile.onClose();
   else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) exportFile();
   else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) {
     panel.hideBusyMask();
   } else if (event.getTarget().equals(cboType) && event.getName().equals(Events.ON_SELECT)) {
     displayExportTabSelection();
   } else if (event.getName().equals("onExporterException")) {
     FDialog.error(0, winExportFile, "FileInvalidExtension");
     winExportFile.onClose();
   }
 }
コード例 #3
0
ファイル: WPaySelect.java プロジェクト: kimhatrung/Adempiere
  /**
   * ************************************************************************ ActionListener
   *
   * @param e event
   */
  public void onEvent(Event e) {
    //  Update Bank Info
    if (e.getTarget() == fieldBankAccount) loadBankInfo();

    //  Generate PaySelection
    else if (e.getTarget() == bGenerate) {
      generatePaySelect();
    } else if (e.getTarget() == bCancel) dispose();

    //  Update Open Invoices
    else if (e.getTarget() == fieldBPartner
        || e.getTarget() == bRefresh
        || e.getTarget() == fieldDtype) loadTableInfo();
  } //  actionPerformed
コード例 #4
0
ファイル: PremiumMainCtrl.java プロジェクト: 03/quicknote
  /** show content when select an item in tree */
  @Listen("onTopicSelect=#notetreeList")
  public void showTopicContent(Event fe) {

    if (!(fe.getTarget() instanceof NoteTreeList)) {
      return;
    }

    NoteTreeList item = (NoteTreeList) fe.getTarget();
    currentNodeId = item.getCurrentItem().getId();

    NoteNode node = noteService.findTopic(currentNodeId);

    String text = node.getText();
    editor.setValue(text);
    notePath.setValue(node.getPath());
  }
コード例 #5
0
  @Listen("onClick = #btnBuscarF0004, #btnBuscarF0004Filtro")
  public void mostrarCatalogoF0004(Event evento) {

    Button boton = (Button) evento.getTarget();
    idBoton = boton.getId();
    final List<F0004> listF0004 = servicioF0004.buscarTodosOrdenados();
    catalogoF0004 =
        new CatalogoGenerico<F0004>(
            divCatalogoF0004,
            "Catalogo de Codigos Definidos por el Usuario",
            listF0004,
            true,
            false,
            false,
            "SY",
            "RT",
            "Descripcion",
            "Codigo",
            "2 Linea",
            "Numerico") {

          @Override
          protected List<F0004> buscar(List<String> valores) {

            List<F0004> lista = new ArrayList<F0004>();

            for (F0004 f0004 : listF0004) {
              if (f0004.getId().getDtsy().toLowerCase().contains(valores.get(0).toLowerCase())
                  && f0004.getId().getDtrt().toLowerCase().contains(valores.get(1).toLowerCase())
                  && f0004.getDtdl01().toLowerCase().contains(valores.get(2).toLowerCase())
                  && String.valueOf(f0004.getDtcdl())
                      .toLowerCase()
                      .contains(valores.get(3).toLowerCase())
                  && f0004.getDtln2().toLowerCase().contains(valores.get(4).toLowerCase())
                  && f0004.getDtcnum().toLowerCase().contains(valores.get(5).toLowerCase())) {
                lista.add(f0004);
              }
            }
            return lista;
          }

          @Override
          protected String[] crearRegistros(F0004 f0004) {
            String[] registros = new String[6];
            registros[0] = f0004.getId().getDtsy();
            registros[1] = f0004.getId().getDtrt();
            registros[2] = f0004.getDtdl01();
            if (f0004.getDtcdl() != null) registros[3] = String.valueOf(f0004.getDtcdl());
            else registros[3] = null;
            registros[4] = f0004.getDtln2();
            registros[5] = f0004.getDtcnum();
            return registros;
          }
        };
    catalogoF0004.setClosable(true);
    catalogoF0004.setWidth("80%");
    catalogoF0004.setParent(divCatalogoF0004);
    catalogoF0004.doModal();
  }
コード例 #6
0
  @Listen("onClick=#btn_atualiza, #btn_aberto, #btn_fechado")
  public void criaLista(Event event) {

    String itemId = event.getTarget().getId();
    ArrayList<Edital> editais = new ArrayList<>();

    if (itemId.equals("btn_atualiza")) {

      editais.addAll(new EditalDAO().getAll());

    } else if (itemId.equals("btn_aberto")) {

      editais.addAll(new EditalDAO().getOpened());

    } else {

      editais.addAll(new EditalDAO().getClosed());
    }

    // remove filhos da listbox
    listar_edital.getItems().clear();

    ListModelList<Edital> editalModel = new ListModelList<Edital>(editais);
    // cria model
    listar_edital.setModel(editalModel);

    // recria listbox
    try {

      Listhead lh = new Listhead();
      lh.appendChild(new Listheader("código edital"));
      lh.appendChild(new Listheader("projeto"));
      lh.appendChild(new Listheader("número de vagas"));
      lh.appendChild(new Listheader("data inicio"));
      lh.appendChild(new Listheader("data final"));

      listar_edital.appendChild(lh);

    } catch (Exception e) {
      // TODO: handle exception
    }

    listar_edital.setItemRenderer(
        new ListitemRenderer() {

          @Override
          public void render(Listitem listitem, Object data, int arg2) throws Exception {

            final Edital edital = (Edital) data;
            final Projeto projeto = new ProjetoDAO().getOneByCod(edital.getProjeto_cod());

            new Listcell(String.valueOf(edital.getCod())).setParent(listitem);
            new Listcell(projeto.getCod() + "-" + projeto.getDescricao()).setParent(listitem);
            new Listcell(String.valueOf(edital.getN_vagas())).setParent(listitem);
            new Listcell(edital.getData_inicio().toString()).setParent(listitem);
            new Listcell(edital.getData_fim().toString()).setParent(listitem);
          }
        });
  }
コード例 #7
0
ファイル: BranchListCtrl.java プロジェクト: bungbil/smas
  /**
   * Automatically called method from zk.
   *
   * @param event
   * @throws Exception
   */
  public void onCreate$windowBranchList(Event event) throws Exception {

    this.binder = (AnnotateDataBinder) event.getTarget().getAttribute("binder", true);

    doFillListbox();

    this.binder.loadAll();
  }
コード例 #8
0
    @Override
    public void onEvent(Event event) throws Exception {

      // check which button is pressed
      if (event.getTarget().getId().equalsIgnoreCase("btnRefresh")) {
        doReadData();
      }
    }
コード例 #9
0
  /**
   * 生成报告按钮事件
   *
   * @param event
   * @throws Exception
   */
  public void onClick$CreateReportBtn(Event event) throws Exception {

    if (topNList.getSelectedItem() == null) {
      try {
        Messagebox.show("请选择报告!", "提示", Messagebox.OK, Messagebox.INFORMATION);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      return;
    }

    View view = Toolkit.getToolkit().getSvdbView(event.getTarget().getDesktop());
    String loginname = view.getLoginName();
    Listitem item = topNList.getSelectedItem();
    String section = item.getId();
    this.iniFile = new IniFile(INI_FILE);
    try {
      this.iniFile.load();
    } catch (Exception e) {
    }
    Map<String, String> reportDefine = this.iniFile.getSectionData(section);
    String Period = reportDefine.get("Period");
    String filetype = reportDefine.get("fileType");
    if (filetype == null) {
      filetype = "html";
    }
    Date tmStart = null;
    Date tmEnd = new Date();

    if (Period.equals("Month")) tmStart = Toolkit.getToolkit().delDay(new Date(), 30);
    else if (Period.equals("Week")) tmStart = Toolkit.getToolkit().delDay(new Date(), 7);
    else if (Period.equals("Day")) tmStart = Toolkit.getToolkit().delDay(new Date(), 1);
    else {
      Toolkit.getToolkit().showError("报告区间不支持:");
      return;
    }

    TopNReport tmpTopNReport = new TopNReport(section, reportDefine, tmStart, tmEnd, view, false);

    //	    tmpTopNReport.createReport();
    Thread thread = new Thread(tmpTopNReport);
    thread.setName("TopNReport -- TopNReport.java");
    thread.start();
    final Window win =
        (Window) Executions.createComponents("/main/progress/topnprogress.zul", null, null);
    win.setAttribute("topnreport", tmpTopNReport);
    win.setAttribute("filetype", filetype);
    win.setAttribute("reportname", tmpTopNReport.strReportName);
    win.doModal();
    // AMedia(String name, String format, String ctype, URL url, String charset)
    // 刷新日志数据

    // addlog
    //		View view = Toolkit.getToolkit().getSvdbView(event.getTarget().getDesktop());
    String minfo = loginname + " " + "在" + OpObjectId.topn_report.name + "中进行了手动生成报告操作.";
    AppendOperateLog.addOneLog(loginname, minfo, OpTypeId.add, OpObjectId.topn_report);
    onSelecttopNList(event);
  }
コード例 #10
0
ファイル: PremiumMainCtrl.java プロジェクト: 03/quicknote
  @Listen("onSelect=#filterbox")
  // Zul page example: onSelect="searchBar.value=self.selectedItem.value.name; searchBar.close();"
  public void changeNote(Event fe) {

    if (!(fe.getTarget() instanceof Listbox)) {
      return;
    }

    Listitem item = ((Listbox) fe.getTarget()).getSelectedItem();

    NoteNode selectedNode = (NoteNode) item.getValue();
    currentNodeId = selectedNode.getId();
    notePath.setValue(selectedNode.getPath());
    editor.setValue(selectedNode.getText());

    EventQueues.lookup("myqueue2", EventQueues.SESSION, true)
        .publish(new Event("onSelectSearchItem", null, currentNodeId));
  }
コード例 #11
0
  public void onEvent(Event e) throws Exception {
    Component component = e.getTarget();

    if (component.equals(confirmPanel.getButton(ConfirmPanel.A_OK))) dispose();
    else if (component instanceof Tab) {
      if (tabbox.getSelectedIndex() == 1) initReservedOrderedTab(true);
      else if (tabbox.getSelectedIndex() == 2) initReservedOrderedTab(false);
      else if (tabbox.getSelectedIndex() == 3) initUnconfirmedTab();
      else if (tabbox.getSelectedIndex() == 4) initAtpTab();
    }
  }
コード例 #12
0
ファイル: WFileImport.java プロジェクト: makezjdq/adempiere-1
  public void onEvent(Event e) throws Exception {
    if (e.getTarget() == bFile) {
      cmd_loadFile();
      invalidate();
    } else if (e.getTarget() == fCharset) {
      int record = m_record;
      cmd_reloadFile();
      m_record = record - 1;
      cmd_applyFormat(true);
    } else if (e.getTarget() == pickFormat) {
      cmd_loadFormat();
      invalidate();
    } else if (e.getTarget() == bNext) cmd_applyFormat(true);
    else if (e.getTarget() == bPrevious) cmd_applyFormat(false);
    else if (e.getTarget() == confirmPanel.getButton("Ok")) {
      confirmPanel.setEnabled("Ok", false);

      cmd_process();
    } else if (e.getTarget() == confirmPanel.getButton("Cancel")) {
      SessionManager.getAppDesktop().closeActiveWindow();
      return;
    }

    if (m_data != null
        && m_data.size() > 0 // 	file loaded
        && m_format != null
        && m_format.getRowCount() > 0) // 	format loaded
    confirmPanel.getButton("Ok").setEnabled(true);
    else confirmPanel.getButton("Ok").setEnabled(false);
  }
コード例 #13
0
ファイル: WWFActivity.java プロジェクト: makezjdq/adempiere-1
  public void onEvent(Event event) throws Exception {
    Component comp = event.getTarget();
    String eventName = event.getName();

    if (eventName.equals(Events.ON_CLICK)) {
      if (comp == bZoom) cmd_zoom();
      else if (comp == bOK) {
        Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"), true);
        Events.echoEvent("onOK", this, null);
      } else if (comp == fAnswerButton) cmd_button();
    } else if (Events.ON_SELECT.equals(eventName) && comp == listbox) {
      m_index = listbox.getSelectedIndex();
      if (m_index >= 0) display(m_index);
    }
  }
コード例 #14
0
  /**
   * 批量允许按钮功能
   *
   * @param event
   */
  public void onClick$batchAllow(Event event) {
    if (topNList.getSelectedCount() <= 0) {
      try {
        Messagebox.show("请选择报告!", "提示", Messagebox.OK, Messagebox.INFORMATION);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      return;
    }

    Set<Listitem> items = topNList.getSelectedItems();
    if (items == null || items.size() == 0) return;
    Iterator itr = items.iterator();
    this.iniFile = new IniFile(INI_FILE);
    if (iniFile == null) return;
    try {
      iniFile.load();
    } catch (Exception e1) {
      e1.printStackTrace();
    }
    for (; itr.hasNext(); ) {
      Listitem item = (Listitem) itr.next();
      try {
        iniFile.setKeyValue(item.getId(), "Deny", "No"); // 允许
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    try {
      iniFile.saveChange();
    } catch (Exception e) {
      e.printStackTrace();
    }

    View view = Toolkit.getToolkit().getSvdbView(event.getTarget().getDesktop());
    String loginname = view.getLoginName();
    String minfo =
        loginname
            + " "
            + "在"
            + OpObjectId.topn_report.name
            + "中进行了  "
            + OpTypeId.enable.name
            + "操作。";
    AppendOperateLog.addOneLog(loginname, minfo, OpTypeId.enable, OpObjectId.topn_report);
    // 刷新页面
    refreshiControl();
  }
コード例 #15
0
ファイル: Binding.java プロジェクト: howardroark2018/zk
 protected void handleEvent(Event event) {
   for (BindingInfo bi : _dataTargets) {
     final Component dt = bi.getComponent();
     final Binding binding = bi.getBinding();
     final DataBinder binder = binding.getBinder();
     final Component dataTarget =
         DataBinder.isTemplate(dt) ? DataBinder.lookupClone(event.getTarget(), dt) : dt;
     if (dataTarget != null) {
       binding.loadAttribute(dataTarget);
     } else { // #bug 2897202
       final List<Component> clones = scanClones(binder, dt);
       for (final Component dataTarget1 : clones) {
         binding.loadAttribute(dataTarget1);
       }
     }
   }
 }
コード例 #16
0
ファイル: UserEditWindow.java プロジェクト: hebut/jxkh
 public void onEvent(Event event) throws Exception {
   Listitem c = (Listitem) event.getTarget().getParent();
   WkTUser u = (WkTUser) c.getValue();
   Executions.getCurrent().setAttribute("editUser", u);
   final UserDetialEditWindow w =
       (UserDetialEditWindow)
           Executions.createComponents("/admin/system/user/userDetail.zul", null, null);
   w.setClosable(true);
   w.doHighlighted();
   w.addEventListener(
       Events.ON_CHANGE,
       new EventListener() {
         public void onEvent(Event arg0) throws Exception {
           reloadDeptTree();
           w.detach();
         }
       });
 }
コード例 #17
0
  public void onEvent(Event event) throws Exception {
    if (Events.ON_CLICK.equalsIgnoreCase(event.getName())) {
      //	Warehouse/Product
      int only_Warehouse_ID = getOnly_Warehouse_ID();
      int only_Product_ID = getOnly_Product_ID();

      log.config("Only Warehouse_ID=" + only_Warehouse_ID + ", Product_ID=" + only_Product_ID);

      //	Text Entry ok

      if (event.getTarget() == getComponent() && actionText(only_Warehouse_ID, only_Product_ID))
        return;

      //	 Button - Start Dialog

      int M_Locator_ID = 0;

      if (m_value instanceof Integer) M_Locator_ID = ((Integer) m_value).intValue();

      m_mLocator.setOnly_Warehouse_ID(only_Warehouse_ID);
      m_mLocator.setOnly_Product_ID(getOnly_Product_ID());

      WLocatorDialog ld =
          new WLocatorDialog(
              Msg.translate(Env.getCtx(), getColumnName()),
              m_mLocator,
              M_Locator_ID,
              isMandatory(),
              only_Warehouse_ID,
              this.m_WindowNo);

      //	display
      ld.setVisible(true);
      AEnv.showWindow(ld);

      m_mLocator.setOnly_Warehouse_ID(0);

      //	redisplay

      if (!ld.isChanged()) return;
      setValue(ld.getValue(), true);
    }
  }
コード例 #18
0
 public static void deleteSalaryHead(Event event, String salaryHeadId) {
   System.out.println("****************SubmitClaim Event Called*********");
   try {
     Component applySalaryHeadWindow = event.getTarget();
     GenericValue userLogin =
         (GenericValue)
             Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin");
     GenericDelegator delegator =
         HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default");
     LocalDispatcher dispatcher =
         HrmsInfrastructure
             .getDispatcher(); // GenericDispatcher.getLocalDispatcher("default", delegator);
     Map submitDelete = null;
     submitDelete = UtilMisc.toMap("userLogin", userLogin, "salaryHeadId", salaryHeadId);
     dispatcher.runSync("deleteSalaryHead", submitDelete);
     Events.postEvent(
         "onClick$searchButton", applySalaryHeadWindow.getPage().getFellow("searchPanel"), null);
     Messagebox.show("Salary Head Successfully Deleted", "Success", 1, null);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #19
0
    @Override
    public void onEvent(Event event) throws Exception {
      final Listheader lh = (Listheader) event.getTarget();
      final String sortDirection = lh.getSortDirection();

      if ("ascending".equals(sortDirection)) {
        final Comparator<?> cmpr = lh.getSortDescending();
        if (cmpr instanceof FieldComparator) {
          String orderBy = ((FieldComparator) cmpr).getOrderBy();
          orderBy = StringUtils.substringBefore(orderBy, "DESC").trim();

          // update SearchObject with orderBy
          getSearchObject().clearSorts();
          getSearchObject().addSort(orderBy, true);
        }
      } else if ("descending".equals(sortDirection)
          || "natural".equals(sortDirection)
          || Strings.isBlank(sortDirection)) {
        final Comparator<?> cmpr = lh.getSortAscending();
        if (cmpr instanceof FieldComparator) {
          String orderBy = ((FieldComparator) cmpr).getOrderBy();
          orderBy = StringUtils.substringBefore(orderBy, "ASC").trim();

          // update SearchObject with orderBy
          getSearchObject().clearSorts();
          getSearchObject().addSort(orderBy, false);
        }
      }

      /**
       * A changing of the sort order implies that the list starts new. So we set the startpage to
       * '0' and refresh the list.
       */
      getPaging().setActivePage(0);
      refreshModel(0);
    }
コード例 #20
0
  public void onEvent(Event e) throws Exception {
    if (m_setting) return;
    //	Update Assignment
    ListItem listItem = fResource.getSelectedItem();
    KeyNamePair resource =
        listItem != null
            ? new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel())
            : null;
    if (resource != null) {
      int S_Resource_ID = resource.getKey();
      m_mAssignment.setS_Resource_ID(S_Resource_ID);
    }

    Calendar date = new GregorianCalendar();
    getDateAndTimeFrom(date);

    Timestamp assignDateFrom = new Timestamp(date.getTimeInMillis());
    if (assignDateFrom != null) m_mAssignment.setAssignDateFrom(assignDateFrom);
    if (fQty.getValue() != null) {
      BigDecimal qty = fQty.getValue();
      m_mAssignment.setQty(qty);
    }
    m_mAssignment.setName((String) fName.getValue());
    m_mAssignment.setDescription((String) fDescription.getValue());

    //	Resource - Look up UOM
    if (e.getTarget() == fResource) {
      Object o = m_lookup.get(fResource.getSelectedItem());
      if (o == null) lUOM.setValue(" ? ");
      else lUOM.setValue(o.toString());
    }

    //	Zoom - InfoResource
    else if (e.getTarget().getId().equals("Zoom")) {
      InfoSchedule is = new InfoSchedule(m_mAssignment, true);
      if (is.getMResourceAssignment() != null) {
        m_mAssignment = is.getMResourceAssignment();
        //	setDisplay();
        detach();
      }
      is = null;
    }

    //	cancel - return
    else if (e.getTarget().getId().equals("Cancel")) {
      m_cancel = true;
      detach();
    }

    //	delete - delete and return
    else if (e.getTarget().getId().equals("Delete")) {
      if (m_mAssignment.delete(true)) {
        m_mAssignment = null;
        detach();
      } else FDialog.error(0, this, "ResourceAssignmentNotDeleted");
    }

    //	OK - Save
    else if (e.getTarget().getId().equals("Ok")) {
      if (cmd_save()) detach();
    }
  }
コード例 #21
0
ファイル: Binding.java プロジェクト: howardroark2018/zk
 public AfterEvent(String evtnm, Event event) {
   super(evtnm, event.getTarget(), event);
 }
コード例 #22
0
 public void onEvent(Event event) {
   try {
     GenericValue userLogin =
         (GenericValue)
             Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin");
     Component EditSalaryHeadWindow = event.getTarget();
     GenericDelegator delegator = (GenericDelegator) userLogin.getDelegator();
     String hrName = ((Textbox) EditSalaryHeadWindow.getFellow("applyHrName")).getValue();
     String geoId =
         (String)
             ((com.ndz.zkoss.CountryBox) EditSalaryHeadWindow.getFellow("countrybandbox"))
                 .getSelectedItem()
                 .getValue();
     Listitem isCreditInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyCredit")).getSelectedItem();
     String isCredit = (String) isCreditInput.getValue();
     Listitem salaryHeadTypeInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applySalaryHeadType")).getSelectedItem();
     String salaryHeadType = (String) salaryHeadTypeInput.getValue();
     Listitem isTaxableInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyTaxable")).getSelectedItem();
     String isTaxable = (String) isTaxableInput.getValue();
     Listitem isMandatoryInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyMandatory")).getSelectedItem();
     String isMandatory = (String) isMandatoryInput.getValue();
     Listitem currencyUomIdInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyCurrencyUomId")).getSelectedItem();
     String currencyUomId = (String) currencyUomIdInput.getValue();
     Listitem salaryComputationTypeIdInput =
         ((Listbox) EditSalaryHeadWindow.getFellow("applyComputationType")).getSelectedItem();
     String salaryComputationTypeId = (String) salaryComputationTypeIdInput.getValue();
     Map<String, Object> context =
         UtilMisc.toMap(
             "salaryHeadId",
             delegator.getNextSeqId("salaryHeadId"),
             "hrName",
             hrName,
             "isCr",
             isCredit,
             "salaryHeadTypeId",
             salaryHeadType,
             "isTaxable",
             isTaxable,
             "isMandatory",
             isMandatory,
             "geoId",
             geoId,
             "currencyUomId",
             currencyUomId,
             "salaryComputationTypeId",
             salaryComputationTypeId);
     delegator.create(delegator.makeValue("SalaryHead", context));
     Component searchPanelComponent = EditSalaryHeadWindow.getPage().getFellowIfAny("searchPanel");
     if (searchPanelComponent != null)
       Events.postEvent("onClick$searchButton", searchPanelComponent, null);
     Messagebox.show("Created successfully", "Success", 1, null);
     EditSalaryHeadWindow.detach();
   } catch (Exception e) {
     try {
       Messagebox.show("Created unsuccessfully", "Error", 1, null);
     } catch (Exception e1) {
       e1.printStackTrace();
     }
     e.printStackTrace();
   }
 }
コード例 #23
0
  public static void EditSalaryHead(Event event) {

    System.out.println("****************SubmitClaim Event Called*********");
    try {
      Component salaryHeadWindow = event.getTarget();
      GenericValue userLogin =
          (GenericValue)
              Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin");
      GenericDelegator delegator =
          HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default");
      LocalDispatcher dispatcher =
          HrmsInfrastructure
              .getDispatcher(); // GenericDispatcher.getLocalDispatcher("default", delegator);
      Map submitUpdate = null;
      String salaryHeadId =
          (String) ((Textbox) salaryHeadWindow.getFellow("salaryHeadId")).getValue();

      String hrName = (String) ((Textbox) salaryHeadWindow.getFellow("applyHrName")).getValue();

      Listitem isCrListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyCredit")).getSelectedItem();
      String isCr = (String) isCrListItem.getValue();

      Listitem salaryHeadTypeIdListItem =
          (Listitem)
              ((Listbox) salaryHeadWindow.getFellow("applySalaryHeadType")).getSelectedItem();
      String salaryHeadTypeId = (String) salaryHeadTypeIdListItem.getValue();

      /*
       * String geoId = (String) ((Bandbox) salaryHeadWindow
       * .getFellow("searchPanel")).getValue();
       */
      Combobox countryBox = ((Combobox) salaryHeadWindow.getFellow("countrybandbox"));
      String geoId =
          (String)
              (countryBox.getSelectedItem() == null
                  ? countryBox.getValue()
                  : countryBox.getSelectedItem().getValue());

      Listitem isTaxableListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyTaxable")).getSelectedItem();
      String isTaxable = (String) isTaxableListItem.getValue();

      Listitem isMandatoryListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyMandatory")).getSelectedItem();
      String isMandatory = (String) isMandatoryListItem.getValue();

      Listitem currencyUomIdListItem =
          (Listitem) ((Listbox) salaryHeadWindow.getFellow("applyCurrencyUomId")).getSelectedItem();
      String currencyUomId = (String) currencyUomIdListItem.getValue();

      Listitem salaryComputationTypeIdListItem =
          (Listitem)
              ((Listbox) salaryHeadWindow.getFellow("applyComputationType")).getSelectedItem();
      String salaryComputationTypeId = (String) salaryComputationTypeIdListItem.getValue();

      submitUpdate =
          UtilMisc.toMap(
              "userLogin",
              userLogin,
              "salaryHeadId",
              salaryHeadId,
              "hrName",
              hrName,
              "isCr",
              isCr,
              "salaryHeadTypeId",
              salaryHeadTypeId,
              "geoId",
              geoId,
              "isTaxable",
              isTaxable,
              "isMandatory",
              isMandatory,
              "currencyUomId",
              currencyUomId,
              "salaryComputationTypeId",
              salaryComputationTypeId);

      Map<String, Object> result = dispatcher.runSync("updateSalaryHead", submitUpdate);

      Messagebox messageBox = new Messagebox();
      String err = "";
      err = (String) result.get("responseMessage");
      if (err != null && err.equals("error"))
        messageBox.show((String) result.get("errorMessage"), "Error", 1, null);
      else
        messageBox.show(
            "Salary Head" + " " + hrName + " " + "Successfully Updated", "Success", 1, null);

      Events.postEvent(
          "onClick$searchButton", salaryHeadWindow.getPage().getFellow("searchPanel"), null);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #24
0
  @SuppressWarnings("deprecation")
  public static void showSalaryHeadWindow(Event event, GenericValue gv)
      throws SuspendNotAllowedException, InterruptedException, GenericEntityException {

    Component approveClaimWindow = event.getTarget();
    GenericValue userLogin =
        (GenericValue) Executions.getCurrent().getDesktop().getSession().getAttribute("userLogin");
    GenericValue person =
        (GenericValue) Executions.getCurrent().getDesktop().getSession().getAttribute("person");

    String salaryHeadId = gv.getString("salaryHeadId");
    String hrName = gv.getString("hrName");
    String isCr = gv.getString("isCr");
    String salaryHeadTypeId = gv.getString("salaryHeadTypeId");
    String geoId = gv.getString("geoId");
    String isTaxable = gv.getString("isTaxable");
    String isMandatory = gv.getString("isMandatory");
    String currencyUomId = gv.getString("currencyUomId");
    String salaryComputationTypeId = gv.getString("salaryComputationTypeId");

    Window win =
        (Window)
            Executions.createComponents(
                "/zul/payRollManagement/updateSalaryHead.zul",
                null,
                UtilMisc.toMap("oldHrName", hrName));
    win.setTitle("Update Salary Head");
    GenericDelegator delegator =
        HrmsInfrastructure.getDelegator(); // GenericDelegator.getGenericDelegator("default");
    /*
     * EntityCondition condition = EntityCondition.makeCondition("enumTypeId",
     * EntityOperator.EQUALS, "CLAIM_TYPE");
     */
    EntityCondition currencyCondition =
        EntityCondition.makeCondition("uomTypeId", EntityOperator.EQUALS, "CURRENCY_MEASURE");

    Set<String> SalaryHeadTypeToDisplay = new HashSet();
    Set<String> currencyTypeToDisplay = new HashSet();
    Set<String> SalaryComputationTypeToDisplay = new HashSet();

    SalaryHeadTypeToDisplay.add("salaryHeadTypeId");
    SalaryHeadTypeToDisplay.add("description");

    currencyTypeToDisplay.add("uomId");
    currencyTypeToDisplay.add("description");

    SalaryComputationTypeToDisplay.add("salaryComputationTypeId");
    SalaryComputationTypeToDisplay.add("description");
    // =====================SalaryHeadType==============================
    List<GenericValue> salaryHeadType =
        delegator.findList("SalaryHeadType", null, SalaryHeadTypeToDisplay, null, null, false);
    salaryHeadType.add(0, null);
    SimpleListModel salaryHeadTypeList = new SimpleListModel(salaryHeadType);

    Listbox applySalaryHeadTypeListBox = (Listbox) win.getFellow("applySalaryHeadType");
    applySalaryHeadTypeListBox.setModel(salaryHeadTypeList);
    applySalaryHeadTypeListBox.setItemRenderer(new SalaryHeadTypeRenderer());

    for (int i = 1; i < salaryHeadType.size(); i++) {
      GenericValue IndividualsalaryHeadType = salaryHeadType.get(i);
      String itemValue = IndividualsalaryHeadType.getString("salaryHeadTypeId");
      if (itemValue.equals(salaryHeadTypeId)) {
        applySalaryHeadTypeListBox.setSelectedIndex(i);
        break;
      }
    }
    // =====================UOM===CURRENCY==============================
    List<GenericValue> currency =
        delegator.findList("Uom", currencyCondition, currencyTypeToDisplay, null, null, false);
    currency.add(0, null);
    SimpleListModel currencyList = new SimpleListModel(currency);

    Listbox currencyListBox = (Listbox) win.getFellow("applyCurrencyUomId");
    currencyListBox.setModel(currencyList);
    currencyListBox.setItemRenderer(new CurrencyRenderer());

    for (int i = 1; i < currency.size(); i++) {
      GenericValue IndividualCurrency = currency.get(i);
      String itemValue = IndividualCurrency.getString("uomId");
      if (itemValue.equals(currencyUomId)) {
        currencyListBox.setSelectedIndex(i);
        break;
      }
    }
    // =====================SalaryComputationType==============================
    List<GenericValue> SalaryComputationType =
        delegator.findList(
            "SalaryComputationType", null, SalaryComputationTypeToDisplay, null, null, false);
    SalaryComputationType.add(0, null);
    SimpleListModel SalaryComputationTypeList = new SimpleListModel(SalaryComputationType);

    Listbox SalaryComputationTypeListBox = (Listbox) win.getFellow("applyComputationType");
    SalaryComputationTypeListBox.setModel(SalaryComputationTypeList);
    SalaryComputationTypeListBox.setItemRenderer(new SalaryComputationTypeRenderer());

    for (int i = 1; i < SalaryComputationType.size(); i++) {
      GenericValue IndividualSalaryComputationType = SalaryComputationType.get(i);
      String itemValue = IndividualSalaryComputationType.getString("salaryComputationTypeId");
      if (itemValue.equals(salaryComputationTypeId)) {
        SalaryComputationTypeListBox.setSelectedIndex(i);
        break;
      }
    }
    // ========================================================================

    // salaryHeadName

    Label salaryHeadNameLabel = (Label) win.getFellow("salaryHeadName");
    salaryHeadNameLabel.setValue(salaryHeadId);

    Textbox salaryHeadIdTextbox = (Textbox) win.getFellow("salaryHeadId");
    salaryHeadIdTextbox.setValue(salaryHeadId);

    Textbox hrNameTextbox = (Textbox) win.getFellow("applyHrName");
    hrNameTextbox.setValue(hrName);

    String Credit = "";
    if (isCr.equals("Y")) Credit = "YES";
    else Credit = "NO";

    Listbox CreditListbox = (Listbox) win.getFellow("applyCredit");
    Listitem CreditListItem = new Listitem();

    for (int i = 1; i <= 2; i++) {
      CreditListItem = CreditListbox.getItemAtIndex(i);
      String itemValue = (String) CreditListItem.getValue();
      if (itemValue.equals(isCr)) {
        CreditListbox.setSelectedIndex(i);
        break;
      }
    }

    /*
     * Bandbox geoIdBandbox = (Bandbox) win.getFellow("searchPanel");
     * geoIdBandbox.setValue(geoId);
     */
    CountryBox geoIdBandbox = (CountryBox) win.getFellow("countrybandbox");
    geoIdBandbox.setValue(geoId);
    String Taxable = "";
    if (isTaxable.equals("Y")) Taxable = "YES";
    else Taxable = "NO";

    Listbox isTaxableListbox = (Listbox) win.getFellow("applyTaxable");
    Listitem isTaxableListItem = new Listitem();
    for (int i = 1; i <= 2; i++) {
      isTaxableListItem = isTaxableListbox.getItemAtIndex(i);
      String itemValue = (String) isTaxableListItem.getValue();
      if (itemValue.equals(isTaxable)) {
        isTaxableListbox.setSelectedIndex(i);
        break;
      }
    }

    String Mandatory = "";
    if (isMandatory.equals("Y")) Mandatory = "YES";
    else Mandatory = "NO";

    Listbox isMandatoryListbox = (Listbox) win.getFellow("applyMandatory");
    Listitem isMandatoryListItem = new Listitem();
    for (int i = 1; i <= 2; i++) {
      isMandatoryListItem = isMandatoryListbox.getItemAtIndex(i);
      String itemValue = (String) isMandatoryListItem.getValue();
      if (itemValue.equals(isMandatory)) {
        isMandatoryListbox.setSelectedIndex(i);
        break;
      }
    }

    // approveClaimWindow.detach();

    win.doModal();
  }
コード例 #25
0
ファイル: Binding.java プロジェクト: howardroark2018/zk
    protected void handleEvent(Event event) {
      final Component target = event.getTarget();
      final String triggerEventName = event.getName();
      final List<BindingInfo> tmplist = new ArrayList<BindingInfo>(_dataTargets.size());
      final List<Object> values = new LinkedList<Object>();
      final List<Component> refs = new LinkedList<Component>();
      final List<Binding> bindings = new LinkedList<Binding>();

      // fire onSave for each binding
      for (BindingInfo bi : _dataTargets) {
        final Component dt = bi.getComponent();
        final Binding binding = bi.getBinding();
        final DataBinder binder = binding.getBinder();
        final Component dataTarget =
            DataBinder.isTemplate(dt) ? DataBinder.lookupClone(target, dt) : dt;
        // bug# 1904389: NullPointerException if save-when in collection binding
        // event.getTarget() might not inside the collection item (i.e. row, listitem, etc.)
        // then binder.lookupClone() will return null dataTarget.
        if (dataTarget != null) {
          final Object[] vals = binding.getAttributeValues(dataTarget);
          if (vals != null) {
            tmplist.add(new BindingInfo(binding, dataTarget, vals));
            values.add(vals[0]);
            refs.add(dataTarget);
            bindings.add(binding);
            Events.sendEvent(
                new BindingSaveEvent("onBindingSave", dataTarget, target, binding, vals[0]));
          }
        } else {
          // bi.getComponent a template and a null dataTarget, meaning all collection items has to
          // be handled. Search the owner to iterate all cloned items.
          final List<Component> clones = scanClones(binder, dt);
          for (Component dataTarget1 : clones) {
            final Object[] vals = binding.getAttributeValues(dataTarget1);
            if (vals != null) {
              tmplist.add(new BindingInfo(binding, dataTarget1, vals));
              values.add(vals[0]);
              refs.add(dataTarget1);
              bindings.add(binding);
              Events.sendEvent(
                  new BindingSaveEvent("onBindingSave", dataTarget1, target, binding, vals[0]));
            }
          }
        }
      }

      // fire onValidate for target component
      Events.sendEvent(
          new BindingValidateEvent("onBindingValidate", target, refs, bindings, values));

      // saveAttribute for each binding
      Component loadOnSaveProxy = null;
      Component dataTarget = null;
      DataBinder binder = null;
      final List<Object> loadOnSaveInfos = new ArrayList<Object>(tmplist.size());
      for (BindingInfo bi : tmplist) {
        dataTarget = bi.getComponent();
        final Binding binding = bi.getBinding();
        if (binder == null) {
          binder = binding.getBinder();
        }
        final Object[] vals = bi.getAttributeValues();
        binding.saveAttributeValue(dataTarget, vals, loadOnSaveInfos, triggerEventName);
        if (loadOnSaveProxy == null && dataTarget.isListenerAvailable("onLoadOnSave", true)) {
          loadOnSaveProxy = dataTarget;
        }
      }

      // bug #1895856 : data binding LoadOnSave works only on the last save-when component
      // do loadOnSave
      // if (dataTarget != null) {
      //		Events.postEvent(new Event("onLoadOnSave", dataTarget, loadOnSaveInfos));
      //	}

      // (use first working dataTarget as proxy)
      // feature#2990932, allow disable load-on-save mechanism
      if (loadOnSaveProxy != null && binder.isLoadOnSave()) {
        Events.postEvent(new Event("onLoadOnSave", loadOnSaveProxy, loadOnSaveInfos));
      }
    }
コード例 #26
0
  public void onEvent(Event event) {
    Component comp = event.getTarget();
    String eventName = event.getName();

    if (eventName.equals(Events.ON_CLICK)) {
      if (comp == max) {
        if (layout.getNorth().isVisible()) {
          collapseHeader();
        } else {
          restoreHeader();
        }
      } else if (comp == showHeader) {
        showHeader.setPressed(true);
        if (pnlHead.getParent() != headerPopup) headerPopup.appendChild(pnlHead);
        LayoutUtils.openPopupWindow(showHeader, headerPopup, "after_start");
      } else if (comp == contextHelp) {
        layout.getEast().setVisible(true);
        layout.getEast().setOpen(true);
        contextHelp.setVisible(false);
        updateHelpCollapsedPreference(false);
      } else if (comp instanceof ToolBarButton) {
        ToolBarButton btn = (ToolBarButton) comp;

        if (btn.getAttribute("AD_Menu_ID") != null) {
          int menuId = (Integer) btn.getAttribute("AD_Menu_ID");
          if (menuId > 0) onMenuSelected(menuId);
        }
      }
    } else if (eventName.equals(ON_ACTIVITIES_CHANGED_EVENT)) {
      @SuppressWarnings("unchecked")
      Map<String, Object> map = (Map<String, Object>) event.getData();
      Integer notice = (Integer) map.get("notice");
      Integer request = (Integer) map.get("request");
      Integer workflow = (Integer) map.get("workflow");
      Integer unprocessed = (Integer) map.get("unprocessed");
      boolean change = false;
      if (notice != null && notice.intValue() != noOfNotice) {
        noOfNotice = notice.intValue();
        change = true;
      }
      if (request != null && request.intValue() != noOfRequest) {
        noOfRequest = request.intValue();
        change = true;
      }
      if (workflow != null && workflow.intValue() != noOfWorkflow) {
        noOfWorkflow = workflow.intValue();
        change = true;
      }
      if (unprocessed != null && unprocessed.intValue() != noOfUnprocessed) {
        noOfUnprocessed = unprocessed.intValue();
        change = true;
      }
      if (change) updateUI();
    } else if (event instanceof ZoomEvent) {
      Clients.clearBusy();
      ZoomEvent ze = (ZoomEvent) event;
      if (ze.getData() != null && ze.getData() instanceof MQuery) {
        AEnv.zoom((MQuery) ze.getData());
      }
    } else if (event instanceof DrillEvent) {
      Clients.clearBusy();
      DrillEvent de = (DrillEvent) event;
      if (de.getData() != null && de.getData() instanceof MQuery) {
        MQuery query = (MQuery) de.getData();
        executeDrill(query);
      }
    }
  }