1 25 26 package org.jrobin.inspector; 27 28 import java.io.File ; 29 import java.text.DecimalFormat ; 30 31 class InspectorModel { 32 private MainTreeModel mainTreeModel = new MainTreeModel(); 33 private HeaderTableModel generalTableModel = new HeaderTableModel(); 34 private DatasourceTableModel datasourceTableModel = new DatasourceTableModel(); 35 private ArchiveTableModel archiveTableModel = new ArchiveTableModel(); 36 private DataTableModel dataTableModel = new DataTableModel(); 37 private File file; 38 private boolean ok = false; 39 40 MainTreeModel getMainTreeModel() { 41 return mainTreeModel; 42 } 43 44 HeaderTableModel getGeneralTableModel() { 45 return generalTableModel; 46 } 47 48 DatasourceTableModel getDatasourceTableModel() { 49 return datasourceTableModel; 50 } 51 52 DataTableModel getDataTableModel() { 53 return dataTableModel; 54 } 55 56 ArchiveTableModel getArchiveTableModel() { 57 return archiveTableModel; 58 } 59 60 void setFile(File file) { 61 this.file = file; 62 this.ok = mainTreeModel.setFile(file); 63 generalTableModel.setFile(file); 64 datasourceTableModel.setFile(file); 65 archiveTableModel.setFile(file); 66 dataTableModel.setFile(file); 67 } 68 69 void refresh() { 70 setFile(file); 71 } 72 73 void selectModel(int dsIndex, int arcIndex) { 74 datasourceTableModel.setIndex(dsIndex); 75 archiveTableModel.setIndex(dsIndex, arcIndex); 76 dataTableModel.setIndex(dsIndex, arcIndex); 77 } 78 79 File getFile() { 80 return file; 81 } 82 83 boolean isOk() { 84 return ok; 85 } 86 87 private static String DOUBLE_FORMAT = "0.0000000000E00"; 88 private static final DecimalFormat df = new DecimalFormat (DOUBLE_FORMAT); 89 90 static String formatDouble(double x, String nanString) { 91 if(Double.isNaN(x)) { 92 return nanString; 93 } 94 return df.format(x); 95 } 96 97 static String formatDouble(double x) { 98 return formatDouble(x, "" + Double.NaN); 99 } 100 } 101 | Popular Tags |