Fix parse complex properties
This commit is contained in:
parent
28fdd139fb
commit
07c297a95a
2 changed files with 22 additions and 23 deletions
|
@ -58,14 +58,13 @@ public class RenderingRule {
|
|||
attributesRef[i] = storage.getRenderingAttributeRule(vl.substring(1));
|
||||
} else if (property.isString()) {
|
||||
intProperties[i] = storage.getDictionaryValue(vl);
|
||||
} else if (property.isFloat()) {
|
||||
if (floatProperties == null) {
|
||||
} else {
|
||||
float floatVal = property.parseFloatValue(vl);
|
||||
if (floatProperties == null && floatVal != 0) {
|
||||
// lazy creates
|
||||
floatProperties = new float[attributes.size()];
|
||||
}
|
||||
floatProperties[i] = property.parseFloatValue(vl);
|
||||
intProperties[i] = property.parseIntValue(vl);
|
||||
} else {
|
||||
}
|
||||
intProperties[i] = property.parseIntValue(vl);
|
||||
}
|
||||
i++;
|
||||
|
|
|
@ -155,12 +155,7 @@ public class RenderingRuleProperty {
|
|||
try {
|
||||
int colon = value.indexOf(':');
|
||||
if(colon != -1) {
|
||||
int c = 0;
|
||||
if(colon > 0) {
|
||||
c += (int) Float.parseFloat(value.substring(0, colon));
|
||||
}
|
||||
c += (int) Float.parseFloat(value.substring(colon + 1));
|
||||
return c;
|
||||
return (int) Float.parseFloat(value.substring(colon + 1));
|
||||
}
|
||||
return (int) Float.parseFloat(value);
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -190,30 +185,35 @@ public class RenderingRuleProperty {
|
|||
} catch (NumberFormatException e) {
|
||||
log.error("Rendering parse " + value + " in " + attrName);
|
||||
}
|
||||
return -1;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public float parseFloatValue(String value){
|
||||
if(type == FLOAT_TYPE){
|
||||
public float parseFloatValue(String value) {
|
||||
try {
|
||||
if (type == FLOAT_TYPE) {
|
||||
int colon = value.indexOf(':');
|
||||
if(colon != -1) {
|
||||
if(colon > 0) {
|
||||
if (colon != -1) {
|
||||
if (colon > 0) {
|
||||
return Float.parseFloat(value.substring(0, colon));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return Float.parseFloat(value);
|
||||
|
||||
} else if (type == INT_TYPE) {
|
||||
int colon = value.indexOf(':');
|
||||
if (colon != -1 && colon > 0) {
|
||||
return Float.parseFloat(value.substring(0, colon));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("Rendering parse " + value + " in " + attrName);
|
||||
}
|
||||
return -1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue