3838
3939import scripts .Figure_Generation .HeatmapPlot ;
4040import util .FileSelection ;
41+ import javax .swing .JCheckBox ;
4142
4243@ SuppressWarnings ("serial" )
4344public class HeatMapWindow extends JFrame implements ActionListener , PropertyChangeListener {
@@ -67,6 +68,11 @@ public class HeatMapWindow extends JFrame implements ActionListener, PropertyCha
6768 private JRadioButton rdbtnBilinear ;
6869 private JRadioButton rdbtnNearestNeighbor ;
6970
71+ private JCheckBox chckbxOutputHeatmap ;
72+ private JButton btnOutput ;
73+ private JLabel lblOutput ;
74+ private JLabel lblCurrentOutput ;
75+
7076 private File OUTPUTPATH = null ;
7177
7278 class Task extends SwingWorker <Void , Void > {
@@ -93,13 +99,13 @@ public Void doInBackground() throws IOException {
9399 else if (rdbtnBilinear .isSelected ()) { scaletype = "bilinear" ; }
94100 else if (rdbtnNearestNeighbor .isSelected ()) { scaletype = "neighbor" ; }
95101 if (OUTPUTPATH == null ) { OUTPUTPATH = new File (System .getProperty ("user.dir" )); }
96-
102+
97103 double absolute = Double .parseDouble (txtAbsolute .getText ());
98104 if (rdbtnPercentileValue .isSelected ()) { absolute = -999 ; }
99105 double quantile = Double .parseDouble (txtPercent .getText ());
100106
101107 //System.out.println(COLOR + "\n" + startR+ "\n" + startC+ "\n" + pHeight+ "\n" + pWidth+ "\n" + scaletype+ "\n" + absolute+ "\n" + quantile+ "\n" + OUTPUTPATH);
102- HeatmapPlot heat = new HeatmapPlot (txtFiles , COLOR , startR , startC , pHeight , pWidth , scaletype , absolute , quantile , OUTPUTPATH );
108+ HeatmapPlot heat = new HeatmapPlot (txtFiles , COLOR , startR , startC , pHeight , pWidth , scaletype , absolute , quantile , OUTPUTPATH , chckbxOutputHeatmap . isSelected () );
103109
104110 heat .addPropertyChangeListener ("heat" , new PropertyChangeListener () {
105111 public void propertyChange (PropertyChangeEvent propertyChangeEvent ) {
@@ -192,7 +198,7 @@ public void actionPerformed(ActionEvent arg0) {
192198
193199 btnGen .setActionCommand ("start" );
194200
195- JLabel lblInputMatrixParameters = new JLabel ("Input Matrix Parameters" );
201+ JLabel lblInputMatrixParameters = new JLabel ("Input Matrix Parameters (0-based) " );
196202 sl_contentPane .putConstraint (SpringLayout .NORTH , lblInputMatrixParameters , 10 , SpringLayout .SOUTH , scrollPane );
197203 sl_contentPane .putConstraint (SpringLayout .WEST , lblInputMatrixParameters , 10 , SpringLayout .WEST , contentPane );
198204 contentPane .add (lblInputMatrixParameters );
@@ -416,7 +422,8 @@ public void itemStateChanged(ItemEvent e) {
416422 Scale .add (rdbtnNearestNeighbor );
417423 rdbtnTreeview .setSelected (true );
418424
419- JButton btnOutput = new JButton ("Output Directory" );
425+ btnOutput = new JButton ("Output Directory" );
426+ btnOutput .setEnabled (false );
420427 sl_contentPane .putConstraint (SpringLayout .WEST , btnOutput , 150 , SpringLayout .WEST , contentPane );
421428 sl_contentPane .putConstraint (SpringLayout .SOUTH , btnOutput , -45 , SpringLayout .NORTH , btnGen );
422429 sl_contentPane .putConstraint (SpringLayout .EAST , btnOutput , -150 , SpringLayout .EAST , contentPane );
@@ -429,20 +436,22 @@ public void itemStateChanged(ItemEvent e) {
429436 sl_contentPane .putConstraint (SpringLayout .EAST , separator_1 , -10 , SpringLayout .EAST , contentPane );
430437 contentPane .add (separator_1 );
431438
432- JLabel lblCurrentOutput = new JLabel ("Current Output:" );
439+ lblCurrentOutput = new JLabel ("Current Output:" );
440+ lblCurrentOutput .setEnabled (false );
433441 sl_contentPane .putConstraint (SpringLayout .NORTH , lblCurrentOutput , 15 , SpringLayout .SOUTH , btnOutput );
434442 sl_contentPane .putConstraint (SpringLayout .WEST , lblCurrentOutput , 10 , SpringLayout .WEST , contentPane );
435443 lblCurrentOutput .setFont (new Font ("Lucida Grande" , Font .BOLD , 13 ));
436444 contentPane .add (lblCurrentOutput );
437445
438- JLabel lblOutput = new JLabel ("Default to Local Directory" );
446+ lblOutput = new JLabel ("Default to Local Directory" );
447+ lblOutput .setEnabled (false );
439448 sl_contentPane .putConstraint (SpringLayout .NORTH , lblOutput , 0 , SpringLayout .NORTH , lblCurrentOutput );
440449 sl_contentPane .putConstraint (SpringLayout .WEST , lblOutput , 6 , SpringLayout .EAST , lblCurrentOutput );
441450 sl_contentPane .putConstraint (SpringLayout .EAST , lblOutput , 0 , SpringLayout .EAST , contentPane );
442451 lblOutput .setFont (new Font ("Dialog" , Font .PLAIN , 12 ));
443452 lblOutput .setBackground (Color .WHITE );
444453 contentPane .add (lblOutput );
445-
454+
446455 btnOutput .addActionListener (new ActionListener () {
447456 public void actionPerformed (ActionEvent e ) {
448457 OUTPUTPATH = FileSelection .getOutputDir (fc );
@@ -451,10 +460,26 @@ public void actionPerformed(ActionEvent e) {
451460 }
452461 }
453462 });
463+
464+ chckbxOutputHeatmap = new JCheckBox ("Output Heatmap" );
465+ sl_contentPane .putConstraint (SpringLayout .WEST , chckbxOutputHeatmap , 0 , SpringLayout .WEST , scrollPane );
466+ sl_contentPane .putConstraint (SpringLayout .SOUTH , chckbxOutputHeatmap , 0 , SpringLayout .SOUTH , btnOutput );
467+ contentPane .add (chckbxOutputHeatmap );
468+ chckbxOutputHeatmap .addItemListener (new ItemListener () {
469+ public void itemStateChanged (ItemEvent e ) {
470+ activateOutput (chckbxOutputHeatmap .isSelected ());
471+ }
472+ });
454473
455474 btnGen .addActionListener (this );
456475 }
457476
477+ public void activateOutput (boolean activate ) {
478+ btnOutput .setEnabled (activate );
479+ lblOutput .setEnabled (activate );
480+ lblCurrentOutput .setEnabled (activate );
481+ }
482+
458483 @ Override
459484 public void actionPerformed (ActionEvent arg0 ) {
460485 massXable (contentPane , false );
@@ -489,8 +514,11 @@ public void massXable(Container con, boolean status) {
489514 txtAbsolute .setEnabled (true );
490515 txtPercent .setEnabled (false );
491516 }
517+ if (chckbxOutputHeatmap .isSelected ()) { activateOutput (true ); }
518+ else { activateOutput (false ); }
492519 }
493520 }
521+
494522}
495523
496524
0 commit comments