Advertisement
dburyak

Untitled

Nov 20th, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 4.43 KB | None | 0 0
  1. void initUI() {
  2.         builder.with {
  3.             builder.application(name: mainWindowId,
  4.                     title: getMessage('main.title'),
  5.                     sizeToScene: true,
  6.                     centerOnScreen: true) {
  7.                 def mainScene = scene(width: model.windowWidth,
  8.                         height: model.windowHeight) {
  9.                     stylesheets([javafxCSS])
  10.  
  11.                     borderPane {
  12.                         top { // Main menu
  13.                             menuBar(useSystemMenuBar: true) {
  14.                                 menu(getMessage('main.menu.File.text')) { // File
  15.                                     menuItem(preferencesAction)
  16.                                     menuItem(exitAction)
  17.                                 }
  18.                                 menu(getMessage('main.menu.Edit.text')) { // Edit
  19.                                 }
  20.                             }
  21.                         }
  22.  
  23.                         center {
  24.                             borderPane {
  25.                                 top {
  26.                                     toolBar {
  27.                                         toggleButton(id: editModeTglId, modeEditAction)
  28.                                         toggleButton(id: runModeTglId, modeRunAction)
  29.                                         noparent { // modeToggleGroup configuration
  30.                                             def toggleGroup = new ToggleGroup()
  31.                                             toggleGroup.toggles.addAll([
  32.                                                     builder[editModeTglId],
  33.                                                     builder[runModeTglId]])
  34.                                             toggleGroup.selectedToggleProperty().addListener({ ov, prevTgl, newTgl ->
  35.                                                 if (!newTgl) {
  36.                                                     runInsideUIAsync { toggleGroup.selectToggle(prevTgl) }
  37.                                                 }
  38.                                             } as ChangeListener)
  39.                                             model.modeProperty().addListener({ ov, prevMode, newMode ->
  40.                                                 toggleGroup.selectToggle(toggleOf(newMode))
  41.                                             } as ChangeListener)
  42.                                             toggleGroup.selectToggle(toggleOf(model.mode))
  43.                                         }
  44.                                         separator(orientation: VERTICAL)
  45.                                     }
  46.                                 }
  47.                                 center {
  48.                                     scrollPane(id: 'nodesPane') {
  49.                                         borderPane {
  50.                                             top {
  51.                                                 node(createMVCGroup('node-source').rootNode)
  52.                                             }
  53.                                             center {
  54.                                                 vbox(id: nodesId) {
  55.                                                     button('transformer1')
  56.                                                     button('element2')
  57.                                                     button('filter3')
  58.                                                 }
  59.                                             }
  60.                                             bottom {
  61.                                                 node(createMVCGroup('node-result').rootNode)
  62.                                             }
  63.                                         }
  64.                                     }
  65.                                 }
  66.                                 bottom {
  67.                                     node(createMVCGroup('status-bar').rootNode)
  68.                                 }
  69.                             }
  70.                         }
  71.                     }
  72.                 }
  73.                 noparent { // bind window size to model
  74.                     mainScene.widthProperty().addListener({ ov, prevValue, newValue ->
  75.                         runOutsideUIAsync { model.windowWidth = newValue }
  76.                     } as ChangeListener)
  77.                     mainScene.heightProperty().addListener({ ov, prevValue, newValue ->
  78.                         runOutsideUIAsync { model.windowHeight = newValue }
  79.                     } as ChangeListener)
  80.                 }
  81.             }
  82.         }
  83.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement