cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic XUI Dialog Creation

Highlighted

Dynamic XUI Dialog Creation

Hello,

Does anyone know if it is possible to create a XUI dialog on the fly,
solely in code?

I have tried to use the Application.createDialogFromDocument() method,
but even though it says it takes in an org.w3c.dom.Document, it fails
within the AOM code since it seems the method tries to call getKey()
which is only defined in com.arbortext.epic.internals.aom.*, but not
in the w3c spec for Document.

For now, I will revert to creating a stub XUI file with a single
element, and add to it from there. Does anyone know if there
is a way around this?

Thanks,
Keith Berard
XML Systems Analyst
Milliman Care Guidelines LLC, A Milliman Company
Tel +1 206 381.8166
keith.berard@milliman.com
http://www.careguidelines.com/

Delivering evidence-based knowledge at the point of care
Tags (2)
4 REPLIES 4
Highlighted

RE: Dynamic XUI Dialog Creation

Use the Application.openDocument() method (without a file argument) to create a new XUI document. Then you can programmatically construct the document, then display the dialog with Application.createDialogFromDocument(), etc.

It saves some code to start with a skeleton xui file, unless you truly need to build the entire dialog dynamically.

Another interesting possibility is to transform an existing document to xui using an XSLT stylesheet.

In a pinch you can convert an org.w3c.dom.Document to an AOM document but there are usually ways to do what you want without resorting to this.

--Paul

Paul Tyson
Principal Consultant, Arbortext/PTC
Highlighted

Re: Dynamic XUI Dialog Creation

Hmm... when I attempt to do that, the resulting document doesn't seem
to let me create an element.

eg:

Document xuiDoc = Application.openDocument();
Element xuiRootNode = xuiDoc.createElement("window");
xuiDoc.appendChild(xuiRootNode);

In which that second line throws an exception pointing to the native
call. Should I be doing something differently? Since it fails on
the createElement method, I'm guessing it's not an exception resulting
from duplicate roots. Also, how would I set the DocumentType using
openDocument? Would I even have to?

As for using a XUI stub... I have created a simple xui containing:


<window enabledocking="any">
</window>

It seems that without setting the enabledocking in the XUI itself,
setting it programatically later has no effect, and the dialog will
not dock.

Thanks again,

Keith Berard
XML Systems Analyst
Milliman Care Guidelines LLC, A Milliman Company
Tel +1 206 381.8166
keith.berard@milliman.com
Highlighted

RE: Dynamic XUI Dialog Creation

Keith,

The 4th argument of openDocument is the public id, and the 5th is the
system id, so you can try:

Application.openDocument('',0,0,'-//Arbortext//DTD XUI XML 1.0//EN')

Another way to crate a document is to use the DOMImplementation class:

DOMImplementation impl = Application.getDomImplementation();
DocumentType doctype = impl.createDocumentType(...);
Document doc = impl.createDocument(..., doctype);

The enabledocking attribute needs to be set before the dialog is
created.

Tung
Highlighted

Re: Dynamic XUI Dialog Creation

Tung,

That worked perfect. Not sure how I missed the
Application.getDomImplemntation() method.

Thanks,

Keith Berard
XML Systems Analyst
Milliman Care Guidelines LLC, A Milliman Company
Tel +1 206 381.8166
keith.berard@milliman.com
Announcements