Package de.intranda.commons.chart.results

Examples of de.intranda.commons.chart.results.DataTable


    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    DataTable dtbl = new DataTable(StatisticsMode.getByClassName(
        this.getClass()).getTitle() + " "
        + Helper.getTranslation("_inGB"));

    DataRow dataRow;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out
    for (Object obj : list) {
      dataRow = new DataRow(null);
      //TODO: Don't use arrays
      Object[] objArr = (Object[]) obj;
      try {

        // getting localized time group unit

        //setting row name with date/time extraction based on the group

        dataRow.setName(new Converter(objArr[1]).getString() + "");

        dataRow.addValue(Helper.getTranslation("storageDifference"),
            (new Converter(objArr[0]).getGB()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }

      //finally adding dataRow to DataTable and fetching next row
      dtbl.addDataRow(dataRow);
    }

    // a list of DataTables is expected as return Object, even if there is only one
    // Data Table as it is here in this implementation
    dtbl.setUnitLabel(Helper
        .getTranslation(this.timeGrouping.getSingularTitle()));
    allTables.add(dtbl);
    return allTables;
  }
View Full Code Here


  private DataTable getDataTable() {
    if (this.myDataTable != null && !this.isDirty) {
      return this.myDataTable;
    }

    DataTable tableStepCompleted = getAllSteps(HistoryEventType.stepDone);

    tableStepCompleted.setUnitLabel(Helper.getTranslation(this.timeGrouping.getSingularTitle()));
    tableStepCompleted.setName(Helper.getTranslation("doneSteps"));

    // show in line graph
    tableStepCompleted.setShowableInChart(true);
    tableStepCompleted.setShowableInTable(false);
    tableStepCompleted.setShowableInPieChart(false);
    tableStepCompleted = tableStepCompleted.getDataTableInverted();

    this.myDataTable = tableStepCompleted;
    this.isDirty = false;
    return tableStepCompleted;
  }
View Full Code Here

    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    DataTable dtbl = new DataTable("");

    // if headerRow is set then add it to the DataTable to set columns
    // needs to be removed later
    if (headerRow != null) {
      dtbl.addDataRow(headerRow);
    }

    DataRow dataRow = null;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out

    // checks if intervall has changed which then triggers the start for a
    // new row
    // intervall here is the timeGroup Expression (e.g. "2006/05" or
    // "2006-10-05")
    String observeIntervall = "";

    for (Object obj : list) {
      Object[] objArr = (Object[]) obj;
      String stepName = new Converter(objArr[1]).getString();
      if (isInWorkFlow(stepName)) {
        try {
          String intervall = new Converter(objArr[2]).getString();

          if (!observeIntervall.equals(intervall)) {
            observeIntervall = intervall;

            // row cannot be added before it is filled because the
            // add process triggers
            // a testing for header alignement -- this is where we
            // add it after iterating it first
            if (dataRow != null) {
              dtbl.addDataRow(dataRow);
            }

            // setting row name with localized time group and the
            // date/time extraction based on the group
            dataRow = new DataRow(intervall);
          }
          Double count = new Converter(objArr[0]).getDouble();
          dataRow.addValue(stepName, count);

        } catch (Exception e) {
          dataRow.addValue(e.getMessage(), new Double(0));
        }
      }
    }
    // to add also the last row
    if (dataRow != null) {
      dtbl.addDataRow(dataRow);
    }

    // now removing headerRow
    if (headerRow != null) {
      dtbl.removeDataRow(headerRow);
    }

    return dtbl;
  }
View Full Code Here

   * @returns DataTable generated from the selected step names and the
   *          selected reference curve
   */
  public DataTable getSelectedTable() {
    getDataTable();
    DataTable returnTable = new DataTable(this.terminatingStep);
    returnTable.addDataRow(getRefRow());
    for (String stepTitle : this.selectedSteps) {
      returnTable.addDataRow(getDataRow(stepTitle));
    }
    // rest this, so that unit knows that no changes were made in between
    // calls
    return returnTable;
  }
View Full Code Here

      crit.createCriteria("prozess", "proz");
      crit.add(Restrictions.in("proz.id", originalFilter.getIDList()));
    }
    StringBuilder title = new StringBuilder(StatisticsMode.getByClassName(this.getClass()).getTitle());

    DataTable dtbl = new DataTable(title.toString());
    dtbl.setShowableInPieChart(true);
    DataRow dRow = new DataRow(Helper.getTranslation("count"));

    for (Object obj : crit.list()) {
      Schritt step = (Schritt) obj;
      String kurztitel = (step.getTitel().length() > 60 ? step.getTitel().substring(0, 60) + "..." : step.getTitel());
      dRow.addValue(kurztitel, dRow.getValue(kurztitel) + 1);
    }

    dtbl.addDataRow(dRow);
    List<DataTable> allTables = new ArrayList<DataTable>();

    dtbl.setUnitLabel(Helper.getTranslation("arbeitsschritt"));
    allTables.add(dtbl);
    return allTables;
  }
View Full Code Here

    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    DataTable dtbl = new DataTable(StatisticsMode.getByClassName(
        this.getClass()).getTitle()
        + Helper.getTranslation("_(number)"));

    DataRow dataRow;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out
    for (Object obj : list) {
      dataRow = new DataRow(null);
      Object[] objArr = (Object[]) obj;
      try {

        // getting localized time group unit

        //setting row name with date/time extraction based on the group

        dataRow.setName(new Converter(objArr[1]).getString() + "");

        dataRow.addValue(Helper.getTranslation("Corrections/Errors"),
            (new Converter(objArr[0]).getDouble()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }

      //finally adding dataRow to DataTable and fetching next row
      dtbl.addDataRow(dataRow);
    }

    // a list of DataTables is expected as return Object, even if there is only one
    // Data Table as it is here in this implementation
    dtbl.setUnitLabel(Helper.getTranslation(getTimeUnit()
        .getSingularTitle()));
    allTables.add(dtbl);
    return allTables;
  }
View Full Code Here

    crit.setProjection(proj);

    StringBuilder title = new StringBuilder(StatisticsMode.getByClassName(
        this.getClass()).getTitle());

    DataTable dtbl = new DataTable(title.toString());
    dtbl.setShowableInPieChart(true);
    DataRow dRow = new DataRow(Helper.getTranslation("count"));

    for (Object obj : crit.list()) {
      Object[] objArr = (Object[]) obj;
      dRow.addValue(new Converter(objArr[1]).getString(), new Converter(
          new Converter(objArr[0]).getInteger()).getDouble());
    }
    dtbl.addDataRow(dRow);

    List<DataTable> allTables = new ArrayList<DataTable>();

    dtbl.setUnitLabel(Helper.getTranslation("project"));
    allTables.add(dtbl);
    return allTables;
  }
View Full Code Here

     */

    // a list of DataTables is expected as return Object, even if there is
    // only one
    // Data Table as it is here in this implementation
    DataTable tableStepOpenAndDone = getAllSteps(HistoryEventType.stepOpen);
    tableStepOpenAndDone.setUnitLabel(Helper.getTranslation(this.timeGrouping.getSingularTitle()));
    tableStepOpenAndDone.setName(StatisticsMode.getByClassName(this.getClass()).getTitle() + " (" + Helper.getTranslation("openSteps") + ")");
    tableStepOpenAndDone = tableStepOpenAndDone.getDataTableInverted();
    tableStepOpenAndDone = tableStepOpenAndDone.getDataTableInverted();
    tableStepOpenAndDone.setShowableInChart(false);
    allTables.add(tableStepOpenAndDone);

    tableStepOpenAndDone = getAllSteps(HistoryEventType.stepDone);
    tableStepOpenAndDone.setUnitLabel(Helper.getTranslation(this.timeGrouping.getSingularTitle()));
    tableStepOpenAndDone.setName(StatisticsMode.getByClassName(this.getClass()).getTitle() + " (" + Helper.getTranslation("doneSteps") + ")");
    tableStepOpenAndDone.setShowableInChart(false);
    tableStepOpenAndDone = tableStepOpenAndDone.getDataTableInverted();
    tableStepOpenAndDone = tableStepOpenAndDone.getDataTableInverted();
    allTables.add(tableStepOpenAndDone);

    /*
     * ======================================================================
     * ==============
     */

    // what do we do here?
    // okay ... first we find out how many steps the selected set has
    // finding lowest step and highest step (no step name discrimination)
    Integer uBound;
    Integer uBoundOpen = getMaxStepCount(HistoryEventType.stepOpen);
    Integer uBoundDone = getMaxStepCount(HistoryEventType.stepDone);
    if (uBoundOpen < uBoundDone) {
      uBound = uBoundDone;
    } else {
      uBound = uBoundOpen;
    }

    Integer lBound;
    Integer lBoundOpen = getMinStepCount(HistoryEventType.stepOpen);
    Integer lBoundDone = getMinStepCount(HistoryEventType.stepDone);

    if (lBoundOpen < lBoundDone) {
      lBound = lBoundDone;
    } else {
      lBound = lBoundOpen;
    }

    // then for each step we get both the open and the done count within the
    // selected intervalls and merge it within one table
    for (Integer i = lBound; i <= uBound; i++) {

      DataTable tableStepOpen;
      tableStepOpen = getSpecificSteps(i, HistoryEventType.stepOpen);
     
      tableStepOpen.setShowableInTable(true);

      DataTable tableStepDone;
      tableStepDone = getSpecificSteps(i, HistoryEventType.stepDone);
     
      tableStepDone.setShowableInTable(true);

      // to merge we just take each table and dump the entire content in a
      // row for the open step
      DataRow rowOpenSteps = new DataRow(Helper.getTranslation("openSteps") + " " + i.toString());
      for (DataRow dtr : tableStepOpen.getDataRows()) {
        rowOpenSteps.addValue(dtr.getName(), dtr.getValue(0));
      }

      // adding the first row
      String title = "";
      if (tableStepOpen.getName().length() > 0) {
        title = tableStepOpen.getName();
      } else {
        title = tableStepDone.getName();
      }

      tableStepOpenAndDone = new DataTable(Helper.getTranslation("throughput") + " " + Helper.getTranslation("steps") + " " + title);
      tableStepOpenAndDone.addDataRow(rowOpenSteps);

      // row for the done step
      rowOpenSteps = new DataRow(Helper.getTranslation("doneSteps") + " " + i.toString());
      for (DataRow dtr : tableStepDone.getDataRows()) {
        rowOpenSteps.addValue(dtr.getName(), dtr.getValue(0));
      }

      // adding that row
      tableStepOpenAndDone.addDataRow(rowOpenSteps);
View Full Code Here

    query.addScalar("intervall", StandardBasicTypes.STRING);

    @SuppressWarnings("rawtypes")
    List list = query.list();

    DataTable dtbl = new DataTable("");

    // if headerRow is set then add it to the DataTable to set columns
    // needs to be removed later
    if (headerRow != null) {
      dtbl.addDataRow(headerRow);
    }

    DataRow dataRow = null;

    // each data row comes out as an Array of Objects
    // the only way to extract the data is by knowing
    // in which order they come out

    // checks if intervall has changed which then triggers the start for a
    // new row
    // intervall here is the timeGroup Expression (e.g. "2006/05" or
    // "2006-10-05")
    String observeIntervall = "";

    for (Object obj : list) {
      Object[] objArr = (Object[]) obj;
      try {
        // objArr[3]
        if (!observeIntervall.equals(new Converter(objArr[3]).getString())) {
          observeIntervall = new Converter(objArr[3]).getString();

          // row cannot be added before it is filled because the add
          // process triggers
          // a testing for header alignement -- this is where we add
          // it after iterating it first
          if (dataRow != null) {
            dtbl.addDataRow(dataRow);
          }

          dataRow = new DataRow(null);
          // setting row name with localized time group and the
          // date/time extraction based on the group
          dataRow.setName(new Converter(objArr[3]).getString() + "");
        }
        dataRow.addValue(
            new Converter(new Converter(objArr[2]).getInteger()).getString() + " (" + new Converter(objArr[1]).getString() + ")",
            (new Converter(objArr[0]).getDouble()));

      } catch (Exception e) {
        dataRow.addValue(e.getMessage(), new Double(0));
      }
    }
    // to add the last row
    if (dataRow != null) {
      dtbl.addDataRow(dataRow);
    }

    // now removing headerRow
    if (headerRow != null) {
      dtbl.removeDataRow(headerRow);
   
    }

    return dtbl;
  }
View Full Code Here

      crit.createCriteria("prozess", "proz");
      crit.add(Restrictions.in("proz.id", originalFilter.getIDList()));
    }
    StringBuilder title = new StringBuilder(StatisticsMode.getByClassName(this.getClass()).getTitle());

    DataTable dtbl = new DataTable(title.toString());
    dtbl.setShowableInPieChart(true);
    DataRow dRow = new DataRow(Helper.getTranslation("count"));

    for (Object obj : crit.list()) {
      Schritt step = (Schritt) obj;
      for (Benutzergruppe group : step.getBenutzergruppenList()) {
        dRow.addValue(group.getTitel(), dRow.getValue(group.getTitel()) + 1);
      }
    }

    dtbl.addDataRow(dRow);
    List<DataTable> allTables = new ArrayList<DataTable>();

    dtbl.setUnitLabel(Helper.getTranslation("benutzergruppe"));
    allTables.add(dtbl);
    return allTables;
  }
View Full Code Here

TOP

Related Classes of de.intranda.commons.chart.results.DataTable

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.