edvin
04/01/2017, 7:54 PMedvin
04/01/2017, 7:55 PMButton.accelerator
so it works in subviews as well.edvin
04/01/2017, 7:55 PMUIComponent.accelerators
map work in any View, not just Workspace embedded Views.ron
04/01/2017, 7:57 PMron
04/01/2017, 7:58 PMron
04/01/2017, 7:58 PMedvin
04/01/2017, 8:00 PMedvin
04/01/2017, 8:00 PMron
04/01/2017, 8:00 PMedvin
04/01/2017, 8:00 PMron
04/01/2017, 8:01 PMedvin
04/01/2017, 8:01 PMedvin
04/01/2017, 8:01 PMedvin
04/01/2017, 8:02 PMk
to select kittens and p
to select puppies.edvin
04/01/2017, 8:02 PMedvin
04/01/2017, 8:05 PMButton.accelerator
function so it just adds to the accelerators map, and also add one that would work from anywhere inside a view so you can define accelerators with accelerator(KeyCombination.valueOf("k") { ... }
.edvin
04/01/2017, 8:06 PMaccelerator("k") {}
edvin
04/01/2017, 8:10 PMshortcut
?edvin
04/01/2017, 8:10 PMshortcut("k") { value = "kittens" }
edvin
04/01/2017, 8:10 PMedvin
04/01/2017, 10:00 PMaccelerator
and called it shortcut
everywhere. More pragmatic name IMO.nimakro
04/02/2017, 2:05 PMconfig
helper, this is what my first draft is looking like, I am open for any improvement suggestions or criticism.
In my opinion we should have the concept of component wide settings and system wide settings (which don't use the java.preferences
) and store them as json ( to allow hierarchical data structures).
My first draft:
// Defines the config context
enum class Context {
LOCAL,
SYSTEM
}
// The the default configBasePath is Paths.get("conf") but can be changed by overriding
// the path variable in App like so:
class MyApp : App(MyView::class) {
override val configBase = Paths.get("custom-folder")
// The system path has to be a relative path since it will wie placed beneath configBase
// If you don't override val system the system settings will be stored under
// configBase/system.properties
override val system = Paths.get("system")
}
class MyView : View() {
// All configs are stored under configBase;
// The LOCAL context contains all the component depending configurations
// config_base_path default is conf inside the current program folder.
config(context: Context = LOCAL) {
// ...
}
// The default context path is configBase/javaClass.name + ".properties"
// So you can write the following to save to the component config
config {
set("username" to "user")
set("password" to "pwd")
}
// The SYSTEM context contains all system wide configurations und configBase/system
// The SYSTEM context can by changed by overriding the system Path variable
config(SYSTEM) {
set("username" to "user")
set("password" to "pwd")
set("window") to jsonObject {
set("x" to 30.0)
set("y" to 40.0)
set("list" to jsonArray(2, 3, 4))
}
}
config(LOCAL) {
val usr = string("username")
val pwd = string("password")
}
config(SYSTEM) {
val usr = string("username")
val pwd = string("password")
val x = double("x", 50.0)
// We allow jsonPath to retrieve elements.
val windowX = double("windwo.x")
val listFirst = double("windwo.list[0]")
}
}
edvin
04/02/2017, 3:04 PMLOCAL
vs SYSTEM
though. What about COMPONENT
vs APP
or something?edvin
04/02/2017, 3:04 PMGLOBAL
instead of APP
?permalmberg
04/02/2017, 3:05 PMpermalmberg
04/02/2017, 3:09 PMscrollpane
? I.e. if I scroll downwards vertically, how much have the contents moved upwards? Right now I'm using pane.vvalue * pane.content.boundsInParent.height
but it doesn't scale correctly - the more I scroll, the more the calculated value overshoots the correct valueedvin
04/02/2017, 3:36 PMpermalmberg
04/02/2017, 3:37 PMedvin
04/02/2017, 3:37 PM