details: /erp/devel/pi/rev/74be53157a46
changeset: 9092:74be53157a46
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Mon Dec 13 10:08:11 2010 +0100
summary: Now columns without validation will be computed at the beginning,
not at the end
details: /erp/devel/pi/rev/c26e8201a772
changeset: 9093:c26e8201a772
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Mon Dec 13 10:10:01 2010 +0100
summary: Modified UIDefinitionController so that button references are taken
into account
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
| 3 +-
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/EnumUIDefinition.java
| 11 +---
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java
| 25 ++++++++++
3 files changed, 30 insertions(+), 9 deletions(-)
diffs (125 lines):
diff -r 8b9b48bcc283 -r c26e8201a772
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Mon Dec 13 09:57:49 2010 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Mon Dec 13 10:10:01 2010 +0100
@@ -180,7 +180,7 @@
// Next step is to calculate the values for the columns
ArrayList<String> calloutsToCall = new ArrayList<String>();
- ArrayList<String> allColumns = new ArrayList<String>(sortedColumns);
+ ArrayList<String> allColumns = new ArrayList<String>();
// we add the columns not included in the sortedColumns
// (the ones which don't have validations)
for (Field field : fields) {
@@ -188,6 +188,7 @@
allColumns.add(field.getColumn().getDBColumnName());
}
}
+ allColumns.addAll(sortedColumns);
for (String col : allColumns) {
Field field = columnsOfFields.get(col);
diff -r 8b9b48bcc283 -r c26e8201a772
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/EnumUIDefinition.java
---
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/EnumUIDefinition.java
Mon Dec 13 09:57:49 2010 +0100
+++
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/EnumUIDefinition.java
Mon Dec 13 10:10:01 2010 +0100
@@ -44,14 +44,9 @@
public String getFieldProperties(Field field, boolean getValueFromSession) {
String columnValue;
try {
- if (field.getColumn().getReference().getId().equals("17")) {
- columnValue = new JSONObject(super.getFieldProperties(field,
getValueFromSession))
- .getString("value");
- return getValueInComboReference(field, getValueFromSession,
columnValue);
- } else {
- System.out.println("Invalid reference: " +
field.getColumn().getReference());
- return super.getFieldProperties(field, getValueFromSession);
- }
+ columnValue = new JSONObject(super.getFieldProperties(field,
getValueFromSession))
+ .getString("value");
+ return getValueInComboReference(field, getValueFromSession, columnValue);
} catch (JSONException e) {
throw new OBException("Error while computing combo data", e);
}
diff -r 8b9b48bcc283 -r c26e8201a772
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java
---
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java
Mon Dec 13 09:57:49 2010 +0100
+++
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java
Mon Dec 13 10:10:01 2010 +0100
@@ -18,8 +18,10 @@
*/
package org.openbravo.client.kernel.reference;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
@@ -67,11 +69,17 @@
private Map<String, UIDefinition> cachedDefinitions = null;
private Map<String, UIDefinition> uiDefinitionsByColumnId = null;
private Map<String, FormatDefinition> formatDefinitions = null;
+ private List<Reference> buttonReferences = null;
+ private List<String> buttonColumns = null;
+ private UIDefinition buttonDefinition = null;
public UIDefinition getUIDefinition(String columnId) {
if (cachedDefinitions == null) {
setInitCachedDefinitions();
}
+ if (buttonColumns.contains(columnId)) {
+ return buttonDefinition;
+ }
final UIDefinition uiDefinition = uiDefinitionsByColumnId.get(columnId);
if (uiDefinition == null) {
log.warn("NO UIDefinition found for columnId " + columnId);
@@ -83,6 +91,9 @@
if (cachedDefinitions == null) {
setInitCachedDefinitions();
}
+ if (buttonReferences.contains(reference)) {
+ return buttonDefinition;
+ }
final UIDefinition uiDefinition = cachedDefinitions.get(reference.getId());
if (uiDefinition == null) {
log.warn("NO UIDefinition found for reference " + reference.getId());
@@ -115,6 +126,8 @@
}
final Map<String, UIDefinition> localCachedDefinitions = new
HashMap<String, UIDefinition>();
final Map<String, UIDefinition> localUIDefinitionsByColumn = new
HashMap<String, UIDefinition>();
+ final ArrayList<Reference> localButtonReferences = new
ArrayList<Reference>();
+ final ArrayList<String> localButtonColumns = new ArrayList<String>();
OBContext.setAdminMode();
try {
@@ -133,6 +146,11 @@
}
localCachedDefinitions.put(reference.getId(), uiDefinition);
+
+ Reference buttonReference = OBDal.getInstance().get(Reference.class,
"28");
+ final Class<?> clz = OBClassLoader.getInstance().loadClass(
+
buttonReference.getOBCLKERUIDefinitionList().get(0).getImplementationClassname());
+ buttonDefinition = (UIDefinition) clz.newInstance();
} catch (Exception e) {
throw new OBException("Exception when creating UIDefinition for
reference " + reference,
e);
@@ -143,6 +161,11 @@
for (Column column : columnQry.list()) {
final String referenceId;
if (column.getReferenceSearchKey() != null) {
+ if (DalUtil.getId(column.getReference()).equals("28")) {
+ // This reference is a button reference. We will add it to the
button references
+ localButtonReferences.add(column.getReferenceSearchKey());
+ localButtonColumns.add(column.getId());
+ }
referenceId = (String) DalUtil.getId(column.getReferenceSearchKey());
} else {
referenceId = (String) DalUtil.getId(column.getReference());
@@ -155,6 +178,8 @@
}
uiDefinitionsByColumnId = localUIDefinitionsByColumn;
cachedDefinitions = localCachedDefinitions;
+ buttonReferences = localButtonReferences;
+ buttonColumns = localButtonColumns;
}
private UIDefinition getUIDefinitionImplementation(Reference reference)
throws Exception {
------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages,
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits