Modified: ofbiz/branches/release14.12/framework/widget/dtd/widget-screen.xsd
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/widget/dtd/widget-screen.xsd?rev=1662488&r1=1662487&r2=1662488&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/widget/dtd/widget-screen.xsd (original) +++ ofbiz/branches/release14.12/framework/widget/dtd/widget-screen.xsd Thu Feb 26 16:16:11 2015 @@ -95,7 +95,6 @@ under the License. <!-- ================ ACTIONS ================ --> - <xs:element name="AllActions" abstract="true" /> <xs:element name="actions"> <xs:complexType> <xs:sequence> @@ -103,97 +102,6 @@ under the License. </xs:sequence> </xs:complexType> </xs:element> - <xs:element name="set" substitutionGroup="AllActions"> - <xs:complexType> - <xs:attribute type="xs:string" name="field" use="required" /> - <xs:attribute type="xs:string" name="from-field" /> - <xs:attribute type="xs:string" name="value" /> - <xs:attribute type="xs:string" name="default-value" /> - <xs:attribute name="global" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="type"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="PlainString" /> - <xs:enumeration value="String" /> - <xs:enumeration value="BigDecimal" /> - <xs:enumeration value="Double" /> - <xs:enumeration value="Float" /> - <xs:enumeration value="List" /> - <xs:enumeration value="Long" /> - <xs:enumeration value="Integer" /> - <xs:enumeration value="Date" /> - <xs:enumeration value="Time" /> - <xs:enumeration value="Timestamp" /> - <xs:enumeration value="Boolean" /> - <xs:enumeration value="Object" /> - <xs:enumeration value="NewList" /> - <xs:enumeration value="NewMap" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="to-scope" default="screen"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="screen" /> - <xs:enumeration value="user" /> - <xs:enumeration value="application" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="from-scope" default="screen"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="screen" /> - <xs:enumeration value="user" /> - <xs:enumeration value="application" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="property-map" substitutionGroup="AllActions"> - <xs:complexType> - <xs:attribute type="xs:string" name="resource" use="required" /> - <xs:attribute type="xs:string" name="map-name" use="required" /> - <xs:attribute name="global" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="property-to-field" substitutionGroup="AllActions"> - <xs:complexType> - <xs:attribute type="xs:string" name="resource" use="required" /> - <xs:attribute type="xs:string" name="property" use="required" /> - <xs:attribute type="xs:string" name="field" use="required" /> - <xs:attribute type="xs:string" name="default" /> - <xs:attribute name="no-locale" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute type="xs:string" name="arg-list-name" /> - </xs:complexType> - </xs:element> - <xs:element name="script" substitutionGroup="AllActions"> - <xs:complexType> - <xs:attribute type="xs:string" name="location" use="required" /> - </xs:complexType> - </xs:element> <xs:element name="service" substitutionGroup="AllActions"> <xs:complexType> <xs:sequence> @@ -208,7 +116,6 @@ under the License. </xs:attribute> </xs:complexType> </xs:element> - <xs:element name="entity-and" substitutionGroup="AllActions"> <xs:complexType> <xs:sequence> @@ -305,190 +212,6 @@ under the License. </xs:attribute> </xs:complexType> </xs:element> - <xs:element name="entity-one" substitutionGroup="AllActions"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="field-map" /> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="select-field" /> - </xs:sequence> - <xs:attribute name="entity-name" type="xs:string" use="required" /> - <xs:attribute name="value-field" type="xs:string" use="required" /> - <xs:attribute name="use-cache" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="auto-field-map" default="true"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="get-related-one" substitutionGroup="AllActions"> - <xs:complexType> - <xs:attribute name="value-field" type="xs:string" use="required" /> - <xs:attribute name="relation-name" type="xs:string" use="required" /> - <xs:attribute name="use-cache" type="xs:string" default="false" /> - <xs:attribute name="to-value-field" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="get-related" substitutionGroup="AllActions"> - <xs:complexType> - <xs:attribute type="xs:string" name="value-field" use="required" /> - <xs:attribute type="xs:string" name="relation-name" use="required" /> - <xs:attribute type="xs:string" name="map" /> - <xs:attribute type="xs:string" name="order-by-list" /> - <xs:attribute type="xs:string" name="use-cache" default="false" /> - <xs:attribute type="xs:string" name="list" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="condition-list"> - <xs:complexType> - <xs:choice maxOccurs="unbounded"> - <xs:element ref="condition-expr" /> - <xs:element ref="condition-list" /> - <xs:element ref="condition-object" /> - </xs:choice> - <xs:attribute name="combine" default="and"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="and" /> - <xs:enumeration value="or" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="having-condition-list"> - <xs:complexType> - <xs:choice maxOccurs="unbounded"> - <xs:element ref="condition-expr" /> - <xs:element ref="condition-list" /> - <xs:element ref="condition-object" /> - </xs:choice> - <xs:attribute name="combine" default="and"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="and" /> - <xs:enumeration value="or" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="condition-expr"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - <xs:attribute name="operator" default="equals"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="less" /> - <xs:enumeration value="greater" /> - <xs:enumeration value="less-equals" /> - <xs:enumeration value="greater-equals" /> - <xs:enumeration value="equals" /> - <xs:enumeration value="not-equals" /> - <xs:enumeration value="in" /> - <xs:enumeration value="not-in" /> - <xs:enumeration value="between" /> - <xs:enumeration value="like" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute type="xs:string" name="from-field" /> - <xs:attribute type="xs:string" name="value" /> - <xs:attribute name="ignore-if-null" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="ignore-if-empty" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="ignore-case" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="ignore" default="false"> - <xs:annotation> - <xs:documentation> - Ignore the condition if flag is true. - Defaults to false. - </xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="condition-object"> - <xs:complexType> - <xs:attribute type="xs:string" name="field" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="select-field"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="order-by"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="limit-range"> - <xs:complexType> - <xs:attribute name="start" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a non-negative integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="size" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a non-negative integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="limit-view"> - <xs:complexType> - <xs:attribute name="view-index" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a non-negative integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="view-size" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a positive integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="use-iterator" /> - <xs:element name="field-map"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - <xs:attribute type="xs:string" name="from-field" /> - <xs:attribute type="xs:string" name="value" /> - </xs:complexType> - </xs:element> <!-- ================ WIDGETS ================ --> @@ -581,138 +304,7 @@ under the License. <xs:attribute type="xs:string" name="style" /> </xs:complexType> </xs:element> - <xs:element name="link" substitutionGroup="AllWidgets"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" ref="auto-parameters-service" /> - <xs:element minOccurs="0" ref="auto-parameters-entity" /> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="parameter" /> - <xs:element minOccurs="0" ref="image" /> - </xs:sequence> - <xs:attribute type="xs:string" name="text" /> - <xs:attribute type="xs:string" name="id" /> - <xs:attribute type="xs:string" name="style" /> - <xs:attribute type="xs:string" name="target" /> - <xs:attribute type="xs:string" name="name" /> - <xs:attribute type="xs:string" name="target-window" /> - <xs:attribute type="xs:string" name="prefix" /> - <xs:attribute type="xs:string" name="width" /> - <xs:attribute type="xs:string" name="height" /> - <xs:attribute name="link-type" default="auto"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="auto"> - <xs:annotation> - <xs:documentation> - If selected the hidden-form type will be used if the url-mode is intra-app - and the request specified has an event, otherwise the anchor type will be used, - except if the ajax-window mode is specified. - </xs:documentation> - </xs:annotation> - </xs:enumeration> - <xs:enumeration value="anchor" /> - <xs:enumeration value="hidden-form" /> - <xs:enumeration value="ajax-window" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="url-mode" default="intra-app"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="intra-app" /> - <xs:enumeration value="inter-app" /> - <xs:enumeration value="content" /> - <xs:enumeration value="plain" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="full-path" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="secure" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="encode" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="parameter"> - <xs:complexType> - <xs:attribute type="xs:string" name="param-name" use="required" /> - <xs:attribute type="xs:string" name="from-field" /> - <xs:attribute type="xs:string" name="value" /> - </xs:complexType> - </xs:element> - <xs:element name="auto-parameters-service"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="exclude" /> - </xs:sequence> - <xs:attribute name="service-name" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>The service name used to resolve parameters. If empty, use form defaultServiceName. Flexible string allowed.</xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="send-if-empty" default="true"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="auto-parameters-entity"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="exclude" /> - </xs:sequence> - <xs:attribute name="entity-name" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>The entity name used to resolve parameters. If empty use form defaultEntityName attribute. Flexible string allowed.</xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="include" default="pk"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="pk" /> - <xs:enumeration value="nonpk" /> - <xs:enumeration value="all" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="send-if-empty" default="true"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="exclude"> - <xs:complexType> - <xs:attribute name="field-name" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> + <xs:element name="link" type="link" substitutionGroup="AllWidgets"/> <xs:element name="screenlet" substitutionGroup="AllWidgets"> <xs:complexType> @@ -848,6 +440,20 @@ under the License. <xs:complexType> <xs:attribute type="xs:string" name="name" use="required" /> <xs:attribute type="xs:string" name="location" use="required" /> + <xs:attribute name="share-scope" default="false"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="true" /> + <xs:enumeration value="false" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="include-grid" substitutionGroup="AllWidgets"> + <xs:complexType> + <xs:attribute type="xs:string" name="name" use="required" /> + <xs:attribute type="xs:string" name="location" use="required" /> <xs:attribute name="share-scope" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> Modified: ofbiz/branches/release14.12/framework/widget/dtd/widget-tree.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/widget/dtd/widget-tree.xsd?rev=1662488&r1=1662487&r2=1662488&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/widget/dtd/widget-tree.xsd (original) +++ ofbiz/branches/release14.12/framework/widget/dtd/widget-tree.xsd Thu Feb 26 16:16:11 2015 @@ -18,6 +18,7 @@ specific language governing permissions under the License. --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + <xs:include schemaLocation="http://ofbiz.apache.org/dtds/widget-common.xsd" /> <xs:element name="trees"> <xs:complexType> <xs:sequence> @@ -61,8 +62,9 @@ under the License. <xs:element name="node"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" ref="condition" /> + <xs:element name="condition" type="ConditionRootType" minOccurs="0" /> <xs:choice minOccurs="0"> + <xs:element ref="actions" /> <xs:element ref="entity-one" /> <xs:element ref="service" /> </xs:choice> @@ -94,6 +96,7 @@ under the License. <xs:complexType> <xs:sequence> <xs:choice> + <xs:element ref="actions" /> <xs:element ref="entity-and" /> <xs:element ref="service" /> <xs:element ref="entity-condition" /> @@ -103,7 +106,6 @@ under the License. <xs:attribute type="xs:string" name="node-name" use="required" /> </xs:complexType> </xs:element> - <xs:element name="include-screen"> <xs:complexType> <xs:attribute type="xs:string" name="name" use="required" /> @@ -125,83 +127,14 @@ under the License. <xs:attribute type="xs:string" name="style" /> </xs:complexType> </xs:element> - <xs:element name="link"> + <xs:element name="link" type="link"/> + <xs:element name="actions"> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="parameter" /> - <xs:element minOccurs="0" ref="image" /> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="AllActions"/> </xs:sequence> - <xs:attribute type="xs:string" name="text" /> - <xs:attribute type="xs:string" name="id" /> - <xs:attribute type="xs:string" name="style" /> - <xs:attribute type="xs:string" name="name" /> - <xs:attribute type="xs:string" name="title" /> - <xs:attribute type="xs:string" name="target" /> - <xs:attribute type="xs:string" name="target-window" /> - <xs:attribute type="xs:string" name="prefix" /> - <xs:attribute name="url-mode" default="intra-app"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="intra-app" /> - <xs:enumeration value="inter-app" /> - <xs:enumeration value="content" /> - <xs:enumeration value="plain" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="full-path" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="secure" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="encode" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="parameter"> - <xs:complexType> - <xs:attribute type="xs:string" name="param-name" use="required" /> - <xs:attribute type="xs:string" name="from-field" /> - <xs:attribute type="xs:string" name="value" /> - </xs:complexType> - </xs:element> - <xs:element name="image"> - <xs:complexType mixed="true"> - <xs:attribute type="xs:string" name="src"/> - <xs:attribute type="xs:string" name="id"/> - <xs:attribute type="xs:string" name="style"/> - <xs:attribute type="xs:string" name="width"/> - <xs:attribute type="xs:string" name="height"/> - <xs:attribute type="xs:string" name="border"/> - <xs:attribute name="url-mode" default="content"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ofbiz"/> - <xs:enumeration value="content"/> - <xs:enumeration value="raw"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> </xs:complexType> </xs:element> - <xs:element name="service"> <xs:complexType> <xs:sequence> @@ -215,12 +148,10 @@ under the License. </xs:annotation> </xs:attribute> <xs:attribute type="xs:string" name="result-map-list" /> - <!-- deprecated, use result-map-list instead <xs:attribute type="xs:string" name="result-map-list-iterator-name"/> --> <xs:attribute type="xs:string" name="result-map-value" /> <xs:attribute type="xs:string" name="value" /> </xs:complexType> </xs:element> - <xs:element name="entity-and"> <xs:complexType> <xs:sequence> @@ -311,355 +242,10 @@ under the License. </xs:attribute> </xs:complexType> </xs:element> - <xs:element name="entity-one"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="field-map" /> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="select-field" /> - </xs:sequence> - <xs:attribute name="entity-name" type="xs:string" use="required" /> - <xs:attribute name="value-field" type="xs:string" /> - <xs:attribute name="use-cache" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="auto-field-map" default="true"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - - <xs:element name="order-by"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="select-field"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="limit-range"> - <xs:complexType> - <xs:attribute name="start" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a non-negative integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="size" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a non-negative integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="limit-view"> - <xs:complexType> - <xs:attribute name="view-index" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a non-negative integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="view-size" type="xs:string" use="required"> - <xs:annotation> - <xs:documentation>Should resolve into a positive integer.</xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="use-iterator" /> - <xs:element name="field-map"> - <xs:complexType> - <xs:attribute type="xs:string" name="field-name" use="required" /> - <xs:attribute type="xs:string" name="from-field" /> - <xs:attribute type="xs:string" name="value" /> - </xs:complexType> - </xs:element> <xs:element name="out-field-map"> <xs:complexType> <xs:attribute type="xs:string" name="field-name" use="required" /> <xs:attribute type="xs:string" name="to-field-name" /> </xs:complexType> </xs:element> - - <xs:element name="condition-list"> - <xs:complexType> - <xs:choice maxOccurs="unbounded"> - <xs:element ref="condition-expr" /> - <xs:element ref="condition-list" /> - </xs:choice> - <xs:attribute name="combine" default="and"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="and" /> - <xs:enumeration value="or" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="having-condition-list"> - <xs:complexType> - <xs:choice maxOccurs="unbounded"> - <xs:element ref="condition-expr" /> - <xs:element ref="condition-list" /> - </xs:choice> - <xs:attribute name="combine" default="and"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="and" /> - <xs:enumeration value="or" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="condition-expr"> - <xs:complexType> - <xs:attribute name="field-name" type="xs:string" use="required" /> - <xs:attribute name="operator" default="equals"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="less" /> - <xs:enumeration value="greater" /> - <xs:enumeration value="less-equals" /> - <xs:enumeration value="greater-equals" /> - <xs:enumeration value="equals" /> - <xs:enumeration value="not-equals" /> - <xs:enumeration value="in" /> - <xs:enumeration value="between" /> - <xs:enumeration value="like" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="from-field" type="xs:string" /> - <xs:attribute name="value" type="xs:string" /> - <xs:attribute name="ignore-if-null" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="ignore-if-empty" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="ignore-case" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="ignore" default="false"> - <xs:annotation> - <xs:documentation> - Ignore the condition if flag is true. - Defaults to false. - </xs:documentation> - </xs:annotation> - </xs:attribute> - </xs:complexType> - </xs:element> - - <!-- ================ CONDITIONS ================ --> - <xs:element name="AllConditionals" abstract="true"/> - <xs:element name="condition"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="1" maxOccurs="1" ref="AllConditionals"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="and" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" ref="AllConditionals"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="xor" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" ref="AllConditionals"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="or" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" ref="AllConditionals"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="not" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:sequence> - <xs:element ref="AllConditionals"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="if-has-permission" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:attribute type="xs:string" name="permission" use="required" /> - <xs:attribute type="xs:string" name="action" /> - </xs:complexType> - </xs:element> - <xs:element name="if-entity-permission" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:choice minOccurs="0"> - <xs:element minOccurs="0" maxOccurs="1" ref="permission-condition-getter" /> - <xs:element minOccurs="0" maxOccurs="1" ref="related-role-getter" /> - <xs:element minOccurs="0" maxOccurs="1" ref="auxiliary-value-getter" /> - </xs:choice> - <xs:attribute type="xs:string" name="entity-name" use="required" /> - <xs:attribute type="xs:string" name="entity-id" use="required" /> - <xs:attribute type="xs:string" name="target-operation" use="required" /> - <xs:attribute name="display-fail-cond" default="false"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="true" /> - <xs:enumeration value="false" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - <xs:element name="permission-condition-getter"> - <xs:complexType> - <xs:attribute type="xs:string" name="entity-name" /> - <xs:attribute type="xs:string" name="operation-field-name" /> - <xs:attribute type="xs:string" name="role-field-name" /> - <xs:attribute type="xs:string" name="auxiliary-field-name" /> - <xs:attribute type="xs:string" name="status-field-name" /> - <xs:attribute type="xs:string" name="privilege-field-name" /> - </xs:complexType> - </xs:element> - <xs:element name="related-role-getter"> - <xs:complexType> - <xs:attribute type="xs:string" name="entity-name" /> - <xs:attribute type="xs:string" name="role-entity-name" /> - <xs:attribute type="xs:string" name="role-type-field-name" /> - <xs:attribute type="xs:string" name="party-field-name" /> - <xs:attribute type="xs:string" name="owner-entity-field-name" /> - <xs:attribute type="xs:string" name="entity-id-name" /> - </xs:complexType> - </xs:element> - <xs:element name="auxiliary-value-getter"> - <xs:complexType> - <xs:attribute type="xs:string" name="entity-name" /> - <xs:attribute type="xs:string" name="auxiliary-field-name" /> - <xs:attribute type="xs:string" name="entity-id-name" /> - </xs:complexType> - </xs:element> - <xs:element name="if-validate-method" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:attribute type="xs:string" name="field" use="required" /> - <xs:attribute type="xs:string" name="method" use="required" /> - <xs:attribute type="xs:string" name="class" default="org.ofbiz.base.util.UtilValidate" /> - </xs:complexType> - </xs:element> - <xs:element name="if-compare" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:attribute name="field" type="xs:string" use="required" /> - <xs:attribute name="operator" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="less" /> - <xs:enumeration value="greater" /> - <xs:enumeration value="less-equals" /> - <xs:enumeration value="greater-equals" /> - <xs:enumeration value="equals" /> - <xs:enumeration value="not-equals" /> - <xs:enumeration value="contains" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute type="xs:string" name="value" use="required" /> - <xs:attribute name="type" default="String"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="PlainString" /> - <xs:enumeration value="String" /> - <xs:enumeration value="BigDecimal" /> - <xs:enumeration value="Double" /> - <xs:enumeration value="Float" /> - <xs:enumeration value="Long" /> - <xs:enumeration value="Integer" /> - <xs:enumeration value="Date" /> - <xs:enumeration value="Time" /> - <xs:enumeration value="Timestamp" /> - <xs:enumeration value="Boolean" /> - <xs:enumeration value="Object" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="format" type="xs:string" /> - </xs:complexType> - </xs:element> - <xs:element name="if-compare-field" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:attribute name="field" type="xs:string" use="required" /> - <xs:attribute name="operator" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="less" /> - <xs:enumeration value="greater" /> - <xs:enumeration value="less-equals" /> - <xs:enumeration value="greater-equals" /> - <xs:enumeration value="equals" /> - <xs:enumeration value="not-equals" /> - <xs:enumeration value="contains" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="to-field" type="xs:string" /> - <xs:attribute name="type" default="String"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="PlainString" /> - <xs:enumeration value="String" /> - <xs:enumeration value="BigDecimal" /> - <xs:enumeration value="Double" /> - <xs:enumeration value="Float" /> - <xs:enumeration value="Long" /> - <xs:enumeration value="Integer" /> - <xs:enumeration value="Date" /> - <xs:enumeration value="Time" /> - <xs:enumeration value="Timestamp" /> - <xs:enumeration value="Boolean" /> - <xs:enumeration value="Object" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute type="xs:string" name="format" /> - </xs:complexType> - </xs:element> - <xs:element name="if-regexp" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:attribute type="xs:string" name="field" use="required" /> - <xs:attribute type="xs:string" name="expr" use="required" /> - </xs:complexType> - </xs:element> - <xs:element name="if-empty" substitutionGroup="AllConditionals"> - <xs:complexType> - <xs:attribute type="xs:string" name="field" use="required"/> - </xs:complexType> - </xs:element> </xs:schema> \ No newline at end of file Modified: ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetFactory.java?rev=1662488&r1=1662487&r2=1662488&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetFactory.java (original) +++ ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetFactory.java Thu Feb 26 16:16:11 2015 @@ -29,9 +29,9 @@ import java.util.concurrent.ConcurrentHa import org.ofbiz.base.util.Assert; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; -import org.ofbiz.widget.screen.IterateSectionWidget; -import org.ofbiz.widget.screen.ModelScreen; -import org.ofbiz.widget.screen.ModelScreenWidget; +import org.ofbiz.widget.model.IterateSectionWidget; +import org.ofbiz.widget.model.ModelScreen; +import org.ofbiz.widget.model.ModelScreenWidget; import org.w3c.dom.Element; /** Modified: ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=1662488&r1=1662487&r2=1662488&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) +++ ofbiz/branches/release14.12/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Thu Feb 26 16:16:11 2015 @@ -20,16 +20,9 @@ package org.ofbiz.widget; import java.io.IOException; import java.io.StringWriter; -import java.math.BigDecimal; import java.net.URLEncoder; import java.nio.charset.Charset; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; import java.util.Map; -import java.util.TimeZone; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -38,33 +31,23 @@ import javax.servlet.http.HttpServletRes import org.apache.commons.lang.StringEscapeUtils; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilCodec; -import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.base.util.UtilXml; -import org.ofbiz.base.util.collections.FlexibleMapAccessor; -import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.Delegator; -import org.ofbiz.entity.model.ModelEntity; -import org.ofbiz.entity.model.ModelField; -import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; -import org.ofbiz.service.ModelParam; -import org.ofbiz.service.ModelService; import org.ofbiz.webapp.control.ConfigXMLReader; import org.ofbiz.webapp.control.RequestHandler; import org.ofbiz.webapp.control.WebAppConfigurationException; import org.ofbiz.webapp.taglib.ContentUrlTag; -import org.ofbiz.widget.form.ModelForm; -import org.ofbiz.widget.form.ModelFormField; -import org.w3c.dom.Element; +import org.ofbiz.widget.model.ModelForm; +import org.ofbiz.widget.model.ModelFormField; -public class WidgetWorker { +public final class WidgetWorker { public static final String module = WidgetWorker.class.getName(); - public WidgetWorker () {} + private WidgetWorker () {} public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, Map<String, String> parameterMap, String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { @@ -331,202 +314,6 @@ public class WidgetWorker { return formName + modelForm.getItemIndexSeparator() + modelFormField.getName(); } } - - /** - * Models the <parameter> element. - * - * @see <code>widget-form.xsd</code> - */ - public static class Parameter { - protected String name; - protected FlexibleStringExpander value; - protected FlexibleMapAccessor<Object> fromField; - - public Parameter(Element element) { - this.name = element.getAttribute("param-name"); - this.value = UtilValidate.isNotEmpty(element.getAttribute("value")) ? FlexibleStringExpander.getInstance(element.getAttribute("value")) : null; - this.fromField = UtilValidate.isNotEmpty(element.getAttribute("from-field")) ? FlexibleMapAccessor.getInstance(element.getAttribute("from-field")) : null; - } - - public Parameter(String paramName, String paramValue, boolean isField) { - this.name = paramName; - if (isField) { - this.fromField = FlexibleMapAccessor.getInstance(paramValue); - } else { - this.value = FlexibleStringExpander.getInstance(paramValue); - } - } - - public String getName() { - return name; - } - - public String getValue(Map<String, Object> context) { - if (this.value != null) { - return this.value.expandString(context); - } - - Object retVal = null; - if (this.fromField != null && this.fromField.get(context) != null) { - retVal = this.fromField.get(context); - } else { - retVal = context.get(this.name); - } - - if (retVal != null) { - TimeZone timeZone = (TimeZone) context.get("timeZone"); - if (timeZone == null) timeZone = TimeZone.getDefault(); - - String returnValue = null; - // format string based on the user's time zone (not locale because these are parameters) - if (retVal instanceof Double || retVal instanceof Float || retVal instanceof BigDecimal) { - returnValue = retVal.toString(); - } else if (retVal instanceof java.sql.Date) { - DateFormat df = UtilDateTime.toDateFormat(UtilDateTime.DATE_FORMAT, timeZone, null); - returnValue = df.format((java.util.Date) retVal); - } else if (retVal instanceof java.sql.Time) { - DateFormat df = UtilDateTime.toTimeFormat(UtilDateTime.TIME_FORMAT, timeZone, null); - returnValue = df.format((java.util.Date) retVal); - } else if (retVal instanceof java.sql.Timestamp) { - DateFormat df = UtilDateTime.toDateTimeFormat(UtilDateTime.DATE_TIME_FORMAT, timeZone, null); - returnValue = df.format((java.util.Date) retVal); - } else if (retVal instanceof java.util.Date) { - DateFormat df = UtilDateTime.toDateTimeFormat("EEE MMM dd hh:mm:ss z yyyy", timeZone, null); - returnValue = df.format((java.util.Date) retVal); - } else { - returnValue = retVal.toString(); - } - return returnValue; - } else { - return null; - } - } - } - - public static class AutoServiceParameters { - private String serviceName; - List<String> excludeList = new ArrayList<String>(); - boolean includePk; - boolean includeNonPk; - boolean sendIfEmpty; - public AutoServiceParameters(Element autoElement){ - serviceName = UtilXml.checkEmpty(autoElement.getAttribute("service-name")); - sendIfEmpty = "true".equals(autoElement.getAttribute("send-if-empty")); - List<? extends Element> excludes = UtilXml.childElementList(autoElement, "exclude"); - if (excludes != null) { - for (Element exclude: excludes) { - if (UtilValidate.isNotEmpty(exclude.getAttribute("field-name"))) { - excludeList.add(exclude.getAttribute("field-name")); - } - } - } - } - - @SuppressWarnings("unchecked") - public Map<String, String> getParametersMap(Map<String, Object> context, String defaultServiceName) { - Map<String, String> autServiceParams = new HashMap<String, String>(); - LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher"); - if (dispatcher == null) { - Debug.logError("We can not append auto service Parameters since we could not find dispatcher in the current context", module); - return autServiceParams; - } - if (UtilValidate.isEmpty(serviceName)) serviceName = defaultServiceName; - FlexibleStringExpander toExpand = FlexibleStringExpander.getInstance(serviceName); - ModelService service = null; - try { - service = dispatcher.getDispatchContext().getModelService(toExpand.toString()); - } catch (GenericServiceException e) { - Debug.logError("Resolve service throw an error : " + e, module); - } - if (service == null) { - Debug.logError("We can not append auto service Parameters since we could not find service with name [" + serviceName + "]", module); - return autServiceParams; - } - - Iterator<ModelParam> paramsIter = service.getInModelParamList().iterator(); - if (paramsIter != null) { - while (paramsIter.hasNext()) { - ModelParam param = paramsIter.next(); - if (param.getInternal()) continue; - String paramName = param.getName(); - FlexibleMapAccessor<Object> fma = FlexibleMapAccessor.getInstance(paramName); - if (!excludeList.contains(paramName)) { - Object flexibleValue = fma.get(context); - if (UtilValidate.isEmpty(flexibleValue) && context.containsKey("parameters")) { - flexibleValue = fma.get((Map<String, ? extends Object>) context.get("parameters")); - } - if (UtilValidate.isNotEmpty(flexibleValue) || sendIfEmpty) { - autServiceParams.put(paramName, String.valueOf(flexibleValue)); - } - } - } - } - return autServiceParams; - } - } - - public static class AutoEntityParameters { - private String entityName; - private String includeType; - List<String> excludeList = new ArrayList<String>(); - boolean includePk; - boolean includeNonPk; - boolean sendIfEmpty; - public AutoEntityParameters(Element autoElement){ - entityName = UtilXml.checkEmpty(autoElement.getAttribute("entity-name")); - sendIfEmpty = "true".equals(autoElement.getAttribute("send-if-empty")); - includeType = UtilXml.checkEmpty(autoElement.getAttribute("include")); - includePk = "pk".equals(includeType) || "all".equals(includeType); - includeNonPk = "nonpk".equals(includeType) || "all".equals(includeType); - List<? extends Element> excludes = UtilXml.childElementList(autoElement, "exclude"); - if (excludes != null) { - for (Element exclude: excludes) { - if (UtilValidate.isNotEmpty(exclude.getAttribute("field-name"))) { - excludeList.add(exclude.getAttribute("field-name")); - } - } - } - } - - @SuppressWarnings("unchecked") - public Map<String, String> getParametersMap(Map<String, Object> context, String defaultEntityName) { - Map<String, String> autEntityParams = new HashMap<String, String>(); - Delegator delegator = (Delegator) context.get("delegator"); - if (delegator == null) { - Debug.logError("We can not append auto entity Parameters since we could not find delegator in the current context", module); - return autEntityParams; - } - if (UtilValidate.isEmpty(entityName)) entityName = defaultEntityName; - FlexibleStringExpander toExpand = FlexibleStringExpander.getInstance(entityName); - ModelEntity entity = delegator.getModelEntity(toExpand.expandString(context)); - if (entity == null) { - Debug.logError("We can not append auto entity Parameters since we could not find entity with name [" + entityName + "]", module); - return autEntityParams; - } - - Iterator<ModelField> fieldsIter = entity.getFieldsIterator(); - if (fieldsIter != null) { - while (fieldsIter.hasNext()) { - ModelField field = fieldsIter.next(); - String fieldName = field.getName(); - FlexibleMapAccessor<Object> fma = FlexibleMapAccessor.getInstance(fieldName); - boolean shouldExclude = excludeList.contains(fieldName); - if ((!shouldExclude) && (!field.getIsAutoCreatedInternal()) - && ((field.getIsPk() && includePk) || (!field.getIsPk() && includeNonPk))) { - Object flexibleValue = fma.get(context); - if (UtilValidate.isEmpty(flexibleValue) && context.containsKey("parameters")) { - flexibleValue = fma.get((Map<String, Object>) context.get("parameters")); - } - if (UtilValidate.isNotEmpty(flexibleValue) || sendIfEmpty) { - autEntityParams.put(fieldName, String.valueOf(flexibleValue)); - } - } - } - } - return autEntityParams; - } - } - public static String determineAutoLinkType(String linkType, String target, String targetType, HttpServletRequest request) { if ("auto".equals(linkType)) { if ("intra-app".equals(targetType)) { |
Free forum by Nabble | Edit this page |