Skip to content

Commit

Permalink
Ta Daa!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimerDude committed Sep 7, 2020
0 parents commit e6199ce
Show file tree
Hide file tree
Showing 15 changed files with 804 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .buildpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path="fan"/>
<buildpathentry kind="con" path="org.eclipse.dltk.launching.INTERPRETER_CONTAINER"/>
</buildpath>
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.xored.fanide.jdt.launching.FANJAVA_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build"/>
</classpath>
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.hg/
/.skyspark/
/bin/
/build/
/sky/
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>App Kit</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.xored.fanide.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
24 changes: 24 additions & 0 deletions build.fan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using build::BuildPod

class Build : BuildPod {

new make() {
podName = "afAppKit"
summary = "My Awesome appKit project"
version = Version("0.0.1")

meta = [
"pod.dis" : "App Kit",
]

depends = [
// ---- Fantom Core -----------------
"sys 1.0.73 - 1.0",
"dom 1.0.73 - 1.0",
]

srcDirs = [`fan/`, `fan/appkit/`, `fan/core/`, `fan/util/`]
resDirs = [`doc/`]
jsDirs = [`js/`]
}
}
4 changes: 4 additions & 0 deletions doc/pod.fandoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

Overview
********
afAppKit - My Awesome appKit project
63 changes: 63 additions & 0 deletions fan/appkit/Checkbox.fan
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using dom

**
** Checkbox displays a checkbox that can be toggled on and off.
**
** - domkit 1.0.75
@Js class Checkbox {

Elem elem { private set }

private new _make(Elem elem) {
this.elem = elem

if (elem.tagName != "input" && elem["type"] != "checkbox")
throw ArgErr("Elem not an input checkbox: ${elem.html}")

elem.onEvent("change", false) |e| {
fireAction(e)
}
}

static new fromSelector(Str selector) {
elem := Win.cur.doc.querySelector(selector)
if (elem == null) throw Err("Could not find Checkbox: ${selector}")
return fromElem(elem)
}

static new fromElem(Elem elem) {
if (elem.prop(Checkbox#.qname) == null)
elem.setProp(Checkbox#.qname, Checkbox._make(elem))
return elem.prop(Checkbox#.qname)
}

** Set to 'true' to set field to readonly mode.
Bool ro {
get { elem->readOnly }
set { elem->readOnly = it }
}

** Get or set indeterminate flag.
Bool indeterminate {
get { elem->indeterminate }
set { elem->indeterminate = it }
}

** Name of input.
Str? name {
get { elem->name }
set { elem->name = it }
}

** Value of checked.
Bool checked {
get { elem->checked }
set { elem->checked = it }
}

** Callback when 'enter' key is pressed.
Void onAction(|This| f) { this.cbAction = f }

internal Void fireAction(Event? e) { cbAction?.call(this) }
private Func? cbAction := null
}
41 changes: 41 additions & 0 deletions fan/appkit/Link.fan
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using dom

**
** Hyperlink anchor element
**
** - domkit 1.0.75
@Js class Link {

Elem elem { private set }

private new _make(Elem elem) {
this.elem = elem

if (elem.tagName != "a")
throw ArgErr("Elem not an anchor: ${elem.html}")
}

static new fromSelector(Str selector) {
elem := Win.cur.doc.querySelector(selector)
if (elem == null) throw Err("Could not find Link: ${selector}")
return fromElem(elem)
}

static new fromElem(Elem elem) {
if (elem.prop(Link#.qname) == null)
elem.setProp(Link#.qname, Link._make(elem))
return elem.prop(Link#.qname)
}

** The target attribute specifies where to open the linked document.
Str target {
get { this->target }
set { this->target = it }
}

** URI to hyperlink to.
Uri url {
get { Uri.decode(elem->href ?: "") }
set { elem->href = it.encode }
}
}
Loading

0 comments on commit e6199ce

Please sign in to comment.