Author: tchemit Date: 2008-02-12 13:38:55 +0000 (Tue, 12 Feb 2008) New Revision: 196 Modified: trunk/jaxx/src/main/java/jaxx/compiler/CompiledObject.java Log: formattage code Modified: trunk/jaxx/src/main/java/jaxx/compiler/CompiledObject.java =================================================================== --- trunk/jaxx/src/main/java/jaxx/compiler/CompiledObject.java 2008-02-12 13:38:42 UTC (rev 195) +++ trunk/jaxx/src/main/java/jaxx/compiler/CompiledObject.java 2008-02-12 13:38:55 UTC (rev 196) @@ -115,14 +115,16 @@ */ public CompiledObject(String id, String javaCode, ClassDescriptor objectClass, JAXXCompiler compiler, boolean force) throws CompilerException { if (!force) { - if (!isValidID(id)) + if (!isValidID(id)) { compiler.reportError("the id '" + id + "' is not a valid Java identifier"); + } } this.id = id; this.javaCode = javaCode; - if (objectClass == null) + if (objectClass == null) { throw new NullPointerException(); + } this.objectClass = objectClass; } @@ -132,8 +134,9 @@ if (id.length() == 0) valid = false; if (valid) { - if (!Character.isJavaIdentifierStart(id.charAt(0))) + if (!Character.isJavaIdentifierStart(id.charAt(0))) { valid = false; + } if (valid) { for (int i = 1; i < id.length(); i++) { if (!Character.isJavaIdentifierPart(id.charAt(i))) { @@ -207,8 +210,9 @@ * @param parent the parent container */ public void setParent(CompiledObject parent) { - if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) + if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) { throw new IllegalArgumentException("parent must descend from java.awt.Container"); + } this.parent = parent; } @@ -443,8 +447,9 @@ */ public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { try { - if (constraints != null) + if (constraints != null) { constraints = compiler.checkJavaCode(constraints); + } } catch (CompilerException e) { compiler.reportError("While parsing 'constraints' attribute: " + e.getMessage()); @@ -452,18 +457,21 @@ if (!child.isOverride()) { TagHandler tagHandler = TagManager.getTagHandler(getObjectClass()); - if (tagHandler instanceof DefaultComponentHandler && !((DefaultComponentHandler) tagHandler).isContainer()) + if (tagHandler instanceof DefaultComponentHandler && !((DefaultComponentHandler) tagHandler).isContainer()) { compiler.reportError("component " + this + " may not have children"); + } String containerDelegate = ((DefaultComponentHandler) tagHandler).getContainerDelegate(); String delegateCode = containerDelegate != null ? "." + containerDelegate + "()" : ""; child.setParent(this); - if (constraints != null) + if (constraints != null) { appendAdditionCode(getJavaCode() + delegateCode + ".add(" + child.getJavaCode() + ", " + constraints + ");"); - else + } + else { appendAdditionCode(getJavaCode() + delegateCode + ".add(" + child.getJavaCode() + ");"); + } } }
participants (1)
-
tchemit@users.labs.libre-entreprise.org