Extracting interfaces from JavaQuery API. Removed first (automatic) refactoring attempt and redid it manually.
1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Canvas.java Fri May 17 12:06:36 2013 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,64 +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.api;
1.22 -
1.23 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
1.24 -import static org.apidesign.bck2brwsr.htmlpage.api.Element.getAttribute;
1.25 -
1.26 -/**
1.27 - *
1.28 - * @author Anton Epple <toni.epple@eppleton.de>
1.29 - */
1.30 -public class Canvas extends Element {
1.31 -
1.32 - public Canvas(String id) {
1.33 - super(id);
1.34 - }
1.35 -
1.36 - public void setHeight(int height) {
1.37 - setAttribute(this, "height", height);
1.38 - }
1.39 -
1.40 - public int getHeight() {
1.41 - Object ret = getAttribute(this, "height");
1.42 - return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
1.43 - }
1.44 -
1.45 - public void setWidth(int width) {
1.46 - setAttribute(this, "width", width);
1.47 - }
1.48 -
1.49 - public int getWidth() {
1.50 - Object ret = getAttribute(this, "width");
1.51 - return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
1.52 - }
1.53 -
1.54 - @JavaScriptBody(
1.55 - args = {"el"},
1.56 - body = "var e = window.document.getElementById(el._id());\n"
1.57 - + "return e.getContext('2d');\n")
1.58 - private native static Object getContextImpl(Canvas el);
1.59 -
1.60 - public HTML5GraphicsContext getContext() {
1.61 - return new HTML5GraphicsContext(getContextImpl(this));
1.62 - }
1.63 -
1.64 - @Override
1.65 - void dontSubclass() {
1.66 - }
1.67 -}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5Canvas.java Fri May 17 12:06:55 2013 +0200
2.3 @@ -0,0 +1,65 @@
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.api;
2.22 +
2.23 +import net.java.html.canvas.Canvas;
2.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
2.25 +import static org.apidesign.bck2brwsr.htmlpage.api.Element.getAttribute;
2.26 +
2.27 +/**
2.28 + *
2.29 + * @author Anton Epple <toni.epple@eppleton.de>
2.30 + */
2.31 +public class HTML5Canvas extends Element implements Canvas{
2.32 +
2.33 + public HTML5Canvas(String id) {
2.34 + super(id);
2.35 + }
2.36 +
2.37 + public void setHeight(int height) {
2.38 + setAttribute(this, "height", height);
2.39 + }
2.40 +
2.41 + public int getHeight() {
2.42 + Object ret = getAttribute(this, "height");
2.43 + return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
2.44 + }
2.45 +
2.46 + public void setWidth(int width) {
2.47 + setAttribute(this, "width", width);
2.48 + }
2.49 +
2.50 + public int getWidth() {
2.51 + Object ret = getAttribute(this, "width");
2.52 + return (ret instanceof Number) ? ((Number)ret).intValue(): Integer.MIN_VALUE;
2.53 + }
2.54 +
2.55 + @JavaScriptBody(
2.56 + args = {"el"},
2.57 + body = "var e = window.document.getElementById(el._id());\n"
2.58 + + "return e.getContext('2d');\n")
2.59 + private native static Object getContextImpl(HTML5Canvas el);
2.60 +
2.61 + public HTML5GraphicsContext getContext() {
2.62 + return new HTML5GraphicsContext(getContextImpl(this));
2.63 + }
2.64 +
2.65 + @Override
2.66 + void dontSubclass() {
2.67 + }
2.68 +}
3.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java Fri May 17 12:06:36 2013 +0200
3.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5GraphicsContext.java Fri May 17 12:06:55 2013 +0200
3.3 @@ -1,23 +1,29 @@
3.4 /**
3.5 - * Back 2 Browser Bytecode Translator
3.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.7 + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
3.8 + * <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 + * This program is free software: you can redistribute it and/or modify it under
3.14 + * the terms of the GNU General Public License as published by the Free Software
3.15 + * Foundation, version 2 of the License.
3.16 *
3.17 - * This program is distributed in the hope that it will be useful,
3.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.20 - * GNU General Public License for more details.
3.21 + * This program is distributed in the hope that it will be useful, but WITHOUT
3.22 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
3.23 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
3.24 + * details.
3.25 *
3.26 - * You should have received a copy of the GNU General Public License
3.27 - * along with this program. Look for COPYING file in the top folder.
3.28 - * If not, see http://opensource.org/licenses/GPL-2.0.
3.29 + * You should have received a copy of the GNU General Public License along with
3.30 + * this program. Look for COPYING file in the top folder. If not, see
3.31 + * http://opensource.org/licenses/GPL-2.0.
3.32 */
3.33 package org.apidesign.bck2brwsr.htmlpage.api;
3.34
3.35 import net.java.html.canvas.GraphicsContext;
3.36 +import net.java.html.canvas.Image;
3.37 +import net.java.html.canvas.ImageData;
3.38 +import net.java.html.canvas.LinearGradient;
3.39 +import net.java.html.canvas.Pattern;
3.40 +import net.java.html.canvas.RadialGradient;
3.41 +import net.java.html.canvas.TextMetrics;
3.42 import org.apidesign.bck2brwsr.core.JavaScriptBody;
3.43
3.44 /**
3.45 @@ -137,16 +143,19 @@
3.46 @Override
3.47 public native void scale(double x, double y);
3.48
3.49 + @Override
3.50 public void drawImage(Image image, double x, double y) {
3.51 - drawImageImpl(context, Element.getElementById(image), x, y);
3.52 + drawImageImpl(context, Element.getElementById((HTML5Image)image), x, y);
3.53 }
3.54
3.55 + @Override
3.56 public void drawImage(Image image, double x, double y, double width, double height) {
3.57 - drawImageImpl(context, Element.getElementById(image), x, y, width, height);
3.58 + drawImageImpl(context, Element.getElementById((HTML5Image)image), x, y, width, height);
3.59 }
3.60
3.61 + @Override
3.62 public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height) {
3.63 - drawImageImpl(context, Element.getElementById(image), sx, sy, sWidth, sHeight, x, y, width, height);
3.64 + drawImageImpl(context, Element.getElementById((HTML5Image)image), sx, sy, sWidth, sHeight, x, y, width, height);
3.65 }
3.66
3.67 @JavaScriptBody(args = {"ctx", "img", "x", "y", "width", "height"}, body = "ctx.drawImage(img,x,y,width,height);")
3.68 @@ -166,39 +175,44 @@
3.69 @Override
3.70 public native String getFillStyle();
3.71
3.72 + @Override
3.73 public void setFillStyle(LinearGradient style) {
3.74 - setFillStyleImpl(context, style.object());
3.75 + setFillStyleImpl(context, ((HTML5LinearGradient)style).object());
3.76 }
3.77
3.78 + @Override
3.79 public void setFillStyle(RadialGradient style) {
3.80 - setFillStyleImpl(context, style.object());
3.81 + setFillStyleImpl(context, ((HTML5RadialGradient)style).object());
3.82 }
3.83
3.84 + @Override
3.85 public void setFillStyle(Pattern style) {
3.86 - setFillStyleImpl(context, style.object());
3.87 + setFillStyleImpl(context, ((HTML5Pattern)style).object());
3.88 }
3.89
3.90 - @JavaScriptBody(args = {"context","obj"}, body = "context.fillStyle=obj;")
3.91 + @JavaScriptBody(args = {"context", "obj"}, body = "context.fillStyle=obj;")
3.92 private native void setFillStyleImpl(Object context, Object obj);
3.93
3.94 @JavaScriptBody(args = {"style"}, body = "this._context().strokeStyle=style.valueOf();")
3.95 @Override
3.96 public native void setStrokeStyle(String style);
3.97
3.98 + @Override
3.99 public void setStrokeStyle(LinearGradient style) {
3.100 - setStrokeStyleImpl(context, style.object());
3.101 + setStrokeStyleImpl(context, ((HTML5LinearGradient)style).object());
3.102 }
3.103
3.104 public void setStrokeStyle(RadialGradient style) {
3.105 - setStrokeStyleImpl(context, style.object());
3.106 + setStrokeStyleImpl(context, ((HTML5RadialGradient)style).object());
3.107 }
3.108
3.109 @JavaScriptBody(args = {"style"}, body = "this._context().fillStyle=style;")
3.110 + @Override
3.111 public void setStrokeStyle(Pattern style) {
3.112 - setStrokeStyleImpl(context, style.object());
3.113 + setStrokeStyleImpl(context, ((HTML5LinearGradient)style).object());
3.114 }
3.115
3.116 - @JavaScriptBody(args = {"context","obj"}, body = "context.strokeStyle=obj;")
3.117 + @JavaScriptBody(args = {"context", "obj"}, body = "context.strokeStyle=obj;")
3.118 private native void setStrokeStyleImpl(Object context, Object obj);
3.119
3.120 @JavaScriptBody(args = {"color"}, body = "this._context().shadowColor=color.valueOf();")
3.121 @@ -208,7 +222,7 @@
3.122 @JavaScriptBody(args = {"blur"}, body = "this._context().shadowBlur=blur;")
3.123 @Override
3.124 public native void setShadowBlur(double blur);
3.125 -
3.126 +
3.127 @JavaScriptBody(args = {"x"}, body = "this._context().shadowOffsetX=x;")
3.128 @Override
3.129 public native void setShadowOffsetX(double x);
3.130 @@ -302,8 +316,9 @@
3.131 public void fillText(String text, double x, double y, double maxWidth) {
3.132 }
3.133
3.134 + @Override
3.135 public TextMetrics measureText(String text) {
3.136 - return new TextMetrics(measureTextImpl(text));
3.137 + return new HTML5TextMetrics(measureTextImpl(text));
3.138 }
3.139
3.140 @JavaScriptBody(args = {"text"},
3.141 @@ -318,36 +333,41 @@
3.142 @Override
3.143 public native void strokeText(String text, double x, double y, double maxWidth);
3.144
3.145 + @Override
3.146 public ImageData createImageData(double x, double y) {
3.147 - return new ImageData(createImageDataImpl(x, y));
3.148 + return new HTML5ImageData(createImageDataImpl(x, y));
3.149 }
3.150
3.151 @JavaScriptBody(args = {"x", "y"},
3.152 body = "return this._context().createImageData(x,y);")
3.153 private native Object createImageDataImpl(double x, double y);
3.154
3.155 + @Override
3.156 public ImageData createImageData(ImageData imageData) {
3.157 - return new ImageData(createImageDataImpl(imageData.getWidth(), imageData.getHeight()));
3.158 + return new HTML5ImageData(createImageDataImpl(imageData.getWidth(), imageData.getHeight()));
3.159 }
3.160
3.161 + @Override
3.162 public ImageData getImageData(double x, double y, double width, double height) {
3.163 - return new ImageData(getImageDataImpl(x, y, width, height));
3.164 + return new HTML5ImageData(getImageDataImpl(x, y, width, height));
3.165 }
3.166
3.167 @JavaScriptBody(args = {"x", "y", "width", "height"},
3.168 body = "return this._context().getImageData(x,y,width,height);")
3.169 private native Object getImageDataImpl(double x, double y, double width, double height);
3.170
3.171 + @Override
3.172 public void putImageData(ImageData imageData, double x, double y) {
3.173 - putImageDataImpl(imageData.object(), x, y);
3.174 + putImageDataImpl(((HTML5ImageData)imageData).object(), x, y);
3.175 }
3.176
3.177 @JavaScriptBody(args = {"imageData", "x", "y"},
3.178 body = "this._context().putImageData(imageData,x,y);")
3.179 private native void putImageDataImpl(Object imageData, double x, double y);
3.180
3.181 + @Override
3.182 public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
3.183 - putImageDataImpl(imageData.object(), x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
3.184 + putImageDataImpl(((HTML5ImageData)imageData).object(), x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
3.185 }
3.186
3.187 @JavaScriptBody(args = {"imageData", "x", "y", "dirtyx", "dirtyy", "dirtywidth", "dirtyheight"},
3.188 @@ -370,22 +390,25 @@
3.189 @Override
3.190 public native String getGlobalCompositeOperation();
3.191
3.192 - public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
3.193 - return new LinearGradient(createLinearGradientImpl(context, x0, y0, x1, y1));
3.194 + @Override
3.195 + public HTML5LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
3.196 + return new HTML5LinearGradient(createLinearGradientImpl(context, x0, y0, x1, y1));
3.197 }
3.198
3.199 @JavaScriptBody(args = {"context", "x0", "y0", "x1", "y1"}, body = "return context.createLinearGradient(x0,y0,x1,y1);")
3.200 - private native Object createLinearGradientImpl(Object context, double x0, double y0, double x1, double y1);
3.201 + private native Object createLinearGradientImpl(Object context, double x0, double y0, double x1, double y1);
3.202
3.203 + @Override
3.204 public Pattern createPattern(Image image, String repeat) {
3.205 - return new Pattern(createPatternImpl(context, image, repeat));
3.206 + return new HTML5Pattern(createPatternImpl(context, image, repeat));
3.207 }
3.208
3.209 @JavaScriptBody(args = {"context", "image", "repeat"}, body = "return context.createPattern(image, repeat);")
3.210 private static native Object createPatternImpl(Object context, Image image, String repeat);
3.211
3.212 - public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
3.213 - return new RadialGradient(createRadialGradientImpl(context, x0, y0, r0, x1, y1, r1));
3.214 + @Override
3.215 + public HTML5RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
3.216 + return new HTML5RadialGradient(createRadialGradientImpl(context, x0, y0, r0, x1, y1, r1));
3.217 }
3.218
3.219 @JavaScriptBody(args = {"context", "x0", "y0", "r0", "x1", "y1", "r1"}, body = "return context.createRadialGradient(x0,y0,r0,x1,y1,r1);")
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5Image.java Fri May 17 12:06:55 2013 +0200
4.3 @@ -0,0 +1,38 @@
4.4 +/**
4.5 + * Back 2 Browser Bytecode Translator
4.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
4.7 + *
4.8 + * This program is free software: you can redistribute it and/or modify
4.9 + * it under the terms of the GNU General Public License as published by
4.10 + * the Free Software Foundation, version 2 of the License.
4.11 + *
4.12 + * This program is distributed in the hope that it will be useful,
4.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.15 + * GNU General Public License for more details.
4.16 + *
4.17 + * You should have received a copy of the GNU General Public License
4.18 + * along with this program. Look for COPYING file in the top folder.
4.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
4.20 + */
4.21 +package org.apidesign.bck2brwsr.htmlpage.api;
4.22 +
4.23 +import net.java.html.canvas.Image;
4.24 +
4.25 +/**
4.26 + *
4.27 + * @author Anton Epple <toni.epple@eppleton.de>
4.28 + */
4.29 +public class HTML5Image extends Element implements Image{
4.30 +
4.31 + public HTML5Image(String id) {
4.32 + super(id);
4.33 + }
4.34 +
4.35 +
4.36 +
4.37 + @Override
4.38 + void dontSubclass() {
4.39 + }
4.40 +
4.41 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5ImageData.java Fri May 17 12:06:55 2013 +0200
5.3 @@ -0,0 +1,90 @@
5.4 +/**
5.5 + * Back 2 Browser Bytecode Translator
5.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5.7 + *
5.8 + * This program is free software: you can redistribute it and/or modify
5.9 + * it under the terms of the GNU General Public License as published by
5.10 + * the Free Software Foundation, version 2 of the License.
5.11 + *
5.12 + * This program is distributed in the hope that it will be useful,
5.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.15 + * GNU General Public License for more details.
5.16 + *
5.17 + * You should have received a copy of the GNU General Public License
5.18 + * along with this program. Look for COPYING file in the top folder.
5.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
5.20 + */
5.21 +/*
5.22 + * To change this template, choose Tools | Templates
5.23 + * and open the template in the editor.
5.24 + */
5.25 +package org.apidesign.bck2brwsr.htmlpage.api;
5.26 +
5.27 +import net.java.html.canvas.ImageData;
5.28 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
5.29 +
5.30 +/**
5.31 + *
5.32 + * @author Anton Epple <toni.epple@eppleton.de>
5.33 + */
5.34 +public class HTML5ImageData implements ImageData{
5.35 +
5.36 + private Object imageData;
5.37 + private Data data;
5.38 +
5.39 + public HTML5ImageData(Object imageData) {
5.40 + this.imageData = imageData;
5.41 + }
5.42 +
5.43 + public Data getData(){
5.44 + if (data == null){
5.45 + data = new Data(getDataImpl(imageData));
5.46 + }
5.47 + return data;
5.48 + }
5.49 +
5.50 + @JavaScriptBody(args = {"imageData"}, body = "return imageData.data")
5.51 + public native Object getDataImpl(Object imageData);
5.52 +
5.53 + public double getWidth() {
5.54 + return getWidthImpl(imageData);
5.55 + }
5.56 +
5.57 + @JavaScriptBody(args = {"imageData"}, body = "return imagedata.width;")
5.58 + private static native double getWidthImpl(Object imageData);
5.59 +
5.60 + public double getHeight() {
5.61 + return getHeightImpl(imageData);
5.62 + }
5.63 +
5.64 + @JavaScriptBody(args = {"imageData"}, body = "return imagedata.height;")
5.65 + private static native double getHeightImpl(Object imageData);
5.66 +
5.67 + Object object() {
5.68 + return imageData;
5.69 + }
5.70 +
5.71 + public static class Data {
5.72 +
5.73 + Object data;
5.74 +
5.75 + public Data(Object data) {
5.76 + this.data = data;
5.77 + }
5.78 +
5.79 + public int get(int index) {
5.80 + return getImpl(data, index);
5.81 + }
5.82 +
5.83 + public void set(int index, int value) {
5.84 + setImpl(data, index, value);
5.85 + }
5.86 +
5.87 + @JavaScriptBody(args = {"data", "index", "value"}, body = "data[index]=value;")
5.88 + private static native void setImpl(Object data, int index, int value);
5.89 +
5.90 + @JavaScriptBody(args = {"imagedata", "index"}, body = "return data[index];")
5.91 + private static native int getImpl(Object data, int index);
5.92 + }
5.93 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5LinearGradient.java Fri May 17 12:06:55 2013 +0200
6.3 @@ -0,0 +1,46 @@
6.4 +/**
6.5 + * Back 2 Browser Bytecode Translator
6.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.7 + *
6.8 + * This program is free software: you can redistribute it and/or modify
6.9 + * it under the terms of the GNU General Public License as published by
6.10 + * the Free Software Foundation, version 2 of the License.
6.11 + *
6.12 + * This program is distributed in the hope that it will be useful,
6.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.15 + * GNU General Public License for more details.
6.16 + *
6.17 + * You should have received a copy of the GNU General Public License
6.18 + * along with this program. Look for COPYING file in the top folder.
6.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
6.20 + */
6.21 +package org.apidesign.bck2brwsr.htmlpage.api;
6.22 +
6.23 +import net.java.html.canvas.LinearGradient;
6.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
6.25 +
6.26 +/**
6.27 + *
6.28 + * @author Anton Epple <toni.epple@eppleton.de>
6.29 + */
6.30 +public class HTML5LinearGradient implements LinearGradient{
6.31 +
6.32 + private final Object gradient;
6.33 +
6.34 + HTML5LinearGradient(Object linearGradient) {
6.35 + this.gradient = linearGradient;
6.36 + }
6.37 +
6.38 + Object object() {
6.39 + return gradient;
6.40 + }
6.41 +
6.42 + public void addColorStop(double position, String color) {
6.43 + addColorStopImpl(gradient, position, color);
6.44 + }
6.45 +
6.46 + @JavaScriptBody(args = {"gradient", "position", "color"}, body =
6.47 + "gradient.addColorStop(position,color)")
6.48 + private static native void addColorStopImpl(Object gradient, double position, String color);
6.49 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5Pattern.java Fri May 17 12:06:55 2013 +0200
7.3 @@ -0,0 +1,37 @@
7.4 +/**
7.5 + * Back 2 Browser Bytecode Translator
7.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
7.7 + *
7.8 + * This program is free software: you can redistribute it and/or modify
7.9 + * it under the terms of the GNU General Public License as published by
7.10 + * the Free Software Foundation, version 2 of the License.
7.11 + *
7.12 + * This program is distributed in the hope that it will be useful,
7.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.15 + * GNU General Public License for more details.
7.16 + *
7.17 + * You should have received a copy of the GNU General Public License
7.18 + * along with this program. Look for COPYING file in the top folder.
7.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
7.20 + */
7.21 +package org.apidesign.bck2brwsr.htmlpage.api;
7.22 +
7.23 +import net.java.html.canvas.Pattern;
7.24 +
7.25 +/**
7.26 + *
7.27 + * @author Anton Epple <toni.epple@eppleton.de>
7.28 + */
7.29 +public class HTML5Pattern implements Pattern{
7.30 +
7.31 + private Object pattern;
7.32 +
7.33 + public HTML5Pattern(Object pattern) {
7.34 + this.pattern = pattern;
7.35 + }
7.36 +
7.37 + Object object() {
7.38 + return pattern;
7.39 + }
7.40 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5RadialGradient.java Fri May 17 12:06:55 2013 +0200
8.3 @@ -0,0 +1,46 @@
8.4 +/**
8.5 + * Back 2 Browser Bytecode Translator
8.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
8.7 + *
8.8 + * This program is free software: you can redistribute it and/or modify
8.9 + * it under the terms of the GNU General Public License as published by
8.10 + * the Free Software Foundation, version 2 of the License.
8.11 + *
8.12 + * This program is distributed in the hope that it will be useful,
8.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.15 + * GNU General Public License for more details.
8.16 + *
8.17 + * You should have received a copy of the GNU General Public License
8.18 + * along with this program. Look for COPYING file in the top folder.
8.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
8.20 + */
8.21 +package org.apidesign.bck2brwsr.htmlpage.api;
8.22 +
8.23 +import net.java.html.canvas.RadialGradient;
8.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
8.25 +
8.26 +/**
8.27 + *
8.28 + * @author Anton Epple <toni.epple@eppleton.de>
8.29 + */
8.30 +public class HTML5RadialGradient implements RadialGradient{
8.31 +
8.32 + private Object gradient;
8.33 +
8.34 + public HTML5RadialGradient(Object radialGradient) {
8.35 + this.gradient = radialGradient;
8.36 + }
8.37 +
8.38 + public void addColorStop(double position, String color) {
8.39 + addColorStopImpl(gradient, position, color);
8.40 + }
8.41 +
8.42 + @JavaScriptBody(args = {"gradient", "position", "color"}, body =
8.43 + "gradient.addColorStop(position,color)")
8.44 + private static native void addColorStopImpl(Object gradient, double position, String color);
8.45 +
8.46 + Object object() {
8.47 + return gradient;
8.48 + }
8.49 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/HTML5TextMetrics.java Fri May 17 12:06:55 2013 +0200
9.3 @@ -0,0 +1,49 @@
9.4 +/**
9.5 + * Back 2 Browser Bytecode Translator
9.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
9.7 + *
9.8 + * This program is free software: you can redistribute it and/or modify
9.9 + * it under the terms of the GNU General Public License as published by
9.10 + * the Free Software Foundation, version 2 of the License.
9.11 + *
9.12 + * This program is distributed in the hope that it will be useful,
9.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.15 + * GNU General Public License for more details.
9.16 + *
9.17 + * You should have received a copy of the GNU General Public License
9.18 + * along with this program. Look for COPYING file in the top folder.
9.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
9.20 + */
9.21 +package org.apidesign.bck2brwsr.htmlpage.api;
9.22 +
9.23 +import net.java.html.canvas.TextMetrics;
9.24 +import org.apidesign.bck2brwsr.core.JavaScriptBody;
9.25 +
9.26 +/**
9.27 + *
9.28 + * @author Anton Epple <toni.epple@eppleton.de>
9.29 + */
9.30 +public class HTML5TextMetrics implements TextMetrics{
9.31 +
9.32 + private Object textMetrics;
9.33 +
9.34 + HTML5TextMetrics(Object measureTextImpl) {
9.35 + this.textMetrics = measureTextImpl;
9.36 + }
9.37 +
9.38 + @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.width;")
9.39 + private native double getWidth(Object textMetrics);
9.40 +
9.41 + @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.height;")
9.42 + private native double getHeight(Object textMetrics);
9.43 +
9.44 + public double getWidth() {
9.45 + return getWidth(textMetrics);
9.46 + }
9.47 +
9.48 + public double getHeight() {
9.49 + return getHeight(textMetrics);
9.50 +
9.51 + }
9.52 +}
10.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Image.java Fri May 17 12:06:36 2013 +0200
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,36 +0,0 @@
10.4 -/**
10.5 - * Back 2 Browser Bytecode Translator
10.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
10.7 - *
10.8 - * This program is free software: you can redistribute it and/or modify
10.9 - * it under the terms of the GNU General Public License as published by
10.10 - * the Free Software Foundation, version 2 of the License.
10.11 - *
10.12 - * This program is distributed in the hope that it will be useful,
10.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
10.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10.15 - * GNU General Public License for more details.
10.16 - *
10.17 - * You should have received a copy of the GNU General Public License
10.18 - * along with this program. Look for COPYING file in the top folder.
10.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
10.20 - */
10.21 -package org.apidesign.bck2brwsr.htmlpage.api;
10.22 -
10.23 -/**
10.24 - *
10.25 - * @author Anton Epple <toni.epple@eppleton.de>
10.26 - */
10.27 -public class Image extends Element{
10.28 -
10.29 - public Image(String id) {
10.30 - super(id);
10.31 - }
10.32 -
10.33 -
10.34 -
10.35 - @Override
10.36 - void dontSubclass() {
10.37 - }
10.38 -
10.39 -}
11.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/ImageData.java Fri May 17 12:06:36 2013 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,89 +0,0 @@
11.4 -/**
11.5 - * Back 2 Browser Bytecode Translator
11.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
11.7 - *
11.8 - * This program is free software: you can redistribute it and/or modify
11.9 - * it under the terms of the GNU General Public License as published by
11.10 - * the Free Software Foundation, version 2 of the License.
11.11 - *
11.12 - * This program is distributed in the hope that it will be useful,
11.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.15 - * GNU General Public License for more details.
11.16 - *
11.17 - * You should have received a copy of the GNU General Public License
11.18 - * along with this program. Look for COPYING file in the top folder.
11.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
11.20 - */
11.21 -/*
11.22 - * To change this template, choose Tools | Templates
11.23 - * and open the template in the editor.
11.24 - */
11.25 -package org.apidesign.bck2brwsr.htmlpage.api;
11.26 -
11.27 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
11.28 -
11.29 -/**
11.30 - *
11.31 - * @author Anton Epple <toni.epple@eppleton.de>
11.32 - */
11.33 -public class ImageData {
11.34 -
11.35 - private Object imageData;
11.36 - private Data data;
11.37 -
11.38 - public ImageData(Object imageData) {
11.39 - this.imageData = imageData;
11.40 - }
11.41 -
11.42 - public Data getData(){
11.43 - if (data == null){
11.44 - data = new Data(getDataImpl(imageData));
11.45 - }
11.46 - return data;
11.47 - }
11.48 -
11.49 - @JavaScriptBody(args = {"imageData"}, body = "return imageData.data")
11.50 - public native Object getDataImpl(Object imageData);
11.51 -
11.52 - public double getWidth() {
11.53 - return getWidthImpl(imageData);
11.54 - }
11.55 -
11.56 - @JavaScriptBody(args = {"imageData"}, body = "return imagedata.width;")
11.57 - private static native double getWidthImpl(Object imageData);
11.58 -
11.59 - public double getHeight() {
11.60 - return getHeightImpl(imageData);
11.61 - }
11.62 -
11.63 - @JavaScriptBody(args = {"imageData"}, body = "return imagedata.height;")
11.64 - private static native double getHeightImpl(Object imageData);
11.65 -
11.66 - Object object() {
11.67 - return imageData;
11.68 - }
11.69 -
11.70 - public static class Data {
11.71 -
11.72 - Object data;
11.73 -
11.74 - public Data(Object data) {
11.75 - this.data = data;
11.76 - }
11.77 -
11.78 - public int get(int index) {
11.79 - return getImpl(data, index);
11.80 - }
11.81 -
11.82 - public void set(int index, int value) {
11.83 - setImpl(data, index, value);
11.84 - }
11.85 -
11.86 - @JavaScriptBody(args = {"data", "index", "value"}, body = "data[index]=value;")
11.87 - private static native void setImpl(Object data, int index, int value);
11.88 -
11.89 - @JavaScriptBody(args = {"imagedata", "index"}, body = "return data[index];")
11.90 - private static native int getImpl(Object data, int index);
11.91 - }
11.92 -}
12.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/LinearGradient.java Fri May 17 12:06:36 2013 +0200
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,45 +0,0 @@
12.4 -/**
12.5 - * Back 2 Browser Bytecode Translator
12.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
12.7 - *
12.8 - * This program is free software: you can redistribute it and/or modify
12.9 - * it under the terms of the GNU General Public License as published by
12.10 - * the Free Software Foundation, version 2 of the License.
12.11 - *
12.12 - * This program is distributed in the hope that it will be useful,
12.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.15 - * GNU General Public License for more details.
12.16 - *
12.17 - * You should have received a copy of the GNU General Public License
12.18 - * along with this program. Look for COPYING file in the top folder.
12.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
12.20 - */
12.21 -package org.apidesign.bck2brwsr.htmlpage.api;
12.22 -
12.23 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
12.24 -
12.25 -/**
12.26 - *
12.27 - * @author Anton Epple <toni.epple@eppleton.de>
12.28 - */
12.29 -public class LinearGradient {
12.30 -
12.31 - private final Object gradient;
12.32 -
12.33 - LinearGradient(Object linearGradient) {
12.34 - this.gradient = linearGradient;
12.35 - }
12.36 -
12.37 - Object object() {
12.38 - return gradient;
12.39 - }
12.40 -
12.41 - public void addColorStop(double position, String color) {
12.42 - addColorStopImpl(gradient, position, color);
12.43 - }
12.44 -
12.45 - @JavaScriptBody(args = {"gradient", "position", "color"}, body =
12.46 - "gradient.addColorStop(position,color)")
12.47 - private static native void addColorStopImpl(Object gradient, double position, String color);
12.48 -}
13.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/Pattern.java Fri May 17 12:06:36 2013 +0200
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,35 +0,0 @@
13.4 -/**
13.5 - * Back 2 Browser Bytecode Translator
13.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
13.7 - *
13.8 - * This program is free software: you can redistribute it and/or modify
13.9 - * it under the terms of the GNU General Public License as published by
13.10 - * the Free Software Foundation, version 2 of the License.
13.11 - *
13.12 - * This program is distributed in the hope that it will be useful,
13.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.15 - * GNU General Public License for more details.
13.16 - *
13.17 - * You should have received a copy of the GNU General Public License
13.18 - * along with this program. Look for COPYING file in the top folder.
13.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
13.20 - */
13.21 -package org.apidesign.bck2brwsr.htmlpage.api;
13.22 -
13.23 -/**
13.24 - *
13.25 - * @author Anton Epple <toni.epple@eppleton.de>
13.26 - */
13.27 -public class Pattern {
13.28 -
13.29 - private Object pattern;
13.30 -
13.31 - public Pattern(Object pattern) {
13.32 - this.pattern = pattern;
13.33 - }
13.34 -
13.35 - Object object() {
13.36 - return pattern;
13.37 - }
13.38 -}
14.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/RadialGradient.java Fri May 17 12:06:36 2013 +0200
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,45 +0,0 @@
14.4 -/**
14.5 - * Back 2 Browser Bytecode Translator
14.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
14.7 - *
14.8 - * This program is free software: you can redistribute it and/or modify
14.9 - * it under the terms of the GNU General Public License as published by
14.10 - * the Free Software Foundation, version 2 of the License.
14.11 - *
14.12 - * This program is distributed in the hope that it will be useful,
14.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
14.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14.15 - * GNU General Public License for more details.
14.16 - *
14.17 - * You should have received a copy of the GNU General Public License
14.18 - * along with this program. Look for COPYING file in the top folder.
14.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
14.20 - */
14.21 -package org.apidesign.bck2brwsr.htmlpage.api;
14.22 -
14.23 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
14.24 -
14.25 -/**
14.26 - *
14.27 - * @author Anton Epple <toni.epple@eppleton.de>
14.28 - */
14.29 -public class RadialGradient {
14.30 -
14.31 - private Object gradient;
14.32 -
14.33 - public RadialGradient(Object radialGradient) {
14.34 - this.gradient = radialGradient;
14.35 - }
14.36 -
14.37 - public void addColorStop(double position, String color) {
14.38 - addColorStopImpl(gradient, position, color);
14.39 - }
14.40 -
14.41 - @JavaScriptBody(args = {"gradient", "position", "color"}, body =
14.42 - "gradient.addColorStop(position,color)")
14.43 - private static native void addColorStopImpl(Object gradient, double position, String color);
14.44 -
14.45 - Object object() {
14.46 - return gradient;
14.47 - }
14.48 -}
15.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/TextMetrics.java Fri May 17 12:06:36 2013 +0200
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,48 +0,0 @@
15.4 -/**
15.5 - * Back 2 Browser Bytecode Translator
15.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
15.7 - *
15.8 - * This program is free software: you can redistribute it and/or modify
15.9 - * it under the terms of the GNU General Public License as published by
15.10 - * the Free Software Foundation, version 2 of the License.
15.11 - *
15.12 - * This program is distributed in the hope that it will be useful,
15.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
15.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15.15 - * GNU General Public License for more details.
15.16 - *
15.17 - * You should have received a copy of the GNU General Public License
15.18 - * along with this program. Look for COPYING file in the top folder.
15.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
15.20 - */
15.21 -package org.apidesign.bck2brwsr.htmlpage.api;
15.22 -
15.23 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
15.24 -
15.25 -/**
15.26 - *
15.27 - * @author Anton Epple <toni.epple@eppleton.de>
15.28 - */
15.29 -public class TextMetrics {
15.30 -
15.31 - private Object textMetrics;
15.32 -
15.33 - TextMetrics(Object measureTextImpl) {
15.34 - this.textMetrics = measureTextImpl;
15.35 - }
15.36 -
15.37 - @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.width;")
15.38 - private native double getWidth(Object textMetrics);
15.39 -
15.40 - @JavaScriptBody(args = {"textMetrics"}, body = "return textMetrics.height;")
15.41 - private native double getHeight(Object textMetrics);
15.42 -
15.43 - public double getWidth() {
15.44 - return getWidth(textMetrics);
15.45 - }
15.46 -
15.47 - public double getHeight() {
15.48 - return getHeight(textMetrics);
15.49 -
15.50 - }
15.51 -}