コード例 #1
0
  private void gridChange(Object itemId) {
    Collection<Object> ids = (Collection<Object>) gridFilter.getGrid().getValue();

    Button btnCheck = (Button) commandbar.getButton(COMMAND.CHECK.getValue());
    Button btnFavorite = (Button) commandbar.getButton(COMMAND.POP_MY_FAVORITE.getValue());
    Button btnCompare = (Button) commandbar.getButton(COMMAND.COMPARE.getValue());

    if (ids.size() != 0) {
      btnCompare.setEnabled(true);

      List<Item> selection = gridFilter.getGrid().getSelection();
      // 選擇多筆時, 只有btnCompare有可能Enabeld
      if (selection.size() > 1) {
        menu.setMenuBarEnabled(false);
        btnCheck.setEnabled(false);
        btnFavorite.setEnabled(false);
      } else {
        menu.setMenuBarEnabled(true);
        btnCheck.setEnabled(true);
        btnFavorite.setEnabled(true);
      }
      // 沒選到任何資料時
    } else {
      menu.setMenuBarEnabled(false);
      btnCheck.setEnabled(false);
      btnFavorite.setEnabled(false);
      btnCompare.setEnabled(false);
    }
  }
コード例 #2
0
  private Component buildGrid() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);

    grid.setSizeFull();
    grid.setMultiSelect(true);
    grid.addContainerProperty(
        "candidateUuid", String.class, null, termResource.getTerm("UUID"), null, null);
    grid.setColumnCollapsed("candidateUuid", true);
    grid.addContainerProperty("candStageInterviewerUuid", String.class, null);
    grid.setColumnCollapsed("candStageInterviewerUuid", true);
    grid.addContainerProperty(
        "decision", CodeData.class, null, termResource.getTerm("Decision"), null, null);
    grid.addContainerProperty(
        "name", String.class, null, termResource.getTerm("IA-CANDIDATE"), null, null);
    grid.addContainerProperty(
        "requisition", String.class, null, termResource.getTerm("IA-REQUISITION"), null, null);
    grid.addContainerProperty(
        "location", String.class, null, termResource.getTerm("Location"), null, null);
    grid.addContainerProperty(
        "dueOn", Date.class, null, termResource.getTerm("Due On"), null, null);
    grid.addContainerProperty(
        "degree", CodeData.class, null, termResource.getTerm("Degree"), null, null);
    grid.addContainerProperty(
        "school", String.class, null, termResource.getTerm("School"), null, null);
    grid.addContainerProperty(
        "major", String.class, null, termResource.getTerm("Major"), null, null);
    grid.addContainerProperty(
        "totalWorkExp",
        BigDecimal.class,
        null,
        termResource.getTerm("Years Experience"),
        null,
        Table.ALIGN_RIGHT);
    grid.addContainerProperty(
        "lastJobTitle", String.class, null, termResource.getTerm("Last Job Title"), null, null);
    grid.addContainerProperty(
        "lastEmplyer", String.class, null, termResource.getTerm("Last Employer"), null, null);
    grid.addContainerProperty(
        "source", String.class, null, termResource.getTerm("Source"), null, null);
    grid.addContainerProperty(
        "completeOn", Date.class, null, termResource.getTerm("Complete On"), null, null);
    grid.addContainerProperty(
        "read", Label.class, null, termResource.getTerm("Read"), null, Table.ALIGN_CENTER);
    grid.setColumnWidth("read", 100);
    grid.addContainerProperty("candStageInterviewer", CandStageInterviewer.class, null);
    grid.setColumnCollapsed("candStageInterviewer", true);
    gridFilter.buildCondition();
    grid.addValueChangeListener(
        new Property.ValueChangeListener() {
          public void valueChange(ValueChangeEvent event) {
            gridChange(event.getProperty().getValue());
          }
        });
    gridFilter.setWindowHeight("485px");

    layout.addComponent(gridFilter);

    return layout;
  }
コード例 #3
0
  private void execute() {
    search();
    // from home - find more candidates
    String findDue = (String) data.get("findDue");
    if (FieldUtil.isNotEmpty(findDue)) {

      LOGGER.debug(findDue);
      // 設條件
      DateField dfFrom = (DateField) gridFilter.getField("dueOn" + "_From");
      DateField dfTo = (DateField) gridFilter.getField("dueOn" + "_To");

      if (findDue.equals(CardDonut.MODE_DUE.DUE_TODAY.getValue())) {
        dfFrom.setValue(DateUtil.getOnlyDate(new Date(), timeZone));
        dfTo.setValue(DateUtil.getOnlyDate(new Date(), timeZone));
      } else if (findDue.equals(CardDonut.MODE_DUE.OVERDUE.getValue())) {
        DateTime dt = new DateTime();
        dfTo.setValue(DateUtil.getOnlyDate(dt.minusDays(1).toDate(), timeZone));
      } else if (findDue.equals(CardDonut.MODE_DUE.TOTAL.getValue())) {

      }
      // 清除
      data.put("findDue", null);
      UI.getCurrent().setData(data);

      gridFilter.search();
    }
  }
コード例 #4
0
  private void saveMyFavorite() {
    Item item = vfMyFavorite.getForm().getValues();
    String createId = (String) item.getItemProperty("createIn").getValue();
    String newForder = (String) item.getItemProperty("newFolder").getValue();

    if (FieldUtil.isNotEmpty(createId) && FieldUtil.isNotEmpty(newForder)) {
      Dialog dialog =
          new Dialog(
              Dialog.MODE.VALIDATE,
              messageResource.getMessage(
                  "501014",
                  locale,
                  termResource.getTerm("Create In"),
                  termResource.getTerm("New Folder")));
      return;
    }
    String category;
    if (createId != null) {
      category = createId;
    } else {
      category = newForder;
    }

    List<Item> selection = gridFilter.getGrid().getSelection();
    Item i = selection.get(0);
    String candidateUuid = (String) i.getItemProperty("candidateUuid").getValue();
    Candidate candidate = candidateService.get(candidateUuid);
    CandFavorite candFavorite = new CandFavorite();
    candFavorite.setCandidate(candidate);
    candFavorite.setCategory(category);
    candFavorite.setManager(currentUser);

    try {
      candFavoriteService.save(candFavorite);
    } catch (DuplicateConflictException d) {
      LOGGER.debug("DuplicateConflictException: ", d);
      Dialog dialog = new Dialog(Dialog.MODE.VALIDATE, d.getLocalizedMessage(locale));
      return;
    } catch (ConstraintConflictException c) {
      LOGGER.debug("ConstraintConflictException: ", c);
      Dialog dialog =
          new Dialog(Dialog.MODE.VALIDATE, ViolationUtils.getViolation(c.getViolations(), locale));
      return;
    } catch (OperationFailureException o) {
      LOGGER.error("Exception: ", o);
      Messagebox.hint(messageResource.getMessage("200001"));
      return;
    }
    // success
    Messagebox.info(messageResource.getMessage("100025"));
    closeMyFavorite();
    refresh();
  }
コード例 #5
0
  private void build() {
    layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.addStyleName("padding-20");

    layout.setSizeFull();

    setCompositionRoot(layout);

    // 因為Menu Decision要放grid當作參數 , 所以必須先new
    gridFilter = new GridFilter(GridFilter.MODE.FILTER_IN_WINDOW);
    this.grid = gridFilter.getGrid();

    layout.addComponent(buildButtons());
    layout.addComponent(buildGrid());

    buildWindows();
  }
コード例 #6
0
 public void refresh() {
   search();
   gridFilter.reSearch();
 }
コード例 #7
0
  private void search() {
    gridFilter.reset();

    String localeStr = locale.toString();
    List<Object[]> datasList =
        candStageInterviewerService.findResumeReviewUnprocessByManager(
            currentUser.getUuid(), localeStr);
    // for isRead
    List<String> isReads = candProfileReadService.findCandidateByManager(currentUser.getUuid());

    //		System.out.println(ANSI_PURPLE + "start setGridContent" + ANSI_RESET);
    LOGGER.debug("start ResumeReviewToDoListFinder search");
    long lStartTime = System.nanoTime();

    for (Object[] datas : datasList) {
      long lStartOneTime = System.nanoTime();
      Item newItem = grid.getItem(grid.addItem());

      long lStartUuidTime = System.nanoTime();
      // uuid
      String candidateUuid = (String) datas[0];
      newItem.getItemProperty("candidateUuid").setValue(candidateUuid);
      // candStageInterviewerUuid
      String candStageInterviewerUuid = (String) datas[17];
      newItem.getItemProperty("candStageInterviewerUuid").setValue(candStageInterviewerUuid);
      LOGGER.debug(
          "Start One - candidateUuid: "
              + candidateUuid
              + " candStageInterviewerUuid: "
              + candStageInterviewerUuid);
      // decision
      CodeData codeDataDecision =
          codeDataService.findOneByCodeTypeAndCode("reviewDecision", (String) datas[14], localeStr);
      newItem.getItemProperty("decision").setValue(codeDataDecision);

      newItem.getItemProperty("name").setValue((String) datas[1]);
      newItem.getItemProperty("totalWorkExp").setValue(datas[9]);

      long lEndUuidTime = System.nanoTime();
      long differenceUuid = lEndUuidTime - lStartUuidTime;
      //			System.out.println(ANSI_PURPLE+ "Put uuid name totalWorkExp time: "+candidateUuid+" spend
      // "+differenceUuid/1000000+" ms" + ANSI_RESET);
      LOGGER.debug(
          "Put uuid name totalWorkExp time: "
              + candidateUuid
              + " spend "
              + differenceUuid / 1000000
              + " ms");

      long lStartDegreeTime = System.nanoTime();

      String degreeCode = (String) datas[2];
      CodeData codeDataDegree =
          codeDataService.findOneByCodeTypeAndCode("degree", degreeCode, localeStr);
      if (codeDataDegree != null) {
        newItem.getItemProperty("degree").setValue(codeDataDegree);
      }
      String schoolCode = (String) datas[3];
      if (schoolCode != null) {
        if (!schoolCode.equals(School.TYPE.OTHER.getValue())) {
          School school =
              schoolService.findOneByDegreeAndCodeAndLocale(degreeCode, schoolCode, localeStr);
          if (school != null) {
            newItem.getItemProperty("school").setValue(school.getName());
          }
          // other school
        } else {
          newItem.getItemProperty("school").setValue((String) datas[5]);
        }
      }
      String majorCode = (String) datas[4];
      if (majorCode != null) {
        if (!majorCode.equals(Major.TYPE.OTHER.getValue())) {
          Major major =
              majorService.findOneByDegreeAndCodeAndLocale(degreeCode, majorCode, localeStr);
          if (major != null) {
            newItem.getItemProperty("major").setValue(major.getName());
          }
          // other major
        } else {
          newItem.getItemProperty("major").setValue((String) datas[6]);
        }
      }

      long lEndDegreeTime = System.nanoTime();
      long differenceDegree = lEndDegreeTime - lStartDegreeTime;
      //			System.out.println(ANSI_PURPLE+ "Put degree school major: "+candidateUuid+" spend
      // "+differenceDegree/1000000+" ms" + ANSI_RESET);
      LOGGER.debug(
          "Put degree school major: "
              + candidateUuid
              + " spend "
              + differenceDegree / 1000000
              + " ms");

      long lStartSourceTime = System.nanoTime();

      // years, last job title , source
      newItem.getItemProperty("lastJobTitle").setValue((String) datas[8]);
      newItem.getItemProperty("lastEmplyer").setValue((String) datas[7]);
      newItem.getItemProperty("source").setValue((String) datas[10]);

      long lEndSourceTime = System.nanoTime();
      long differenceSource = lEndSourceTime - lStartSourceTime;
      //			System.out.println(ANSI_PURPLE+ "Put lastJobTitle lastEmplyer source: "+candidateUuid+"
      // spend "+differenceSource/1000000+" ms" + ANSI_RESET);
      LOGGER.debug(
          "Put lastJobTitle lastEmplyer source: "
              + candidateUuid
              + " spend "
              + differenceSource / 1000000
              + " ms");

      long lStartReadTime = System.nanoTime();

      // read
      if (isReads.contains(candidateUuid)) {
        Label lRead = new Label();
        lRead.setSizeUndefined();
        lRead.setContentMode(ContentMode.HTML);
        lRead.setValue(FontAwesome.TAG.getHtml());
        newItem.getItemProperty("read").setValue(lRead);
      }

      long lEndReadTime = System.nanoTime();
      long differenceRead = lEndReadTime - lStartReadTime;
      //			System.out.println(ANSI_PURPLE+ "Put read: "+candidateUuid+" spend
      // "+differenceRead/1000000+" ms" + ANSI_RESET);
      LOGGER.debug("Put read: " + candidateUuid + " spend " + differenceRead / 1000000 + " ms");

      long lStartRequisitionTime = System.nanoTime();

      newItem.getItemProperty("requisition").setValue((String) datas[11]);

      newItem.getItemProperty("location").setValue((String) datas[13]);

      // due on
      newItem.getItemProperty("dueOn").setValue((Date) datas[15]);
      // complete on
      newItem.getItemProperty("completeOn").setValue((Date) datas[16]);

      long lEndRequisitionTime = System.nanoTime();
      long differenceRequisition = lEndRequisitionTime - lStartRequisitionTime;
      //			System.out.println(ANSI_PURPLE+ "Put requisition location dueOn completeOn:
      // "+candidateUuid+" spend "+differenceRequisition/1000000+" ms"+ ANSI_RESET);
      LOGGER.debug(
          "Put requisition location dueOn completeOn: "
              + candidateUuid
              + " spend "
              + differenceRequisition / 1000000
              + " ms");

      long lEndOneTime = System.nanoTime();
      long differenceOne = lEndOneTime - lStartOneTime;
      //			System.out.println(ANSI_PURPLE+"One Item set done: "+candidateUuid+" spend
      // "+differenceOne/1000000+" ms"+ ANSI_RESET);
      LOGGER.debug(
          "One Item set done: " + candidateUuid + " spend " + differenceOne / 1000000 + " ms");

      //
      //	System.out.println(ANSI_PURPLE+"==========================================================="+ ANSI_RESET);
      LOGGER.debug("===========================================================");
    }

    long lEndTime = System.nanoTime();
    long difference = lEndTime - lStartTime;
    //		System.out.println(ANSI_PURPLE+"Complete setGridContent spend "+difference/1000000+" ms"+
    // ANSI_RESET);
    LOGGER.debug("Complete setGridContent spend " + difference / 1000000 + " ms");

    long lStartAdjustTime = System.nanoTime();

    gridFilter.adjust();
    count();

    long lEndAdjustTime = System.nanoTime();
    long differenceAdjust = lEndAdjustTime - lStartAdjustTime;
    //		System.out.println(ANSI_PURPLE+"Adjust Time "+differenceAdjust/1000000+" ms"+ ANSI_RESET);
    LOGGER.debug("Adjust Time " + differenceAdjust / 1000000 + " ms");
  }