hi,I am the new one for lotus notes. I do some lotusscript in the nsf file, which will call java. When click the send button, I want to change the notesui “EnterSendTo”. so I write some code in the “Querysend”, then call the java code. There are in the java code"NotesUIDocument doc = (new NotesUIWorkspace()).getCurrentDocument();" but I can not get the doc.
Your code looks like something in between. BTW, as of 8.5.1, you cannot use Java in form events, nor does the Java API of Notes provide any UI classes.
but some error. like no workspace init. I confuse about that.When I click the send button, then I run the java code above.(I run it from LS2J)
BTW, what do you mean?“you cannot use Java in form events, nor does the Java API of Notes provide any UI classes.” I can not use the ui doc? e.g."NotesUIDocument "?
Isn’t LS2J object instantiation done by invoking ‘JavaClass.CreateObject()’, not by ‘new …’ as in your code example? (See the LS2J examples in Designer help.) I must admit that I’m not an LS2J expert though.
And yes, the UI classes (NotesUiDocument etc) are currently available in LotusScript (native) only.
I create the new source in the code->script…then I add the LS code in the option
Uselsx “*javacon”
Use “JavaSource”
I can run my java code in the LS code. like that
Set jSession = New JavaSession
Set jSample = jSession.GetClass("tmp008/ClassSample").createObject()
jSample.setStrMyName(" ls ------------")
Msgbox jSample.getStrMyName()
this is my java package and java class name
tmp008/ClassSample
It will run. but if I add some java code which get the uidocment, it does work. the error is no uiworkbench. so I think that maybe the init order.do you think so?
BTY,I can get the uidocment object in java code, when I create a plug-in project.but the project must indepence the “com.ibm.notes.java.ui” jar.
I guest it will be ok.
If you interested in my topic,we can talk it in msn. If you wish, It’s my pleasure. This is my msn:zezhenyan@hotmail.com
As mentioned previously, the Notes UI classes are generally not available to Java. With Notes 8.5, a few Notes UI classes were made available to Java but only for plug-in development (which you have already seen).
Try this. Instead of trying to access NotesUIDocument from within Java, get the value of the EnterSendTo field in LotusScript first (via NotesUIDocument) and then pass that value to your Java code. This would require you to write a small method in your Java code to receive the value but would allow you to get around the UI class limitation.