|
|
|
Latest Published
|
Table des matières The plugin org.nuxeo.xforms.ui.editors is providing a XForms viewer widget, a XForms model viewer and integration of an Eclipse editor and viewer. To use this plugin inside Eclipse IDE you should install the three XForms plug-in from Nuxeo:
Simply copy the plug-in jars inside your eclipse plugins directory and restart eclipse. The org.nuxeo.xforms.ui.editors plug-in register an Eclipse View and an Eclipse editor that is bound to *.xhtml, *.xforms and *.xf file extensions. The XForms view is located inside the group “Other Views” and can be used to browse and test XForms files There are three types of viewer provided:
This viewer is conceived to browse and test XForms files. The viewer status bar is displaying the status of the last validation: a red color is used to display validation errors otherwise the default color is used : The model viewer is displaying the XForms model in a tree widget. It can be used only for borwsing the model. In a future version you will also be able to edit the model and to generate XForms files.
To create a XForms viewer inside a parent widget and to load a XForms document you need only a few lines of code: FormsViewer viewer = new FormsViewer(parent, FormsViewer.MESSAGE_BAR); XInputSource src = new FileInputSource(new File(“document.xml”)); viewer.getProcesor().load(src); viewer.rebuild(); or XInputSource src = new FileInputSource(new File(“document.xml”)); XFormsProcessor proc = new XFormsProcessor(src); FormViewer viewer = new FormViewer(proc, parent, FormViewer.MESSAGE_BAR); The first approach is creating the XForms Viewer control first, then loading a XForms file and finally rebuilding the content of the viewer. The second approach is building the viewer using an initialized XForms processor so is no need to rebuild the view. The model viewer is not a widget, instead it extends an Eclipse TreeViewer. It can be intialized as follows: XInputSource src = new FileInputSource(new File(“document.xml”)); XFormsProcessor proc = new XFormsProcessor(src); ModelViewer viewer = new ModelViewer(proc, parent); The model viewer is usually using input objects of type: XForms, XFModel or XFInstance. Thus, to change the content displayed by the viewer you simply set a new input: XForms form = processor.getForm(); viewer.setInput(form); ... viewer.setInput(form.getModel(“myModel”)); ... The XFormsViewer can be used in a similar way: XInputSource src = new FileInputSource(new File(“document.xml”)); XFormsProcessor proc = new XFormsProcessor(src); FormViewer viewer = new FormViewer(proc, parent, XFormsViewer.MESSAGE_BAR | XFormsViewer.TOOLBAR); To refresh the viewer after loading another XForms file (or modifying the current one) you need to call the rebuild() method: viewer.rebuild(); The XForms View is located in the “Other Views” view category. It can be used to browse and test XForms documents.
|
|
|