Package com.centraview.report.valueobject

Examples of com.centraview.report.valueobject.ReportContentString


   */

  public void processReport(int i,Vector res,ArrayList result){
    int size = 0;
    int rowSize = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    int totalCount = 0;

    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;

    switch (i) {
      case 0:
           size = res.size();

           // set header line
           result.add(getTableHeader());

           for (int j = 0; j<size; ++j) {

               row = (ArrayList)res.get(j);
               contentRow = new ReportContentString();
               outputRow = new ArrayList();
               rowSize = row.size();
               for (int k = 0; k < rowSize; ++k) {

                   if ( k < colNumber ) {

                     column = row.get(k);

                     element = outputObject(column, getColumnName(k));
                     if ( cols[k].isVisible() ) {
                         outputRow.add(element);
                     }

                     if ( k == 2 ) {
                        // calculate total activities
                        try {
                          totalCount += Integer.parseInt(element.getDisplayString());
                        }
                        catch (Exception e) {}
                     }
                   }
               }

               contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
               contentRow.setReportRow(outputRow);
               result.add(contentRow);
           }

           contentRow = new ReportContentString();
           outputRow = new ArrayList();
           outputRow.add(outputObject("Total Tickets",getColumnName(1)));
           outputRow.add(outputObject(new Integer(totalCount), getColumnName(1)));
           contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
           contentRow.setReportRow(outputRow);
           result.add(contentRow);

           // add end table line
           result.add(getTableEnd());
    }
View Full Code Here


     *
     */
    public void processReport(int i, Vector res, ArrayList result) {
        int size = 0;
        int rowSize = 0;
        ReportContentString contentRow = null;
        ArrayList row = null;
        ArrayList outputRow = null;
        Object column = null;
        float totAmount = 0; // sum of report total amount
        float forAmount = 0; // sum of report forecased amount

        ReportColumn[] cols = getColumns();
        int colNumber = cols.length;

        switch (i) {
            case 0:
                size = res.size();

                // set header line
                result.add(getTableHeader());

                for (int j = 0; j < size; ++j) {

                    row = (ArrayList) res.get(j);
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();
                    rowSize = row.size();
                    for (int k = 0; k < rowSize; ++k) {

                        if ( k < colNumber ) {

                            column = row.get(k);

                            if (k == 3) {
                                // calculate total amount
                                try {
                                    totAmount +=
                                        Float.parseFloat(column.toString());
                                }
                                catch (Exception e) {}
                            }
                            else if (k == 4) {
                                // calculate forecast amount
                                try {
                                    forAmount +=
                                        Float.parseFloat(column.toString());
                                }
                                catch (Exception e) {}
                            }

                            if (cols[k].isVisible()) {
                                outputRow.add(outputObject(column, getColumnName(k)));
                            }
                        }
                    }

                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // add sum of amounts line
                if (size > 0) {
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();

                    // two empty columns
                    outputRow.add(outputObject("", getColumnName(1)));

                    outputRow.add(outputObject("", getColumnName(2)));

                    // total amount sum
                    outputRow.add(outputObject(new Float(totAmount),getColumnName(3)));

                    // forecast amount sum
                    outputRow.add(outputObject(new Float(forAmount),getColumnName(4)));

                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // add end table line
                result.add(getTableEnd());
View Full Code Here

     */
    public void processReport(int i, Vector res, ArrayList result) {

        int size = 0;
        int rowSize = 0;
        ReportContentString contentRow = null;
        ArrayList row = null;
        ArrayList outputRow = null;
        Object column = null;
        Object prevBindObject = null;
        Object currBindObject = null;
        ListElementMember element = null;
        int leaderCount = 0;
        String previousLeaderValue = null;
        String currentLeaderValue = "";
        int leaderHeaderIndex = 0;

        ReportColumn[] cols = getColumns();
        int colNumber = cols.length;

        float currTotal1Amount = 0;
        float currTotal2Amount = 0;
        float currTotal3Amount = 0;
        float total1Amount = 0;
        float total2Amount = 0;
        float total3Amount = 0;
        float repTotal1Amount = 0;
        float repTotal2Amount = 0;
        float repTotal3Amount = 0;
        String prevBindValue = null;
        String currBindValue = "";

        switch (i) {
            case 0:
                size = res.size();

                // set leader line index
                leaderHeaderIndex = result.size();

                // add table header line for new leader
                result.add(getTableHeader());

                for (int j = 0; j < size; ++j) {
                    row = (ArrayList) res.get(j);
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();
                    rowSize = row.size();
                    for (int k = 0; k < rowSize; ++k) {
                        if ( k < colNumber ) {
                            column = row.get(k);

                            if (k == 4) {
                                // quantiy
                               column = new String(column.toString());
                            }

                            element = outputObject(column, getColumnName(k));

                            if ( cols[k].isVisible() ) {
                                outputRow.add(element);
                            }

                            if (k == getLeader()) {
                                // get leader column value
                                currentLeaderValue = element.getDisplayString();
                            }
                            if (k == leaderBind) {
                                // save leader object for binding
                                currBindObject = column;
                                currBindValue = element.getDisplayString();
                            }

                            if (k == 6) {
                                // total amount sum 1
                                if (column instanceof Float) {
                                    currTotal1Amount = ( (Float) column).floatValue();
                                }
                                else if (column instanceof Double) {
                                    currTotal1Amount = ( (Double) column).floatValue();
                                }

                            }
                            else if (k == 8) {
                                // total amount sum 2
                                if (column instanceof Float) {
                                    currTotal2Amount = ( (Float) column).floatValue();
                                }
                                else if (column instanceof Double) {
                                    currTotal2Amount = ( (Double) column).floatValue();
                                }
                            }
                            else if (k == 9) {
                                // total amount sum 3
                                if (column instanceof Float) {
                                    currTotal3Amount = ( (Float) column).floatValue();
                                }
                                else if (column instanceof Double) {
                                    currTotal3Amount = ( (Double) column).floatValue();
                                }
                            }

                        }

                    }

                    if (prevBindValue == null ||
                       !prevBindValue.endsWith(currBindValue)) {

                        // leader changed, now we need form header for

                        if (leaderCount > 0) {
                            // add header line for previous leader(leader name and Record Count)
                            result.add(leaderHeaderIndex,
                                       getLeaderHeader(previousLeaderValue));

                            // add total amount line
                            result.add(getTotals(total1Amount, total2Amount, total3Amount,false));

                            // add end table line
                            result.add(getTableEnd());

                            // add table header line for new leader
                            result.add(getTableHeader());

                        }

                        previousLeaderValue = currentLeaderValue; // set new leader
                        prevBindObject = currBindObject; // set new bind object
                        prevBindValue = currBindValue; // set new bind value

                        leaderCount = 0; // reset leaderCount
                        leaderHeaderIndex = result.size() - 1; // set new header index

                        total1Amount = 0;
                        total2Amount = 0;
                        total3Amount = 0;
                    }
                    ++leaderCount;

                    total1Amount += currTotal1Amount;
                    repTotal1Amount += currTotal1Amount;
                    total2Amount += currTotal2Amount;
                    repTotal2Amount += currTotal2Amount;
                    total3Amount += currTotal3Amount;
                    repTotal3Amount += currTotal3Amount;

                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // actions for last leader
                if (size > 0) {
View Full Code Here

     * @param leaderValue String
     * @return ReportContentString
     *
     */
    private ReportContentString getLeaderHeader(String leaderValue) {
        ReportContentString headerRow = new ReportContentString();
        ArrayList header = new ArrayList();
        headerRow.setShowType(ReportContentString.SHOW_TYPE_LINE);

        header.add(new StringMember(getColumnName(getLeader()),
                                    getColumnName(getLeader()) + ":",
                                    'r', "", 'T', false));

        header.add(new StringMember(getColumnName(getLeader()),
                                    leaderValue, 'r', "",'T', false));

        headerRow.setReportRow(header);

        return headerRow;
    }
View Full Code Here

     */
    private ReportContentString getTotals(float total1Amount,
                                          float total2Amount,
                                          float total3Amount,
                                          boolean report) {
        ReportContentString headerRow = new ReportContentString();
        ArrayList header = new ArrayList();
        headerRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
        ReportColumn[] colName = getColumns();

         for (int i = 0; i < 6; ++i) {

            if (colName[i].isVisible()) {

                if ( i == 1 ) {

                    header.add(new StringMember("Report Total",
                                                (report)?"Report Totals":"Totals",
                                                'r', "", 'T', false));
                } else {

                    header.add(new StringMember("", "", 'r', "", 'T', false));
                }
            }
        }

        header.add(new MoneyMember("Total1 Amount", new Float(total1Amount),
                                   'r', "", 'T', false, 10));

        header.add(new StringMember("", "", 'r', "", 'T', false));

        header.add(new MoneyMember("Total2 Amount", new Float(total2Amount),
                                   'r', "", 'T', false, 10));

        header.add(new MoneyMember("Total3 Amount", new Float(total3Amount),
                                   'r', "", 'T', false, 10));

        headerRow.setReportRow(header);

        return headerRow;
    }
View Full Code Here

   */

  public void processReport(int i,Vector res,ArrayList result) {
    int size = 0;
    int rowSize = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    int totalCount = 0;

    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;

    switch (i) {
      case 0:
           size = res.size();

           // set header line
           result.add(getTableHeader());

           for (int j = 0; j<size; ++j) {

               row = (ArrayList)res.get(j);
               contentRow = new ReportContentString();
               outputRow = new ArrayList();
               rowSize = row.size();
               for (int k = 0; k < rowSize; ++k) {

                   if ( k < colNumber ) {

                     column = row.get(k);

                     element = outputObject(column, getColumnName(k));
                     if ( cols[k].isVisible() ) {
                         outputRow.add(element);
                     }

                     if ( k == 2 ) {
                        // calculate total activities
                        try {
                          totalCount += Integer.parseInt(element.getDisplayString());
                        }
                        catch (Exception e) {}
                     }
                   }
               }

               contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
               contentRow.setReportRow(outputRow);
               result.add(contentRow);
           }
           // add Total activities line
           contentRow = new ReportContentString();
           outputRow = new ArrayList();
           outputRow.add(outputObject("Total Activities",getColumnName(1)));
           outputRow.add(outputObject(new Integer(totalCount), getColumnName(1)));
           contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
           contentRow.setReportRow(outputRow);
           result.add(contentRow);
           // add end table line
           result.add(getTableEnd());
    }
  }
View Full Code Here

     */
    public void processReport(int i, Vector res, ArrayList result) {

        int size = 0;
        int rowSize = 0;
        ReportContentString contentRow = null;
        ArrayList row = null;
        ArrayList outputRow = null;
        Object column = null;
        ListElementMember element = null;
        int leaderCount = 0;
        String previousLeaderValue = null;
        String currentLeaderValue = "";
        int leaderHeaderIndex = 0;

        ReportColumn[] cols = getColumns();
        int colNumber = cols.length;

        switch (i) {
            case 0:
                size = res.size();

                // set leader line index
                leaderHeaderIndex = result.size();

                // add table header line for new leader
                result.add(getTableHeader());

                for (int j = 0; j < size; ++j) {
                    row = (ArrayList) res.get(j);
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();
                    rowSize = row.size();
                    for (int k = 0; k < rowSize; ++k) {
                        if ( k < colNumber ) {
                            column = row.get(k);
                            element = outputObject(column, getColumnName(k));

                            // Id value
                            if (k == getLeader()) {
                                // get leader column value
                                currentLeaderValue = element.getDisplayString();
                            }

                            if ( cols[k].isVisible() ) {
                                outputRow.add(element);
                            }
                        }
                    }
                    if (previousLeaderValue == null ||
                        !previousLeaderValue.equals(currentLeaderValue)) {

                        // leader changed, now we need form header for

                        if (leaderCount > 0) {
                            // add header line for previous leader(leader name and Record Count)
                            result.add(leaderHeaderIndex,
                                       getLeaderHeader(previousLeaderValue));

                            // add end table line
                            result.add(getTableEnd());

                            // add table header line for new leader
                            result.add(getTableHeader());

                        }

                        previousLeaderValue = currentLeaderValue; // set new leader

                        leaderCount = 0; // reset leaderCount
                        leaderHeaderIndex = result.size() - 1; // set new header index

                    }
                    ++leaderCount;

                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // add end table line
                result.add(getTableEnd());
View Full Code Here

     * @return ReportContentString
     *
     */

    private ReportContentString getLeaderHeader(String leaderValue) {
        ReportContentString headerRow = new ReportContentString();
        ArrayList header = new ArrayList();
        headerRow.setShowType(ReportContentString.SHOW_TYPE_LINE);

        header.add(new StringMember(getColumnName(getLeader()),
                                    getColumnName(getLeader()) + ":",
                                    'r', "", 'T', false));

        header.add(new StringMember(getColumnName(getLeader()),
                                    leaderValue, 'r', "", 'T', false));

        headerRow.setReportRow(header);

        return headerRow;
    }
View Full Code Here

   */

  public void processReport(int i,Vector res,ArrayList result){
    int size = 0;
    int rowSize = 0;
    ReportContentString contentRow = null;
    ArrayList row = null;
    ArrayList outputRow = null;
    Object column = null;
    ListElementMember element = null;
    int totalCount = 0;

    ReportColumn[] cols = getColumns();
    int colNumber = cols.length;

    switch (i) {
      case 0:
           size = res.size();

           // set header line
           result.add(getTableHeader());

           for (int j = 0; j<size; ++j) {

               row = (ArrayList)res.get(j);
               contentRow = new ReportContentString();
               outputRow = new ArrayList();
               rowSize = row.size();
               for (int k = 0; k < rowSize; ++k) {

                   if ( k < colNumber ) {

                     column = row.get(k);

                     element = outputObject(column, getColumnName(k));
                     if ( cols[k].isVisible() ) {
                         outputRow.add(element);
                     }

                     if ( k == 2 ) {
                        // calculate total activities
                        try {
                          totalCount += Integer.parseInt(element.getDisplayString());
                        }
                        catch (Exception e) {}
                     }
                   }
               }

               contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
               contentRow.setReportRow(outputRow);
               result.add(contentRow);
           }
           // add Total activities line
           contentRow = new ReportContentString();
           outputRow = new ArrayList();
           outputRow.add(outputObject("Total Activities",getColumnName(1)));
           outputRow.add(outputObject(new Integer(totalCount), getColumnName(1)));
           contentRow.setShowType(ReportContentString.SHOW_TYPE_TABLE_ROW);
           contentRow.setReportRow(outputRow);
           result.add(contentRow);
           // add end table line
           result.add(getTableEnd());
    }
  }
View Full Code Here

     */

    public void processReport(int i, Vector res, ArrayList result) {
        int size = 0;
        int rowSize = 0;
        ReportContentString contentRow = null;
        ArrayList row = null;
        ArrayList outputRow = null;
        Object column = null;
        ListElementMember element = null;
        int leaderCount = 0;
        String previousLeaderValue = null;
        String currentLeaderValue = "";
        int leaderHeaderIndex = 0;

        // current row Amount
        float currAmount = 0;

        // current leader total Amount
        float totalAmount = 0;

        // report total Amount
        float repAmount = 0;

        ReportColumn[] cols = getColumns();
        int colNumber = cols.length;

        switch (i) {
            case 0:
                size = res.size();

                // set leader line index
                leaderHeaderIndex = result.size();

                // set header line
                result.add(getTableHeader());

                for (int j = 0; j < size; ++j) {
                    row = (ArrayList) res.get(j);
                    contentRow = new ReportContentString();
                    outputRow = new ArrayList();
                    rowSize = row.size();
                    for (int k = 0; k < rowSize; ++k) {
                        if ( k < colNumber ) {
                            column = row.get(k);
                            element = outputObject(column, getColumnName(k));

                            if ( cols[k].isVisible() ) {
                                outputRow.add(element);
                            }

                            if ( k == getLeader() ) {
                                // get leader column value
                                currentLeaderValue = element.getDisplayString();
                            }
                            if ( k == 4 ) {
                                // total amount
                                if (column instanceof Float) {
                                    currAmount = ( (Float) column).floatValue();
                                }
                                else if (column  instanceof Double) {
                                    currAmount = ( (Double) column).floatValue();
                                }
                            }

                        }
                   }
                   if (previousLeaderValue == null ||
                       !previousLeaderValue.equals(currentLeaderValue)) {
                        // leader changed, now we need form header for

                        if (leaderCount > 0) {
                            // add header line for previous leader(leader name and Record Count)
                            result.add(leaderHeaderIndex,
                                       getLeaderHeader(previousLeaderValue));

                            // add total amount line
                            result.add(getTotals(totalAmount,false));

                            // add end table line
                            result.add(getTableEnd());
                            // add table header line for new leader
                            result.add(getTableHeader());

                        }
                        previousLeaderValue = currentLeaderValue; // set new leader

                        leaderCount = 0; // reset leaderCount
                        leaderHeaderIndex = result.size() - 1; // set new header index

                        totalAmount = 0;
                    }
                    ++leaderCount;

                    totalAmount += currAmount;
                    repAmount += currAmount;

                    contentRow.setShowType(ReportContentString.
                                           SHOW_TYPE_TABLE_ROW);
                    contentRow.setReportRow(outputRow);
                    result.add(contentRow);
                }

                // add header line for last leader
                if (size > 0) {
View Full Code Here

TOP

Related Classes of com.centraview.report.valueobject.ReportContentString

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.