View Javadoc
1 package junit.quilt.ui; 2 3 /*** 4 * Quilt 5 * 6 * This is the UI used for running other applications 7 * and such. 8 */ 9 10 import javax.swing.*; 11 import java.awt.event.*; 12 13 import java.lang.reflect.*; 14 import java.util.List; 15 import java.util.ArrayList; 16 import java.util.ResourceBundle; 17 18 import junit.quilt.framework.*; 19 import junit.quilt.cover.state.StateMachineRegistry; 20 21 public class Quilt extends JFrame 22 { 23 private QuiltRegistry registry = null; 24 25 private List covers; 26 private List reports; 27 28 public Quilt() { 29 registry = new StateMachineRegistry(); 30 31 ResourceBundle bundle = ResourceBundle.getBundle("quilt"); 32 33 reports = makeActionList(bundle, "report", junit.quilt.ui.ReportAction.class); 34 covers = makeActionList(bundle, "cover", junit.quilt.ui.CoverAction.class); 35 // adapters = makeActionList(bundle, "adapter"); 36 } 37 38 private List makeActionList( ResourceBundle bundle, 39 String keyRoot, 40 Class clazz ) 41 { 42 Class formals[] = new Class[2]; 43 formals[0] = junit.quilt.ui.Quilt.class; 44 formals[1] = java.lang.String.class; 45 46 Object params[] = new Object[2]; 47 List RC = new ArrayList(); 48 49 String countStr = bundle.getString( keyRoot + ".count" ); 50 try { 51 int count = Integer.parseInt( countStr ); 52 53 Constructor con = clazz.getConstructor( formals ); 54 params[0] = this; 55 56 for (int i = 0; i < count; i++) { 57 params[1] = bundle.getString(keyRoot + "." + i + ".res"); 58 RC.add( con.newInstance( params )); 59 } 60 } catch (Exception e) { 61 System.err.println("Unable to read list of : " + keyRoot ); 62 } 63 64 return RC; 65 } 66 67 public QuiltRegistry getRegistry() { 68 return registry; 69 } 70 71 72 public void setRegistry( QuiltRegistry registry ) { 73 this.registry = registry; 74 } 75 76 public List getCoverActions() { 77 return covers; 78 } 79 80 public List getReportActions() { 81 return reports; 82 } 83 84 public static void main(String args[]) { 85 86 } 87 } 88 89

This page was automatically generated by Maven