|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.table.DataTableSortController
public class DataTableSortController
DataTableSortController sorts a dataset based on column selections made in a
TableView
. DataTableSortController is an adapter which listens
for ItemEvent
events from a TableView. If a column is selected,
that column is added to a PROC SORT statement to sort the input dataset by that column.
If additional columns are selected, the dataset will be sorted on those columns.
For example, if a dataset SASUSER.SURVEY includes three columns: DATE, TIME, and RESPONSE,
then clicking on the TIME column will sort by TIME. If you then clicked on date, the adapter will
sort by DATE TIME. When a column is selected, it is moved to the front of the list of BY variables.
If that column is already at the front, the sort order is toggled between ascending and descending
order for that column. After sorting, the TableView's model is the sorted WORK dataset.
This adapter has options to either sort the dataset in place, or use WORK datasets so that the original dataset does not get modified.
Clicking on the blank upper-left cell of the table resets the TableView back to the original dataset if the sorts are not being done in place and also clears the list of BY variables.
setTableView(TableView)
with the name of the
TableView as the parameter.
To connect a DataSetInterface to a DataTableSortController without using the constuctor,
you must designate the DatSetInterface on the frame as the DataSetInterface to be used by the
DataTableSortController by using setModelInterface(DataSetInterface)
with the name
of the DataSetInterface as the parameter.
Nested Class Summary | |
---|---|
protected class |
DataTableSortController.ColumnSort
|
Field Summary | |
---|---|
protected com.sas.sasserver.dataset.DataSetInterface |
dataSetInterface
The DataSetInterface which used to connect to the dataset |
protected boolean |
enabled
Whether or not the DataTableSortController is enabled (TRUE) and will act on the TableView or will not affect the TableView (FALSE). |
protected boolean |
inPlace
Whether or not the new sorted dataset will replace the previous dataset (TRUE) or be stored to a temporary dataset to be displayed (FALSE) |
protected int |
maxSortedColumns
The maximum number of columns which can be stored in the BY list of variables. |
protected java.lang.String |
originalDataSet
Name of the original dataset with any options from which the sorted output is based |
protected java.lang.String |
originalDataSetName
Name of the original dataset from which the sorted output is based |
protected SASProcedureTemplate |
proc
Template used to create a PROC statement |
protected java.util.Vector |
sortedVector
A Vector of the column names to be used in the BY list in order as they will appear |
protected TableView |
tableView
The TableView that all actions are taken from and where the dataSet is displayed |
protected java.lang.String |
workDataSetName
Name of the output dataset to which the sorted output is stored |
Constructor Summary | |
---|---|
DataTableSortController()
Null Constructor Constructor equal to DataTableSortController(null, null, 0) |
|
DataTableSortController(TableView tv,
com.sas.sasserver.dataset.DataSetInterface dsi)
Constructor equal to DataTableSortController(tv, dsi, 0) |
|
DataTableSortController(TableView tv,
com.sas.sasserver.dataset.DataSetInterface dsi,
int numColumns)
Constructor that sets TableView, DataSetInterface, and number of columns with parameters. |
Method Summary | |
---|---|
com.sas.sasserver.dataset.DataSetInterface |
getDataSetInterface()
Returns dataSetInterface |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a DataTableSortController. |
int |
getMaxSortedColumns()
Returns maxSortedColumns |
protected java.lang.String |
getOriginalDataSet()
Returns originalDataSet |
protected java.lang.String |
getOriginalDataSetName()
Returns originalDataSetName |
java.util.Vector |
getRequiredInterfaces()
Creates list of required interfaces, in this case only DataSetInterface, and return list |
SASProcedureTemplate |
getSortProcedure()
Returns proc |
protected java.lang.String |
getSortStatement()
Creates the list of BY variables to be used by the PROC |
TableView |
getTableView()
Returns tableView |
java.lang.String |
getWorkDataSetName()
Returns workDataSetName |
boolean |
isEnabled()
Returns enabled |
boolean |
isInPlace()
Returns inPlace |
void |
itemStateChanged(java.awt.event.ItemEvent event)
Handles a column selected in the TableView and sorts the DataSet appropriately. |
protected SASProcedureTemplate |
newSortProcedure()
Creates the basis for a new PROC template |
protected java.lang.String |
newWorkDataSetName()
Creates a temporary dataset name to store the output of a sort procedure if one does not exist |
void |
propertyChange(java.beans.PropertyChangeEvent prop)
Handles the upper-left corner cell selected in the tableView and resets the sort. |
void |
reset()
Reload original dataset into TableView and remove all variables from the BY list |
void |
setDataSetInterface(com.sas.sasserver.dataset.DataSetInterface dsi)
Sets dataSetInterface |
void |
setEnabled(boolean val)
Sets enabled |
void |
setInPlace(boolean val)
Sets inPlace |
void |
setMaxSortedColumns(int numCol)
Sets maxSortedColumns |
void |
setModelInterface(com.sas.ModelInterface model)
Attaches model and calls setDataSetInterface if model is an instance of DataSetInterface |
void |
setSortProcedure(SASProcedureTemplate newSort)
Sets proc |
void |
setTableView(TableView tv)
Sets tableView |
void |
setWorkDataSetName(java.lang.String wds)
Sets workDataSetName |
protected void |
sortDataset(java.lang.String strSort)
Creates connection to data source and submits procedure |
Field Detail |
---|
protected TableView tableView
protected com.sas.sasserver.dataset.DataSetInterface dataSetInterface
protected int maxSortedColumns
protected boolean enabled
protected boolean inPlace
protected java.util.Vector sortedVector
protected SASProcedureTemplate proc
protected java.lang.String originalDataSetName
protected java.lang.String originalDataSet
protected java.lang.String workDataSetName
Constructor Detail |
---|
public DataTableSortController()
DataTableSortController(null, null, 0)
public DataTableSortController(TableView tv, com.sas.sasserver.dataset.DataSetInterface dsi)
DataTableSortController(tv, dsi, 0)
tv
- The TableView to allow sorting in.dsi
- The DataSetinterface that is the model of the TableView.public DataTableSortController(TableView tv, com.sas.sasserver.dataset.DataSetInterface dsi, int numColumns)
tv
- The TableView to allow sorting in.dsi
- The DataSetInterface that is the model of the TableView.numColumns
- The maximum number of columns to keep in the list of
BY variables.Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public void propertyChange(java.beans.PropertyChangeEvent prop)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class com.sas.Component
prop
- Instance of PropertyChangeEventPropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public void itemStateChanged(java.awt.event.ItemEvent event)
itemStateChanged
in interface java.awt.event.ItemListener
event
- Instance of ItemEventprotected SASProcedureTemplate newSortProcedure()
public void reset()
protected java.lang.String getSortStatement()
public SASProcedureTemplate getSortProcedure()
public void setSortProcedure(SASProcedureTemplate newSort)
newSort
- PROC statement in a procedure template formatprotected void sortDataset(java.lang.String strSort)
strSort
- Entire PROC statement in a String formatpublic java.util.Vector getRequiredInterfaces()
getRequiredInterfaces
in interface com.sas.ViewInterface
getRequiredInterfaces
in class com.sas.Component
ViewInterface.getRequiredInterfaces()
public void setModelInterface(com.sas.ModelInterface model)
setDataSetInterface
if model is an instance of DataSetInterface
setModelInterface
in interface com.sas.ViewInterface
setModelInterface
in class com.sas.Component
model
- Model for DataTableSortController classViewInterface.setModelInterface(com.sas.ModelInterface)
public int getMaxSortedColumns()
public void setMaxSortedColumns(int numCol)
numCol
- Number of columns that can be sorted on in the BY list at one time.
Passing in zero will default to sorting all columns.protected java.lang.String newWorkDataSetName()
public boolean isInPlace()
public void setInPlace(boolean val)
val
- boolean representing whether the output dataset will replace the input datasetpublic void setDataSetInterface(com.sas.sasserver.dataset.DataSetInterface dsi)
dsi
- DataSetInterface from which to get the input datasetpublic com.sas.sasserver.dataset.DataSetInterface getDataSetInterface()
public void setTableView(TableView tv)
tv
- TableView to display the datasetspublic TableView getTableView()
protected java.lang.String getOriginalDataSetName()
protected java.lang.String getOriginalDataSet()
public java.lang.String getWorkDataSetName()
public void setWorkDataSetName(java.lang.String wds)
wds
- Temporary output dataset as stringpublic boolean isEnabled()
public void setEnabled(boolean val)
val
- boolean representing whether the DataTableSortController will be enabled
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |