@@ -578,10 +578,10 @@ private void addMetadataAndResults(QueueItem item) {
578578 }
579579
580580 Map <String , Object > result = item .result ();
581-
581+
582582 // Add a separator row for metadata section
583583 if (!result .isEmpty ()) {
584- ParameterRow separator = new ParameterRow ("--- Metadata & Results ---" , false , "" ,
584+ ParameterRow separator = new ParameterRow ("--- Metadata & Results ---" , false , "" ,
585585 "Execution metadata and results (read-only)" , false , null );
586586 parameterRows .add (separator );
587587 }
@@ -592,7 +592,7 @@ private void addMetadataAndResults(QueueItem item) {
592592 Object value = entry .getValue ();
593593 String displayValue = formatResultValue (value );
594594 String description = "Result field: " + key + " (read-only)" ;
595-
595+
596596 ParameterRow row = new ParameterRow (key , false , displayValue , description , false , null );
597597 parameterRows .add (row );
598598 }
@@ -602,31 +602,31 @@ private String formatResultValue(Object value) {
602602 if (value == null ) {
603603 return "null" ;
604604 }
605-
605+
606606 if (value instanceof Map ) {
607607 Map <?, ?> map = (Map <?, ?>) value ;
608608 if (map .isEmpty ()) {
609609 return "{}" ;
610610 }
611611 return "Map (" + map .size () + " entries)" ;
612612 }
613-
613+
614614 if (value instanceof List ) {
615615 List <?> list = (List <?>) value ;
616616 if (list .isEmpty ()) {
617617 return "[]" ;
618618 }
619619 return "List (" + list .size () + " items)" ;
620620 }
621-
621+
622622 if (value instanceof String ) {
623623 String str = (String ) value ;
624624 if (str .length () > 100 ) {
625625 return str .substring (0 , 97 ) + "..." ;
626626 }
627627 return str ;
628628 }
629-
629+
630630 return String .valueOf (value );
631631 }
632632
@@ -956,7 +956,7 @@ private void exitEditMode() {
956956 private void openBatchUpload () {
957957 BatchUploadDialog dialog = new BatchUploadDialog (table .getScene ().getWindow ());
958958 Optional <BatchUploadDialog .Result > result = dialog .showAndWait ();
959-
959+
960960 if (result .isPresent ()) {
961961 BatchUploadDialog .Result uploadResult = result .get ();
962962 processBatchFile (uploadResult .getFilePath (), uploadResult .getFileType ());
@@ -1076,34 +1076,34 @@ private List<QueueItem> parseCSVFile(java.io.File file) throws Exception {
10761076
10771077 private List <QueueItem > parseExcelFile (java .io .File file ) throws Exception {
10781078 List <QueueItem > items = new ArrayList <>();
1079-
1079+
10801080 try (java .io .FileInputStream fis = new java .io .FileInputStream (file );
10811081 Workbook workbook = new HSSFWorkbook (fis )) {
1082-
1082+
10831083 Sheet sheet = workbook .getSheetAt (0 ); // Use first sheet
1084-
1084+
10851085 if (sheet .getPhysicalNumberOfRows () == 0 ) {
10861086 return items ;
10871087 }
1088-
1088+
10891089 // Parse header row
10901090 Row headerRow = sheet .getRow (0 );
10911091 if (headerRow == null ) {
10921092 return items ;
10931093 }
1094-
1094+
10951095 List <String > headers = new ArrayList <>();
10961096 for (int i = 0 ; i < headerRow .getLastCellNum (); i ++) {
10971097 Cell cell = headerRow .getCell (i );
10981098 String header = getCellValueAsString (cell );
10991099 headers .add (header != null ? header .trim () : "" );
11001100 }
1101-
1101+
11021102 // Parse data rows
11031103 for (int rowNum = 1 ; rowNum <= sheet .getLastRowNum (); rowNum ++) {
11041104 Row row = sheet .getRow (rowNum );
11051105 if (row == null ) continue ;
1106-
1106+
11071107 // Skip empty rows
11081108 boolean hasData = false ;
11091109 for (int i = 0 ; i < Math .min (2 , headers .size ()); i ++) {
@@ -1114,39 +1114,39 @@ private List<QueueItem> parseExcelFile(java.io.File file) throws Exception {
11141114 }
11151115 }
11161116 if (!hasData ) continue ;
1117-
1117+
11181118 String itemType = "" ;
11191119 String planName = "" ;
1120-
1120+
11211121 if (headers .size () >= 1 ) {
11221122 Cell cell = row .getCell (0 );
11231123 itemType = getCellValueAsString (cell );
11241124 itemType = itemType != null ? itemType .trim () : "" ;
11251125 }
1126-
1126+
11271127 if (headers .size () >= 2 ) {
11281128 Cell cell = row .getCell (1 );
11291129 planName = getCellValueAsString (cell );
11301130 planName = planName != null ? planName .trim () : "" ;
11311131 }
1132-
1132+
11331133 if (planName .isEmpty ()) continue ;
1134-
1134+
11351135 Map <String , Object > kwargs = new HashMap <>();
1136-
1136+
11371137 // Parse additional parameters
11381138 for (int i = 2 ; i < Math .min (headers .size (), row .getLastCellNum ()); i ++) {
11391139 String paramName = headers .get (i ).trim ();
11401140 if (paramName .isEmpty ()) continue ;
1141-
1141+
11421142 Cell cell = row .getCell (i );
11431143 Object paramValue = getCellValueAsObject (cell );
1144-
1144+
11451145 if (paramValue != null ) {
11461146 kwargs .put (paramName , paramValue );
11471147 }
11481148 }
1149-
1149+
11501150 QueueItem item = new QueueItem (
11511151 itemType .isEmpty () ? "plan" : itemType ,
11521152 planName ,
@@ -1160,13 +1160,13 @@ private List<QueueItem> parseExcelFile(java.io.File file) throws Exception {
11601160 items .add (item );
11611161 }
11621162 }
1163-
1163+
11641164 return items ;
11651165 }
1166-
1166+
11671167 private String getCellValueAsString (Cell cell ) {
11681168 if (cell == null ) return null ;
1169-
1169+
11701170 switch (cell .getCellType ()) {
11711171 case STRING :
11721172 return cell .getStringCellValue ();
@@ -1204,20 +1204,20 @@ private String getCellValueAsString(Cell cell) {
12041204 return null ;
12051205 }
12061206 }
1207-
1207+
12081208 private Object getCellValueAsObject (Cell cell ) {
12091209 if (cell == null ) return null ;
1210-
1210+
12111211 switch (cell .getCellType ()) {
12121212 case STRING :
12131213 String strValue = cell .getStringCellValue ().trim ();
12141214 if (strValue .isEmpty ()) return null ;
1215-
1215+
12161216 // Try to parse as boolean
12171217 if ("true" .equalsIgnoreCase (strValue ) || "false" .equalsIgnoreCase (strValue )) {
12181218 return Boolean .parseBoolean (strValue );
12191219 }
1220-
1220+
12211221 // Try to parse as number
12221222 try {
12231223 if (strValue .contains ("." )) {
@@ -1228,7 +1228,7 @@ private Object getCellValueAsObject(Cell cell) {
12281228 } catch (NumberFormatException e ) {
12291229 return strValue ;
12301230 }
1231-
1231+
12321232 case NUMERIC :
12331233 if (DateUtil .isCellDateFormatted (cell )) {
12341234 return cell .getDateCellValue ();
@@ -1300,67 +1300,67 @@ private void setChoiceBoxTooltip(String itemName) {
13001300 }
13011301
13021302 private static class BatchUploadDialog extends Dialog <BatchUploadDialog .Result > {
1303-
1303+
13041304 public static class Result {
13051305 private final String filePath ;
13061306 private final String fileType ;
1307-
1307+
13081308 public Result (String filePath , String fileType ) {
13091309 this .filePath = filePath ;
13101310 this .fileType = fileType ;
13111311 }
1312-
1312+
13131313 public String getFilePath () { return filePath ; }
13141314 public String getFileType () { return fileType ; }
13151315 }
1316-
1316+
13171317 private TextField filePathField ;
13181318 private ComboBox <String > fileTypeCombo ;
13191319 private Button browseButton ;
13201320 private String selectedFilePath ;
1321-
1321+
13221322 public BatchUploadDialog (javafx .stage .Window owner ) {
13231323 initOwner (owner );
13241324 setTitle ("Batch Upload" );
13251325 setHeaderText ("Load Plans from Spreadsheet" );
1326-
1326+
13271327 // Create content
13281328 GridPane grid = new GridPane ();
13291329 grid .setHgap (10 );
13301330 grid .setVgap (10 );
13311331 grid .setPadding (new Insets (20 , 150 , 10 , 10 ));
1332-
1332+
13331333 // File selection
13341334 browseButton = new Button ("..." );
13351335 browseButton .setOnAction (e -> selectFile ());
1336-
1336+
13371337 filePathField = new TextField ();
13381338 filePathField .setEditable (false );
13391339 filePathField .setPrefWidth (300 );
1340-
1340+
13411341 // File type selection
13421342 fileTypeCombo = new ComboBox <>();
13431343 fileTypeCombo .getItems ().addAll ("xls" , "csv" );
13441344 fileTypeCombo .setValue ("xls" );
1345-
1345+
13461346 grid .add (browseButton , 0 , 0 );
13471347 grid .add (filePathField , 1 , 0 );
13481348 grid .add (new Label ("Spreadsheet Type:" ), 0 , 1 );
13491349 grid .add (fileTypeCombo , 1 , 1 );
1350-
1350+
13511351 getDialogPane ().setContent (grid );
1352-
1352+
13531353 // Add buttons
13541354 getDialogPane ().getButtonTypes ().addAll (ButtonType .OK , ButtonType .CANCEL );
1355-
1355+
13561356 // Initially disable OK button
13571357 getDialogPane ().lookupButton (ButtonType .OK ).setDisable (true );
1358-
1358+
13591359 // Enable OK button when file is selected
13601360 filePathField .textProperty ().addListener ((obs , oldVal , newVal ) -> {
13611361 getDialogPane ().lookupButton (ButtonType .OK ).setDisable (newVal == null || newVal .trim ().isEmpty ());
13621362 });
1363-
1363+
13641364 // Result converter
13651365 setResultConverter (dialogButton -> {
13661366 if (dialogButton == ButtonType .OK && selectedFilePath != null ) {
@@ -1369,7 +1369,7 @@ public BatchUploadDialog(javafx.stage.Window owner) {
13691369 return null ;
13701370 });
13711371 }
1372-
1372+
13731373 private void selectFile () {
13741374 javafx .stage .FileChooser fileChooser = new javafx .stage .FileChooser ();
13751375 fileChooser .setTitle ("Select Spreadsheet File" );
@@ -1378,12 +1378,12 @@ private void selectFile() {
13781378 new javafx .stage .FileChooser .ExtensionFilter ("CSV Files (*.csv)" , "*.csv" ),
13791379 new javafx .stage .FileChooser .ExtensionFilter ("All Files" , "*.*" )
13801380 );
1381-
1381+
13821382 java .io .File file = fileChooser .showOpenDialog (getDialogPane ().getScene ().getWindow ());
13831383 if (file != null ) {
13841384 selectedFilePath = file .getAbsolutePath ();
13851385 filePathField .setText (selectedFilePath );
1386-
1386+
13871387 // Auto-detect file type based on extension
13881388 String fileName = file .getName ().toLowerCase ();
13891389 if (fileName .endsWith (".xls" )) {
@@ -1395,4 +1395,4 @@ private void selectFile() {
13951395 }
13961396 }
13971397
1398- }
1398+ }
0 commit comments