bjonnh
03/27/2019, 12:01 AMbjonnh
03/27/2019, 12:01 AMbjonnh
03/27/2019, 12:05 AMRuckus
03/27/2019, 7:44 PMprivate void showImpl(final Window owner) {
...
sceneValue.getStylesheets().setAll(ownerScene.getStylesheets());
...
}
Has anyone else run into this, and/or does anyone know a workaround? I'd like to avoid adding the popup specific stylesheet to the owning scene as there are some conflicting definitions that I don't want to rework.ec
03/28/2019, 8:44 PMron
03/29/2019, 12:44 PMron
03/29/2019, 12:45 PMpackage example.java;
import java.util.Objects;
/**
*
*/
public class StockItem {
private String itemName;
private Integer amountAvailable=0;
private Integer minimumAmountInStock=1;
public StockItem(String itemName) {
this.itemName = itemName;
}
public StockItem(String itemName, int amountAvailable, int minimumAmountInStock) {
this.itemName = itemName;
this.amountAvailable = amountAvailable;
this.minimumAmountInStock = minimumAmountInStock;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public int getAmountAvailable() {
return amountAvailable;
}
public void setAmountAvailable(int amountAvailable) {
this.amountAvailable = amountAvailable;
}
public int getMinimumAmountInStock() {
return minimumAmountInStock;
}
public void setMinimumAmountInStock(int minimumAmountInStock) {
this.minimumAmountInStock = minimumAmountInStock;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StockItem stockItem = (StockItem) o;
return itemName.equals(stockItem.itemName);
}
@Override
public int hashCode() {
return Objects.hash(itemName);
}
}
ron
03/29/2019, 12:47 PMclass StockItemModel(stockItem: StockItem) : ItemViewModel<StockItem>(stockItem) {
val name = observable(stockItem, StockItem::getItemName, StockItem::setItemName)
val amountAvailable = observable(stockItem, StockItem::getAmountAvailable, StockItem::setAmountAvailable)
val minimumInStock = observable(stockItem, StockItem::getMinimumAmountInStock, StockItem::setMinimumAmountInStock)
}
ron
03/29/2019, 12:49 PMclass StockItemDetailView : View("My View") {
val model = StockItemModel(StockItem("test", 1, 10))
override val root = form {
fieldset {
field("Name", VERTICAL) { textfield(model.name) }
field("Available", VERTICAL) { textfield(model.amountAvailable) }
field("amount", VERTICAL) { textfield(model.minimumInStock) }
}
}
}
ron
03/29/2019, 12:50 PMron
03/29/2019, 12:50 PMfun EventTarget.textfield(property: ObservableValue<Int>, op: TextField.() -> Unit = {}) = textfield().apply {
bind(property)
op(this)
}
ron
03/29/2019, 12:50 PMron
03/29/2019, 12:50 PMfun <S : Any> observableI(bean: S, getter: KFunction<kotlin.Int>, setter: KFunction2<S, <http://kotlin.Int|kotlin.Int>, Unit>): SimpleIntegerProperty {
val propname = getter.name.substring(3).decapitalize()
return object : SimpleIntegerProperty(bean, propname) {
override fun getValue() = getter.call(bean)
override fun setValue(v: kotlin.Number?) {
if (v != null)
setter.invoke(bean, v as <http://kotlin.Int|kotlin.Int>)
}
}
}
ron
03/29/2019, 12:50 PMron
03/29/2019, 12:52 PMcarlw
03/29/2019, 1:30 PMron
03/29/2019, 1:34 PMron
03/29/2019, 1:35 PMobservable
and makes a "special one"ron
03/29/2019, 1:36 PMEventTarget.textfield
extensions the first one would just be a normal extra oneron
03/29/2019, 7:57 PMron
04/03/2019, 1:10 PMron
04/03/2019, 1:10 PMcarlw
04/03/2019, 1:13 PMron
04/03/2019, 1:14 PMron
04/03/2019, 1:14 PMron
04/03/2019, 1:15 PMron
04/03/2019, 1:15 PMval includeArray = include.split(" ").toTypedArray()
val excluseArray = exclude.split(" ").toTypedArray()
storyList.filter {entry-> entry.types.split(" ").filter{includeArray.contains(it)}}
ron
04/03/2019, 1:16 PMron
04/03/2019, 1:19 PMron
04/03/2019, 1:22 PMdata class Book (val title: String, val types: String)
val booklist = listOf(
Book("1", "a b c"),
Book("2", "b c d"),
Book("3", "e f g")
)
val toinclude="a g".split(" ")