Author: nmalin
Date: Wed Feb 14 23:15:11 2018
New Revision: 1824274

URL: http://svn.apache.org/viewvc?rev=1824274&view=rev
Log:
Implemented: Add CustomScreen entity copy from CustomMethod pattern 
(OFBIZ-10186) 
With this entity we can define some different widget screens available on the 
system (organised by type) to link with other entities for resolve a specific 
screen to use for a specific context (future actual case to implement, select a 
invoice pdf screen linked to a party) without framework modification

Added:
    
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
   (with props)
Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml
    ofbiz/ofbiz-framework/trunk/framework/common/entitydef/entitymodel.xml

Modified: ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml?rev=1824274&r1=1824273&r2=1824274&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml 
(original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/config/CommonUiLabels.xml Wed 
Feb 14 23:15:11 2018
@@ -2825,6 +2825,10 @@
         <value xml:lang="zh">缺省组织机构</value>
         <value xml:lang="zh-TW">預設組織機構團體代號</value>
     </property>
+    <property key="CommonDefaultScreen">
+        <value xml:lang="en">Default Screen</value>
+        <value xml:lang="fr">Écran par défault</value>
+    </property>
     <property key="CommonDeferred">
         <value xml:lang="ar">مؤجل</value>
         <value xml:lang="cs">Odložený</value>
@@ -13848,6 +13852,14 @@
         <value xml:lang="zh">当前状态标识</value>
         <value xml:lang="zh-TW">目前狀態識別</value>
     </property>
+    <property key="FormFieldTitle_customScreenId">
+        <value xml:lang="en">Custom screen</value>
+        <value xml:lang="fr">Écran dédié</value>
+    </property>
+    <property key="FormFieldTitle_customScreenTypeId">
+        <value xml:lang="en">custom screen type</value>
+        <value xml:lang="fr">Type d'écran dédié</value>
+    </property>
     <property key="FormFieldTitle_deleteButton">
         <value xml:lang="ar">حذف</value>
         <value xml:lang="cs">Smazat</value>

Modified: ofbiz/ofbiz-framework/trunk/framework/common/entitydef/entitymodel.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/entitydef/entitymodel.xml?rev=1824274&r1=1824273&r2=1824274&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/entitydef/entitymodel.xml 
(original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/entitydef/entitymodel.xml Wed 
Feb 14 23:15:11 2018
@@ -658,6 +658,37 @@ under the License.
       <prim-key field="userPrefGroupTypeId"/>
     </entity>
 
+    <!-- ========================================================= -->
+    <!-- org.apache.ofbiz.common.screen -->
+    <!-- ========================================================= -->
+
+    <entity entity-name="CustomScreen"
+        package-name="org.apache.ofbiz.common.screen"
+        default-resource-name="CommonEntityLabels"
+        title="Custom Screen Entity">
+        <field name="customScreenId" type="id"/>
+        <field name="customScreenTypeId" type="id"/>
+        <field name="customScreenName" type="long-varchar"/>
+        <field name="customScreenLocation" type="long-varchar"/>
+        <field name="description" type="description"/>
+        <prim-key field="customScreenId"/>
+        <relation type="one" fk-name="CSCR_TO_TYPE" 
rel-entity-name="CustomScreenType">
+            <key-map field-name="customScreenTypeId"/>
+        </relation>
+    </entity>
+    <entity entity-name="CustomScreenType"
+        package-name="org.apache.ofbiz.common.screen"
+        title="Custom Screen Type Entity">
+        <field name="customScreenTypeId" type="id"/>
+        <field name="parentTypeId" type="id"/>
+        <field name="hasTable" type="indicator"/>
+        <field name="description" type="description"/>
+        <prim-key field="customScreenTypeId"/>
+        <relation type="many" fk-name="CSCR_TYPE_CHILD" title="Child" 
rel-entity-name="CustomScreenType">
+            <key-map field-name="customScreenTypeId" 
rel-field-name="parentTypeId"/>
+        </relation>
+    </entity>
+
     <!-- ============================ -->
     <!-- org.apache.ofbiz.common.theme -->
     <!-- ============================ -->

Added: 
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy?rev=1824274&view=auto
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
 (added)
+++ 
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
 Wed Feb 14 23:15:11 2018
@@ -0,0 +1,32 @@
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityTypeUtil
+import org.apache.ofbiz.entity.util.EntityUtil
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+List customScreenTypeIds = []
+if (context.customScreenTypeId) {
+    GenericValue customScreenType = 
from('CustomScreenType').where([customScreenTypeId: 
customScreenTypeId]).cache().queryOne()
+    if (customScreenType) {
+        List<GenericValue> customScreenTypes = 
EntityTypeUtil.getDescendantTypes(customScreenType)
+        customScreenTypeIds = 
EntityUtil.getFieldListFromEntityList(customScreenTypes, 'customScreenTypeId', 
true)
+    }
+}
+context.customScreenTypeIds = customScreenTypeIds
\ No newline at end of file

Propchange: 
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: 
ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/ChildrenCustomScreenTypes.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to