Project structure fixed

This commit is contained in:
pTalanov
2012-02-27 19:07:59 +04:00
parent 8bfa313ad4
commit 953c33a846
31 changed files with 100 additions and 555 deletions
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package core;
/**
* @author Pavel Talanov
*/
public final class Dummy {
}
+6
View File
@@ -0,0 +1,6 @@
package js;
native
annotation class native(name : String = "") {}
native
annotation class library(name : String = "") {}
+40
View File
@@ -0,0 +1,40 @@
package js;
import js.library
import js.native
import java.util.*;
import java.lang.*;
native
val noImpl : Nothing = throw Exception();
library("println")
fun println() {}
library("println")
fun println(s : Any?) {}
library("print")
fun print(s : Any?) {}
library("parseInt")
fun parseInt(s : String) : Int = 0
library
open class Exception() : Throwable() {}
library
class NumberFormatException() : Exception() {}
native
fun setTimeout(callback : ()-> Unit) {}
native
fun setInterval(callback : ()-> Unit, ms : Int) {}
native
fun setInterval(callback : ()-> Unit) {}
native
open class DomElement() {
val offsetLeft = 0.0;
val offsetTop = 0.0;
val offsetParent : DomElement? = DomElement();
}
+6
View File
@@ -0,0 +1,6 @@
package js
native
class Date() {
fun getTime() : Int = js.noImpl
}
+12
View File
@@ -0,0 +1,12 @@
package java.lang
import java.util.Iterator;
import js.library
library
trait Iterable<T> {
fun iterator() : java.util.Iterator<T> = js.noImpl
}
library("splitString")
public fun String.split(regex : String) : Array<String> = js.noImpl
+175
View File
@@ -0,0 +1,175 @@
package java.util
import js.*;
library("collectionsMax")
public fun max<T>(col : Collection<T>, comp : Comparator<T>) : T = js.noImpl
library
public trait Comparator<T> {
fun compare(obj1 : T, obj2 : T) : Int;
}
library("comparator")
public fun comparator<T>(f : (T, T) -> Int) : Comparator<T> = js.noImpl
library
public open class Iterator<T>() {
open fun next() : T = js.noImpl
open fun hasNext() : Boolean = js.noImpl
}
library
val Collections = object {
library("collectionsMax")
public fun max<T>(col : Collection<T>, comp : Comparator<T>) : T = js.noImpl
}
library
public open class ArrayList<erased E>() : java.util.List<E> {
override public fun size() : Int = js.noImpl
override public fun isEmpty() : Boolean = js.noImpl
override public fun contains(o : Any?) : Boolean = js.noImpl
override public fun iterator() : Iterator<E> = js.noImpl
// override public fun indexOf(o : Any?) : Int = js.noImpl
// override public fun lastIndexOf(o : Any?) : Int = js.noImpl
// override public fun toArray() : Array<Any?> = js.noImpl
// override public fun toArray<erased T>(a : Array<out T>) : Array<T> = js.noImpl
override public fun get(index : Int) : E = js.noImpl
override public fun set(index : Int, element : E) : E = js.noImpl
override public fun add(e : E) : Boolean = js.noImpl
override public fun add(index : Int, element : E) : Unit = js.noImpl
override public fun remove(index : Int) : E = js.noImpl
override public fun remove(o : Any?) : Boolean = js.noImpl
override public fun clear() : Unit = js.noImpl
override public fun addAll(c : java.util.Collection<out E>) : Boolean = js.noImpl
// override public fun addAll(index : Int, c : java.util.Collection<out E>) : Boolean = js.noImpl
}
library
public trait Collection<erased E> : java.lang.Iterable<E> {
open fun size() : Int
open fun isEmpty() : Boolean
open fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
// open fun toArray() : Array<Any?>
// open fun toArray<erased T>(a : Array<out T>) : Array<T>
open fun add(e : E) : Boolean
open fun remove(o : Any?) : Boolean
//open fun containsAll(c : java.util.Collection<*>) : Boolean
open fun addAll(c : java.util.Collection<out E>) : Boolean
//open fun removeAll(c : java.util.Collection<*>) : Boolean
//open fun retainAll(c : java.util.Collection<*>) : Boolean
open fun clear() : Unit
}
library
public trait List<erased E> : Collection<E> {
override fun size() : Int
override fun isEmpty() : Boolean
override fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
// override fun toArray() : Array<Any?>
// Simulate Java's array covariance
// override fun toArray<erased T>(a : Array<out T>) : Array<T>
override fun add(e : E) : Boolean
override fun remove(o : Any?) : Boolean
// override fun containsAll(c : java.util.Collection<*>) : Boolean
override fun addAll(c : java.util.Collection<out E>) : Boolean
// open fun addAll(index : Int, c : java.util.Collection<out E>) : Boolean
// override fun removeAll(c : java.util.Collection<*>) : Boolean
// override fun retainAll(c : java.util.Collection<*>) : Boolean
override fun clear() : Unit
open fun get(index : Int) : E
open fun set(index : Int, element : E) : E
open fun add(index : Int, element : E) : Unit
open fun remove(index : Int) : E
// open fun indexOf(o : Any?) : Int
// open fun lastIndexOf(o : Any?) : Int
}
library
public trait Set<erased E> : Collection<E> {
override fun size() : Int
override fun isEmpty() : Boolean
override fun contains(o : Any?) : Boolean
override fun iterator() : java.util.Iterator<E>
// override fun toArray() : Array<Any?>
// override fun toArray<erased T>(a : Array<out T>) : Array<T>
override fun add(e : E) : Boolean
override fun remove(o : Any?) : Boolean
//override fun containsAll(c : java.util.Collection<*>) : Boolean
override fun addAll(c : java.util.Collection<out E>) : Boolean
//override fun retainAll(c : java.util.Collection<*>) : Boolean
//override fun removeAll(c : java.util.Collection<*>) : Boolean
override fun clear() : Unit
}
library
public open class HashSet<erased E>() : java.util.Set<E> {
override public fun iterator() : java.util.Iterator<E> = js.noImpl
override public fun size() : Int = js.noImpl
override public fun isEmpty() : Boolean = js.noImpl
override public fun contains(o : Any?) : Boolean = js.noImpl
override public fun add(e : E) : Boolean = js.noImpl
override public fun remove(o : Any?) : Boolean = js.noImpl
override public fun clear() : Unit = js.noImpl
override fun addAll(c : java.util.Collection<out E>) : Boolean = js.noImpl
}
library
public trait Map<erased K, erased V> {
open fun size() : Int
open fun isEmpty() : Boolean
open fun containsKey(key : Any?) : Boolean
open fun containsValue(value : Any?) : Boolean
open fun get(key : Any?) : V?
open fun put(key : K, value : V) : V?
open fun remove(key : Any?) : V?
open fun putAll(m : java.util.Map<out K, out V>) : Unit
open fun clear() : Unit
open fun keySet() : java.util.Set<K>
open fun values() : java.util.Collection<V>
}
library
public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
override public fun size() : Int = js.noImpl
override public fun isEmpty() : Boolean = js.noImpl
override public fun get(key : Any?) : V = js.noImpl
override public fun containsKey(key : Any?) : Boolean = js.noImpl
override public fun put(key : K, value : V) : V = js.noImpl
override public fun putAll(m : java.util.Map<out K, out V>) : Unit = js.noImpl
override public fun remove(key : Any?) : V? = js.noImpl
override public fun clear() : Unit = js.noImpl
override public fun containsValue(value : Any?) : Boolean = js.noImpl
override public fun keySet() : java.util.Set<K> = js.noImpl
override public fun values() : java.util.Collection<V> = js.noImpl
}
library
public open class LinkedList<erased E>() : List<E> {
override public fun iterator() : java.util.Iterator<E> = js.noImpl
override public fun isEmpty() : Boolean = js.noImpl
override public fun contains(o : Any?) : Boolean = js.noImpl
override public fun size() : Int = js.noImpl
override public fun add(e : E) : Boolean = js.noImpl
override public fun remove(o : Any?) : Boolean = js.noImpl
override public fun addAll(c : java.util.Collection<out E>) : Boolean = js.noImpl
override public fun clear() : Unit = js.noImpl
override public fun get(index : Int) : E = js.noImpl
override public fun set(index : Int, element : E) : E = js.noImpl
override public fun add(index : Int, element : E) : Unit = js.noImpl
override public fun remove(index : Int) : E = js.noImpl
public fun poll() : E? = js.noImpl
public fun peek() : E? = js.noImpl
public fun offer(e : E) : Boolean = js.noImpl
}
library
public class StringBuilder() {
public fun append(obj : Any) : StringBuilder = js.noImpl
public fun toString() : String = js.noImpl
}
+18
View File
@@ -0,0 +1,18 @@
package js
import java.util.*;
import js.library
native
class Json() {
}
library("jsonSet")
fun Json.set(paramName : String, value : Any?) : Unit {}
library("jsonGet")
fun Json.get(paramName : String) : Any? = null
library("jsonFromTuples")
fun json(vararg pairs : Tuple2<String, Any?>) = Json()
+32
View File
@@ -0,0 +1,32 @@
package js;
import js.native
native
class MathClass() {
val PI : Double = 1.0;
fun random() : Double = 0.0;
fun abs(value : Double) = 0.0
fun acos(value : Double) = 0.0
fun asin(value : Double) = 0.0
fun atan(value : Double) = 0.0
fun atan2(x : Double, y : Double) = 0.0
fun cos(value : Double) = 0.0
fun sin(value : Double) = 0.0
fun exp(value : Double) = 0.0
fun max(vararg values : Double) = 0.0
fun max(vararg values : Int) : Int = js.noImpl
fun min(vararg values : Int) : Int = js.noImpl
fun min(vararg values : Double) = 0.0
fun sqrt(value : Double) = 0.0
fun tan(value : Double) = 0.0
fun log(value : Double) = 0.0
fun pow(base : Double, exp : Double) = 0.0
fun round(value : Double) = 0.0
fun floor(value : Double) = 0.0
fun ceil(value : Double) = 0.0
}
native
val Math = MathClass();
+130
View File
@@ -0,0 +1,130 @@
package html5
import js.native
import js.DomElement
native
class Context() {
fun save() {
}
fun restore() {
}
fun scale(x : Double, y : Double) {
}
fun rotate(angle : Double) {
}
fun translate(x : Double, y : Double) {
}
fun clearRect(x : Double, y : Double, w : Double, h : Double) {
}
fun fillRect(x : Double, y : Double, w : Double, h : Double) {
}
fun strokeRect(x : Double, y : Double, w : Double, h : Double) {
}
var globalAlpha : Double = 1.0;
var strokeStyle : Any = ""
var fillStyle : Any = ""
var lineWidth : Double = 1.0
var shadowOffsetX : Double = 0.0
var shadowOffsetY : Double = 0.0
var shadowBlur : Double = 0.0
var shadowColor : String = ""
var font : String = ""
fun beginPath() {
}
fun moveTo(x : Double, y : Double) {
}
fun closePath() {
}
fun lineTo(x : Double, y : Double) {
}
fun quadraticCurveTo(cpx : Double, cpy : Double, x : Double, y : Double) {
}
fun bezierCurveTo(cp1x : Double, cp1y : Double, cp2x : Double, cp2y : Double, x : Double, y : Double) {
}
fun arcTo(x1 : Double, y1 : Double, x2 : Double, y2 : Double, radius : Double) {
}
fun arc(x : Double, y : Double, radius : Double, startAngle : Double, endAngle : Double, anticlockwise : Boolean) {
}
fun rect(x : Double, y : Double, w : Double, h : Double) {
}
fun fill() {
}
fun stroke() {
}
fun fillText(text : String, x : Double, y : Double) {
}
fun fillText(text : String, x : Double, y : Double, maxWidth : Double) {
}
fun strokeText(text : String, x : Double, y : Double) {
}
fun strokeText(text : String, x : Double, y : Double, maxWidth : Double) {
}
fun measureText(text : String) : TextMetrics = TextMetrics();
fun drawImage(image : HTMLImageElement, dx : Double, dy : Double) {
}
fun drawImage(image : HTMLImageElement, dx: Double, dy: Double, dw: Double, dh: Double) {
}
fun drawImage(image : HTMLImageElement, sx: Double, sy: Double,
sw: Double, sh: Double, dx: Double, dy: Double, dw: Double, dh: Double) {
}
fun createLinearGradient(x0 : Double, y0 : Double, x1 : Double, y1 : Double) : CanvasGradient = CanvasGradient()
fun createRadialGradient(x0 : Double, y0 : Double, r0 : Double, x1 : Double, y1 : Double, r1 : Double) : CanvasGradient = CanvasGradient();
fun getImageData(sx : Int, sy : Int, sw : Int, sh : Int) : ImageData = js.noImpl
fun putImageData(data : ImageData, dx : Int, dy : Int) : Unit = js.noImpl
}
native
open class HTMLImageElement() : DomElement() {
}
native
class CanvasGradient() {
fun addColorStop(offset : Double, color : String) {
}
}
native
class ImageData() {
// readonly attribute unsigned long width;
// readonly attribute unsigned long height;
// readonly attribute Uint8ClampedArray data;
val width : Int = js.noImpl
val height : Int = js.noImpl
val data : Array<Int> = js.noImpl
}
native
class Canvas() : DomElement() {
var width : Int = js.noImpl;
var height : Int = js.noImpl;
//DOMString toDataURL(in optional DOMString type, in any... args);
fun toDataURL() : String = js.noImpl
fun toDataURL(typ : String) : String = js.noImpl
}
native
class TextMetrics() {
val width : Int = 0
}
/*custom helpers*/
native
fun getContext() : Context = Context();
native
fun getCanvas() : Canvas = Canvas();
native
fun getKotlinLogo() : HTMLImageElement = HTMLImageElement();
+37
View File
@@ -0,0 +1,37 @@
package html5.files
import js.native
native
class FileReader() {
var onloadend : ((FileReaderEvent)->Unit)? = js.noImpl //
fun readAsDataURL(blob : Blob) = js.noImpl
val result : File = js.noImpl
}
native
class FileReaderEvent() {
val target : FileReader = js.noImpl
}
native
class FileList() {
fun item(index : Int) : File? = js.noImpl
val length : Int = js.noImpl
}
native
class File() : Blob() {
val name : String = js.noImpl
// readonly attribute Date lastModifiedDate;
}
native
open class Blob() {
val size : Int = js.noImpl
val `type` : String = js.noImpl
//Blob slice(optional long long start,
//optional long long end,
//optional DOMString contentType);
//
}
+25
View File
@@ -0,0 +1,25 @@
package html5
import js.Exception
import js.native
import js.DomElement
import html5.files.FileList
native
class HTMLInputElement() : DomElement() {
val files : FileList = js.noImpl
var onchange : (HTMLInputElementEvent)->Unit = js.noImpl
}
native
class HTMLInputElementEvent() {
val target : HTMLInputElement = js.noImpl
}
native
class Image() : HTMLImageElement() {
var height : Int = js.noImpl
var width : Int = js.noImpl
var src : String = js.noImpl
var onload : ()->Unit = js.noImpl
}
+72
View File
@@ -0,0 +1,72 @@
package jquery;
import js.*;
import js.DomElement
native
class JQuery() {
fun addClass(className : String) : JQuery = js.noImpl;
fun addClass(f : DomElement.(Int, String)->String) = js.noImpl;
fun attr(attrName : String) = "";
fun attr(attrName : String, value : String) = this;
fun html() : String = "";
fun html(s : String) = this;
fun html(f : DomElement.(Int, String)->String) = this;
fun hasClass(className : String) = true
fun removeClass(className : String) = this
fun height() = 0
fun width() = 0
fun click() = this;
fun mousedown(handler : DomElement.(MouseEvent)->Unit) = this;
fun mouseup(handler : DomElement.(MouseEvent)->Unit) = this;
fun mousemove(handler : DomElement.(MouseEvent)->Unit) = this;
fun dblclick(handler : DomElement.(MouseClickEvent)->Unit) = this;
fun click(handler : DomElement.(MouseClickEvent)->Unit) = this;
fun load(handler : DomElement.()->Unit) = this;
fun change(handler : DomElement.()->Unit) = this;
fun append(str : String) = this;
fun ready(handler : ()->Unit) = this;
fun text(text : String) = this;
fun slideUp() = this;
fun hover(handlerInOut : DomElement.() -> Unit) = this;
fun hover(handlerIn : DomElement.() -> Unit, handlerOut : DomElement.() -> Unit) = this;
fun next() : JQuery = js.noImpl
fun parent() : JQuery = js.noImpl
}
native
open class MouseEvent() {
val pageX : Double = 0.0;
val pageY : Double = 0.0;
fun preventDefault() {}
fun isDefaultPrevented() : Boolean = true;
}
native
class MouseClickEvent() : MouseEvent() {
val which : Int = 0;
}
native("$")
fun jq(selector : String) = JQuery();
native("$")
fun jq(selector : String, context : DomElement) = JQuery();
native("$")
fun jq(callback : () -> Unit) = JQuery();
native("$")
fun jq(obj : JQuery) = JQuery();
native("$")
fun jq(el : DomElement) = JQuery();
native("$")
fun jq() = JQuery();
+20
View File
@@ -0,0 +1,20 @@
package jquery.ui
//jquery UI
import jquery.JQuery
import js.native
import js.Json
native
fun JQuery.buttonset() : JQuery = js.noImpl;
native
fun JQuery.dialog() : JQuery = js.noImpl;
native
fun JQuery.button() : JQuery = js.noImpl;
native
fun JQuery.accordion() : JQuery = js.noImpl
native
fun JQuery.draggable(params : Json) : JQuery = js.noImpl
native
fun JQuery.selectable() : JQuery = js.noImpl
+63
View File
@@ -0,0 +1,63 @@
package raphael
import js.*;
import js.*;
native
open class Element() {
fun attr(name : String, value : Any?) : Element = this
fun attr(nameToValue : Json) : Element = this
fun click(handler : Element.()-> Unit) = this;
fun mouseover(handler : Element.() -> Unit) = this
fun mouseout(handler : Element.() -> Unit) = this
fun getTotalLength() : Double = 0.0
fun getPointAtLength(length : Double) : Point = js.noImpl
fun animate(params : Json, ms : Int, callback : ()-> Unit) : Element = js.noImpl
fun animate(params : Json, ms : Int, s : String) : Element = js.noImpl
fun animate(params : Json, ms : Int) : Element = js.noImpl
//fun mouse
}
native
class Set() : Element() {
fun push(el : Element) = js.noImpl
}
native
class Paper() {
fun path(pathString : String) : Element = Element();
fun path() : Element = Element();
fun ellipse(x : Int, y : Int, rx : Int, ry : Int) : Element = js.noImpl
fun circle(x : Int, y : Int, r : Int) : Element = js.noImpl
fun set() : Set = js.noImpl
val customAttributes : Json = Json();
}
native("Raphael")
fun Raphael(elementId : String, width : Int, height : Int) : Paper = Paper();
native("Raphael")
fun Raphael(elementId : String, width : Int, height : Int, initFun : Paper.() -> Unit) : Unit = js.noImpl
native
fun getColor() : Color = js.noImpl
native
fun resetColors() = js.noImpl
native
class Color() {
}
native
class Point() {
val x = 0
val y = 0
val alpha = 0
}