4141import edu .umassmed .omega .commons .utilities .OmegaIOUtility ;
4242
4343public class OmegaTracksToolDialog extends GenericDialog {
44-
44+
4545 private static final long serialVersionUID = -4689339679604912836L ;
46-
46+
4747 private static String EXTENSIONS_TXT = "txt" ;
4848 private static String EXTENSIONS_XY = "xy" ;
4949 private static String EXTENSIONS_CSV = "csv" ;
50-
50+
5151 private JButton chooseFile_btt , action_btt , close_btt ;
5252 private JButton addData_btt , addStandardData_btt , moveDataUp_btt ,
5353 moveDataDown_btt , removeData_btt ;
@@ -61,17 +61,17 @@ public class OmegaTracksToolDialog extends GenericDialog {
6161 private GenericInsertDialog insertDialog ;
6262 private GenericPickDialog pickDialog ;
6363 private JComboBox <String > extension_cmb ;
64-
64+
6565 private String selectedVal ;
66-
66+
6767 private final OmegaIOUtility otio ;
68-
68+
6969 private final boolean isImpExp , isImporter ;
70-
70+
7171 private JPanel fieldsPanel ;
72-
73- private GenericStatusPanel statusPanel ;
7472
73+ private GenericStatusPanel statusPanel ;
74+
7575 public OmegaTracksToolDialog (final RootPaneContainer parentContainer ,
7676 final boolean isImpExp , final boolean isImporter ,
7777 final OmegaIOUtility otio ) {
@@ -83,22 +83,22 @@ public OmegaTracksToolDialog(final RootPaneContainer parentContainer,
8383 this .isImpExp = isImpExp ;
8484 this .otio = otio ;
8585 this .selectedVal = null ;
86-
87- this .adjustWidgets ();
8886
87+ this .adjustWidgets ();
88+
8989 this .setDefaultCloseOperation (WindowConstants .HIDE_ON_CLOSE );
9090 this .revalidate ();
9191 this .repaint ();
9292 this .pack ();
9393 }
94-
94+
9595 private void adjustWidgets () {
9696 if (!this .isImporter ) {
9797 this .fieldsPanel .setLayout (new GridLayout (9 , 1 ));
9898 } else {
9999 this .fieldsPanel .setLayout (new GridLayout (8 , 1 ));
100100 }
101-
101+
102102 if (!this .isImporter ) {
103103 final JPanel extensionPanel = new JPanel ();
104104 extensionPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
@@ -119,14 +119,14 @@ public void actionPerformed(final ActionEvent e) {
119119 extensionPanel .add (this .extension_cmb );
120120 this .fieldsPanel .add (extensionPanel , 4 );
121121 }
122-
122+
123123 if (this .isImporter ) {
124124 this .action_btt .setText ("Import" );
125125 } else {
126126 this .action_btt .setText ("Export" );
127127 }
128128 }
129-
129+
130130 @ Override
131131 protected void createAndAddWidgets () {
132132 this .insertDialog = new GenericInsertDialog (this .getParentContainer (),
@@ -136,14 +136,14 @@ protected void createAndAddWidgets() {
136136 this .fileChooser = new JFileChooser (System .getProperty ("user.dir" ));
137137 this .fileChooser
138138 .setFileSelectionMode (JFileChooser .FILES_AND_DIRECTORIES );
139-
139+
140140 final JPanel mainPanel = new JPanel ();
141141 mainPanel .setLayout (new BorderLayout ());
142-
142+
143143 final JPanel fieldsPanelMain = new JPanel ();
144144 fieldsPanelMain .setLayout (new BorderLayout ());
145145 this .fieldsPanel = new JPanel ();
146-
146+
147147 final JPanel filePanel = new JPanel ();
148148 filePanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
149149 final JLabel folder_lbl = new JLabel ("Select folder: " );
@@ -158,7 +158,7 @@ protected void createAndAddWidgets() {
158158 this .chooseFile_btt .setPreferredSize (OmegaConstants .BUTTON_SIZE );
159159 filePanel .add (this .chooseFile_btt );
160160 this .fieldsPanel .add (filePanel );
161-
161+
162162 final JPanel multipleFilesPanel = new JPanel ();
163163 multipleFilesPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
164164 final JLabel multipleFiles_lbl = new JLabel ("Multiple files: " );
@@ -169,7 +169,7 @@ protected void createAndAddWidgets() {
169169 this .multipleFiles_ckb = new JCheckBox ();
170170 multipleFilesPanel .add (this .multipleFiles_ckb );
171171 this .fieldsPanel .add (multipleFilesPanel );
172-
172+
173173 final JPanel fileIdentifierPanel = new JPanel ();
174174 fileIdentifierPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
175175 final JLabel fileIdentifier_lbl = new JLabel ("File indentifier: " );
@@ -182,7 +182,7 @@ protected void createAndAddWidgets() {
182182 .setPreferredSize (OmegaConstants .LARGE_TEXT_SIZE );
183183 fileIdentifierPanel .add (this .fileIdentifier_txt );
184184 this .fieldsPanel .add (fileIdentifierPanel );
185-
185+
186186 final JPanel trackIdentifierPanel = new JPanel ();
187187 trackIdentifierPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
188188 final JLabel trackIdentifier_lbl = new JLabel ("Data type indentifier: " );
@@ -195,11 +195,10 @@ protected void createAndAddWidgets() {
195195 .setPreferredSize (OmegaConstants .LARGE_TEXT_SIZE );
196196 trackIdentifierPanel .add (this .dataIdentifier_txt );
197197 this .fieldsPanel .add (trackIdentifierPanel );
198-
198+
199199 final JPanel particleIdentifierPanel = new JPanel ();
200200 particleIdentifierPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
201- final JLabel particleIdentifier_lbl = new JLabel (
202- "Particle line indentifier: " );
201+ final JLabel particleIdentifier_lbl = new JLabel ("Line indentifier: " );
203202 particleIdentifier_lbl
204203 .setToolTipText ("<html><p width=\" 500\" >"
205204 + OmegaDataToolConstants .PARTICLE_IDENTIFIER_TT
@@ -212,17 +211,16 @@ protected void createAndAddWidgets() {
212211 .setPreferredSize (OmegaConstants .LARGE_TEXT_SIZE );
213212 particleIdentifierPanel .add (this .particleIdentifier_txt );
214213 this .fieldsPanel .add (particleIdentifierPanel );
215-
214+
216215 final JPanel particleStartPanel = new JPanel ();
217216 particleStartPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
218- final JLabel particleStart_lbl = new JLabel (
219- "Particle index starts at 1: " );
217+ final JLabel particleStart_lbl = new JLabel ("Indexes start at 1: " );
220218 particleStart_lbl .setPreferredSize (OmegaConstants .BUTTON_SIZE_LARGE );
221219 particleStartPanel .add (particleStart_lbl );
222220 this .startAtOne_ckb = new JCheckBox ();
223221 particleStartPanel .add (this .startAtOne_ckb );
224222 this .fieldsPanel .add (particleStartPanel );
225-
223+
226224 final JPanel nonParticleIdentifierPanel = new JPanel ();
227225 nonParticleIdentifierPanel .setLayout (new FlowLayout (FlowLayout .LEFT ));
228226 final JLabel nonParticleIdentifier_lbl = new JLabel (
@@ -238,7 +236,7 @@ protected void createAndAddWidgets() {
238236 .setPreferredSize (OmegaConstants .LARGE_TEXT_SIZE );
239237 nonParticleIdentifierPanel .add (this .nonParticleIdentifier_txt );
240238 this .fieldsPanel .add (nonParticleIdentifierPanel );
241-
239+
242240 final JPanel particleSeparatorIdentifierPanel = new JPanel ();
243241 particleSeparatorIdentifierPanel .setLayout (new FlowLayout (
244242 FlowLayout .LEFT ));
@@ -253,7 +251,7 @@ protected void createAndAddWidgets() {
253251 particleSeparatorIdentifierPanel
254252 .add (this .particleSeparatordentifier_txt );
255253 this .fieldsPanel .add (particleSeparatorIdentifierPanel );
256-
254+
257255 final JPanel particleDataPanel = new JPanel ();
258256 particleDataPanel .setLayout (new BorderLayout (5 , 5 ));
259257 particleDataPanel .setBorder (new EmptyBorder (5 , 5 , 5 , 5 ));
@@ -308,37 +306,37 @@ protected void createAndAddWidgets() {
308306 BorderLayout .NORTH );
309307 particleDataButtonPanelMain .add (new JLabel (), BorderLayout .CENTER );
310308 particleDataPanel .add (particleDataButtonPanelMain , BorderLayout .EAST );
311-
309+
312310 fieldsPanelMain .add (this .fieldsPanel , BorderLayout .NORTH );
313311 fieldsPanelMain .add (particleDataPanel , BorderLayout .CENTER );
314-
312+
315313 mainPanel .add (fieldsPanelMain , BorderLayout .NORTH );
316314 mainPanel .add (new JLabel (), BorderLayout .CENTER );
317315 this .add (mainPanel , BorderLayout .CENTER );
318-
316+
319317 final JPanel bottomPanel = new JPanel ();
320318 bottomPanel .setLayout (new BorderLayout ());
321-
319+
322320 final JPanel buttPanel = new JPanel ();
323321 buttPanel .setLayout (new FlowLayout (FlowLayout .RIGHT ));
324-
322+
325323 this .action_btt = new JButton ();
326324 this .action_btt .setPreferredSize (OmegaConstants .BUTTON_SIZE );
327325 buttPanel .add (this .action_btt );
328-
326+
329327 this .close_btt = new JButton (OmegaGUIConstants .MENU_FILE_CLOSE );
330328 this .close_btt .setPreferredSize (OmegaConstants .BUTTON_SIZE );
331329 buttPanel .add (this .close_btt );
332-
330+
333331 bottomPanel .add (buttPanel , BorderLayout .NORTH );
334-
332+
335333 this .statusPanel = new GenericStatusPanel (1 );
336334 this .updateStatus ("Ready!" );
337335 bottomPanel .add (this .statusPanel , BorderLayout .SOUTH );
338-
336+
339337 this .add (bottomPanel , BorderLayout .SOUTH );
340338 }
341-
339+
342340 @ Override
343341 protected void addListeners () {
344342 this .chooseFile_btt .addActionListener (new ActionListener () {
@@ -366,7 +364,7 @@ public void actionPerformed(final ActionEvent e) {
366364 OmegaTracksToolDialog .this .handleAddData ();
367365 }
368366 });
369-
367+
370368 this .addStandardData_btt .addActionListener (new ActionListener () {
371369 @ Override
372370 public void actionPerformed (final ActionEvent e ) {
@@ -404,7 +402,7 @@ public void actionPerformed(final ActionEvent e) {
404402 };
405403 });
406404 }
407-
405+
408406 private void handleExtensionSelection () {
409407 final String ext = (String ) this .extension_cmb .getSelectedItem ();
410408 this .particleSeparatordentifier_txt .setEnabled (true );
@@ -413,7 +411,7 @@ private void handleExtensionSelection() {
413411 this .particleSeparatordentifier_txt .setEnabled (false );
414412 }
415413 }
416-
414+
417415 private void handleAddStandardData () {
418416 this .pickDialog .reset ();
419417 final String [] data = { OmegaDataToolConstants .PARTICLE_CENT_INTENSITY ,
@@ -432,7 +430,7 @@ private void handleAddStandardData() {
432430 this .particleData_mdl .addElement (toInsert );
433431 }
434432 }
435-
433+
436434 private void handleAddData () {
437435 this .insertDialog .reset ();
438436 this .insertDialog .setVisible (true );
@@ -447,13 +445,13 @@ private void handleAddData() {
447445 this .particleData_mdl .addElement (toInsert );
448446 }
449447 }
450-
448+
451449 private void handleMoveDataUp () {
452450 final int index = this .particleData_mdl .indexOf (this .selectedVal );
453451 this .particleData_mdl .insertElementAt (this .selectedVal , index - 1 );
454452 this .particleData_mdl .remove (index + 1 );
455453 }
456-
454+
457455 private void handleMoveDataDown () {
458456 final int index = this .particleData_mdl .indexOf (this .selectedVal );
459457 int newIndex = index + 2 ;
@@ -463,11 +461,11 @@ private void handleMoveDataDown() {
463461 this .particleData_mdl .insertElementAt (this .selectedVal , newIndex );
464462 this .particleData_mdl .remove (index );
465463 }
466-
464+
467465 private void handleRemoveData () {
468466 this .particleData_mdl .removeElement (this .selectedVal );
469467 }
470-
468+
471469 private void handleListSelection () {
472470 this .moveDataUp_btt .setEnabled (false );
473471 this .moveDataDown_btt .setEnabled (false );
@@ -505,15 +503,15 @@ private void handleListSelection() {
505503 // }
506504 // }
507505 }
508-
506+
509507 private void handleMultipleFilesSelection () {
510508 // if (this.multipleFiles_ckb.isSelected()) {
511509 // this.fileIdentifier_txt.setEnabled(true);
512510 // } else {
513511 // this.fileIdentifier_txt.setEnabled(false);
514512 // }
515513 }
516-
514+
517515 private void handleChooseFile () {
518516 final int result = this .fileChooser .showOpenDialog (this );
519517 if (result == JFileChooser .APPROVE_OPTION ) {
@@ -523,7 +521,7 @@ private void handleChooseFile() {
523521 this .file_txt .setText ("" );
524522 }
525523 }
526-
524+
527525 private void handleAction () {
528526 if (this .otio instanceof OmegaTracksImporter ) {
529527 final OmegaTracksImporter oti = (OmegaTracksImporter ) this .otio ;
@@ -565,7 +563,7 @@ private void handleAction() {
565563 this .updateStatus ("A directory is required to begin the process!" );
566564 return ;
567565 }
568-
566+
569567 final File f = new File (fName );
570568 if (f .isFile ()) {
571569 this .updateStatus (f .getName ()
@@ -622,21 +620,25 @@ private void handleAction() {
622620 }
623621 if (this .otio instanceof OmegaTracksExporter ) {
624622 final OmegaTracksExporter ote = (OmegaTracksExporter ) this .otio ;
625- ote .reset ();
623+ ote .resetAll ();
626624 }
627625 if (completed ) {
628626 this .setVisible (false );
629627 }
630628 }
631-
629+
632630 private void handleClose () {
633631 this .setVisible (false );
634632 }
635633
634+ public void disableFileName () {
635+ this .fileIdentifier_txt .setEditable (false );
636+ }
637+
636638 public void setFileName (final String targetAnalysisName ) {
637639 this .fileIdentifier_txt .setText (targetAnalysisName );
638640 }
639-
641+
640642 public void updateStatus (final String s ) {
641643 try {
642644 this .statusPanel .updateStatus (0 , s );
0 commit comments