Examples of ContentProvider


Examples of org.projectforge.excel.ContentProvider

  public void addCreditorInvoicesSheet(final MyExcelExporter exporter, final String title, final Collection<EingangsrechnungDO> list)
  {
    final ExportSheet sheet = exporter.addSheet(title);
    sheet.createFreezePane(0, 1);
    final ContentProvider sheetProvider = sheet.getContentProvider();

    final ExportColumn[] cols = new ExportColumn[5];
    int i = 0;
    cols[i++] = createColumn(exporter, sheet, AbstractRechnungDO.class, "datum");
    cols[i++] = createColumn(exporter, sheet, AbstractRechnungDO.class, "faelligkeit");
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

    super(filename);
  }

  public ExportSheet addSheet(final String sheetTitle)
  {
    final ContentProvider contentProvider = new MyXlsContentProvider(getWorkbook()) {
      /**
       * @see org.projectforge.export.MyXlsContentProvider#getCustomizedCellFormat(org.projectforge.excel.CellFormat, java.lang.Object)
       */
      @Override
      protected CellFormat getCustomizedCellFormat(final CellFormat format, final Object value)
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

          return (o1.getUser().getFullname()).compareTo(o2.getUser().getFullname());
        }
      });
    }
    final ExportWorkbook xls = new ExportWorkbook();
    final ContentProvider contentProvider = new MyContentProvider(xls);
    // create a default Date format and currency column
    xls.setContentProvider(contentProvider);

    final EmployeeSalaryDO first = list.get(0);
    final int year = first.getYear();
    final int month = first.getMonth();
    final DayHolder buchungsdatum = new DayHolder();
    buchungsdatum.setDate(year, month, 1);
    final MonthHolder monthHolder = new MonthHolder(buchungsdatum.getDate());
    final BigDecimal numberOfWorkingDays = monthHolder.getNumberOfWorkingDays();
    buchungsdatum.setEndOfMonth();

    final String sheetTitle = DateHelper.formatMonth(year, month);
    final ExportSheet sheet = xls.addSheet(sheetTitle);
    sheet.createFreezePane(0, 1);

    final ExportSheet employeeSheet = xls.addSheet(PFUserContext.getLocalizedString("fibu.employee"));
    employeeSheet.setColumnWidth(0, MyXlsContentProvider.LENGTH_USER * 256);
    employeeSheet.setColumnWidth(1, 14 * 256);
    employeeSheet.setColumnWidth(2, 12 * 256);
    employeeSheet.setColumnWidth(3, 12 * 256);
    employeeSheet.setColumnWidth(4, 12 * 256);
    final ContentProvider provider = employeeSheet.getContentProvider();
    provider.putFormat("STUNDEN", "0.00;[Red]-0.00");
    final ExportRow employeeRow = employeeSheet.addRow();
    employeeRow.addCell(0, PFUserContext.getLocalizedString("fibu.employee"));
    employeeRow.addCell(1, PFUserContext.getLocalizedString("fibu.employee.wochenstunden"));
    employeeRow.addCell(2, PFUserContext.getLocalizedString("fibu.employee.sollstunden"));
    employeeRow.addCell(3, PFUserContext.getLocalizedString("fibu.employee.iststunden"));
    employeeRow.addCell(4, PFUserContext.getLocalizedString("fibu.common.difference"));

    // build all column names, title, widths from fixed and variable columns
    final int numCols = ExcelColumn.values().length;

    final String[] colNames = new String[numCols];
    final String[] colTitles = new String[numCols];
    final int[] colWidths = new int[numCols];

    int idx = 0;
    for (final ExcelColumn col : EnumSet.range(ExcelColumn.START, ExcelColumn.END)) {
      colNames[idx] = col.name();
      colTitles[idx] = PFUserContext.getLocalizedString(col.theTitle);
      colWidths[idx] = col.width;
      ++idx;
    }

    // column property names
    sheet.setPropertyNames(colNames);

    final ContentProvider sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat("STUNDEN", "0.00");
    sheetProvider.putFormat("BRUTTO_MIT_AG", "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat("KORREKTUR", "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat("SUMME", "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat("KOST1", "#");
    sheetProvider.putFormat("KOST2", "#");
    sheetProvider.putFormat("KONTO", "#");
    sheetProvider.putFormat("GEGENKONTO", "#");
    sheetProvider.putFormat("DATUM", "dd.MM.yyyy");
    // inform provider of column widths
    for (int ci = 0; ci < colWidths.length; ++ci) {
      sheetProvider.putColWidth(ci, colWidths[ci]);
    }

    final ExportRow headRow = sheet.addRow();
    int i = 0;
    for (final String title : colTitles) {
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

   */
  public byte[] export(final List<KostZuweisungDO> list, final String sheetTitle, final KontoCache kontoCache)
  {
    log.info("Exporting kost zuweisung list.");
    final ExportWorkbook xls = new ExportWorkbook();
    final ContentProvider contentProvider = new MyContentProvider(xls);
    // create a default Date format and currency column
    xls.setContentProvider(contentProvider);

    final ExportSheet sheet = xls.addSheet(sheetTitle);
    sheet.createFreezePane(0, 1);

    final ExportColumn[] cols = new ExportColumn[InvoicesCol.values().length];
    int i = 0;
    for (final InvoicesCol col : InvoicesCol.values()) {
      cols[i++] = new I18nExportColumn(col, col.theTitle, col.width);
    }

    // column property names
    sheet.setColumns(cols);

    final ContentProvider sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat(InvoicesCol.BRUTTO, "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat(InvoicesCol.KORREKTUR, "#,##0.00;[Red]-#,##0.00");
    sheetProvider.putFormat(InvoicesCol.KOST1, "#");
    sheetProvider.putFormat(InvoicesCol.KOST2, "#");
    sheetProvider.putFormat(InvoicesCol.DATE, "dd.MM.yyyy");

    final PropertyMapping mapping = new PropertyMapping();
    for (final KostZuweisungDO zuweisung : list) {
      final AbstractRechnungsPositionDO position;
      final AbstractRechnungDO< ? > rechnung;
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

    }

    // column property names
    sheet.setColumns(cols);

    final ContentProvider sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat(AccountsCol.DATE_OF_LAST_MODIFICATION, "dd.MM.yyyy HH:mm");
    sheetProvider.putFormat(AccountsCol.DATE_OF_CREATION, "dd.MM.yyyy HH:mm");
    sheetProvider.putFormat(AccountsCol.NUMBER, "#");

    final KontoDao kontoDao = Registry.instance().getDao(KontoDao.class);
    final QueryFilter filter = new QueryFilter();
    filter.addOrder(Order.desc("lastUpdate"));
    final List<KontoDO> list = kontoDao.getList(filter);
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

      form.addError("validation.error.nothingToExport");
      return;
    }
    final String filename = "ProjectForge-Kost1Export_" + DateHelper.getDateAsFilenameSuffix(new Date()) + ".xls";
    final ExportWorkbook xls = new ExportWorkbook();
    final ContentProvider contentProvider = new MyXlsContentProvider(xls);
    xls.setContentProvider(contentProvider);
    final ExportSheet sheet = xls.addSheet(PFUserContext.getLocalizedString("fibu.kost1.kost1s"));
    final ExportColumn[] cols = new ExportColumn[] { //
        new I18nExportColumn(Col.KOST, "fibu.kost1", MyXlsContentProvider.LENGTH_KOSTENTRAEGER),
        new I18nExportColumn(Col.DESCRIPTION, "description", MyXlsContentProvider.LENGTH_STD),
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

   */
  public byte[] export(final List<TimesheetDO> list)
  {
    log.info("Exporting timesheet list.");
    final ExportWorkbook xls = new ExportWorkbook();
    final ContentProvider contentProvider = new MyContentProvider(xls);
    // create a default Date format and currency column
    xls.setContentProvider(contentProvider);

    final String sheetTitle = PFUserContext.getLocalizedString("timesheet.timesheets");
    final ExportSheet sheet = xls.addSheet(sheetTitle);
    sheet.createFreezePane(8, 1);

    final ExportColumn[] cols = new ExportColumn[] { //
        new I18nExportColumn(Col.USER, "timesheet.user", MyXlsContentProvider.LENGTH_USER),
        new I18nExportColumn(Col.KUNDE, "fibu.kunde", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.PROJEKT, "fibu.projekt", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.KOST2, "fibu.kost2", MyXlsContentProvider.LENGTH_KOSTENTRAEGER),
        new I18nExportColumn(Col.WEEK_OF_YEAR, "calendar.weekOfYearShortLabel", 4),
        new I18nExportColumn(Col.DAY_OF_WEEK, "calendar.dayOfWeekShortLabel", 4),
        new I18nExportColumn(Col.START_TIME, "timesheet.startTime", MyXlsContentProvider.LENGTH_DATETIME),
        new I18nExportColumn(Col.STOP_TIME, "timesheet.stopTime", MyXlsContentProvider.LENGTH_TIMESTAMP),
        new I18nExportColumn(Col.DURATION, "timesheet.duration", MyXlsContentProvider.LENGTH_DURATION),
        new I18nExportColumn(Col.HOURS, "hours", MyXlsContentProvider.LENGTH_DURATION),
        new I18nExportColumn(Col.LOCATION, "timesheet.location", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.TASK_TITLE, "task.title", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.REFERENCE, "task.reference", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.SHORT_DESCRIPTION, "shortDescription", MyXlsContentProvider.LENGTH_STD),
        new I18nExportColumn(Col.DESCRIPTION, "timesheet.description", MyXlsContentProvider.LENGTH_EXTRA_LONG),
        new I18nExportColumn(Col.TASK_PATH, "task.path", MyXlsContentProvider.LENGTH_EXTRA_LONG),
        new I18nExportColumn(Col.ID, "id", MyXlsContentProvider.LENGTH_ID)};

    // column property names
    sheet.setColumns(cols);

    final ContentProvider sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat(Col.START_TIME, "yyyy-MM-dd HH:mm");
    sheetProvider.putFormat(Col.STOP_TIME, "HH:mm");
    sheetProvider.putFormat(Col.DURATION, "[h]:mm");
    sheetProvider.putFormat(Col.HOURS, "#,##0.00");
    sheetProvider.putFormat(Col.ID, "0");

    final PropertyMapping mapping = new PropertyMapping();
    for (final TimesheetDO timesheet : list) {
      final TaskNode node = taskTree.getTaskNodeById(timesheet.getTaskId());
      final PFUserDO user = userGroupCache.getUser(timesheet.getUserId());
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

    if (CollectionUtils.isEmpty(list) == true) {
      return null;
    }
    log.info("Exporting order list.");
    final ExportWorkbook xls = new ExportWorkbook();
    final ContentProvider contentProvider = new MyContentProvider(xls);
    // create a default Date format and currency column
    xls.setContentProvider(contentProvider);

    ExportColumn[] columns = createOrderColumns();
    String sheetTitle = PFUserContext.getLocalizedString("fibu.auftrag.auftraege");
    ExportSheet sheet = xls.addSheet(sheetTitle);
    ContentProvider sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat(MyXlsContentProvider.FORMAT_CURRENCY, OrderCol.NETSUM, OrderCol.INVOICED, OrderCol.TO_BE_INVOICED);
    sheetProvider.putFormat(DateFormats.getExcelFormatString(DateFormatType.DATE), OrderCol.DATE, OrderCol.ORDER_DATE);
    sheet.createFreezePane(1, 1);
    sheet.setColumns(columns);
    for (final AuftragDO order : list) {
      final PropertyMapping mapping = new PropertyMapping();
      addOrderMapping(mapping, order, params);
      sheet.addRow(mapping.getMapping(), 0);
    }
    sheet.setAutoFilter();
    columns = createPosColumns();
    sheetTitle = PFUserContext.getLocalizedString("fibu.auftrag.positions");
    sheet = xls.addSheet(sheetTitle);
    sheetProvider = sheet.getContentProvider();
    sheetProvider.putFormat(MyXlsContentProvider.FORMAT_CURRENCY, PosCol.NETSUM, PosCol.INVOICED, PosCol.TO_BE_INVOICED);
    sheetProvider.putFormat(DateFormats.getExcelFormatString(DateFormatType.DATE), PosCol.DATE, PosCol.PERIOD_OF_PERFORMANCE_BEGIN,
        PosCol.PERIOD_OF_PERFORMANCE_END);
    sheet.createFreezePane(1, 1);
    sheet.setColumns(columns);
    sheet.setMergedRegion(0, 0, PosCol.PERIOD_OF_PERFORMANCE_BEGIN.ordinal(), PosCol.PERIOD_OF_PERFORMANCE_END.ordinal(),
        PFUserContext.getLocalizedString("fibu.periodOfPerformance"));
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

  public void addAsExcelSheet(final MyExcelExporter exporter, final String sheetTitle)
  {
    final ExportSheet sheet = exporter.addSheet(sheetTitle);
    sheet.createFreezePane(0, 1);
    final ContentProvider sheetProvider = sheet.getContentProvider();

    sheet.addRow();
    sheet.setMergedRegion(0, 0, 1, 3, I18n.getString("plugins.liquidityplanning.entry.expectedDateOfPayment"));
    sheet.setMergedRegion(0, 0, 4, 6, I18n.getString("plugins.liquidityplanning.forecast.dueDate"));

    final ExportColumn[] cols = new ExportColumn[7];
    int colNo = 0;
    I18nExportColumn exportColumn = new I18nExportColumn("date", "date", 10);
    sheetProvider.putFormat(exportColumn, DateFormats.getExcelFormatString(DateFormatType.DATE));
    cols[colNo++] = exportColumn;

    exportColumn = new I18nExportColumn("creditsExpected", "plugins.liquidityplanning.common.credit");
    cols[colNo++] = exportColumn;
    exporter.putCurrencyFormat(sheetProvider, exportColumn);
View Full Code Here

Examples of org.projectforge.excel.ContentProvider

      form.addError("validation.error.nothingToExport");
      return;
    }
    final String filename = "ProjectForge-Kost2Export_" + DateHelper.getDateAsFilenameSuffix(new Date()) + ".xls";
    final ExportWorkbook xls = new ExportWorkbook();
    final ContentProvider contentProvider = new MyXlsContentProvider(xls);
    xls.setContentProvider(contentProvider);
    final ExportSheet sheet = xls.addSheet(PFUserContext.getLocalizedString("fibu.kost2.kost2s"));
    final ExportColumn[] cols = new ExportColumn[] { //
        new I18nExportColumn(Col.KOST, "fibu.kost2", MyXlsContentProvider.LENGTH_KOSTENTRAEGER),
        new I18nExportColumn(Col.ART, "fibu.kost2.art", MyXlsContentProvider.LENGTH_STD),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.