Get current view from java agent

I have a java agent in lotus notes and this java agent will launch a swing dialog where i have some buttons.Now i want to enable or disable those buttons based on the view of lotus notes.How can i get the current view using java agent? I seen in some of the threads that its not possible from java. So how can i approach to solve this.

Please suggest,

Thanks in advace…

Subject: Get current view from java agent

You don’t have UI classes in Java agents, so there is nothing like a current workspace, current document or current view.

You could probably write the name of the current view to a profile document in the view’s PostOpen and then retrieve this in your agent.

Subject: RE: Get current view from java agent

Thanks for your response. I am very new to lotus notes and i dont have any idea of creating a profile document in view’s postopen and get from java agent.

It would be greatfull if you give a small example on this.

Thanks in advance,

Subject: RE: Get current view from java agent

No real sample at hand, but the first step would be similar to this:

http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllFlatweb/2320d6956f294a37852573a20001c525?OpenDocument

To create a profile document and add a value to it you can either use @Formulas or LotusScript in PostOpen (no Java). The example mentioned above uses LotusScript, but you would only need the part that actually sets the value. In your case you would want to store

Source.Viewname

in the profile doc. To retrieve the profile document from your Java method, use

Session.getProfileDocument(“ProfileName”, Session.getUserName())

Once you have access to the profile document, you can read out the item value storing the view name just like any other item value.

To make this work, the code to write the view name into the profile document would have to be in every view, that needs this feature. And: If users switch between different views, this could get messed up.

Subject: RE: Get current view from java agent

Thank you for your help.It works for me…I have another requirement like, java agent has to get all the selected documents from any view like inbox,draft…I can get these by using getUnprocessedDocuments() and the agent target should be “All Selected Documents”.But if i run the agent for any open mails and those are not saved then it saying like “Please save the document”.This will work if i make target of that java agent to “None”.As per our requirement i need to get these two features, if inbox view is opened i need to get all the selected documents, if i open a new memo, it should not ask for saving the document before calling agent. Is these any way to solve this problem from one single java agent OR is there any way to call one java agent from another java agent through coding.

Thanks in advance,

Subject: RE: Get current view from java agent

http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllFlatweb/ffd191cc629e9c55852573a4001af9f6?OpenDocumenthttp://www-10.lotus.com/ldd/nd6forum.nsf/DateAllFlatweb/87cad147fc92e3b1852573a4001abc4d?OpenDocument