1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java Sat Jan 19 06:07:49 2013 +0100
1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/PageProcessor.java Sun Jan 20 12:29:50 2013 +0100
1.3 @@ -95,7 +95,7 @@
1.4 append(type).append("(\"").append(id).append("\");\n");
1.5 }
1.6 w.append(" static {\n");
1.7 - if (!initializeOnClick(pe, w, pp)) {
1.8 + if (!initializeOnClick((TypeElement) e, w, pp)) {
1.9 return false;
1.10 }
1.11 w.append(" }\n");
1.12 @@ -138,14 +138,13 @@
1.13 return id.toUpperCase(Locale.ENGLISH).replace('.', '_');
1.14 }
1.15
1.16 - private boolean initializeOnClick(PackageElement pe, Writer w, ProcessPage pp) throws IOException {
1.17 + private boolean initializeOnClick(TypeElement type, Writer w, ProcessPage pp) throws IOException {
1.18 TypeMirror stringType = processingEnv.getElementUtils().getTypeElement("java.lang.String").asType();
1.19 - for (Element clazz : pe.getEnclosedElements()) {
1.20 - if (clazz.getKind() != ElementKind.CLASS) {
1.21 - continue;
1.22 - }
1.23 - TypeElement type = (TypeElement)clazz;
1.24 - for (Element method : clazz.getEnclosedElements()) {
1.25 + { //for (Element clazz : pe.getEnclosedElements()) {
1.26 + // if (clazz.getKind() != ElementKind.CLASS) {
1.27 + // continue;
1.28 + // }
1.29 + for (Element method : type.getEnclosedElements()) {
1.30 On oc = method.getAnnotation(On.class);
1.31 if (oc != null) {
1.32 for (String id : oc.id()) {
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ModelTest.java Sun Jan 20 12:29:50 2013 +0100
2.3 @@ -0,0 +1,34 @@
2.4 +/**
2.5 + * Back 2 Browser Bytecode Translator
2.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 + *
2.8 + * This program is free software: you can redistribute it and/or modify
2.9 + * it under the terms of the GNU General Public License as published by
2.10 + * the Free Software Foundation, version 2 of the License.
2.11 + *
2.12 + * This program is distributed in the hope that it will be useful,
2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 + * GNU General Public License for more details.
2.16 + *
2.17 + * You should have received a copy of the GNU General Public License
2.18 + * along with this program. Look for COPYING file in the top folder.
2.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
2.20 + */
2.21 +package org.apidesign.bck2brwsr.htmlpage;
2.22 +
2.23 +import org.apidesign.bck2brwsr.htmlpage.api.Page;
2.24 +import static org.testng.Assert.*;
2.25 +import org.testng.annotations.Test;
2.26 +
2.27 +/**
2.28 + *
2.29 + * @author Jaroslav Tulach <jtulach@netbeans.org>
2.30 + */
2.31 +@Page(xhtml = "Empty.html", className = "Model")
2.32 +public class ModelTest {
2.33 + @Test public void classGenerated() {
2.34 + Class<?> c = Model.class;
2.35 + assertNotNull(c, "Class for empty page generated");
2.36 + }
2.37 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/javaquery/api/src/test/resources/org/apidesign/bck2brwsr/htmlpage/Empty.html Sun Jan 20 12:29:50 2013 +0100
3.3 @@ -0,0 +1,29 @@
3.4 +<?xml version="1.0" encoding="UTF-8"?>
3.5 +<!--
3.6 +
3.7 + Back 2 Browser Bytecode Translator
3.8 + Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.9 +
3.10 + This program is free software: you can redistribute it and/or modify
3.11 + it under the terms of the GNU General Public License as published by
3.12 + the Free Software Foundation, version 2 of the License.
3.13 +
3.14 + This program is distributed in the hope that it will be useful,
3.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.17 + GNU General Public License for more details.
3.18 +
3.19 + You should have received a copy of the GNU General Public License
3.20 + along with this program. Look for COPYING file in the top folder.
3.21 + If not, see http://opensource.org/licenses/GPL-2.0.
3.22 +
3.23 +-->
3.24 +<!DOCTYPE html>
3.25 +<html xmlns="http://www.w3.org/1999/xhtml">
3.26 + <head>
3.27 + <title>Empty</title>
3.28 + </head>
3.29 + <body>
3.30 + Empty page
3.31 + </body>
3.32 +</html>