Class SummaryTable
- All Implemented Interfaces:
EditableTableModel
,PopupActivationListener
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModel
SummaryTable objects can be created using the constructor or
or the static createSummaryTable(ca.spatial.table.AttributeStore,java.lang.String,java.lang.String,java.lang.String,int,java.util.Observer)
method. When using the
constructor a summary table 'template' is created that does not
yet contain any sampled data. This template is suitable to pass to
a report constructor where it will be used to collect data on
demand when the report is materialized. Use the getSnapshot(boolean)
method in order to get a summarized data table from the template/
When the createSummaryTable(ca.spatial.table.AttributeStore, java.lang.String, java.lang.String, java.lang.String, int, java.util.Observer)
method is used a snapshot will
be taken of the state of the table when the summary is run. Use the
SummaryTable.Snapshot.getParent()
method to retrieve the template from
the snaphot.
For example, the following will capture a summary table by LMU and planning period. The report will format the minimum harvest age value and present this as a table.
at = new SummaryTable(control.getBlockTable(),
"LMU", // The expression to categorize the data
"TREATMENTAGE", // Summarize TREATMENTAGE
"CURRENTTREATMENT ne ''", // Select harvest activities
null, // Select all periods
);
// Take a snapshot and show the resulting data cube
at.getSnapshot(false).showCube(true);
categories5 = new Comparable[] {
"A",
"CH",
"CP",
"HE",
"HO",
"LI",
"MI",
"N",
"SA",
"SOL",
"W"};
report1 = new PeriodCategoryReport("minHarvAgeLMU", // filename
"Minimum harvest age by LMU", // title
"Age", // units
attributeStore4, // attributeStore
"", // reselectExpression
Horizon.activeList, // periods
false, // annualize
"", // HTMLText
false, // percent
"Minimum", // valueExpression
"Category", // categoryExpression
categories5 // categories
);
report1.setNoChart(true);
reportWriter.addReport(report1);
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
-
Constructor Summary
ConstructorsConstructorDescriptionSummaryTable(AttributeStore as, String cat, String val, String select, int period)
Create a summary table for the values from a single planning period.SummaryTable(AttributeStore as, String cat, String val, String select, int[] periods)
Create a summary table for the values from a list of planning periods. -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeStore
createSummaryTable(AttributeStore as, String cat, String val, String select, int[] periods, Observer progress)
Create a summary table for the selected planning peiords.static AttributeStore
createSummaryTable(AttributeStore as, String cat, String val, String select, int period, Observer progress)
Create a summary table for the values from a single planning period.Return the parent data source from within a caching layer.int[]
getSnapshot(boolean useSelected)
Get a snapshot of this summary definition.getSnapshot(boolean useSelected, Observer progress)
Get a snapshot of this summary definition.getValue()
Methods inherited from class ca.spatial.table.RamAttributeStore
addRow, addRow, addRows, clearAllRows, createSummaryTable, getCache, getPeriodCount, getRowCount, getValueAt, getYearForPeriod, insertRow, insertRows, moveRow, removeRow, setValueAt
Methods inherited from class ca.spatial.table.AttributeStore
absoluteFile, absoluteFile, absolutePath, absolutePath, addCellEditors, addMenuItems, addPopupActivationListener, addRelate, addRelate, addTableModelListener, addToGlobalStoreList, allowsEditing, booleanValue, booleanValue, buildIndex, calculate, calculateField, calculateField, canIndex, changeSelection, clearSelection, close, compareTo, decodeCharset, doubleValue, doubleValue, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportDBF, exportDBF, exportDBF, exportDBF, exportDBF, findColumn, findColumn, findSimilarColumnNames, getAttributeFormat, getCachingLayer, getCachingLayer, getCanonicalName, getColumnClass, getColumnCount, getColumnName, getColumnNames, getContextPeriods, getCwd, getEditMode, getFullColumnName, getListSelectionModel, getMinMax, getMinMax, getMinMax, getMinMax, getMinMax, getOpenStore, getOpenStore, getOpenStore, getOpenStores, getPeriod, getPeriodWidth, getRowNodeRemap, getSelectedRowCount, getSelection, getSelection, getSelection, getShortName, getStoreByShortName, getStoreByTitle, getSynchronizer, getTableName, getTableSpec, getTitle, getValueAt, hasIndex, identifyRecords, integerValue, integerValue, isCellEditable, isSelectedIndex, isSelectionEmpty, listify, listValue, listValue, lookupRow, makeLu, maybePopup, notifyPopupActivationListeners, openOrReuse, openOrReuse, queryTable, queryTable, quoteIfRequired, relativePath, removeFromGlobalStoreList, removePopupActivationListener, removeTableModelListener, select, select, selectAdd, selectFrom, selectNew, setCwd, setCwd, setEditMode, setListSelectionModel, setPeriod, setRowNodeRemap, setShortName, setTableSpec, setTitle, setValueAt, showCube, showTable, toString, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, valueChanged
Methods inherited from class javax.swing.table.AbstractTableModel
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getValueAt, isCellEditable, removeTableModelListener, setValueAt
-
Constructor Details
-
SummaryTable
public SummaryTable(AttributeStore as, String cat, String val, String select, int period) throws ExceptionCreate a summary table for the values from a single planning period. The summary table will have one row for each unique value of the category expression. The row will contain the category expression and the sum of the value expression for each matching record.This constructor will create a SummaryTable definition but without the results. In order to capture the results obtain a snapshot using the
getSnapshot(boolean)
method. In order to automatically get a snapshot for the current values use one of thecreateSummaryTable(ca.spatial.table.AttributeStore, java.lang.String, java.lang.String, java.lang.String, int, java.util.Observer)
methods.- Parameters:
as
- The input attribute store to be summarizedcat
- The category expression. The output table will have one row for each unique value of the catgory expression.val
- The value expression. The output table will sum the value expression for each unique category.period
- The period to summarize- Throws:
Exception
-
SummaryTable
public SummaryTable(AttributeStore as, String cat, String val, String select, int[] periods) throws ExceptionCreate a summary table for the values from a list of planning periods. The summary table will have one row for each unique value of the category expression. The row will contain the category expression and the sum of the value expression for each matching record.This constructor will create a SummaryTable definition but without the results. In order to capture the results obtain a snapshot using the
getSnapshot(boolean)
method. In order to automatically get a snapshot for the current values use one of thecreateSummaryTable(ca.spatial.table.AttributeStore, java.lang.String, java.lang.String, java.lang.String, int, java.util.Observer)
methods.- Parameters:
as
- The input attribute store to be summarizedcat
- The category expression. The output table will have one row for each unique value of the catgory expression.val
- The value expression. The output table will sum the value expression for each unique category.periods
- The list of periods to summarize, or null to summarize all periods.- Throws:
Exception
-
-
Method Details
-
getParent
-
getCacheParent
Description copied from class:AttributeStore
Return the parent data source from within a caching layer. In case the data source is not being cached then this will simply return itself.- Overrides:
getCacheParent
in classAttributeStore
-
getCategory
-
getValue
-
getReselect
-
getPeriods
public int[] getPeriods() -
createSummaryTable
public static AttributeStore createSummaryTable(AttributeStore as, String cat, String val, String select, int period, Observer progress) throws ExceptionCreate a summary table for the values from a single planning period. The summary table will have one row for each unique value of the category expression. The row will contain the category expression and the sum of the value expression for each matching record.- Parameters:
as
- The input attribute store to be summarizedcat
- The category expression. The output table will have one row for each unique value of the catgory expression.val
- The value expression. The output table will sum the value expression for each unique category.period
- The period to summarizeprogress
- An optionalObserver
object to track the progress of the summary. This parameter may be null.- Returns:
- Will return a SummaryTable with the results of the summary.
- Throws:
Exception
-
createSummaryTable
public static AttributeStore createSummaryTable(AttributeStore as, String cat, String val, String select, int[] periods, Observer progress) throws ExceptionCreate a summary table for the selected planning peiords. The summary table will have one row for each unique value of the category expression. The row will contain the category expression and the sum of the value expression for each matching record.- Parameters:
as
- The input attribute store to be summarizedcat
- The category expression. The output table will have one row for each unique value of the catgory expression.val
- The value expression. The output table will sum the value expression for each unique category.periods
- A list of periods to summarize. If null then summarize all periods.progress
- An optionalObserver
object to track the progress of the summary. This parameter may be null.- Returns:
- Will return a SummaryTable with the results of the summary.
- Throws:
Exception
-
getSnapshot
Get a snapshot of this summary definition. The queries will be run to compute the statistics in the underlying dataset. The results will be contained in the snapshot and will not change even if the underlying data set changes.- Overrides:
getSnapshot
in classAttributeStore
- Parameters:
useSelected
- The calculations will only be computed on the selected records.- Returns:
- This method will return a new shapshot that captures the state of the summary definition for the current data set.
-
getSnapshot
Get a snapshot of this summary definition. The queries will be run to compute the statistics in the underlying dataset. The results will be contained in the snapshot and will not change even if the underlying data set changes.- Overrides:
getSnapshot
in classAttributeStore
- Parameters:
useSelected
- The calculations will only be computed on the selected records.progress
- A optional reference to anObserver
that will be updated with the progress of the calculations.- Returns:
- This method will return a new shapshot that captures the state of the summary definition for the current data set.
-