Post

2 followers Follow
0
Avatar

DocumentSelectionOption example

Hi,

Context:

I am creating a custom options dialog box. I want to incorporate "add Documents to workflow" like option to the dialog box.

Question:

Is addDocumentSelectionOption the right method? Can someone provide an example of how to use DocumentSelectionOption?

Thanks!

Matthew Shum

Please sign in to leave a comment.

5 comments

0
Avatar

Yes, addDocumentSelectionOption is a good way to do it.

Here's and example using it to specify one additional sequence document:

//add the option
List<DocumentField> fieldsToDisplay = Arrays.asList(DocumentField.DESCRIPTION_FIELD, DocumentField.SEQUENCE_LENGTH);
DocumentSelectionOption documentSelectionOption = options.addDocumentSelectionOption("additionalSequence", "Addition Sequence:", DocumentSelectionOption.FolderOrDocuments.EMPTY,
DocumentType.NUCLEOTIDE_SEQUENCE_TYPE, fieldsToDisplay, false, Collections.emptyList());

//get its value
AnnotatedPluginDocument additionalDocument = documentSelectionOption.getDocuments().get(0);
Richard Moir 0 votes
Comment actions Permalink
0
Avatar

With the code block above, I receive a NullPointerException with the null default value parameter. How would I resolve this?

(I want to reproduce below)

Matthew Shum 0 votes
Comment actions Permalink
0
Avatar

Sorry about that, you can use the following for an empty selection instead of null:

DocumentSelectionOption.FolderOrDocuments.EMPTY
Richard Moir 0 votes
Comment actions Permalink