-
Notifications
You must be signed in to change notification settings - Fork 149
GXE Concepts
This section describes the basics of configuring the Geoportal XML Editor (GXE). For a general overview and other topics, see Geoportal XML Editor.
The purpose of the editor definition files is to compose the components of the user interface for the Geoportal XML editor. The simplest view of the editor is a web browser client that dynamically constructs elements of an HTML page through JavaScript. Below is an example showing a snippet of XML that you may find within an editor definition file. It defines HTML components of the user interface.
<h:div xmlns:g="http://www.esri.com/geoportal/gxe"
xmlns:h="http://www.esri.com/geoportal/gxe/html">
<h:h2>Sample Heading</h:h2>
<h:br/>
<h:p>Some links:</h:p>
<h:ul h:class="someCssClass">
<h:li>
<h:a h:href="http://www.esri.com/" h:target="_blank">Esri</h:a>
</h:li>
<h:li>
<h:a h:href="http://geoportal.sourceforge.net/" h:target="_blank">Esri Geoportal Server</h:a>
</h:li>
</h:ul>
</h:div>
Below is a picture of the above snippet rendered on an HTML page:
The editor definition files need an ability to introduce dynamic logic on the page. JavaScript is used to provide functionality as a result of user interaction with elements on the page, or to override the default behavior of the editor. The way that JavaScript is introduced is by associating a JavaScript object with an element of the editor definition, as shown in example below.
<h:a h:href="http://www.esri.com/"
h:target="_blank"
g:jsClass="mySampleClass">Esri</h:a>
The attribute g:jsClass is used to associate a JavaScript class with a renderable editor definition element. The specified g:jsClass must extend from the editor's base class for all renderable controls (gxe.control.Control found within [webapp]/catalog/js/v1.1.1/gxe.js). The Dojo Toolkit is used a JavaScript framework.
dojo.provide("mySampleClass");
dojo.declare("mySampleClass",gxe.control.Control,{
onHtmlElementCreated: function(domProcessor,domNode) {
// add a tool tip
this.htmlElement.title = "This is a sample tip.";
// listen for an event
dojo.connect(this.htmlElement,"onclick",this,dojo.hitch(this,function(e) {
alert("Clicked!");
}));
}
});
The editor definition files need an ability to reuse portions. An editor definition consists of a set of definition files. These files can be used in multiple sections of the editor. Reuse limits repetition and redundancy. There are two primary methods associated with reuse.
<g:import g:src="Example1.xml"/>
<h:div g:extends="$base/Example2.xml"/>
The editor definition element <g:import> instructs the processor to load the definition file located at the path specified by the associated g:src attribute. The editor definition attribute g:extends instructs the processor to load and extend the definition file located at the path specified by the value of the attribute. In the above example $base/Example2.xml contains a value predicate named $base. A number of such predicates are recognized by the editor. The purpose of such a predicate is to provide a logical context for interpreting a value. In particular, $base provides the context for determining the order of precedence when loading editor definition files.
The purpose of the editor is to provide functionality to create and update XML documents of a particular standard or profile. The editor definition files need an ability to bind user interface components to values within the targeted XML standard mapping. There are two primary methods for binding such values.
<g:element g:targetName="ex:element1"
g:extends="$base/core/xml/ElementTextOnly.xml" />
<g:element g:targetName="ex:element2"
g:minOccurs="0" g:maxOccurs="unbounded"
g:extends="$base/core/xml/Element.xml">
<g:body>
<g:attribute g:targetName="ex:attribute1"
g:use="required"
g:extends="$base/core/xml/Attribute.xml"/>
<g:attribute g:targetName="ex:attribute2"
g:extends="$base/core/xml/Attribute.xml"/>
</g:body>
</g:element>
The editor definition element <g:element>
binds a user interface component to a target XML element specified by the qualified name contained within the g:targetName
attribute. The editor definition element <g:attribute>
binds a user interface component to a target XML attribute specified by the qualified name contained within the g:targetName
attribute. In the above example, the g:extends
attribute is used to leverage definition components that provide predefined user interface functionality. The editor definition attributes g:minOccurs
and g:maxOccurs
define the multiplicity for the target XML element. They mirror corresponding attributes within XML Schema. By default g:minOccurs='1'
and g:maxOccurs='1'
. The editor definition attribute g:use
defines the whether an attribute is optional or required. Attributes are optional by default.
This is a picture of the above snippet rendered on an HTML page.
This is the generated XML document.
<?xml version="1.0" encoding="UTF-8"?>
<ex:example xmlns:ex="http://www.example.com">
<ex:element1>elementValue1</ex:element1>
<ex:element2 ex:attribute1="Tab1-attributeValue1" ex:attribute2="Tab1-attributeValue2"/>
<ex:element2 ex:attribute1="Tab2-attributeValue1" ex:attribute2="Tab2-attributeValue2"/>
</ex:example>
Back to Geoportal XML Editor