1.1 --- a/htmlpage/src/test/java/org/apidesign/bck2brwsr/htmlpage/PageController.java Fri Nov 09 09:00:46 2012 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,57 +0,0 @@
1.4 -/**
1.5 - * Back 2 Browser Bytecode Translator
1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify
1.9 - * it under the terms of the GNU General Public License as published by
1.10 - * the Free Software Foundation, version 2 of the License.
1.11 - *
1.12 - * This program is distributed in the hope that it will be useful,
1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 - * GNU General Public License for more details.
1.16 - *
1.17 - * You should have received a copy of the GNU General Public License
1.18 - * along with this program. Look for COPYING file in the top folder.
1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
1.20 - */
1.21 -package org.apidesign.bck2brwsr.htmlpage;
1.22 -
1.23 -import org.apidesign.bck2brwsr.htmlpage.api.OnClick;
1.24 -import org.apidesign.bck2brwsr.htmlpage.api.Page;
1.25 -
1.26 -/** Trivial demo for the bck2brwsr project. First of all start
1.27 - * with <a href="TestPage.html">your XHTML page</a>. Include there
1.28 - * a script that will <em>boot Java</em> in your browser.
1.29 - * <p>
1.30 - * Then use <code>@Page</code> annotation to
1.31 - * generate a Java representation of elements with IDs in that page.
1.32 - * Depending on the type of the elements, they will have different
1.33 - * methods (e.g. <code>PG_TITLE</code> has <code>setText</code>, etc.).
1.34 - * Use <code>@OnClick</code> annotation to associate behavior
1.35 - * with existing elements. Use the generated elements
1.36 - * (<code>PG_TITLE</code>, <code>PG_TEXT</code>) to modify the page.
1.37 - * <p>
1.38 - * Everything is type-safe. As soon as somebody modifies the page and
1.39 - * removes the IDs or re-assigns them to wrong elements. Java compiler
1.40 - * will emit an error.
1.41 - * <p>
1.42 - * Welcome to the type-safe HTML5 world!
1.43 - *
1.44 - * @author Jaroslav Tulach <jtulach@netbeans.org>
1.45 - */
1.46 -@Page(xhtml="TestPage.html")
1.47 -public class PageController {
1.48 - @OnClick(id="pg.button")
1.49 - static void updateTitle() {
1.50 - TestPage.PG_TITLE.setText("You want this window to be named " + TestPage.PG_TEXT.getValue());
1.51 - }
1.52 -
1.53 - @OnClick(id={ "pg.title", "pg.text" })
1.54 - static void click(String id) {
1.55 - if (!id.equals("pg.title")) {
1.56 - throw new IllegalStateException();
1.57 - }
1.58 - TestPage.PG_TITLE.setText(id);
1.59 - }
1.60 -}