Save ad-hoc trend pen configuration

yes. its all just datasets. you could look at creating tables that would mimic the datasets and then saving them with an identifier. You could also serialize the datasets which is the way I would do it and just have your identifier saved in a column next to the column that holds the serialized dataset

this should get you started on using the java.io package
How to serialize a dataset?

also the click to graph project may help you some as far as windows and stuff tvo get started.
https://inductiveautomation.com/downloads/extra-material