public class TopcatModel extends Object
This is a big ugly mixed bag of various different models. It has crossed my mind to attempt to amalgamate them into something a bit more rational, but the structure of one model containing a set of other (swing-defined) models seems to work OK.
Modifier | Constructor and Description |
---|---|
protected |
TopcatModel(uk.ac.starlink.table.StarTable startab,
int id,
String location,
ControlWindow controlWindow)
Constructs a new model from a given table.
|
Modifier and Type | Method and Description |
---|---|
void |
addParameter(uk.ac.starlink.table.DescribedValue param)
Adds a new table parameter to the table.
|
void |
addSubset(RowSubset rset)
Adds a new row subset to the list which this model knows about.
|
void |
addTopcatListener(TopcatListener listener)
Adds a listener to be notified of changes in this model.
|
void |
appendColumn(uk.ac.starlink.table.ColumnData col)
Appends a new column to the existing table as the last column.
|
void |
appendColumn(uk.ac.starlink.table.ColumnData col,
int colIndex)
Appends a new column to the existing table at a given column index.
|
void |
appendColumns(uk.ac.starlink.table.StarTable colTable)
Appends all the columns in a given table as new columns in this one.
|
void |
applySubset(RowSubset rset)
Sets a given row subset to the Current one.
|
static TopcatModel |
createDefaultTopcatModel(uk.ac.starlink.table.StarTable table,
String location,
ControlWindow controlWindow)
Returns a new TopcatModel suitable for a table that has just been
loaded in the usual way.
|
static TopcatModel |
createDummyModel()
Creates and returns a new TopcatModel with no data.
|
uk.ac.starlink.ttools.jel.RandomJELRowReader |
createJELRowReader()
Returns a JEL expression evaluation context appropriate for the
current state of this table.
|
JComboBox |
createNewSubsetNameSelector()
Returns a new editable JComboBox which can be used to select the
name of a new RowSubset.
|
static TopcatModel |
createRawTopcatModel(uk.ac.starlink.table.StarTable table,
String location,
ControlWindow controlWindow)
Returns a new TopcatModel based on a table but without some of the
additional decorations.
|
static TopcatModel |
createUnloadedTopcatModel(uk.ac.starlink.table.StarTable table,
String name)
Returns a new TopcatModel that is supposed to be used independently
rather than loaded into the main topcat application list.
|
SubsetConsumer |
enquireNewSubsetConsumer(Component parent)
Pops up a dialogue to ask the user what to do with a newly created
RowSubset.
|
void |
explodeColumn(uk.ac.starlink.table.gui.StarTableColumn tcol)
Replaces an N-element array-valued column in the table with
N scalar-valued columns.
|
void |
fireModelChanged(int code,
Object datum)
Notifies all registered listeners that this model has changed.
|
ActivationWindow |
getActivationWindow()
Returns the window that manages this model's activation actions.
|
uk.ac.starlink.table.StarTable |
getApparentStarTable()
Returns a StarTable representing the table data as displayed by
a JTable looking at this model.
|
ColumnList |
getColumnList()
Returns the list of columns available from this table.
|
TableColumnModel |
getColumnModel()
Returns the table column model which should be used by this a
JTable for table display.
|
ColumnSelectorModel |
getColumnSelectorModel(uk.ac.starlink.table.ValueInfo info)
Returns a ColumnSelectorModel which represents the current choice
for a given ValueInfo for this table.
|
PlasticStarTable |
getDataModel()
Returns the container for the data held by this viewer.
|
int |
getID()
Retursn the model's ID number.
|
String |
getLabel()
Returns this model's label.
|
String |
getLocation()
Returns the location of the table described by this model.
|
Action |
getNewSubsetAction()
Gets an action which will pop up a window for defining a new
algebraic subset for this model.
|
SortOrder |
getSelectedSort()
Returns the most recently selected sort order.
|
RowSubset |
getSelectedSubset()
Returns the most recently selected row subset.
|
Action |
getSortAction(SortOrder order,
boolean ascending)
Returns an action which sorts the table on the contents of a given
column.
|
ComboBoxModel |
getSortSelectionModel()
Returns the selection model which controls sorts on the table rows.
|
JToggleButton.ToggleButtonModel |
getSortSenseModel()
Returns the model indicating whether sorts are up or down.
|
Map<RowSubset,Long> |
getSubsetCounts()
Returns the Map which contains the number of rows believed to be
in each subset.
|
OptionsListModel<RowSubset> |
getSubsets()
Returns the ListModel which keeps track of which
RowSubset objects are available.
|
ComboBoxModel |
getSubsetSelectionModel()
Returns the selection model which controls the active subset
for the viewed table.
|
uk.ac.starlink.table.TableBuilder |
getTableFormat()
Returns the table builder object that originally loaded
this model's table.
|
Action |
getUnsortAction()
Gets an action which will return the view model for this model
to its unsorted state.
|
ViewerTableModel |
getViewModel()
Returns the table model which should be used by a JTable
for table display.
|
boolean |
hasActivationWindow()
Indicates whether this model currently has an activation window.
|
void |
highlightRow(long lrow)
Performs all actions required to highlight a row,
including notifying external applications via SAMP/PLASTIC
if this model is currently so configured.
|
void |
highlightRow(long lrow,
boolean sendOut)
Performs actions required to highlight a row,
optionally including notifying external applications via SAMP/PLASTIC.
|
void |
recompileSubsets()
Recompiles all synthetic subsets from their expressions.
|
boolean |
removeParameter(uk.ac.starlink.table.DescribedValue param)
Removes a table parameter from the table.
|
void |
removeTopcatListener(TopcatListener listener)
Removes a listener from notification of changes in this model.
|
void |
renameColumn(TableColumn tcol,
String name)
Changes the name of a TableColumn in this model.
|
void |
setLabel(String label)
Sets the label for model identification.
|
void |
showSubset(RowSubset rset)
Causes a given row subset to be be highlighted in some way.
|
void |
sortBy(SortOrder order,
boolean ascending)
Trigger a sort of the rows in the viewModel.
|
String |
toString() |
protected TopcatModel(uk.ac.starlink.table.StarTable startab, int id, String location, ControlWindow controlWindow)
startab
- random-access table providing the dataid
- id number; should be unique for loaded tableslocation
- location stringcontrolWindow
- control window instancepublic String getLocation()
public String getLabel()
public int getID()
public uk.ac.starlink.table.TableBuilder getTableFormat()
public void setLabel(String label)
label
- new label valuepublic PlasticStarTable getDataModel()
public ViewerTableModel getViewModel()
public TableColumnModel getColumnModel()
public ColumnList getColumnList()
TableColumnModel
, this keeps track of
all the columns which have ever been in the column model, and
is able to say whether they are currently hidden or not.public OptionsListModel<RowSubset> getSubsets()
public Map<RowSubset,Long> getSubsetCounts()
public ComboBoxModel getSortSelectionModel()
public JToggleButton.ToggleButtonModel getSortSenseModel()
public ComboBoxModel getSubsetSelectionModel()
public RowSubset getSelectedSubset()
public SortOrder getSelectedSort()
public ColumnSelectorModel getColumnSelectorModel(uk.ac.starlink.table.ValueInfo info)
info
- description of the column which is wantedpublic ActivationWindow getActivationWindow()
public boolean hasActivationWindow()
getActivationWindow()
will result in one being created.public void addTopcatListener(TopcatListener listener)
listener
- listener to addpublic void removeTopcatListener(TopcatListener listener)
listener
- listener to removepublic void fireModelChanged(int code, Object datum)
code
- item code indicating the type of change that has
occurred (one of the static final constants in
TopcatEvent
)datum
- additional information about the eventpublic void highlightRow(long lrow)
lrow
- row indexpublic void highlightRow(long lrow, boolean sendOut)
lrow
- index of the row to activatesendOut
- if true, will notify external applications via
SAMP/PLASTIC when this model is so configured;
if false, no such external notifications will be sentpublic Action getNewSubsetAction()
public Action getUnsortAction()
public Action getSortAction(SortOrder order, boolean ascending)
order
- sort orderascending
- sense of sort (true for up, false for down)public void appendColumn(uk.ac.starlink.table.ColumnData col, int colIndex)
col
- the new columncolIndex
- the column index at which the new column is
to be appended, or -1 for at the endpublic void appendColumn(uk.ac.starlink.table.ColumnData col)
col
- the new columnpublic void appendColumns(uk.ac.starlink.table.StarTable colTable)
colTable
- table containing columns to be grafted onto this
tablepublic void renameColumn(TableColumn tcol, String name)
tcol
- column in this topcat model whose name is to be updatedname
- new namepublic void explodeColumn(uk.ac.starlink.table.gui.StarTableColumn tcol)
tcol
- vector-valued columnpublic SubsetConsumer enquireNewSubsetConsumer(Component parent)
parent
- parent componentpublic JComboBox createNewSubsetNameSelector()
public uk.ac.starlink.ttools.jel.RandomJELRowReader createJELRowReader()
public void addSubset(RowSubset rset)
rset
- the new row subsetpublic void recompileSubsets()
public void addParameter(uk.ac.starlink.table.DescribedValue param)
param
- new parameter to add to the tablepublic boolean removeParameter(uk.ac.starlink.table.DescribedValue param)
param
- parameter object to removepublic void sortBy(SortOrder order, boolean ascending)
TopcatEvent.CURRENT_ORDER
event to be sent
to listeners.order
- sort orderascending
- sort sense (true for up, false for down)public void applySubset(RowSubset rset)
TopcatEvent.CURRENT_SUBSET
event to be sent
to listeners and changes the selection of rows visible in the
viewModel.rset
- the row subset to use (must be one from the known list)public void showSubset(RowSubset rset)
TopcatEvent.SHOW_SUBSET
event to be sent to listeners.rset
- the row subset to use (must be one from the known list)public uk.ac.starlink.table.StarTable getApparentStarTable()
public static TopcatModel createDefaultTopcatModel(uk.ac.starlink.table.StarTable table, String location, ControlWindow controlWindow)
table
- random-access table providing the datalocation
- location stringcontrolWindow
- control window instancepublic static TopcatModel createRawTopcatModel(uk.ac.starlink.table.StarTable table, String location, ControlWindow controlWindow)
table
- random-access table providing the datalocation
- location stringcontrolWindow
- control window instancepublic static TopcatModel createUnloadedTopcatModel(uk.ac.starlink.table.StarTable table, String name)
table
- random-access table providing the dataname
- name by which the table will be knownpublic static TopcatModel createDummyModel()
Copyright © 2003-2019 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.