]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/template/IfStatement.java
UPD: Move some template classes to there reightful place.
[gigi.git] / src / org / cacert / gigi / output / template / IfStatement.java
index 02687630b8ab84757944ddae45c1103927b92905..db0cbe11f07f20132ebdad1503ed82695686f849 100644 (file)
@@ -3,23 +3,24 @@ package org.cacert.gigi.output.template;
 import java.io.PrintWriter;
 import java.util.Map;
 
-import org.cacert.gigi.Language;
-import org.cacert.gigi.output.Outputable;
+import org.cacert.gigi.localisation.Language;
 
-final class IfStatement implements Outputable {
-       private final String variable;
-       private final TemplateBlock body;
+public final class IfStatement implements Outputable {
 
-       IfStatement(String variable, TemplateBlock body) {
-               this.variable = variable;
-               this.body = body;
-       }
+    private final String variable;
 
-       @Override
-       public void output(PrintWriter out, Language l, Map<String, Object> vars) {
-               Object o = vars.get(variable);
-               if (o instanceof Boolean && o == Boolean.TRUE) {
-                       body.output(out, l, vars);
-               }
-       }
-}
\ No newline at end of file
+    private final TemplateBlock body;
+
+    public IfStatement(String variable, TemplateBlock body) {
+        this.variable = variable;
+        this.body = body;
+    }
+
+    @Override
+    public void output(PrintWriter out, Language l, Map<String, Object> vars) {
+        Object o = vars.get(variable);
+        if ( !(o == Boolean.FALSE || o == null)) {
+            body.output(out, l, vars);
+        }
+    }
+}