Skip to content

Commit

Permalink
Merge pull request #14 from mrovnanik/master
Browse files Browse the repository at this point in the history
Updating "update_161105" with the latest code changes.
  • Loading branch information
mrovnanik authored Nov 11, 2016
2 parents 93fc69a + 1c90234 commit 6a7681a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// tasks.withType(GroovyCompile) { options.compilerArgs << "-Xlint:unchecked" }
// tasks.withType(GroovyCompile) { options.compilerArgs << "-Xlint:deprecation" }

version = '2.0.0-rc1'
version = '2.0.0-SNAPSHOT'

apply plugin: 'groovy'
apply plugin: 'war'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ class ScreenForm {
}
}
} else if ("option".equals(childNode.name)) {
String key = ec.resource.expand(childNode.attribute('key'), null)
String key = ec.resource.expandNoL10n(childNode.attribute('key'), null)
String text = ec.resource.expand(childNode.attribute('text'), null)
options.put(key, text ?: key)
}
Expand All @@ -978,7 +978,7 @@ class ScreenForm {
String key = null
String keyAttr = childNode.attribute('key')
if (keyAttr != null && keyAttr.length() > 0) {
key = ec.resource.expand(keyAttr, null)
key = ec.resource.expandNoL10n(keyAttr, null)
// we just did a string expand, if it evaluates to a literal "null" then there was no value
if (key == "null") key = null
} else if (listOptionEvb != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,8 @@ class ScreenRenderImpl implements ScreenRender {
// NOTE: defaultValue is handled below so that for a plain string it is not run through expand
Object obj = getFieldValue(fieldNodeWrapper, "")
if (ObjectUtilities.isEmpty(obj) && defaultValue != null && defaultValue.length() > 0)
return ec.resourceFacade.expand(defaultValue, "")
return ec.resourceFacade.expandNoL10n(defaultValue, "")
return ObjectUtilities.toPlainString(obj)
// NOTE: this approach causes problems with currency fields, but kills the string expand for default-value... a better approach?
//return obj ? obj.toString() : (defaultValue ? ec.getResource().expand(defaultValue, null) : "")
}

Object getFieldValue(MNode fieldNode, String defaultValue) {
Expand Down
2 changes: 1 addition & 1 deletion moqui-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" }

version = '1.0.0-rc1'
version = '1.0.0-SNAPSHOT'

apply plugin: 'java'
// to run gradle-versions-plugin use "gradle dependencyUpdates"
Expand Down
8 changes: 4 additions & 4 deletions moqui-util/src/main/java/org/moqui/util/MNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ public void endElement(String ns, String localName, String qName) {
private static final FtlNodeListWrapper emptyNodeListWrapper = new FtlNodeListWrapper(new ArrayList<>(), null);
private FtlNodeListWrapper allChildren = null;
private ConcurrentHashMap<String, TemplateModel> attrAndChildrenByName = null;
private Set<String> knownNullAttributes = null;
private ConcurrentHashMap<String, Boolean> knownNullAttributes = null;

public Object getAdaptedObject(Class aClass) { return this; }

Expand All @@ -775,7 +775,7 @@ public void endElement(String ns, String localName, String qName) {
TemplateModel attrOrChildWrapper = attrAndChildrenByName.get(s);
if (attrOrChildWrapper != null) return attrOrChildWrapper;
}
if (knownNullAttributes != null && knownNullAttributes.contains(s)) return null;
if (knownNullAttributes != null && knownNullAttributes.containsKey(s)) return null;

// at this point we got a null value but attributes and child nodes were pre-loaded so return null or empty list
if (s.startsWith("@")) {
Expand All @@ -790,8 +790,8 @@ public void endElement(String ns, String localName, String qName) {
String attrName = s.substring(1, s.length());
String attrValue = attributeMap.get(attrName);
if (attrValue == null) {
if (knownNullAttributes == null) knownNullAttributes = new HashSet<>();
knownNullAttributes.add(s);
if (knownNullAttributes == null) knownNullAttributes = new ConcurrentHashMap<>();
knownNullAttributes.put(s, Boolean.TRUE);
return null;
} else {
FtlAttributeWrapper attrWrapper = new FtlAttributeWrapper(attrName, attrValue, this);
Expand Down

0 comments on commit 6a7681a

Please sign in to comment.