Skip to content
Snippets Groups Projects
Commit 11ba588a authored by srosse's avatar srosse
Browse files

OO-4493: hide the component check in isNotZero / isTrue velocity methods

parent e6ca4030
No related branches found
No related tags found
No related merge requests found
...@@ -832,6 +832,22 @@ public class VelocityRenderDecorator implements Closeable { ...@@ -832,6 +832,22 @@ public class VelocityRenderDecorator implements Closeable {
return notEmpty; return notEmpty;
} }
public boolean isNotZero(Object obj) {
boolean notZero;
if(obj == null) {
notZero = false;
} else if(obj instanceof Number) {
notZero = ((Number)obj).intValue() != 0;
} else if(obj instanceof Collection) {
notZero = !((Collection<?>)obj).isEmpty();
} else if(obj instanceof Map) {
notZero = !((Map<?,?>)obj).isEmpty();
} else {
notZero = true;
}
return notZero;
}
public int parseInt(String text) { public int parseInt(String text) {
try { try {
if(StringHelper.containsNonWhitespace(text)) { if(StringHelper.containsNonWhitespace(text)) {
...@@ -843,8 +859,8 @@ public class VelocityRenderDecorator implements Closeable { ...@@ -843,8 +859,8 @@ public class VelocityRenderDecorator implements Closeable {
} }
} }
public String replace(String text, String target, String replacement) { public String replace(String text, String targetString, String replacement) {
return text.replace(target, replacement); return text.replace(targetString, replacement);
} }
/** /**
......
#set ($notEmpty = $r.getComponent("table").getFlexiTableElement().getRowCount() > 0) #set ($notEmpty = $r.isNotZero($r.getComponent("table").getFlexiTableElement().getRowCount()))
## inSearch to detect group management ## inSearch to detect group management
#set ($inSearch = $r.getComponent("table").getFlexiTableElement().isExtendedSearchExpanded()) #set ($inSearch = $r.isTrue($r.getComponent("table").getFlexiTableElement().isExtendedSearchExpanded()))
#if($notEmpty || $inSearch) #if($notEmpty || $inSearch)
$r.render("table") $r.render("table")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment