@@ -62,45 +62,15 @@ object CsvValidatorUi extends SimpleSwingApplication {
6262 private lazy val txtCsvFile = new JTextField (30 )
6363 private lazy val txtCsvSchemaFile = new JTextField (30 )
6464
65- private def changeHeightOfOutputPane (heightDiff : Int ): Unit = {
66- // need to normalise the height change by converting it to "rows"
67- val heightChangeAsRows = Math .ceil(heightDiff / 30f ).toInt // 30 is just an arbitrary number that seemed to work fine
68- val newHeight = if (txtArReport.rows + heightChangeAsRows <= 1 ) 1
69- else if (txtArReport.rows + heightChangeAsRows > 40 ) 40
70- else txtArReport.rows + heightChangeAsRows
71-
72- // sometimes the size and preferredSize height stay the same even when the window gets larger so just make box size large in this case
73- val finalHeight = if (heightDiff == 0 && ! prefSizeHeightChanged) 40 else newHeight
74- txtArReport.rows = finalHeight
75- }
76-
7765 def top : SJXFrame = new SJXFrame {
78- this .listenTo(this ) // add a listener to the window to listen for all changes to the window
79- private var previousHeight = this .preferredSize.height
80- this .reactions += onResize {
81- val heightDiff = this .size.height - this .preferredSize.height
82-
83- changeHeightOfOutputPane(heightDiff)
84- prefSizeHeightChanged = previousHeight != this .preferredSize.height
85- previousHeight = this .preferredSize.height
86- }
87-
8866 title = " CSV Validator"
8967 peer.setDefaultCloseOperation(WindowConstants .EXIT_ON_CLOSE )
9068 contents = {
9169 val settings = new SettingsPanel (this )
9270
9371 // handle resizing the main window, when resizing the settings panel
9472 settings.settingsGroup.reactions += SJXTaskPane .onViewStateChanged {
95- val newSize = if (settings.settingsGroup.collapsed) {
96- txtArReport.rows = 40
97- this .size
98- } else {
99- txtArReport.rows = 9
100- val settingsHeight = settings.size.getHeight
101- new Dimension (this .size.getWidth.toInt, (this .preferredSize.getHeight + settingsHeight).toInt)
102- }
103- this .preferredSize = newSize
73+ this .preferredSize = this .size
10474 this .pack()
10575 }
10676 new ContentPanel (settings, this )
0 commit comments