# HG changeset patch # User Jaroslav Tulach # Date 1358681390 -3600 # Node ID 4b59fa013d492a2e8e31b757e702b3e572597ee0 # Parent 9288ecf9657cf4a4ac418c1c24b29811bbb6eb0a Multiple page handlers can be in the same package diff -r 9288ecf9657c -r 4b59fa013d49 javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java Sat Jan 19 06:07:49 2013 +0100 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java Sun Jan 20 12:29:50 2013 +0100 @@ -95,7 +95,7 @@ append(type).append("(\"").append(id).append("\");\n"); } w.append(" static {\n"); - if (!initializeOnClick(pe, w, pp)) { + if (!initializeOnClick((TypeElement) e, w, pp)) { return false; } w.append(" }\n"); @@ -138,14 +138,13 @@ return id.toUpperCase(Locale.ENGLISH).replace('.', '_'); } - private boolean initializeOnClick(PackageElement pe, Writer w, ProcessPage pp) throws IOException { + private boolean initializeOnClick(TypeElement type, Writer w, ProcessPage pp) throws IOException { TypeMirror stringType = processingEnv.getElementUtils().getTypeElement("java.lang.String").asType(); - for (Element clazz : pe.getEnclosedElements()) { - if (clazz.getKind() != ElementKind.CLASS) { - continue; - } - TypeElement type = (TypeElement)clazz; - for (Element method : clazz.getEnclosedElements()) { + { //for (Element clazz : pe.getEnclosedElements()) { + // if (clazz.getKind() != ElementKind.CLASS) { + // continue; + // } + for (Element method : type.getEnclosedElements()) { On oc = method.getAnnotation(On.class); if (oc != null) { for (String id : oc.id()) { diff -r 9288ecf9657c -r 4b59fa013d49 javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ModelTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ModelTest.java Sun Jan 20 12:29:50 2013 +0100 @@ -0,0 +1,34 @@ +/** + * Back 2 Browser Bytecode Translator + * Copyright (C) 2012 Jaroslav Tulach + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. Look for COPYING file in the top folder. + * If not, see http://opensource.org/licenses/GPL-2.0. + */ +package org.apidesign.bck2brwsr.htmlpage; + +import org.apidesign.bck2brwsr.htmlpage.api.Page; +import static org.testng.Assert.*; +import org.testng.annotations.Test; + +/** + * + * @author Jaroslav Tulach + */ +@Page(xhtml = "Empty.html", className = "Model") +public class ModelTest { + @Test public void classGenerated() { + Class c = Model.class; + assertNotNull(c, "Class for empty page generated"); + } +} diff -r 9288ecf9657c -r 4b59fa013d49 javaquery/api/src/test/resources/org/apidesign/bck2brwsr/htmlpage/Empty.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/api/src/test/resources/org/apidesign/bck2brwsr/htmlpage/Empty.html Sun Jan 20 12:29:50 2013 +0100 @@ -0,0 +1,29 @@ + + + + + + Empty + + + Empty page + +