Plugin Reference
To register your plug-in with HEC-DSSVue, use one of the following functions in the main method of your Java code:
Java signature | example | plugin menu location |
---|---|---|
registerPlugin(int menuNumber, JMenuItem menuItem) | listSelection.registerPlugin(ListSelection.TOOLS,menu); | Tools→'To Text...' |
registerImportPlugin(ImportPlugin importPlugin, JMenuItem menuItem, String dropAndDragExtension) | listSelection.registerImportPlugin(null,menu,null); | Data Entry->Import-'To Text...' |
registerExportPlugin(JMenuItem menuItem) | listSelection.registerExportPlugin(menu); | Data Entry->Export→'To Text...' |
addToolBarButton(JButton button) |
public static void main(Object[] args)
{
final ToTextPlugin plugin = new ToTextPlugin();
final ListSelection listSelection = (ListSelection) args[0];
JMenuItem menu = new JMenuItem("To Text...");
menu.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
plugin.process(listSelection);
}
});
listSelection.getToolBar().add(menu);
//listSelection.registerPlugin(ListSelection.TOOLS, menu);
/* other menu locations for the above registerPlugin method.
public static final int FILE = 0;
public static final int EDIT = 1;
public static final int VIEW = 2;
public static final int DISPLAY = 3;
public static final int GROUPS = 4;
public static final int DATA_ENTRY = 5;
public static final int TOOLS = 6;
public static final int CUSTOM = 7;
public static final int SCRIPTS = 8;
public static final int ADVANCED = 9;
public static final int HELP = 10;
*/
//listSelection.registerExportPlugin(menu);
//listSelection.registerImportPlugin(null,menu,null);
}
private void process(ListSelection listSelection)
{
// Reads data from DSS and returns it in data containers in a list of lists
List[] dataList = listSelection.getSelectedDataContainers();
if (dataList == null) {
JOptionPane.showMessageDialog(listSelection, "No records selected",
"Cannot read data", JOptionPane.WARNING_MESSAGE);
return;
}
// your plugin code here....
}
JAVA
Read data for selected pathnames with
getSelectedDataContainers():
JAVA
List[0] will be a list of TimeSeriesContainer, or null if none read.
List[1] will be a list of PairedDataContainer or null
List[2] will be a list of TextContainer
Write data to HEC-DSS:
boolean save(DataContainer dataContainer);
boolean saveAs(DataContainer dataContainer);
int save(Vector DataContainer);
JAVA
Others:
DataReferenceSet getSelectedPathnames()
void updateCatalog();
boolean setDSSFilename(String DSSFileName);
String getDSSFilename();
void addToSelection(String pathname)
public void setTimeWindow(String timeWindow)
void setTimeWindow(String start, String end, boolean applyAll)
void setTimeWindow(HecTime start, HecTime end, boolean applyAll)
void tabulate(List selectedDataContainers);
void plot(List selectedDataContainers);
JAVA