Advertisement
MadMax1028

SimpleCommand usage

Oct 9th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. val body = VerticalLayout().apply {
  2.     isSpacing = true
  3.    
  4.     val isButtonEnabledProperty = objectProperty(false)
  5.     val isButtonVisibleProperty = objectProperty(true)
  6.    
  7.     val showHelloWorldCommand = SimpleCommand(
  8.         action = { Notification.show("Hello World!!!") },
  9.         isEnabledPredicate = { isButtonEnabledProperty.value },
  10.         isVisiblePredicate = { isButtonVisibleProperty.value }
  11.     ).apply {
  12.         bindNotifier(isButtonEnabledProperty)
  13.         bindNotifier(isButtonVisibleProperty)
  14.     }
  15.    
  16.     this += CheckBox("Hello World enabled?", isButtonEnabledProperty).apply { isImmediate = true }
  17.     this += CheckBox("Hello World visible?", isButtonVisibleProperty).apply { isImmediate = true }
  18.     this += button("Hello World!!!", MadosTheme.FontIcons.SUBMIT, showHelloWorldCommand)
  19. }
  20. this += body
  21. this.setExpandRatio(body, 1f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement