/**
   * When the "update geo data" button is clicked. <br>
   * Updates the login records with geodata for their IP's if found.<br>
   * This is done by a calling a web service from Hostinfo.org.<br>
   *
   * @param event
   * @throws InterruptedException
   */
  public void onClick$button_SecLoginlogList_UpdateGeoData(Event event)
      throws InterruptedException {

    final String str =
        InputConfirmBox.show(
            this.secLoginlogListWindow,
            Labels.getLabel("message.Information.InputSupervisorPassword"));

    if (StringUtils.equalsIgnoreCase(str, "yes we can")) {
      final int recCount = getGuiLoginLoggingService().updateFromHostLookUpMain();

      final String message =
          Labels.getLabel("message.Information.CountRecordsInsertedUpdated") + " " + recCount;
      final String title = Labels.getLabel("message.Information");
      MultiLineMessageBox.doSetTemplate();
      MultiLineMessageBox.show(message, title, MultiLineMessageBox.OK, "INFORMATION", true);

      // ++ create the searchObject and init sorting ++//
      final HibernateSearchObject<SecLoginlog> soSecLoginlog =
          new HibernateSearchObject<SecLoginlog>(SecLoginlog.class, getCountRows());
      // deeper loading of the relations to prevent the lazy
      // loading problem.
      soSecLoginlog.addFetch("ip2Country.countryCode");
      soSecLoginlog.addSort("lglLogtime", true);

      // Set the ListModel
      getPagedListWrapper().init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);

    } else {
      final String message = Labels.getLabel("message.error.falsePassword");
      final String title = Labels.getLabel("message.Error");
      MultiLineMessageBox.doSetTemplate();
      MultiLineMessageBox.show(message, title, MultiLineMessageBox.OK, "INFORMATION", true);
    }
  }
示例#2
0
  /**
   * Search/filter data for the filled out fields<br>
   * <br>
   * 1. Count how many textboxes are filled. <br>
   * 2. Create a map with the count entries. <br>
   * 3. Store the propertynames(must corresponds to the domain classes properties) and values to the
   * map. <br>
   * 4. Call the ServiceDAO method with the map as parameter. <br>
   */
  private void doSearchArticle() {

    // ++ create the searchObject and init sorting ++//
    // only in sample app init with all orders
    HibernateSearchObject<Article> soArticle =
        new HibernateSearchObject<Article>(Article.class, getPageSizeArticleSearch());
    soArticle.addSort("artNr", false);

    if (StringUtils.isNotEmpty(tb_OrderPosition_SearchArticlelNo.getValue())) {
      soArticle.addFilter(
          new Filter(
              "artNr", "%" + tb_OrderPosition_SearchArticlelNo.getValue() + "%", Filter.OP_ILIKE));
    }

    if (StringUtils.isNotEmpty(tb_OrderPosition_SearchArticleDesc.getValue())) {
      soArticle.addFilter(
          new Filter(
              "artKurzbezeichnung",
              "%" + tb_OrderPosition_SearchArticleDesc.getValue() + "%",
              Filter.OP_ILIKE));
    }

    // Set the ListModel.
    getPlwArticles().init(soArticle, listBoxArticleSearch, paging_ListBoxArticleSearch);
  }
示例#3
0
  public void onOpen$bandbox_OrderPositionDialog_ArticleSearch(Event event) throws Exception {
    // logger.debug(event.toString());

    // ++ create the searchObject and init sorting ++//
    // only in sample app init with all orders
    HibernateSearchObject<Article> soArticle =
        new HibernateSearchObject<Article>(Article.class, getPageSizeArticleSearch());
    soArticle.addSort("artNr", false);

    // Set the ListModel.
    getPlwArticles().init(soArticle, listBoxArticleSearch, paging_ListBoxArticleSearch);
  }
  /**
   * when the "search/filter" button is clicked. It searches over a period. <br>
   * Checks if EndDate not before StartDate.<br>
   *
   * @param event
   */
  public void onClick$button_SecLoginlogList_bb_SearchDate(Event event) throws Exception {

    if (!(this.dbox_LoginLog_DateFrom.getValue() == null)
        && !(this.dbox_LoginLog_DateTo.getValue() == null)) {

      if (this.dbox_LoginLog_DateFrom.getValue().after(this.dbox_LoginLog_DateTo.getValue())) {
        MultiLineMessageBox.doSetTemplate();
        MultiLineMessageBox.show(Labels.getLabel("message_EndDate_Before_BeginDate"));
      } else {
        Date dateFrom = this.dbox_LoginLog_DateFrom.getValue();
        Date dateTo = this.dbox_LoginLog_DateTo.getValue();

        final Calendar calFrom = Calendar.getInstance();
        calFrom.setTime(dateFrom);
        calFrom.set(Calendar.AM_PM, 0);
        calFrom.set(Calendar.HOUR, 0);
        calFrom.set(Calendar.MINUTE, 0);
        calFrom.set(Calendar.SECOND, 1);
        dateFrom = calFrom.getTime();

        final Calendar calTo = Calendar.getInstance();
        calTo.setTime(dateTo);
        calTo.set(Calendar.AM_PM, 1);
        calTo.set(Calendar.HOUR, 11);
        calTo.set(Calendar.MINUTE, 59);
        calTo.set(Calendar.SECOND, 59);
        dateTo = calTo.getTime();

        // ++ create the searchObject and init sorting ++//
        final HibernateSearchObject<SecLoginlog> soSecLoginlog =
            new HibernateSearchObject<SecLoginlog>(SecLoginlog.class, getCountRows());
        // deeper loading of the relations to prevent the lazy
        // loading problem.
        soSecLoginlog.addFetch("ip2Country.countryCode");
        soSecLoginlog.addSort("lglLogtime", true);

        soSecLoginlog.addFilter(new Filter("lglLogtime", dateFrom, Filter.OP_GREATER_OR_EQUAL));
        soSecLoginlog.addFilter(new Filter("lglLogtime", dateTo, Filter.OP_LESS_OR_EQUAL));

        // Set the ListModel
        getPagedListWrapper()
            .init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);

        this.checkbox_SecLoginlogList_ShowAll.setChecked(false);
      }
    }
  }
  /**
   * when the checkBox 'Show All' for filtering is checked. <br>
   *
   * @param event
   */
  public void onCheck$checkbox_SecLoginlogList_ShowAll(Event event) {

    // empty the text search boxes
    this.tb_SecUserlog_LoginName.setValue(""); // clear
    this.checkbox_SecLoginlogList_ShowOnlySuccess.setChecked(false);
    this.checkbox_SecLoginlogList_ShowOnlyFailed.setChecked(false);

    // ++ create the searchObject and init sorting ++//
    final HibernateSearchObject<SecLoginlog> soSecLoginlog =
        new HibernateSearchObject<SecLoginlog>(SecLoginlog.class, getCountRows());
    // deeper loading of the relations to prevent the lazy
    // loading problem.
    soSecLoginlog.addFetch("ip2Country.countryCode");
    soSecLoginlog.addSort("lglLogtime", true);

    // Set the ListModel
    getPagedListWrapper().init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);
  }
  /**
   * Filter the logins log list with 'like LoginName'. <br>
   * We check additionally if something is selected in the right type listbox <br>
   * for including in the search statement.<br>
   */
  public void onClick$button_SecLoginlogList_SearchLoginName(Event event) throws Exception {

    // if not empty
    if (!this.tb_SecUserlog_LoginName.getValue().isEmpty()) {
      this.checkbox_SecLoginlogList_ShowAll.setChecked(false); // clear

      // ++ create the searchObject and init sorting ++//
      final HibernateSearchObject<SecLoginlog> soSecLoginlog =
          new HibernateSearchObject<SecLoginlog>(SecLoginlog.class, getCountRows());
      // deeper loading of the relations to prevent the lazy
      // loading problem.
      soSecLoginlog.addFetch("ip2Country.countryCode");
      soSecLoginlog.addSort("lglLogtime", true);

      soSecLoginlog.addFilter(
          new Filter("lglLoginname", this.tb_SecUserlog_LoginName.getValue(), Filter.OP_EQUAL));

      // Set the ListModel
      getPagedListWrapper().init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);
    }
  }
  /**
   * When the "clear local IPs" button is clicked. <br>
   * Deletes local IP's (127.0.0.1) or '0:0:0:0:0:0' <br>
   * from the list from.
   *
   * @param event
   * @throws InterruptedException
   */
  public void onClick$button_SecLoginlogList_DeleteLocalIPs(Event event)
      throws InterruptedException {

    final int recCount = getLoginLoggingService().deleteLocalIPs();

    final String message =
        Labels.getLabel("message.Information.CountRecordsDeleted") + " " + recCount;
    final String title = Labels.getLabel("message.Information");
    MultiLineMessageBox.doSetTemplate();
    MultiLineMessageBox.show(message, title, MultiLineMessageBox.OK, "INFORMATION", true);

    // ++ create the searchObject and init sorting ++//
    final HibernateSearchObject<SecLoginlog> soSecLoginlog =
        new HibernateSearchObject<SecLoginlog>(SecLoginlog.class, getCountRows());
    // deeper loading of the relations to prevent the lazy
    // loading problem.
    soSecLoginlog.addFetch("ip2Country.countryCode");
    soSecLoginlog.addSort("lglLogtime", true);

    // Set the ListModel
    getPagedListWrapper().init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);
  }
示例#8
0
  public void doFillListbox() {

    doFitSize();

    // set the paging params
    pagingBranchList.setPageSize(getCountRows());
    pagingBranchList.setDetailed(true);

    // not used listheaders must be declared like ->
    // lh.setSortAscending(""); lh.setSortDescending("")
    listheader_BranchText.setSortAscending(new FieldComparator("braBezeichnung", true));
    listheader_BranchText.setSortDescending(new FieldComparator("braBezeichnung", false));

    // ++ create the searchObject and init sorting ++//
    // get customers and only their latest address
    searchObj = new HibernateSearchObject<Branche>(Branche.class, getCountRows());
    searchObj.addSort("braBezeichnung", false);
    setSearchObj(searchObj);

    // Set the BindingListModel
    getPagedBindingListWrapper().init(searchObj, getListBoxBranch(), pagingBranchList);
    final BindingListModelList lml = (BindingListModelList) getListBoxBranch().getModel();
    setBranches(lml);

    // check if first time opened and init databinding for selectedBean
    if (getSelectedBranche() == null) {
      // init the bean with the first record in the List
      if (lml.getSize() > 0) {
        final int rowIndex = 0;
        // only for correct showing after Rendering. No effect as an
        // Event
        // yet.
        getListBoxBranch().setSelectedIndex(rowIndex);
        // get the first entry and cast them to the needed object
        setSelectedBranche((Branche) lml.get(0));

        // call the onSelect Event for showing the objects data in the
        // statusBar
        Events.sendEvent(new Event("onSelect", getListBoxBranch(), getSelectedBranche()));
      }
    }
  }
示例#9
0
  /**
   * Saves the components to table. <br>
   *
   * @throws InterruptedException
   */
  public void doSave() throws InterruptedException {

    Orderposition anOrderposition = getOrderposition();

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

    artNr.getValue();

    // additionally calculate new
    if (isDataChanged()) {
      doCalculate();
    }

    // fill the objects with the components data
    doWriteComponentsToBean(anOrderposition);

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

      // Reset to init values
      doResetInitValues();

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

    /** Synchronize the listbox in the OrderDialog */
    HibernateSearchObject<Orderposition> soOrderPosition =
        new HibernateSearchObject<Orderposition>(
            Orderposition.class, orderDialogCtrl.getPageSizeOrderPosition());
    soOrderPosition.addFilter(new Filter("order", getOrder(), Filter.OP_EQUAL));
    // deeper loading of a relation to prevent the lazy
    // loading problem.
    soOrderPosition.addFetch("article");

    // Set the ListModel.
    getPlwOrderpositions()
        .init(
            soOrderPosition,
            orderDialogCtrl.listBoxOrderOrderPositions,
            orderDialogCtrl.paging_ListBoxOrderOrderPositions);

    /** Synchronize the OrderList */
    // Listbox listBoxOrderArticle = orderListCtrl.getListBoxOrderArticle();
    // listBoxOrderArticle.setModel(orderDialogCtrl.listBoxOrderOrderPositions.getModel());
    orderListCtrl
        .getListBoxOrderArticle()
        .setModel(orderDialogCtrl.listBoxOrderOrderPositions.getModel());

    // synchronize the TotalCount from the paging component
    orderListCtrl.paging_OrderArticleList.setTotalSize(
        orderDialogCtrl.paging_ListBoxOrderOrderPositions.getTotalSize());

    doReadOnly();
    btnCtrl.setBtnStatus_Save();
    // init the old values vars new
    doStoreInitValues();
  }
  public void onCreate$secLoginlogListWindow(Event event) throws Exception {
    /**
     * Calculate how many rows have been place in the listbox. Get the currentDesktopHeight from a
     * hidden Intbox from the index.zul that are filled by onClientInfo() in the indexCtroller
     */
    final int height =
        ((Intbox) Path.getComponent("/outerIndexWindow/currentDesktopHeight"))
            .getValue()
            .intValue();
    final int maxListBoxHeight = height - 150;
    setCountRows(Math.round(maxListBoxHeight / 17));
    // System.out.println("MaxListBoxHeight : " + maxListBoxHeight);
    // System.out.println("==========> : " + getCountRows());

    this.borderLayout_SecUserlogList.setHeight(String.valueOf(maxListBoxHeight) + "px");

    // init, show all rights
    this.checkbox_SecLoginlogList_ShowAll.setChecked(true);

    // not used listheaders must be declared like ->
    // lh.setSortAscending(""); lh.setSortDescending("")
    this.listheader_SecLoginlogList_lglLogtime.setSortAscending(
        new FieldComparator("lglLogtime", true));
    this.listheader_SecLoginlogList_lglLogtime.setSortDescending(
        new FieldComparator("lglLogtime", false));
    this.listheader_SecLoginlogList_lglLogtime.setSortDirection("descending");
    this.listheader_SecLoginlogList_lglLoginname.setSortAscending(
        new FieldComparator("lglLoginname", true));
    this.listheader_SecLoginlogList_lglLoginname.setSortDescending(
        new FieldComparator("lglLoginname", false));
    this.listheader_SecLoginlogList_lglStatusid.setSortAscending(
        new FieldComparator("lglStatusid", true));
    this.listheader_SecLoginlogList_lglStatusid.setSortDescending(
        new FieldComparator("lglStatusid", false));
    this.listheader_SecLoginlogList_lglIp.setSortAscending(new FieldComparator("lglIp", true));
    this.listheader_SecLoginlogList_lglIp.setSortDescending(new FieldComparator("lglIp", false));
    this.listheader_SecLoginlogList_CountryCode2.setSortAscending(
        new FieldComparator("ip2Country.countryCode.ccdCode2", true));
    this.listheader_SecLoginlogList_CountryCode2.setSortDescending(
        new FieldComparator("ip2Country.countryCode.ccdCode2", false));
    this.listheader_SecLoginlogList_lglSessionid.setSortAscending(
        new FieldComparator("lglSessionid", true));
    this.listheader_SecLoginlogList_lglSessionid.setSortDescending(
        new FieldComparator("lglSessionid", false));

    // ++ create the searchObject and init sorting ++//
    final HibernateSearchObject<SecLoginlog> soSecLoginlog =
        new HibernateSearchObject<SecLoginlog>(SecLoginlog.class);
    // deeper loading of the relations to prevent the lazy
    // loading problem.
    soSecLoginlog.addFetch("ip2Country.countryCode");
    soSecLoginlog.addSort("lglLogtime", true);

    // set the paging params
    this.paging_SecUserLogList.setPageSize(getCountRows());
    this.paging_SecUserLogList.setDetailed(true);

    // Set the ListModel
    getPagedListWrapper().init(soSecLoginlog, this.listBoxSecUserlog, this.paging_SecUserLogList);
    // set the itemRenderer
    this.listBoxSecUserlog.setItemRenderer(new SecLoginlogListModelItemRenderer());

    createServerPushTimer();
  }