public class IlvDashboardDOM extends Object
IlvDashboardDOM
utility class is used to read and write a
dashboard diagram to and from a Document Object Model (DOM)
Element
.
The following code example shows you how to use
IlvDashboardDOM
.
public void buildDoc(IlvDiagrammer diagrammer) throws Exception { IlvDashboardDiagram diagram = (IlvDashboardDiagram) diagrammer; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbFactory.newDocumentBuilder(); Document document = builder.newDocument(); Element dashboardDOM = IlvDashboardDOM.buildDashboardDOM(document, diagram); ...
Modifier and Type | Method and Description |
---|---|
static Element |
buildDashboardDOM(Document document,
IlvDashboardDiagram diagram)
Builds a DOM Element describing an
IlvDashboardDiagram
instance. |
static boolean |
isValidDocument(Document document)
Checks if
document is a valid dashboard diagram document. |
static void |
readDashboardDOM(IlvDashboardDiagram diagram,
Document document)
Reads the dashboard diagram contents from a DOM
Element . |
public static Element buildDashboardDOM(Document document, IlvDashboardDiagram diagram)
IlvDashboardDiagram
instance. The created Element
is not added to
document
by this function. It is the responsibility of
the caller to add it to the document at the suitable level of the hierarchy.document
- The Document
used to create DOM objects.diagram
- The dashboard diagram to be written to a DOM
Element
.diagram
.public static boolean isValidDocument(Document document)
document
is a valid dashboard diagram document.
Note: this method does not validate the XML stored in
document
.
document
- The Document
to test.true
if the root element in
document
is a valid dashboard diagram root tag.public static void readDashboardDOM(IlvDashboardDiagram diagram, Document document) throws IlvDiagrammerException
Element
.
The following code example shows how to read a DOM into a
IlvDashboardDiagram
instance.
public void read(IlvDiagrammer diagrammer) throws Exception { // The given diagrammer must be an IlvDashboardDiagram if (diagrammer instanceof IlvDashboardDiagram) { IlvDashboardDiagram source = (IlvDashboardDiagram) diagrammer; ... } IlvDashboardContext context = new IlvDashboardContext(); IlvDashboardDiagram dashboard = new IlvDashboardDiagram(context); // Build the DOM DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.newDocument(); Element dashboardDOM = IlvDashboardDOM.buildDashboardDOM(document, source); document.appendChild(dashboardDOM); // Read the contents IlvDashboardDOM.readDashboardDOM(dashboard, document); ...
diagram
- The target dashboard diagram.document
- The source document.IlvDiagrammerException
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.