问题
I want to have a custom control that works on whatever documents I decide to pass to it. What's the best way of doing that?
Assuming that you can't pass the collection directly... should a function be created to convert the collection to a hashMap or vector of UNID's?
Is there another way?
Thanks
回答1:
Passing NotesDocument and/or NotesDocumentCollection objects to the Custom Control works fine. Just set the Custom Control's property type as java.lang.Object. By this you can transfer what ever objects to the Custom Control.
回答2:
If you instead pass a data source, you'll get recycle-safe objects transferred to the Custom Control.
For example, if the XPage defines a document data source, and you pass a reference to that data source to the CC, the Java object being transferred is a DominoDocument, which is a recycle-safe wrapper around the "back end" document. Passing the document directly risks that the linked C object will get orphaned between requests.
Similarly, passing a reference to a view data source provides the CC a DominoView, which is essentially a recycle-safe wrapper around a back end ViewEntryCollection.
For most use cases, you can get away with just passing the back end object directly, but passing the data source is far safer.
来源:https://stackoverflow.com/questions/9821518/how-do-you-pass-a-notesdocument-notesviewentry-collection-into-a-custom-contro