1 16 package org.joda.example.time; 17 20 import java.awt.Dimension ; 21 import java.awt.Toolkit ; 22 import java.awt.event.ActionEvent ; 23 import java.awt.event.WindowAdapter ; 24 import java.awt.event.WindowEvent ; 25 import java.io.BufferedReader ; 26 import java.io.File ; 27 import java.io.FileReader ; 28 import java.io.IOException ; 29 import java.io.PrintStream ; 30 import java.text.DateFormat ; 31 import java.text.ParseException ; 32 import java.text.SimpleDateFormat ; 33 import java.util.ArrayList ; 34 import java.util.Calendar ; 35 import java.util.Date ; 36 import java.util.GregorianCalendar ; 37 import java.util.TimeZone ; 38 39 import javax.swing.AbstractAction ; 40 import javax.swing.Action ; 41 import javax.swing.JFileChooser ; 42 import javax.swing.JFrame ; 43 import javax.swing.JMenu ; 44 import javax.swing.JMenuBar ; 45 import javax.swing.JMenuItem ; 46 import javax.swing.JScrollPane ; 47 import javax.swing.JTable ; 48 import javax.swing.WindowConstants ; 49 import javax.swing.table.TableColumn ; 50 import javax.swing.table.TableColumnModel ; 51 52 import org.joda.time.DateTime; 53 54 69 public class DateTimeBrowser extends JFrame { 70 private String [] mainArgs = null; private LoadedFile currFile = null; private JScrollPane mainSP = null; 80 JMenuItem jmiGetter = null; 81 84 JMenuItem jmiHex = null; 85 88 JMenuItem jmiDate = null; 89 92 JMenuItem jmiCal = null; 93 private final JFileChooser chooser = new JFileChooser (); 97 private final boolean debugf = false; private final boolean debugt = true; 100 105 public static void main(String [] args) { 106 130 if ( args.length < 1 ) { 131 System.err.println("File name is required!"); 132 usage(); 133 System.exit(1); 134 } 135 139 new DateTimeBrowser().go( args ); 140 } 142 146 private static void usage() { 147 System.err.println("Usage:"); 148 System.err.print("java <options> "); 149 System.err.print(DateTimeBrowser.class.getName()); 150 System.err.println(" <filename>"); 151 System.err.println("<filename> contains a list of Strings"); 152 System.err.println("\twhich are valid for DateTime instantiation."); 153 System.err.println("<optons>"); 154 System.err.println("\t-Duse.time.zone="); 155 System.err.println("\t\tA valid timezone name. If not specified"); 156 System.err.println("\t\tthe OS/user default is used. If sepcified"); 157 System.err.println("\t\tincorrectly, GMT is quietly used."); 158 System.err.println("\t-Duse.view="); 159 System.err.println("\t\tAn initial view to be displayed."); 160 System.err.println("\t\tValid names are: getter, hex, date, cal"); 161 System.err.println("\t\tIf incorrectly specified, getter is used."); 162 System.err.println("\t\tThis becomes the default view."); 163 } 165 172 private void go(String [] args) { 173 174 mainArgs = args; 175 setDefaultTimeZone(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 178 JMenuBar menuBar = new JMenuBar (); 180 setJMenuBar( menuBar ); 181 addMenus( menuBar ); 182 185 186 addWindowListener( new WindowAdapter () { 187 public void windowClosing(WindowEvent e) 188 { 189 setVisible( false ); 190 dispose(); 191 System.exit(0); 192 } 193 } 194 ); 195 196 currFile = new LoadedFile( mainArgs[0] ); 200 TableView tView = getDefaultTableView(); 201 resetDefaults( tView ); 202 Dimension screenMax = Toolkit.getDefaultToolkit().getScreenSize(); 206 setSize ( screenMax ); 207 setVisible(true); 208 } 209 210 214 217 private TableView getDefaultTableView() { 218 String viewStr = System.getProperty("use.view"); 220 if ( viewStr == null ) { 221 jmiGetter.setEnabled( false ); 222 return new GetterTableView( currFile ); 223 } 224 if ( viewStr.equalsIgnoreCase("hex") ) { 226 jmiHex.setEnabled( false ); 227 return new HexTableView( currFile ); 228 } 229 else if ( viewStr.equalsIgnoreCase("date") ) { 230 jmiDate.setEnabled( false ); 231 return new DateTableView( currFile ); 232 } 233 else if ( viewStr.equalsIgnoreCase("cal") ) { 234 jmiCal.setEnabled( false ); 235 return new CalTableView( currFile ); 236 } 237 else if ( viewStr.equalsIgnoreCase("getter") ) { 238 jmiGetter.setEnabled( false ); 239 return new GetterTableView( currFile ); 240 } 241 else { System.err.println("View name: " + viewStr + " invalid."); 243 jmiGetter.setEnabled( false ); 244 return new GetterTableView( currFile ); 245 } 246 } 247 250 private void setDefaultTableView(String newView) { 251 System.setProperty( "use.view", newView ); 252 } 253 256 private void setDefaultTimeZone() { 257 String tzName = System.getProperty("use.time.zone"); 258 if ( tzName == null ) return; TimeZone toSet = TimeZone.getTimeZone( tzName ); 264 TimeZone.setDefault( toSet ); 268 } 269 270 273 private void addMenus( JMenuBar menuBar) { 274 JMenu fileMenu = new JMenu ("File"); 278 JMenu viewMenu = new JMenu ("View"); 279 menuBar.add( fileMenu ); 283 menuBar.add( viewMenu ); 284 Action open = new OpenAction(); 288 JMenuItem jmiOpen = new JMenuItem ( open ); 289 Action exit = new ExitAction(); 290 JMenuItem jmiExit = new JMenuItem ( exit ); 291 Action getter = new GetterAction(); 295 jmiGetter = new JMenuItem ( getter ); 296 getter.setEnabled( true ); 297 Action hex = new HexAction(); 299 jmiHex = new JMenuItem ( hex ); 300 hex.setEnabled( true ); 301 Action date = new DateAction(); 303 jmiDate = new JMenuItem ( date ); 304 date.setEnabled( true ); 305 Action cal = new CalAction(); 307 jmiCal = new JMenuItem ( cal ); 308 cal.setEnabled( true ); 309 fileMenu.add( jmiOpen ); 313 fileMenu.addSeparator(); 314 fileMenu.add( jmiExit ); 315 viewMenu.add( jmiGetter ); 319 viewMenu.add( jmiHex ); 320 viewMenu.add( jmiDate ); 321 viewMenu.add( jmiCal ); 322 } 332 337 private void dumpObjs(Object [][] objs, PrintStream out ) { 338 for (int i = 0; i < objs.length; ++i) { 339 for (int j = 0; j < objs[i].length; ++j) { 340 out.println(i + " " + j + " " 341 + objs[i][j]); 342 } } } 345 346 349 private void enableAllViews() { 350 jmiGetter.setEnabled( true ); 351 jmiHex.setEnabled( true ); 352 jmiDate.setEnabled( true ); 353 jmiCal.setEnabled( true ); 354 } 356 361 private DateTime getADate(String s) { 362 DateTime retDT = null; 363 try 364 { 365 retDT = new DateTime( s ); 366 } catch(IllegalArgumentException pe) 368 { 369 } return retDT; 372 } private static final String PADCHARS = "00000000000000000000000000000000"; 375 376 380 private String LPad(String inStr, int maxLen) { 381 if (inStr.length() >= maxLen) return inStr.toUpperCase(); 382 String zeroes = PADCHARS.substring(0, maxLen - inStr.length()); 383 String retVal = zeroes + inStr; 384 return retVal.toUpperCase(); 385 } 386 387 390 private void resetDefaults( TableView tView ) { 391 Object [] colNames = tView.getColNames(); 392 Object [][] tableValues = tView.getCalcdValues(); 393 JTable table = new JTable ( tableValues, colNames ); 395 tView.setViewColumnsWidth( table ); 396 setTitle( tView.getViewTitle() ); 397 if ( mainSP != null ) getContentPane().remove( mainSP ); 399 mainSP = new JScrollPane ( table ); 400 getContentPane().add( mainSP, "Center" ); 401 validate(); 402 } 404 408 412 private class LoadedFile { 413 String fileName = null; 415 ArrayList fileStrings = null; 416 ArrayList dtObjects = null; 417 int lineGuess = 0; 418 419 422 LoadedFile(String fileName) { 423 validateFile( fileName ); 424 this.fileName = fileName; 425 fileStrings = new ArrayList ( lineGuess ); 427 dtObjects = new ArrayList ( lineGuess ); 428 429 try 430 { 431 BufferedReader rdr = 432 new BufferedReader ( new FileReader ( fileName ) ); 433 String inputLine = null; 434 DateTime calculatedDT = null; 435 int currLine = 0; 436 while( (inputLine = rdr.readLine()) != null ) { 437 currLine++; 438 inputLine = inputLine.trim(); 439 if ( inputLine.length() == 0 ) continue; 441 if ( inputLine.charAt(0) == '#' ) continue; 442 if ( (calculatedDT = getADate(inputLine)) == null ) { 444 System.err.println("Parse failed for: " + inputLine 445 + " at line number " + currLine); 446 continue; 447 } 448 fileStrings.add( inputLine ); 450 dtObjects.add( calculatedDT ); 451 } 452 rdr.close(); 453 } 454 catch(IOException ioe) 455 { 456 System.err.println("Load of file: " 457 + fileName + " failed!"); 458 ioe.printStackTrace(); 459 System.exit(100); 460 } 461 462 fileStrings.trimToSize(); 464 dtObjects.trimToSize(); 465 } 469 public String getFileName() { return fileName; } 470 public int getLineGuess() { return lineGuess; } 471 public ArrayList getFileStrings() { return fileStrings; } 472 public ArrayList getDtObjects() { return dtObjects; } 473 public int getLoadedFileSize() { 474 if ( dtObjects == null ) return 0; 475 return dtObjects.size(); 476 } 477 480 private void validateFile(String fileName) { 481 485 File f = new File ( fileName ); 486 if ( !f.exists() || !f.canRead() ) { 487 System.err.println("File: " + mainArgs[0] 488 + " does not exist or cannot be read!"); 489 usage(); 490 System.exit(2); 491 } 492 496 lineGuess = (int)(f.length() / (long)"YYYY-MM-DDTHH:MM:SS".length()); 500 lineGuess += (lineGuess / 10); 501 if ( false ) { 505 System.out.println("Line guess is: " + lineGuess); 506 } 507 } } 510 515 private abstract class TableView { 516 protected Object [] colNames = null; 517 protected Object [][] calcdValues = null; 518 protected LoadedFile lddFile = null; 519 TableView(LoadedFile lddFile) { 521 this.lddFile = lddFile; 522 } 523 public Object [] getColNames() { 525 return colNames; 526 } 527 public Object [][] getCalcdValues() { 528 return calcdValues; 529 } 530 abstract Object [] genColNames(); 532 abstract Object [][] genCalcdValues(); 533 abstract String getViewTitle(); 534 abstract void setViewColumnsWidth(JTable jt); 535 } 538 542 private class GetterTableView extends TableView { 543 GetterTableView(LoadedFile lddFile) { 545 super(lddFile); 546 setDefaultTableView( "getter" ); 547 colNames = genColNames(); 548 calcdValues = genCalcdValues(); 549 } 550 551 554 Object [][] genCalcdValues() { 555 Object [][] retValues = null; 556 561 ArrayList fileStrings = lddFile.getFileStrings(); 562 ArrayList dtObjects = lddFile.getDtObjects(); 563 int numRows = fileStrings.size(); 564 retValues = new Object [numRows][]; 565 int numCols = colNames.length; 566 572 for (int nextStrNum = 0; nextStrNum < fileStrings.size(); ++ nextStrNum) { 573 retValues[nextStrNum] = new Object [numCols]; int column = 0; String fileString = (String )fileStrings.get(nextStrNum); 580 retValues[nextStrNum][column++] = fileString; 581 DateTime adt = (DateTime)dtObjects.get(nextStrNum); 583 String adtStr = adt.toString(); 584 retValues[nextStrNum][column++] = adtStr; 585 retValues[nextStrNum][column++] = new Integer ( adt.getMillisOfSecond() ); 589 retValues[nextStrNum][column++] = new Integer ( adt.getSecondOfMinute() ); 590 retValues[nextStrNum][column++] = new Integer ( adt.getMinuteOfHour() ); 591 retValues[nextStrNum][column++] = new Integer ( adt.getHourOfDay() ); 592 retValues[nextStrNum][column++] = new Integer ( adt.getDayOfWeek() ); 593 retValues[nextStrNum][column++] = new Integer ( adt.getDayOfMonth() ); 594 retValues[nextStrNum][column++] = new Integer ( adt.getDayOfYear() ); 595 retValues[nextStrNum][column++] = new Integer ( adt.getWeekOfWeekyear() ); 596 retValues[nextStrNum][column++] = new Integer ( adt.getWeekyear() ); 597 retValues[nextStrNum][column++] = new Integer ( adt.getMonthOfYear() ); 598 retValues[nextStrNum][column++] = new Integer ( adt.getYear() ); 599 } if ( debugf ) dumpObjs( retValues, System.err ); 602 return retValues; 603 } 605 608 Object [] genColNames() { 609 Object [] retVal = { 610 "FileString", 611 "toString()", 612 "MillisOfSec", 613 "SecOfMin", 614 "MinOfHr", 615 "HrOfDay", 616 "DayOfWk", 617 "DayOfMon", 618 "DayOfYr", 619 "WeekOfWY", 620 "Weekyear", 621 "MonOfYr", 622 "Year" 623 }; 624 return retVal; 625 } 626 627 630 String getViewTitle() { 631 return "DateTime.getXXX() Method Calculations" 632 + " : " 633 + TimeZone.getDefault().getDisplayName() 634 + " : " 635 + " Record Count " 636 + currFile.getLoadedFileSize(); 637 } 638 641 void setViewColumnsWidth(JTable jt) { 642 645 TableColumnModel colmodel = jt.getColumnModel(); 646 TableColumn col0 = colmodel.getColumn(0); 647 col0.setPreferredWidth(200); 648 TableColumn col1 = colmodel.getColumn(1); 649 col1.setPreferredWidth(200); 650 return; 651 } 652 653 } 655 659 private class HexTableView extends TableView { 660 HexTableView(LoadedFile lddFile) { 662 super(lddFile); 663 setDefaultTableView( "hex" ); 664 colNames = genColNames(); 665 calcdValues = genCalcdValues(); 666 } 667 668 671 Object [][] genCalcdValues() { 672 Object [][] retValues = null; 673 678 ArrayList fileStrings = lddFile.getFileStrings(); 679 ArrayList dtObjects = lddFile.getDtObjects(); 680 int numRows = fileStrings.size(); 681 retValues = new Object [numRows][]; 682 int numCols = colNames.length; 683 String fs = "yyyy-MM-dd'T'HH:mm:ss"; 685 DateFormat df = new SimpleDateFormat ( fs ); 686 691 for (int nextStrNum = 0; nextStrNum < fileStrings.size(); ++ nextStrNum) { 692 retValues[nextStrNum] = new Object [numCols]; int column = 0; 698 String fileString = (String )fileStrings.get(nextStrNum); 699 retValues[nextStrNum][column++] = fileString; 700 DateTime adt = (DateTime)dtObjects.get(nextStrNum); 702 String adtStr = adt.toString(); 703 retValues[nextStrNum][column++] = adtStr; 704 long lVal = adt.getMillis(); 708 Long millis = new Long ( lVal ); 709 retValues[nextStrNum][column++] = millis; 710 String hexVal = Long.toHexString( lVal ); 711 String octalVal = Long.toOctalString( lVal ); 712 retValues[nextStrNum][column++] = "0"+ LPad(octalVal,22); 713 retValues[nextStrNum][column++] = "0x" + LPad(hexVal,16); 714 Date javaDate = null; 716 try 717 { 718 javaDate = df.parse( fileString ); 719 } 720 catch(ParseException e) 721 { 722 System.err.println("Parse failed for : " + fileString); 723 } 725 lVal = javaDate.getTime(); 727 millis = new Long ( lVal ); 728 hexVal = Long.toHexString( lVal ); 729 octalVal = Long.toOctalString( lVal ); 730 retValues[nextStrNum][column++] = millis; 731 retValues[nextStrNum][column++] = "0"+ LPad(octalVal,22); 732 retValues[nextStrNum][column++] = "0x" + LPad(hexVal,16); 733 } if ( debugf ) dumpObjs( retValues, System.err ); 736 return retValues; 737 } 739 742 Object [] genColNames() { 743 Object [] retVal = { 744 "FileString", 745 "toString()", 746 "JDT-millis", 747 "JDT-Oct", 748 "JDT-Hex", 749 "Date-millis", 750 "Date-Oct", 751 "Date-Hex" 752 }; 753 return retVal; 754 } 755 756 759 String getViewTitle() { 760 return "View the long values" 761 + " : " 762 + TimeZone.getDefault().getDisplayName() 763 + " : " 764 + " Record Count " 765 + currFile.getLoadedFileSize(); 766 } 767 770 void setViewColumnsWidth(JTable jt) { 771 return; 772 } 773 774 } 776 780 private class DateTableView extends TableView { 781 DateTableView(LoadedFile lddFile) { 783 super(lddFile); 784 setDefaultTableView( "date" ); 785 colNames = genColNames(); 786 calcdValues = genCalcdValues(); 787 } 788 789 792 Object [][] genCalcdValues() { 793 Object [][] retValues = null; 794 799 ArrayList fileStrings = lddFile.getFileStrings(); 800 ArrayList dtObjects = lddFile.getDtObjects(); 801 int numRows = fileStrings.size(); 802 retValues = new Object [numRows][]; 803 int numCols = colNames.length; 804 810 for (int nextStrNum = 0; nextStrNum < fileStrings.size(); ++ nextStrNum) { 811 retValues[nextStrNum] = new Object [numCols]; int column = 0; 817 String fileString = (String )fileStrings.get(nextStrNum); 818 retValues[nextStrNum][column++] = fileString; 819 DateTime adt = (DateTime)dtObjects.get(nextStrNum); 821 String adtStr = adt.toString(); 822 retValues[nextStrNum][column++] = adtStr; 823 long lVal = adt.getMillis(); 827 java.util.Date jDate = new java.util.Date ( lVal ); 828 retValues[nextStrNum][column++] = new Integer ( jDate.getSeconds() ); 829 retValues[nextStrNum][column++] = new Integer ( jDate.getMinutes() ); 830 retValues[nextStrNum][column++] = new Integer ( jDate.getHours() ); 831 retValues[nextStrNum][column++] = new Integer ( jDate.getDay() ); 832 retValues[nextStrNum][column++] = new Integer ( jDate.getDate() ); 833 retValues[nextStrNum][column++] = new Integer ( jDate.getMonth() ); 834 retValues[nextStrNum][column++] = new Integer ( jDate.getYear() ); 835 } if ( debugf ) dumpObjs( retValues, System.err ); 838 return retValues; 839 } 841 844 Object [] genColNames() { 845 Object [] retVal = { 846 "FileString", "toString()", "Seconds", "Minutes", "Hours", "Day Of Week", "Day Of Month", "Month", "Year" }; 856 return retVal; 857 } 858 859 862 String getViewTitle() { 863 return "java.util.Date getXXX" 864 + " : " 865 + TimeZone.getDefault().getDisplayName() 866 + " : " 867 + " Record Count " 868 + currFile.getLoadedFileSize(); 869 } 870 873 void setViewColumnsWidth(JTable jt) { 874 877 TableColumnModel colmodel = jt.getColumnModel(); 878 TableColumn col0 = colmodel.getColumn(0); 879 col0.setPreferredWidth(150); 880 TableColumn col1 = colmodel.getColumn(1); 881 col1.setPreferredWidth(150); 882 return; 883 } 884 885 } 887 891 private class CalTableView extends TableView { 892 CalTableView(LoadedFile lddFile) { 894 super(lddFile); 895 setDefaultTableView( "cal" ); 896 colNames = genColNames(); 897 calcdValues = genCalcdValues(); 898 } 899 900 903 Object [][] genCalcdValues() { 904 Object [][] retValues = null; 905 910 ArrayList fileStrings = lddFile.getFileStrings(); 911 ArrayList dtObjects = lddFile.getDtObjects(); 912 int numRows = fileStrings.size(); 913 retValues = new Object [numRows][]; 914 int numCols = colNames.length; 915 921 for (int nextStrNum = 0; nextStrNum < fileStrings.size(); ++ nextStrNum) { 922 retValues[nextStrNum] = new Object [numCols]; int column = 0; 928 String fileString = (String )fileStrings.get(nextStrNum); 929 retValues[nextStrNum][column++] = fileString; 930 DateTime adt = (DateTime)dtObjects.get(nextStrNum); 932 String adtStr = adt.toString(); 933 retValues[nextStrNum][column++] = adtStr; 934 long lVal = adt.getMillis(); 938 GregorianCalendar cal = new GregorianCalendar (); 939 cal.setTime( new Date ( lVal ) ); 940 cal.setMinimalDaysInFirstWeek(4); 941 retValues[nextStrNum][column++] = new Integer ( cal.get( 942 Calendar.MILLISECOND ) ); 943 retValues[nextStrNum][column++] = new Integer ( cal.get( 944 Calendar.SECOND ) ); 945 retValues[nextStrNum][column++] = new Integer ( cal.get( 946 Calendar.MINUTE ) ); 947 retValues[nextStrNum][column++] = new Integer ( cal.get( 948 Calendar.HOUR_OF_DAY ) ); 949 retValues[nextStrNum][column++] = new Integer ( cal.get( 950 Calendar.DAY_OF_WEEK ) ); 951 retValues[nextStrNum][column++] = new Integer ( cal.get( 952 Calendar.DAY_OF_MONTH ) ); 953 retValues[nextStrNum][column++] = new Integer ( cal.get( 954 Calendar.DAY_OF_YEAR ) ); 955 retValues[nextStrNum][column++] = new Integer ( cal.get( 956 Calendar.WEEK_OF_YEAR ) ); 957 retValues[nextStrNum][column++] = new Integer ( cal.get( 958 Calendar.MONTH ) ); 959 retValues[nextStrNum][column++] = new Integer ( cal.get( 960 Calendar.YEAR ) ); 961 } if ( debugf ) dumpObjs( retValues, System.err ); 964 return retValues; 965 } 967 970 Object [] genColNames() { 971 Object [] retVal = { 972 "FileString", "toString()", "Millis", "Sec", "Min", "HrOfDay", "DayOfWeek", "DayOfMon", "DayOfYr", "WkofYr", "MonOfYr", "Year" }; 985 return retVal; 986 } 987 988 991 String getViewTitle() { 992 return "java.util.Calendar.get(int)" 993 + " : " 994 + TimeZone.getDefault().getDisplayName() 995 + " : " 996 + " Record Count " 997 + currFile.getLoadedFileSize(); 998 } 999 1002 void setViewColumnsWidth(JTable jt) { 1003 1006 TableColumnModel colmodel = jt.getColumnModel(); 1007 TableColumn col0 = colmodel.getColumn(0); 1008 col0.setPreferredWidth(175); 1009 TableColumn col1 = colmodel.getColumn(1); 1010 col1.setPreferredWidth(175); 1011 return; 1012 } 1013 1014 } 1016 1019 private class OpenAction extends AbstractAction { 1020 1023 public OpenAction() { 1024 super("Open"); 1025 } 1027 1030 public void actionPerformed(ActionEvent e) { 1031 int result = chooser.showOpenDialog( DateTimeBrowser.this ); 1032 String canPath = null; 1033 if ( result == JFileChooser.APPROVE_OPTION ) { 1034 File chosenFile = chooser.getSelectedFile(); 1035 try 1036 { 1037 canPath = chosenFile.getCanonicalPath(); 1038 } 1039 catch(IOException ioe) 1040 { 1041 System.err.println( "I/O Error on file: " 1042 + chosenFile ); 1043 } 1045 enableAllViews(); 1046 currFile = new LoadedFile( canPath ); 1047 TableView tView = getDefaultTableView(); 1048 resetDefaults( tView ); 1049 } } } 1053 1056 private class ExitAction extends AbstractAction { 1057 1060 public ExitAction() { 1061 super("Exit"); 1062 } 1064 1067 public void actionPerformed(ActionEvent e) { 1068 DateTimeBrowser.this.setVisible( false ); 1069 DateTimeBrowser.this.dispose(); 1070 System.exit(0); 1071 } } 1074 1077 private class GetterAction extends AbstractAction { 1078 1081 public GetterAction() { 1082 super("Getter"); 1083 } 1085 1088 public void actionPerformed(ActionEvent e) { 1089 TableView tView = new GetterTableView( currFile ); 1090 resetDefaults( tView ); 1091 enableAllViews(); 1092 jmiGetter.setEnabled( false ); 1093 } } 1096 1099 private class HexAction extends AbstractAction { 1100 1103 public HexAction() { 1104 super("Hex"); 1105 } 1107 1110 public void actionPerformed(ActionEvent e) { 1111 TableView tView = new HexTableView( currFile ); 1112 resetDefaults( tView ); 1113 enableAllViews(); 1114 jmiHex.setEnabled( false ); 1115 } } 1118 1121 private class DateAction extends AbstractAction { 1122 1125 public DateAction() { 1126 super("Date"); 1127 } 1129 1132 public void actionPerformed(ActionEvent e) { 1133 TableView tView = new DateTableView( currFile ); 1134 resetDefaults( tView ); 1135 enableAllViews(); 1136 jmiDate.setEnabled( false ); 1137 } } 1140 1143 private class CalAction extends AbstractAction { 1144 1147 public CalAction() { 1148 super("Calendar"); 1149 } 1151 1154 public void actionPerformed(ActionEvent e) { 1155 TableView tView = new CalTableView( currFile ); 1156 resetDefaults( tView ); 1157 enableAllViews(); 1158 jmiCal.setEnabled( false ); 1159 } } 1162} | Popular Tags |