Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "STP/Policy Component/XEF Reference"
(→Catalogue Modifiers) |
(→Spinners) |
||
Line 274: | Line 274: | ||
</xs:attribute></pre> | </xs:attribute></pre> | ||
|} | |} | ||
+ | |||
+ | === Pattern validation (TODO) === | ||
+ | {| border="1" cellspacing="0" cellpadding="4" | ||
+ | |- valign="top" | ||
+ | ! Annotation | ||
+ | | type="..." with types that represent integers >= 0 | ||
+ | |- valign="top" | ||
+ | ! Description | ||
+ | | Elements and attributes that have an integer type >= 0 will be rendered as spinner controls. Since spinners can't show negative values types that can hold negative values will not be rendered as a spinner. | ||
+ | |- valign="top" | ||
+ | ! Applies to | ||
+ | | <xs:element> and <xs:attribute> | ||
+ | |- valign="top" | ||
+ | ! Before | ||
+ | | [[Image:XEFSpinnerBefore.jpg]] | ||
+ | |- valign="top" | ||
+ | ! After | ||
+ | | [[Image:XEFSpinnerAfter.jpg]] | ||
+ | |- valign="top" | ||
+ | ! Example | ||
+ | | | ||
+ | <pre><xs:attribute name="sample_interval" type="xs:positiveInteger" default="5000"/></pre> | ||
+ | |} | ||
+ | |||
+ | |||
+ | === Required text and examples (TODO) === | ||
+ | {| border="1" cellspacing="0" cellpadding="4" | ||
+ | |- valign="top" | ||
+ | ! Annotation | ||
+ | | type="..." with types that represent integers >= 0 | ||
+ | |- valign="top" | ||
+ | ! Description | ||
+ | | Elements and attributes that have an integer type >= 0 will be rendered as spinner controls. Since spinners can't show negative values types that can hold negative values will not be rendered as a spinner. | ||
+ | |- valign="top" | ||
+ | ! Applies to | ||
+ | | <xs:element> and <xs:attribute> | ||
+ | |- valign="top" | ||
+ | ! Before | ||
+ | | [[Image:XEFSpinnerBefore.jpg]] | ||
+ | |- valign="top" | ||
+ | ! After | ||
+ | | [[Image:XEFSpinnerAfter.jpg]] | ||
+ | |- valign="top" | ||
+ | ! Example | ||
+ | | | ||
+ | <pre><xs:attribute name="sample_interval" type="xs:positiveInteger" default="5000"/></pre> | ||
+ | |} | ||
+ | |||
=== Spinners === | === Spinners === |
Revision as of 07:12, 14 December 2007
XEF Reference
Contents
- 1 XEF Reference
- 1.1 Basics
- 1.2 Password fields & filters
- 1.3 Context-sensitive values
- 1.4 Subelements in <sequence> and <choice> groups
- 1.5 Catalogue Modifiers
- 1.6 Registering specific field editors
- 1.7 Supported XML Schema data types
The way the XEF editor renders widgets is based on the XML Schema definition of the elements and attributes. It can be influenced by putting addition information in the schema, or by providing annotations. The annotations are divided over two namespaces, xef (http://schemas.eclipse.org/stp/xsd/2006/05/xef) and xefgui (http://schemas.eclipse.org/stp/xsd/2006/05/xef/gui). The xef namespace contains information that is not purely GUI-related (e.g. it could also be used for non-gui purposes such as generating extra documentation around an element). The xefgui namespace contains purely widget-related information.
The xef and xefgui namespaces are documented in their own XML-Schema files that can be found in the following locations: [xef] [xefgui]
Below you can find a list of the various ways in which the XEF editor can be influenced.
Basics
Category
Annotation | <xef:category> - String |
---|---|
Description | Provides categorization for the element or attribute. For elements the category is used in the Schema Selection Dialog, for attributes the category is used to put the attribute in a collapsible section in the editor. |
Applies to | <xs:element> and <xs:attribute> |
Before |
|
After |
|
Example |
<xs:element name="audit"> <xs:annotation> <xs:appinfo> <xef:category>Logging</xef:category> </xs:appinfo> </xs:annotation> </xs:element> |
Boolean values
Defaults
Display Name
Annotation | <xef:displayName> - String |
---|---|
Description | Provides a human readable name for the attribute or element. |
Applies to | <xs:element> and <xs:attribute> |
Before |
|
After |
|
Example |
<xs:attribute name="every_client" type="xs:boolean"> <xs:annotation> <xs:appinfo> <xef:displayName>Every Client</xef:displayName> </xs:appinfo> </xs:annotation> </xs:attribute> |
Drop-down Combo
Multi-line text
Read-Only Widgets
Getting a field displayed using read-only widgets is possible in two ways:
- using the
fixed="..."
attribute in the XML Schema definition. This doesn't allow the value to be changed at all. - There is an alternative for when it's desirable that the editor doesn't change it. The use of
<xefgui:widget>read_only</xefgui:widget>
simply draws a readonly widget. In this case the value can still be changed in the underlying XML.
In both cases the way the read-only field is presented to the user is the same.
Fixing the value in the Schema
Marking the widget as Read-Only
Pattern validation (TODO)
Required text and examples (TODO)
Spinners
Tool Tips
Units
Password fields & filters
Password fields provide a way to hide what the user types in as a password. Password filters provide a puggable way to process these passwords before they are stored in the XML.
Password Fields
Password Filters
Annotation | <xef:filter> - (filter ID) |
---|---|
Description | Password filtering allows the password entered using a password widget to be processed before it is stored in the XML file. This prevents users from seeing the actual password entered by looking at the XML source of the document being edited.
Password filters implement the package org.eclipse.stp.ui.xef.editor; public interface TextFilter { public String filter(String data); } New password filters can be provided in eclipse plugins and need to be registered through the A number of sample filters are provided with the XEF editor, e.g. <extension point="org.eclipse.stp.xef.xefExtension"> <filter class="org.eclipse.stp.ui.xef.editor.SimpleHashFilter" filterId="SimpleHashFilter"/> </extension> The There is also a |
Applies to | attributes of type <xs:string> |
Before | The password text uses the default filter to protect passwords, for a password "abcd" entered, the XML would contain the following:
<example:audit xmlns:example="http://www.example.com/xsd/2006/02/test_audit" lock_password="2987074" /> |
After | The password uses our ReverseTextFilter, which is not very secure but clearly demonstrates the filtering functionality. This filter simply reverses the string, so the XML will be:
<example:audit xmlns:example="http://www.example.com/xsd/2006/02/test_audit" lock_password="dcba" /> |
Example | <xs:attribute name="lock_password" type="xs:string"> <xs:annotation> <xs:appinfo> <xef:displayName>Lock Password</xef:displayName> <xef:filter>ReverseTextFilter</xef:filter> <xefgui:widget>password</xefgui:widget> </xs:appinfo> </xs:annotation> </xs:attribute |
Context-sensitive values
Subelements in <sequence> and <choice> groups
Catalogue Modifiers
Registering specific field editors
Supported XML Schema data types
- xsd:boolean
- xsd:byte
- xsd:decimal (currently unvalidated)
- xsd:double (currently unvalidated)
- xsd:float (currently unvalidated)
- xsd:int (currently unvalidated)
- xsd:integer (currently unvalidated)
- xsd:long
- xsd:NCName - Unqualified names
- xsd:negativeInteger (currently unvalidated)
- xsd:nonNegativeInteger
- xsd:nonPositiveInteger (currently unvalidated)
- xsd:positiveInteger
- xsd:QName - Renders a QName editor
- xsd:short (currently unvalidated)
- xsd:string
- xsd:unsignedByte
- xsd:unsignedInt
- xsd:unsignedLong (currently unvalidated)
- xsd:unsignedShort
other schema types work too but will render as a text field.