Rohan Sircar
3 years ago
8 changed files with 336 additions and 0 deletions
-
44src/main/scala/nova/monadic_sfx/implicits/FontIcon.scala
-
42src/main/scala/nova/monadic_sfx/implicits/JFXButton.scala
-
36src/main/scala/nova/monadic_sfx/implicits/JFXListCell.scala
-
48src/main/scala/nova/monadic_sfx/implicits/JFXListView.scala
-
29src/main/scala/nova/monadic_sfx/implicits/JFXSpinner.scala
-
40src/main/scala/nova/monadic_sfx/implicits/JFXTextArea.scala
-
35src/main/scala/nova/monadic_sfx/implicits/JFXTextField.scala
-
62src/main/scala/nova/monadic_sfx/implicits/JFXTreeTableView.scala
@ -0,0 +1,44 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import javafx.{scene => jfxs} |
||||
|
import org.kordamp.ikonli.{javafx => ikonlifx} |
||||
|
import scalafx.scene.paint.Paint |
||||
|
import scalafx.scene.text.Text |
||||
|
|
||||
|
object FontIcon { |
||||
|
implicit def sfxText2jfx(v: FontIcon): jfxs.text.Text = |
||||
|
if (v != null) v.delegate else null |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// extends Shape(delegate) |
||||
|
// with PositionDelegate[ikonlifx.FontIcon] |
||||
|
// with SFXDelegate[ikonlifx.FontIcon] |
||||
|
|
||||
|
class FontIcon(override val delegate: ikonlifx.FontIcon = new ikonlifx.FontIcon) |
||||
|
extends Text(delegate) { |
||||
|
|
||||
|
// def iconCode_=(v: Ikon) = delegate.setIconCode(v) |
||||
|
|
||||
|
def iconColor = delegate.getIconColor() |
||||
|
|
||||
|
def iconColor_=(color: Paint) = delegate.setIconColor(color) |
||||
|
|
||||
|
def iconSize = delegate.getIconSize() |
||||
|
|
||||
|
def iconSize_=(size: Int) = delegate.setIconSize(size) |
||||
|
|
||||
|
def iconLiteral = delegate.getIconLiteral() |
||||
|
|
||||
|
def iconLiteral_=(literal: IconLiteral) = |
||||
|
delegate.setIconLiteral(literal.value) |
||||
|
|
||||
|
def iconLiteral_=(literal: String) = delegate.setIconLiteral(literal) |
||||
|
|
||||
|
} |
||||
|
|
||||
|
sealed abstract class IconLiteral(val value: String) |
||||
|
object IconLiteral { |
||||
|
// fab-accusoft |
||||
|
case object Gmi10k extends IconLiteral("gmi-10k") |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import javafx.{scene => jfxs} |
||||
|
import scalafx.Includes._ |
||||
|
import scalafx.beans.property.ObjectProperty |
||||
|
import scalafx.scene.Node |
||||
|
import scalafx.scene.control.Button |
||||
|
|
||||
|
import jfxs.{paint => jfxsp} |
||||
|
|
||||
|
object JFXButton { |
||||
|
implicit def sfxButton2jfx(v: JFXButton): jfoenixc.JFXButton = |
||||
|
if (v != null) v.delegate else null |
||||
|
} |
||||
|
|
||||
|
// extends ButtonBase(delegate) |
||||
|
// with SFXDelegate[jfoenixc.JFXButton] |
||||
|
|
||||
|
class JFXButton( |
||||
|
override val delegate: jfoenixc.JFXButton = new jfoenixc.JFXButton |
||||
|
) extends Button(delegate) { |
||||
|
|
||||
|
/** |
||||
|
* Creates a button with the specified text as its label. |
||||
|
*/ |
||||
|
def this(text: String) = this(new jfoenixc.JFXButton(text)) |
||||
|
|
||||
|
/** |
||||
|
* Creates a button with the specified text and icon for its label. |
||||
|
*/ |
||||
|
def this(text: String, graphic: Node) = |
||||
|
this(new jfoenixc.JFXButton(text, graphic)) |
||||
|
|
||||
|
def ripplerFill: ObjectProperty[jfxsp.Paint] = |
||||
|
jfxObjectProperty2sfx(delegate.ripplerFillProperty) |
||||
|
|
||||
|
def ripplerFill_=(b: jfxsp.Paint): Unit = { |
||||
|
ripplerFill() = b |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import javafx.scene.{control => jfxsc} |
||||
|
import scalafx.Includes._ |
||||
|
import scalafx.beans.property.ReadOnlyObjectProperty |
||||
|
import scalafx.delegate.SFXDelegate |
||||
|
import scalafx.scene.control.IndexedCell |
||||
|
import scalafx.scene.control.ListView |
||||
|
|
||||
|
object JFXListCell { |
||||
|
implicit def sfxListCell2jfx[T]( |
||||
|
l: JFXListCell[T] |
||||
|
): jfoenixc.JFXListCell[T] = |
||||
|
if (l != null) l.delegate else null |
||||
|
} |
||||
|
|
||||
|
class JFXListCell[T]( |
||||
|
override val delegate: jfoenixc.JFXListCell[T] = new jfoenixc.JFXListCell[T] |
||||
|
) extends IndexedCell(delegate) |
||||
|
with SFXDelegate[jfoenixc.JFXListCell[T]] { |
||||
|
|
||||
|
/** |
||||
|
* The ListView associated with this Cell. |
||||
|
*/ |
||||
|
def listView: ReadOnlyObjectProperty[jfxsc.ListView[T]] = |
||||
|
delegate.listViewProperty |
||||
|
|
||||
|
/** |
||||
|
* Updates the ListView associated with this Cell. |
||||
|
*/ |
||||
|
def updateListView(listView: ListView[T]): Unit = { |
||||
|
delegate.updateListView(listView) |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import monix.execution.Scheduler |
||||
|
import monix.reactive.Observable |
||||
|
import scalafx.Includes._ |
||||
|
import scalafx.collections.ObservableBuffer |
||||
|
import scalafx.scene.control.ListView |
||||
|
|
||||
|
object JFXListView { |
||||
|
implicit def sfxListView2jfx[T](l: JFXListView[T]): jfoenixc.JFXListView[T] = |
||||
|
if (l != null) l.delegate else null |
||||
|
} |
||||
|
|
||||
|
// extends Control(delegate) |
||||
|
// with SFXDelegate[jfoenixc.JFXListView[T]] |
||||
|
|
||||
|
class JFXListView[T]( |
||||
|
override val delegate: jfoenixc.JFXListView[T] = new jfoenixc.JFXListView[T] |
||||
|
) extends ListView[T] { |
||||
|
|
||||
|
// def items_=( |
||||
|
// v: Observable[ObservableBuffer[T]] |
||||
|
// )(implicit s: Scheduler): Unit = { |
||||
|
// v.foreach { items() = _ } |
||||
|
// } |
||||
|
|
||||
|
def items_=( |
||||
|
v: Observable[Seq[T]] |
||||
|
)(implicit s: Scheduler): Unit = { |
||||
|
v |
||||
|
.map { |
||||
|
// case buf: ObservableBuffer[T] => buf |
||||
|
case other => ObservableBuffer.from(other) |
||||
|
} |
||||
|
// .map(myDiff(items(), _)) |
||||
|
.foreach { items() = _ } |
||||
|
} |
||||
|
|
||||
|
def depth = delegate.depthProperty() |
||||
|
def depth_=(depth: Int) = delegate.setDepth(depth) |
||||
|
|
||||
|
def expanded = delegate.expandedProperty() |
||||
|
def expanded_=(v: Boolean) = expanded() = v |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import scalafx.scene.control.ProgressIndicator |
||||
|
|
||||
|
object JFXSpinner { |
||||
|
implicit def sfxSpinner2jfx( |
||||
|
v: JFXSpinner |
||||
|
): jfoenixc.JFXSpinner = if (v != null) v.delegate else null |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// extends Control(delegate) |
||||
|
// with SFXDelegate[jfoenixc.JFXSpinner] |
||||
|
|
||||
|
/** |
||||
|
* Wraps [[JFoenix JFXSpinner]] |
||||
|
*/ |
||||
|
class JFXSpinner( |
||||
|
override val delegate: jfoenixc.JFXSpinner = new jfoenixc.JFXSpinner |
||||
|
) extends ProgressIndicator(delegate) { |
||||
|
|
||||
|
def radius = delegate.getRadius() |
||||
|
def radius_=(radius: Double) = delegate.setRadius(radius) |
||||
|
|
||||
|
def startingAngle = delegate.startingAngleProperty() |
||||
|
def startingAngle_=(angle: Double) = delegate.setStartingAngle(angle) |
||||
|
|
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import scalafx.Includes._ |
||||
|
import scalafx.beans.property.BooleanProperty |
||||
|
import scalafx.scene.control.TextArea |
||||
|
import scalafx.scene.paint.Paint |
||||
|
|
||||
|
object JFXTextArea { |
||||
|
implicit def sfxTextArea2jfx(v: JFXTextArea): jfoenixc.JFXTextArea = |
||||
|
if (v != null) v.delegate else null |
||||
|
} |
||||
|
// extends TextInputControl(delegate) |
||||
|
// with SFXDelegate[jfoenixc.JFXTextArea] |
||||
|
class JFXTextArea( |
||||
|
override val delegate: jfoenixc.JFXTextArea = new jfoenixc.JFXTextArea() |
||||
|
) extends TextArea(delegate) { |
||||
|
|
||||
|
/** |
||||
|
* Creates a TextArea with initial text content. |
||||
|
* |
||||
|
* @param text - A string for text content. |
||||
|
*/ |
||||
|
def this(text: String) = this(new jfoenixc.JFXTextArea(text)) |
||||
|
|
||||
|
def labelFloat = delegate.labelFloatProperty() |
||||
|
def labelFloat_=(v: Boolean) = delegate.setLabelFloat(v) |
||||
|
|
||||
|
def focusColor: Paint = delegate.getFocusColor() |
||||
|
def focusColor_=(color: Paint) = delegate.setFocusColor(color) |
||||
|
|
||||
|
def unFocusColor = delegate.getUnFocusColor() |
||||
|
def unFocusColor_=(color: Paint) = delegate.setUnFocusColor(color) |
||||
|
|
||||
|
def disableAnimation: BooleanProperty = delegate.disableAnimationProperty() |
||||
|
|
||||
|
def disableAnimation_=(disable: Boolean) = |
||||
|
delegate.setDisableAnimation(disable) |
||||
|
|
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import scalafx.Includes._ |
||||
|
import scalafx.beans.property.BooleanProperty |
||||
|
import scalafx.scene.control.TextField |
||||
|
import scalafx.scene.paint.Paint |
||||
|
|
||||
|
object JFXTextField { |
||||
|
implicit def sfxTextField2jfx(v: JFXTextField): jfoenixc.JFXTextField = |
||||
|
if (v != null) v.delegate else null |
||||
|
} |
||||
|
|
||||
|
// TextInputControl(delegate) |
||||
|
// with AlignmentDelegate[jfoenixc.JFXTextField] |
||||
|
// with SFXDelegate[jfoenixc.JFXTextField] { |
||||
|
|
||||
|
class JFXTextField( |
||||
|
override val delegate: jfoenixc.JFXTextField = new jfoenixc.JFXTextField |
||||
|
) extends TextField(delegate) { |
||||
|
|
||||
|
def labelFloat = delegate.labelFloatProperty() |
||||
|
def labelFloat_=(v: Boolean) = delegate.setLabelFloat(v) |
||||
|
|
||||
|
def focusColor: Paint = delegate.getFocusColor() |
||||
|
def focusColor_=(color: Paint) = delegate.setFocusColor(color) |
||||
|
|
||||
|
def unFocusColor = delegate.getUnFocusColor() |
||||
|
def unFocusColor_=(color: Paint) = delegate.setUnFocusColor(color) |
||||
|
|
||||
|
def disableAnimation: BooleanProperty = delegate.disableAnimationProperty() |
||||
|
|
||||
|
def disableAnimation_=(disable: Boolean) = |
||||
|
delegate.setDisableAnimation(disable) |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
package nova.monadic_sfx.implicits |
||||
|
|
||||
|
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject |
||||
|
import com.jfoenix.{controls => jfoenixc} |
||||
|
import javafx.scene.{control => jfxsc} |
||||
|
import scalafx.collections.ObservableBuffer |
||||
|
import scalafx.scene.control.TreeItem |
||||
|
import scalafx.scene.control.TreeTableView |
||||
|
|
||||
|
class RecursiveTreeItem[G <: RecursiveTreeObject[G]]( |
||||
|
override val delegate: jfoenixc.RecursiveTreeItem[G] = |
||||
|
new jfoenixc.RecursiveTreeItem[G]((item: RecursiveTreeObject[G]) => |
||||
|
item.getChildren() |
||||
|
) |
||||
|
) extends TreeItem[G](delegate) { |
||||
|
def this(value: G) = |
||||
|
this( |
||||
|
new jfoenixc.RecursiveTreeItem[G]( |
||||
|
value, |
||||
|
(item: RecursiveTreeObject[G]) => item.getChildren() |
||||
|
) |
||||
|
) |
||||
|
def this(items: ObservableBuffer[G]) = |
||||
|
this( |
||||
|
new jfoenixc.RecursiveTreeItem[G]( |
||||
|
items, |
||||
|
(item: RecursiveTreeObject[G]) => item.getChildren() |
||||
|
) |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
object RecursiveTreeItem { |
||||
|
implicit def sfxTreeItem2jfxTreeItem[G <: RecursiveTreeObject[G]]( |
||||
|
v: RecursiveTreeItem[G] |
||||
|
): jfoenixc.RecursiveTreeItem[G] = v.delegate |
||||
|
} |
||||
|
|
||||
|
// @formatter:off |
||||
|
class JFXTreeTableView[S <: RecursiveTreeObject[S]]( |
||||
|
override val delegate: jfoenixc.JFXTreeTableView[S] = new jfoenixc.JFXTreeTableView[S] |
||||
|
) extends TreeTableView(delegate) { |
||||
|
|
||||
|
|
||||
|
def this(root: TreeItem[S]) = this(new jfoenixc.JFXTreeTableView[S](root)) |
||||
|
// def this(root: TreeItem[S], items: ObservableBuffer[S]) = this(new jfoenixc.JFXTreeTableView[S](root, items)) |
||||
|
|
||||
|
// @formatter:on |
||||
|
def currentItemsCount = delegate.currentItemsCountProperty() |
||||
|
def predicate = delegate.predicateProperty() |
||||
|
// delegate.set |
||||
|
|
||||
|
// override def treeColumn_=(v: TreeTableColumn[S, _]): Unit = ??? |
||||
|
// delegate.setTreeColumn() |
||||
|
} |
||||
|
|
||||
|
// @formatter:off |
||||
|
object JFXTreeTableView { |
||||
|
implicit def sfxTreeTableView2jfx[S <: RecursiveTreeObject[S]]( |
||||
|
v: JFXTreeTableView[S] |
||||
|
): jfxsc.TreeTableView[S] = if (v != null) v.delegate else null |
||||
|
} |
||||
|
// @formatter:on |
Write
Preview
Loading…
Cancel
Save
Reference in new issue