< prev index next >

src/com/sun/javatest/tool/TabDeskView.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


  66  * A container that presents the current desktop tools in a tabbed pane.
  67  * The main complexity is that when a tool is made current, its menus
  68  * are merged onto the main menu bar, and removed when the tool is no
  69  * longer selected.
  70  */
  71 class TabDeskView extends DeskView {
  72 
  73     TabDeskView(Desktop desktop) {
  74         this(desktop, getDefaultBounds());
  75     }
  76 
  77     TabDeskView(DeskView other) {
  78         this(other.getDesktop(), other.getBounds());
  79         //System.err.println("Tab: create from " + other);
  80         //System.err.println("Tab: create " + other.getTools().length + " tools");
  81 
  82         Tool[] tools = other.getTools();
  83 
  84         // perhaps would be nice to have getTools(Comparator) and have it return a sorted
  85         // array of tools
  86         Arrays.sort(tools, new Comparator() {
  87             public int compare(Object o1, Object o2) {
  88                 Long l1 = new Long(((Tool)o1).getCreationTime());
  89                 Long l2 = new Long(((Tool)o2).getCreationTime());
  90                 return (l1.compareTo(l2));
  91             }
  92         });
  93 
  94         for (int i = 0; i < tools.length; i++)
  95             addTool(tools[i]);
  96 
  97         setVisible(other.isVisible());
  98     }
  99 
 100     private TabDeskView(Desktop desktop, Rectangle bounds) {
 101         super(desktop);
 102         initMainFrame(bounds);
 103         uif.setDialogParent(mainFrame);
 104         JDialog.setDefaultLookAndFeelDecorated(false);
 105     }
 106 
 107     public void dispose() {
 108         mainFrame.setVisible(false);
 109         mainFrame.dispose();




  66  * A container that presents the current desktop tools in a tabbed pane.
  67  * The main complexity is that when a tool is made current, its menus
  68  * are merged onto the main menu bar, and removed when the tool is no
  69  * longer selected.
  70  */
  71 class TabDeskView extends DeskView {
  72 
  73     TabDeskView(Desktop desktop) {
  74         this(desktop, getDefaultBounds());
  75     }
  76 
  77     TabDeskView(DeskView other) {
  78         this(other.getDesktop(), other.getBounds());
  79         //System.err.println("Tab: create from " + other);
  80         //System.err.println("Tab: create " + other.getTools().length + " tools");
  81 
  82         Tool[] tools = other.getTools();
  83 
  84         // perhaps would be nice to have getTools(Comparator) and have it return a sorted
  85         // array of tools
  86         Arrays.sort(tools, new Comparator<Tool>() {
  87             public int compare(Tool o1, Tool o2) {
  88                 Long l1 = new Long(o1.getCreationTime());
  89                 Long l2 = new Long(o2.getCreationTime());
  90                 return (l1.compareTo(l2));
  91             }
  92         });
  93 
  94         for (int i = 0; i < tools.length; i++)
  95             addTool(tools[i]);
  96 
  97         setVisible(other.isVisible());
  98     }
  99 
 100     private TabDeskView(Desktop desktop, Rectangle bounds) {
 101         super(desktop);
 102         initMainFrame(bounds);
 103         uif.setDialogParent(mainFrame);
 104         JDialog.setDefaultLookAndFeelDecorated(false);
 105     }
 106 
 107     public void dispose() {
 108         mainFrame.setVisible(false);
 109         mainFrame.dispose();


< prev index next >