Examples of PivotPanel


Examples of ro.fortsoft.wicket.pivot.web.PivotPanel

    PivotDataSource pivotDataSource = PivotDataSourceHandler.getPivotDataSource();
    System.out.println("pivotDataSource = " + pivotDataSource);
//    System.out.println("fieldCount = " + pivotDataSource.getFieldCount());
//    System.out.println("rowCount = " + pivotDataSource.getRowCount());

    PivotPanel pivotPanel = new PivotPanel("pivot", pivotDataSource) {

      private static final long serialVersionUID = 1L;

      @Override
      protected PivotModel createPivotModel(PivotDataSource pivotDataSource) {
        PivotModel pivotModel = super.createPivotModel(pivotDataSource);

        // add some fields on some area
        pivotModel.getField("REGION").setArea(PivotField.Area.ROW);
        pivotModel.getField("SALESMAN").setArea(PivotField.Area.ROW).setAreaIndex(1);
        pivotModel.getField("YEAR").setArea(PivotField.Area.COLUMN);
        pivotModel.getField("MONTH").setArea(PivotField.Area.COLUMN).setAreaIndex(1);
        pivotModel.getField("SALES").setArea(PivotField.Area.DATA);

        // set an aggregator for a data pivot field
//        pivotModel.getField("SALES").setAggregator(new Aggregator.Count());
       
        // set a custom converter for a pivot field
        /*
        pivotModel.getField("SALES").setConverter(new DoubleConverter() {

          private static final long serialVersionUID = 1L;

          @Override
          public NumberFormat getNumberFormat(Locale locale) {
            NumberFormat format = super.getNumberFormat(locale);
            format.setMinimumFractionDigits(2);
           
            return format;
          }
         
        });
        */
       
        // show grand totals
        pivotModel.setShowGrandTotalForColumn(true);
        pivotModel.setShowGrandTotalForRow(true);

        return pivotModel;
      }

    };
    pivotPanel.setPivotConfigStorage(new PivotConfigSessionStorage());
    add(pivotPanel);
  }
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.