Scripting > Accessing the Main Program Window


ListSelection Class

The static functions of the ListSelection class are listed in in the table below.

ListSelection Static Functions

Function

Returns

Description

createMainWindow()

ListSelection

Returns a new ListSelection object. This should not be called unless the script is not running in interactive mode.

getMainWindow()

ListSelection

Returns the main program window (ListSelection object) of the script.  Returns None if the script is not running in interactive mode.

 

ListSelection objects can be used to gather information about pathnames and time windows that the user selected interactively before launching the script.  ListSelection objects can also be used to launch the interactive graphical editor. The ListSelection methods are listed in the table below.

 

ListSelection Methods

Method

Returns

Description

addToolBarButton(JButton b)

None

Adds a button to the main toolbar.

addToSelection(String path)

None

Adds a pathname to the selection list.

clear()

None

Clears selected pathnames.

close()

None

Close the current DSS file.

copyPathnamesToClipboard()

None

Copies selected pathnames to the clipboard

copyRecords(0/1)

None

Copies selected records to the second DSS file opened if 0, or displays an open dialog

delete()

None

Deletes the selected records

duplicateRecords()

None

Duplicates the selected records

exitProgram()

None

Exits the program, saving settings

exportShef(String filename)

None

Exports the selected records to SHEF in the file given

exportShef(String filename, Vector timeSeriesContainers)

None

Exports the provided data to SHEF in the file given

exportToFile()

None

Exports images, etc. by opening a Open dialog

fileCheck()

None

Runs a file check on the opened DSS file

finish()

None

Exits without saving settings

getCustomMenu()

JMenu

Returns the custom menu

getDataManager()

CombinedDataManager

Returns the combined data manager for the current file

getDisplayMenu()

Jmenu

Returns the Display menu

getDSSFilename()

string

Returns the current DSS file name

getEndTime()

HecTime

Returns the current end time of the ListSelection as an HecTime object.2

getEditMenu()

Jmenu

Returns the Edit menu

getExport Menu()

Jmenu

Returns the Export menu

getFileMenu()

Jmenu

Returns the File menu

getImportMenu()

Jmenu

Returns the Import menu

getNumberSelectedPathnames()

integer

Returns the number of selected pathnames

getScriptMenu()

Jmenu

Returns the script menu

getSecondDataManager()

CombinedDataManager

Returns the combined data manager for the second file

getSelectedDataContainers()

List

Reads data for the selected pathnames and returns it in a list of data containers

getSelectionList()

list of DataReference objects

Returns a list of DataReference objects that represent the interactive pathname and time window selections.

getSelectedPaths()

Vector

Returns a Vector of Strings of pathnames in the open DSS file.

getStartTime()

HecTime

Returns the current start time of the ListSelection as an HecTime object.2

getTimeWindow(HecTime startTime, HecTime endTime)

0/1

Returns whether the start time and end time provided are defined

getToolBar()

JtoolBar

Returns the tool bar

getViewMenu()

Jmenu

Returns the View menu

graphicalEdit()

None

Launches the graphical editor for the interactively-selected pathnames and time windows.

graphicalEdit(TimeSeriesContainer tsc)

None

Launches the graphical editor for the specified TimeSeriesContainer.

graphicalEdit(list tscList)

None

Launches the graphical editor for all TimeSeriesContainers in the list.

importGenericFiles()

None

Launches a file open dialog to import files

importImages()

None

Launches a file open dialog to import image files

importShef()

None

Launches a file open dialog to import SHEF files

importShef(String ilename)

None

Imports the SHEF file

isDssFileAccessible()

0/1

Returns if the DSS file set earlier is accessible currently

isInteractive()

0/1

Returns if the program is being run interactively or in a batch mode.

isRemote()

0/1

Returns whether the DSS file opened is remote and accessed using DSSManager

isVisible()

0/1

Returns whether the dialog is currently visible on the screen.

math()

None

Reads the selected data and then opens the math dialog

mergeFiles(String toDssFilename)

None

Copies all the data from the opened DSS file into the one specified

openDSSFile (String DSSFileName)

0/1

Opens the DSS file name of the ListSelection and returns whether it was opened or not

pairedDataEntry()

None

Opens the paried data entry dialog

plot()

None

Reads the selected data and then plots it

read(String pathname)

DataContainer

Reads the recored specified by the pathname

read(String pathname, HecTime start, HecTime end)

DataContainer

Reads the recored specified by the pathname and time window

read(String pathname, String timeWindow)

DataContainer

Reads the recored specified by the pathname and time window

refreshCatalog()

None

Refreshes the catalog for the opened file

registerExportPlugin(JmenuItem menuItem)

None

Adds the menu item to the export menu

registerImportPlugin(ImportPlugin importPlugin, JmenuItem menuItem, String dropAndDragExtension)

None

Adds the menu item to the import menu and associates the plugin and drag and drop extension to that item

registerPlugin(integer menuNumber, JmenuItem menuItem)

None

Adds the menu item to main menus.  Menu numbers are the following:

FILE = 0;

EDIT = 1;

VIEW = 2;

DISPLAY = 3;

GROUPS = 4;

DATA_ENTRY = 5;

TOOLS = 6;

CUSTOM = 7;

SCRIPTS = 8;

ADVANCED = 9;

HELP = 10;

renameRecords()

None

Brings up the rename dialog for the selected pathnames

runFile()

None

Reads the selected data and runs the programs associated with them (e.g., .pdf, .mp3)

runFile(Vector pathnames)

None

Reads the selected pathnames and runs the programs associated with them (e.g., .pdf, .mp3)

save(DataContainer dataContainer)

0/1

Saves the data container in the opened DSS file.  Returns if success or not

saveAs(DataContainer dataContainer)

0/1

Opens the Save As dialog and saves the data container in the opened DSS file.  Returns if success or not

selectAll()

0/1

Adds all pathnames to the selection list

setCustomMenu(String menuText)

None

Sets the text displayed on the menu bar

setDssLogFile(String logFile)

None

Writes DSS messages to the file provided

setScriptMenu(String menuText)

None

Sets the text displayed on the menu bar

setSelectedPathnames(Vector selectedPathnames)

None

Sets the selected list of pathnames

setTimeWindow(string timeWindow)

None

Sets the current time window of the ListSelection using a string value to define the start time and end time

setTimeWindow(string start, string end, ilenam applyAll)

None

Sets the current time window of the ListSelection using a string value to define the start time and end time

setTimeWindow(HecTime start, HecTime end, ilenam applyAll)

None

Sets the current time window of the ListSelection using an Hec Time object to define the start time and end time

setVisible(0/1 visible)

None

Sets whether the dialog is visible on the screen.

Squeeze()

None

Squeezes the open DSS file

tabulate()

Jframe

Tabulates the selected data

tabularEdit()

Jframe

Displays the tabular editor for the selected data

textEntry()

None

Displays the text entry dialog

textFileEntry()

None

Displays an open dialog to read a text file into text format

timeSeriesDataEntry()

None

Displays the time series data entry dialog

undeleteAll()

None

Undeletes all deleted records in the DSS file

undeleteSelected()

None

Undeletes the selected records

updateCatalog()

None

Creates a new catalog, if needed (refreshCatalog forces a new catalog)

updateMessageField(String message)

None

Puts the message in the message field

 

1The coordinate system used is a graphics coordinate system, where X increases to the right and Y increases downward from the origin (0,0) which is located in the top left corner of the display. Locations set or retrieved refer to the top left corner of the dialog in reference to this coordinate system.

2The current start and end times of a ListSelection object are not necessarily the same as the start and end times of any DataReference objects in the ListSelection.  Rather they represent the start and end times that will be applied to subsequent selections.