Package org.projectforge.timesheet

Examples of org.projectforge.timesheet.TimesheetPrefData


    // clean ignore location if needed
    if(form != null && form.getFilter() != null && getData() != null) {
      form.getFilter().removeIgnoredLocation(getData().getLocation());
    }
    // Save time sheet as recent time sheet
    final TimesheetPrefData pref = getTimesheetPrefData();
    final TimesheetDO timesheet = getData();
    pref.appendRecentEntry(timesheet);
    pref.appendRecentTask(timesheet.getTaskId());
    if (StringUtils.isNotBlank(timesheet.getLocation()) == true) {
      pref.appendRecentLocation(timesheet.getLocation());
    }
    // Does the user want to store this time sheet as template?
    if (BooleanUtils.isTrue(form.saveAsTemplate) == true) {
      final UserPrefEditPage userPrefEditPage = new UserPrefEditPage(UserPrefArea.TIMESHEET_TEMPLATE, getData());
      userPrefEditPage.setReturnToPage(this.returnToPage);
View Full Code Here


    this.timesheet = timesheet;
  }

  public TimesheetPrefData getTimesheetPrefData()
  {
    TimesheetPrefData pref = (TimesheetPrefData) page.getUserPrefEntry(TimesheetEditPage.class.getName());
    if (pref == null) {
      pref = new TimesheetPrefData();
      page.putUserPrefEntry(TimesheetEditPage.class.getName(), pref, true);
    }
    return pref;
  }
View Full Code Here

        getData().setStopTime(new Timestamp(newStopTimeInMillis));
      }
    }

    if (isNew() == true) {
      final TimesheetPrefData pref = getTimesheetPrefData();
      TimesheetPrefEntry entry = null;
      if (pref != null) {
        entry = pref.getNewesRecentEntry();
        if (getData().getTaskId() == null && entry != null) {
          getBaseDao().setTask(getData(), entry.getTaskId());
        }
      }
      if (getData().getUserId() == null) {
View Full Code Here

   * Return list for table with all recent used time sheets.
   * @return
   */
  protected List<TimesheetDO> getRecentTimesheets()
  {
    final TimesheetPrefData data = getTimesheetPrefData();
    final List<TimesheetDO> list = new ArrayList<TimesheetDO>();
    if (data != null && data.getRecents() != null) {
      for (final TimesheetPrefEntry entry : data.getRecents()) {
        final TimesheetDO sheet = getRecentSheet(entry);
        list.add(sheet);
      }
      Collections.sort(list, new Comparator<TimesheetDO>() {
        public int compare(final TimesheetDO t1, final TimesheetDO t2)
        {
          final Kost2DO kost1 = t1.getKost2();
          final Kost2DO kost2 = t2.getKost2();
          final ProjektDO project1 = kost1 != null ? kost1.getProjekt() : null;
          final ProjektDO project2 = kost2 != null ? kost2.getProjekt() : null;
          final String kunde1 = project1 != null && project1.getKunde() != null ? project1.getKunde().getName() : null;
          final String kunde2 = project2 != null && project2.getKunde() != null ? project2.getKunde().getName() : null;
          return new CompareToBuilder().append(kunde1, kunde2)
              .append(project1 != null ? project1.getName() : null, project2 != null ? project2.getName() : null)
              .append(t1.getTask() != null ? t1.getTask().getTitle() : null, t2.getTask() != null ? t2.getTask().getTitle() : null)
              .toComparison();
        }
      });
      // Don't show recent block for new users if all entries are already displayed.
      if (data.getRecents().size() > SIZE_OF_FIRST_RECENT_BLOCK) {
        int i = 0;
        for (final TimesheetPrefEntry entry : data.getRecents()) {
          final TimesheetDO sheet = getRecentSheet(entry);
          list.add(i, sheet);
          if (i++ >= SIZE_OF_FIRST_RECENT_BLOCK) {
            break;
          }
View Full Code Here

  /**
   * Gets the recent locations.
   */
  public List<String> getRecentLocations()
  {
    final TimesheetPrefData data = getTimesheetPrefData();
    if (data != null) {
      return data.getRecentLocations();
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.projectforge.timesheet.TimesheetPrefData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.