Home | History | Annotate | Download | only in afe
      1 package autotest.afe;
      2 
      3 import autotest.afe.ITextBox;
      4 import autotest.afe.ITextBox.TextBoxImpl;
      5 import autotest.afe.TestSelector.IDataTable;
      6 import autotest.afe.TestSelector.IDataTable.DataTableImpl;
      7 import autotest.afe.TestSelector.ISelectionManager;
      8 import autotest.afe.TestSelector.ISelectionManager.SelectionManagerImpl;
      9 import autotest.common.table.DataTable;
     10 import autotest.common.ui.ExtendedListBox;
     11 import autotest.common.ui.SimplifiedList;
     12 import autotest.common.ui.ToolTip;
     13 
     14 import com.google.gwt.user.client.ui.Composite;
     15 import com.google.gwt.user.client.ui.HTML;
     16 import com.google.gwt.user.client.ui.HasHTML;
     17 import com.google.gwt.user.client.ui.HorizontalPanel;
     18 import com.google.gwt.user.client.ui.HorizontalSplitPanel;
     19 import com.google.gwt.user.client.ui.Label;
     20 import com.google.gwt.user.client.ui.Panel;
     21 import com.google.gwt.user.client.ui.VerticalPanel;
     22 
     23 public class TestSelectorDisplay extends Composite implements TestSelector.Display {
     24     private static final String[][] testTableColumns = new String[][] {
     25         {DataTable.WIDGET_COLUMN, ""},
     26         {"name", "Test"},
     27     };
     28 
     29     private ExtendedListBox testTypeSelect = new ExtendedListBox();
     30     private TextBoxImpl testNameFilter = new TextBoxImpl();
     31     private DataTableImpl testTable = new DataTableImpl(testTableColumns);
     32     private SelectionManagerImpl testSelection = new SelectionManagerImpl(testTable, false);
     33     private HTML testInfo = new HTML("Click a test to view its description");
     34     private HorizontalSplitPanel mainPanel = new HorizontalSplitPanel();
     35     private ToolTip testTypeToolTip = new ToolTip(
     36         "?",
     37         "Client tests run asynchronously, as hosts become available. " +
     38         "Server tests run synchronously, when all hosts are available.");
     39 
     40     public TestSelectorDisplay() {
     41         testInfo.setStyleName("test-description");
     42 
     43         testTable.fillParent();
     44         testTable.setClickable(true);
     45 
     46         Panel testTypePanel = new HorizontalPanel();
     47         testTypePanel.add(new Label("Filter by test type:"));
     48         testTypePanel.add(testTypeSelect);
     49         testTypePanel.add(testTypeToolTip);
     50 
     51         Panel testFilterPanel = new HorizontalPanel();
     52         testFilterPanel.add(new Label("Filter by test name:"));
     53         testFilterPanel.add(testNameFilter);
     54 
     55         Panel testInfoPanel = new VerticalPanel();
     56         testInfoPanel.add(testInfo);
     57 
     58         mainPanel.setLeftWidget(testTable);
     59         mainPanel.setRightWidget(testInfoPanel);
     60         mainPanel.setSize("100%", "30em");
     61         mainPanel.setSplitPosition("30%");
     62         mainPanel.addStyleName("test-selector");
     63         mainPanel.addStyleName("noborder");
     64 
     65         Panel container = new VerticalPanel();
     66         container.add(testTypePanel);
     67         container.add(testFilterPanel);
     68         container.add(mainPanel);
     69         container.addStyleName("panel-boundedwidth");
     70         container.addStyleName("data-table-outlined-gray");
     71 
     72         initWidget(container);
     73     }
     74 
     75     public SimplifiedList getTestTypeSelect() {
     76         return testTypeSelect;
     77     }
     78 
     79     public ITextBox getTestNameFilter() {
     80         return testNameFilter;
     81     }
     82 
     83     public HasHTML getTestInfo() {
     84         return testInfo;
     85     }
     86 
     87     public ISelectionManager getTestSelection() {
     88         return testSelection;
     89     }
     90 
     91     public IDataTable getTestTable() {
     92         return testTable;
     93     }
     94 }
     95