details:   /erp/devel/pi/rev/e90d0c13ca1d
changeset: 9313:e90d0c13ca1d
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed Dec 22 18:02:30 2010 +0100
summary:   [fl] Initial implementation of Form layout

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
                                                        |   5 +
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
                                                       |  46 ++++++++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
                                                             |   5 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
                                                                    |   6 +-
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-application-styles.js
 |   8 +
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
       |   6 +-
 
modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
                                                                             |  
 2 +-
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TextUIDefinition.java
                                                                 |  39 ++++++++
 8 files changed, 112 insertions(+), 5 deletions(-)

diffs (235 lines):

diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
      Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
      Wed Dec 22 18:02:30 2010 +0100
@@ -27,6 +27,11 @@
         inpColumnName: '${fieldDefinition.inpColumnName?string}',
         referencedKeyColumnName: 
'${fieldDefinition.referencedKeyColumnName?string}',
         required: ${fieldDefinition.required?string},
+        colSpan: ${fieldDefinition.colSpan},
+        rowSpan: ${fieldDefinition.rowSpan},
+        startRow: ${fieldDefinition.startRow},
+        endRow: ${fieldDefinition.endRow},
+        width: '*',
         </#if>
         ${fieldDefinition.fieldProperties}
         dummy: "dummy"
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
     Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
     Wed Dec 22 18:02:30 2010 +0100
@@ -48,6 +48,12 @@
 
   private static final String TEMPLATE_ID = "C1D176407A354A40815DC46D24D70EB8";
 
+  // Based on WAD implementation legacy code
+  // 22 - Half column
+  // 44 - One column
+  private static final long ONE_COLUMN_MAX_LENGTH = 44;
+  private static final long MULTILINE_MIN_LENGTH = 60;
+
   private Tab tab;
 
   protected Template getComponentTemplate() {
@@ -127,6 +133,14 @@
 
     public String getReferencedKeyColumnName();
 
+    public String getStartRow();
+
+    public String getEndRow();
+
+    public long getColSpan();
+
+    public long getRowSpan();
+
   }
 
   public class OBViewField implements OBViewFieldDefinition {
@@ -235,6 +249,22 @@
     public String getDataSourceId() {
       return property.getTargetEntity().getName();
     }
+
+    public long getColSpan() {
+      return field.getDisplayedLength() > ONE_COLUMN_MAX_LENGTH ? 2 : 1;
+    }
+
+    public String getEndRow() {
+      return "false";
+    }
+
+    public long getRowSpan() {
+      return field.getDisplayedLength() >= MULTILINE_MIN_LENGTH ? 2 : 1;
+    }
+
+    public String getStartRow() {
+      return "false";
+    }
   }
 
   public class OBViewFieldGroup implements OBViewFieldDefinition {
@@ -293,6 +323,22 @@
     public String getName() {
       return fieldGroup.getId();
     }
+
+    public long getColSpan() {
+      return 1;
+    }
+
+    public String getEndRow() {
+      return "false";
+    }
+
+    public long getRowSpan() {
+      return 1;
+    }
+
+    public String getStartRow() {
+      return "false";
+    }
   }
 
   public static class FormFieldComparator implements Comparator<Field> {
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Wed Dec 22 18:02:30 2010 +0100
@@ -20,6 +20,7 @@
 // Contains the following widgets:
 // * OBFormButton: button used in forms.
 // * OBTextItem: string/text item
+// * OBTextAreaItem: string/text-area item
 // * OBDateItem: FormItem for dates
 // * OBDateTimeItem: FormItem for DateTime
 // * OBNumber: FormItem for numbers
@@ -47,6 +48,10 @@
 // Input for normal strings
 isc.ClassFactory.defineClass('OBTextItem', TextItem);
 
+// == OBTextAreaItem ==
+// Input for large strings
+isc.ClassFactory.defineClass('OBTextAreaItem', TextAreaItem);
+
 // == OBListComboBoxItem ==
 // Combo box for list references
 isc.ClassFactory.defineClass('OBListComboBoxItem', ComboBoxItem);
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Wed Dec 22 18:02:30 2010 +0100
@@ -29,9 +29,13 @@
   // handles this form
   // and the grid and other related components.
   view: null,
-  numCols: 4,
   auxInputs: {},
   dynamicCols: [],
+
+  // ** {{ Layout Settings }} **
+  numCols: 4,
+  colWidths: ['24%', '24%', '24%', '24%'],
+  //cellBorder: 1, // debug layout
   
   fieldsByInpColumnName: null,
   fieldsByColumnName: null,
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-application-styles.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-application-styles.js
       Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-application-styles.js
       Wed Dec 22 18:02:30 2010 +0100
@@ -40,6 +40,14 @@
   textBoxStyle: 'OBFormFieldInput'
 });
 
+isc.OBTextAreaItem.addProperties({
+  errorOrientation: 'left',
+  width: '100%',
+  cellStyle: 'OBFormField',
+  titleStyle: 'OBFormFieldLabel',
+  textBoxStyle: 'OBFormFieldInput'
+});
+
 OB.DefaultPickListStyleProperties = {
   pickListTallBaseStyle: 'OBFormField',
   cellStyle: 'OBFormField',
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
     Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
     Wed Dec 22 18:02:30 2010 +0100
@@ -32,7 +32,7 @@
 .OBFormFieldError,
 .OBFormFieldFocused {
        font-family: 'lucida sans', sans-serif;
-  width: 100%;
+  /*width: 100%;*/
 }
 
 .OBFormFieldLabel,
@@ -62,7 +62,7 @@
   font-family: arial, sans-serif; 
   font-size: 12px;
   line-height: normal;
-  width: 100%;
+  /*width: 100%;*/
 }
 
 .OBFormFieldInputDisabled,
@@ -80,7 +80,7 @@
   font-family: arial, sans-serif; 
   font-size: 12px;
   color: #333;
-  width: 100%;
+  /*width: 100%;*/
   border: 0px 0px 0px 0px;
 }
 
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
--- 
a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
   Wed Dec 22 20:23:44 2010 +0100
+++ 
b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
   Wed Dec 22 18:02:30 2010 +0100
@@ -166,7 +166,7 @@
 <!--82EF543CDC66498897FC83536CE5AC16-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--82EF543CDC66498897FC83536CE5AC16-->  
<AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
 <!--82EF543CDC66498897FC83536CE5AC16-->  
<AD_REFERENCE_ID><![CDATA[14]]></AD_REFERENCE_ID>
-<!--82EF543CDC66498897FC83536CE5AC16-->  
<CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.StringUIDefinition]]></CLASSNAME>
+<!--82EF543CDC66498897FC83536CE5AC16-->  
<CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.TextUIDefinition]]></CLASSNAME>
 <!--82EF543CDC66498897FC83536CE5AC16-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--82EF543CDC66498897FC83536CE5AC16--></OBCLKER_UIDEFINITION>
 
diff -r a11656814bfd -r e90d0c13ca1d 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TextUIDefinition.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TextUIDefinition.java
       Wed Dec 22 18:02:30 2010 +0100
@@ -0,0 +1,39 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.client.kernel.reference;
+
+/**
+ * Implements Text (textarea) UI Definition
+ * 
+ * @author iperdomo
+ * 
+ */
+public class TextUIDefinition extends StringUIDefinition {
+
+  @Override
+  public String getParentType() {
+    return "textArea";
+  }
+
+  @Override
+  public String getFormEditorType() {
+    return "OBTextAreaItem";
+  }
+}

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to