Example #1
0
 public void onEvent(Event event) {
   if (Events.ON_SELECT.equalsIgnoreCase(event.getName())) {
     Object newValue = getValue();
     if (isValueChange(newValue)) {
       ValueChangeEvent changeEvent =
           new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
       super.fireValueChange(changeEvent);
       oldValue = newValue;
     }
   } else if (Events.ON_BLUR.equalsIgnoreCase(event.getName())) {
     Comboitem item = getComponent().getSelectedItem();
     if (item == null) {
       setValue(oldValue);
     } else {
       // on select not fire for empty label item
       if (item.getLabel().equals("")) {
         Object newValue = getValue();
         if (isValueChange(newValue)) {
           ValueChangeEvent changeEvent =
               new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
           super.fireValueChange(changeEvent);
           oldValue = newValue;
         }
       }
     }
   }
 }
 @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();
 }
Example #3
0
 public void onEvent(Event event) {
   if (event instanceof AfterEvent) {
     handleEvent((Event) event.getData());
   } else { // post AfterEvent to make sure it is called after
     // enforce the event is the last processed
     Events.postEvent(-10100, new AfterEvent(event.getName() + "SaveAfter", event));
   }
 }
Example #4
0
  /**
   * ************************************************************************ 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
Example #5
0
  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);
    }
  }
Example #6
0
  public void onClick$btnBatal(Event event) throws Exception {

    if (logger.isDebugEnabled()) {
      logger.debug("--> " + event.toString());
    }
    window_Permohonan.onClose();
  }
  public void onEvent(Event event) throws Exception {
    //
    if (Events.ON_CLICK.equalsIgnoreCase(event.getName())) {
      Integer oldValue = (Integer) getValue();
      int S_ResourceAssignment_ID = oldValue == null ? 0 : oldValue.intValue();
      MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), S_ResourceAssignment_ID, null);

      //	Start VAssignment Dialog
      if (S_ResourceAssignment_ID != 0) {
        WAssignmentDialog vad = new WAssignmentDialog(ma, true, true);
        ma = vad.getMResourceAssignment();
      }
      //	Start InfoSchedule directly
      else {
        InfoSchedule is = new InfoSchedule(ma, true);
        ma = is.getMResourceAssignment();
      }

      //	Set Value
      if (ma != null && ma.getS_ResourceAssignment_ID() != 0) {
        setValue(new Integer(ma.getS_ResourceAssignment_ID()));
        ValueChangeEvent vce =
            new ValueChangeEvent(this, gridField.getColumnName(), oldValue, getValue());
        fireValueChange(vce);
      }
    }
  }
Example #8
0
    public void select() {
      ComponentAgent parent = AuUtility.lookupEventTarget(target, Events.ON_SELECT);
      Set<String> items = new HashSet<String>();
      items.add(target.getUuid());

      String desktopId = target.getDesktop().getId();
      Event event =
          new SelectEvent(
              Events.ON_SELECT,
              (Component) parent.getDelegatee(),
              items,
              (Component) target.getDelegatee());
      Map<String, Object> data = EventDataManager.getInstance().build(event);
      ((ClientCtrl) target.getClient())
          .postUpdate(desktopId, event.getName(), parent.getUuid(), data, null);
    }
Example #9
0
  /** 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());
  }
  @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();
  }
  @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);
          }
        });
  }
    @Override
    public void onEvent(Event event) throws Exception {

      // check which button is pressed
      if (event.getTarget().getId().equalsIgnoreCase("btnRefresh")) {
        doReadData();
      }
    }
Example #13
0
  /**
   * 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();
  }
  /**
   * 生成报告按钮事件
   *
   * @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);
  }
Example #15
0
  @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));
  }
Example #16
0
  public void onClick$btnSimpan_Permohonan(Event event) throws Exception {

    if (logger.isDebugEnabled()) {
      logger.debug("--> " + event.toString());
    }
    if (isValidatedFlow()) {
      doSimpan();
      window_Permohonan.onClose();
    }
  }
Example #17
0
  /**
   * Opens the help screen for the current module.
   *
   * @param event
   * @throws InterruptedException
   */
  private void doHelp(Event event) throws InterruptedException {

    ZksampleMessageUtils.doShowNotImplementedMessage();

    // we stop the propagation of the event, because zk will call ALL events
    // with the same name in the namespace and 'btnHelp' is a standard
    // button in this application and can often appears.
    // Events.getRealOrigin((ForwardEvent) event).stopPropagation();
    event.stopPropagation();
  }
Example #18
0
 public void onEvent(Event event) throws Exception {
   if (Events.ON_CLICK.equals(event.getName())) {
     ActionEvent actionEvent = new ActionEvent(this, getColumnName(), Events.ON_CLICK);
     ActionListener[] listeners = new ActionListener[0];
     listeners = actionListeners.toArray(listeners);
     for (ActionListener evtListener : listeners) {
       evtListener.actionPerformed(actionEvent);
     }
   }
 }
  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);
    }
  }
Example #20
0
 public void onEvent(Event event) throws Exception {
   @SuppressWarnings("unchecked")
   T evt = (T) event.getData();
   for (Iterator<ListenerInfo<T>> it = CollectionsX.comodifiableIterator(_listenerInfos);
       it.hasNext(); ) {
     final ListenerInfo<T> inf = it.next();
     if (inf.async) new AsyncListenerThread<T>(DesktopEventQueue.this, inf, evt).start();
     else inf.listener.onEvent(evt);
   }
 }
Example #21
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();
    }
  }
 public void onEvent(Event event) {
   if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName())) {
     String newText = getComponent().getText();
     String oldText = null;
     if (m_value != null) {
       oldText = m_mPAttribute.getDisplay(m_value);
     }
     if (oldText != null && newText != null && oldText.equals(newText)) {
       return;
     }
     if (oldText == null && newText == null) {
       return;
     }
     ValueChangeEvent changeEvent =
         new ValueChangeEvent(this, this.getColumnName(), oldText, newText);
     fireValueChange(changeEvent);
   } else if (Events.ON_CLICK.equals(event.getName())) {
     cmd_dialog();
   }
 }
Example #23
0
 public void onClick$button_Download(Event event) throws Exception {
   if (logger.isDebugEnabled()) {
     logger.debug("--> " + event.toString());
   }
   String lam = permohonanService.getFilePath() + "lampiran.xlsx";
   try {
     Filedownload.save(new File(lam), null);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public void onEvent(Event event) {
    if (Events.ON_CHANGE.equalsIgnoreCase(event.getName())
        || Events.ON_OK.equalsIgnoreCase(event.getName())) {
      Date date = getComponent().getValue();
      Timestamp newValue = null;

      if (date != null) {
        newValue = new Timestamp(date.getTime());
      }
      if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
      }
      if (oldValue == null && newValue == null) {
        return;
      }
      ValueChangeEvent changeEvent =
          new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
      super.fireValueChange(changeEvent);
      oldValue = newValue;
    }
  }
Example #25
0
  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);
  }
  /**
   * 批量允许按钮功能
   *
   * @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();
  }
Example #27
0
 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);
       }
     }
   }
 }
  public void onClick$btnImprimir(Event event) {
    logger.log(java.util.logging.Level.INFO, "[onClick$btnImprimir]Event:{0}", event.toString());
    try {

      genericDaoServiceBean.executeSPSaldoInicial(
          UtilFormat.convertirFechaYYYYMMMDDD(dbDesde.getValue()),
          getUserLogin().getEmpresa().getIdempresa());

      genericDaoServiceBean.executeSPSaldoInicialMayor(
          UtilFormat.convertirFechaYYYYMMMDDD(dbDesde.getValue()),
          getUserLogin().getEmpresa().getIdempresa());

      obtenerReporteLibroAuxiliar();

    } catch (Exception a) {
      a.printStackTrace();
    }
  }
Example #29
0
 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();
         }
       });
 }
Example #30
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();
   }
 }