View Javadoc

1   package org.kuali.student.lum.common.client.widgets;
2   
3   import org.kuali.student.common.assembly.data.LookupMetadata;
4   import org.kuali.student.common.search.dto.SearchRequest;
5   import org.kuali.student.common.ui.client.widgets.KSButton;
6   import org.kuali.student.common.ui.client.widgets.KSLightBox;
7   import org.kuali.student.common.ui.client.widgets.search.SearchResultsTable;
8   
9   import com.google.gwt.event.dom.client.ClickEvent;
10  import com.google.gwt.event.dom.client.ClickHandler;
11  import com.google.gwt.user.client.ui.VerticalPanel;
12  
13  public class SearchResultsLightBox {
14      private KSLightBox lightbox;
15      private SearchResultsTable searchResultsTable;
16      private KSButton closeButton;
17      private SearchRequest searchRequest;
18      private LookupMetadata lookupMetadata;
19      
20      public SearchResultsLightBox(String title, SearchRequest searchRequest, LookupMetadata lookupMetadata) {
21          VerticalPanel contents = new VerticalPanel();
22          lightbox = new KSLightBox(title);
23          searchResultsTable = new SearchResultsTable();
24          searchResultsTable.addStyleName("KS-Advanced-Search-Results-Table");
25          searchResultsTable.setWithMslable(false);
26          closeButton = new KSButton("Close");
27          this.searchRequest = searchRequest;
28          this.lookupMetadata = lookupMetadata;
29          contents.add(searchResultsTable);
30          contents.add(closeButton);
31          
32          closeButton.addClickHandler(new ClickHandler() {
33              @Override
34              public void onClick(ClickEvent event) {
35                  hide();
36              }
37          });
38          
39          lightbox.setWidget(contents);
40      }
41      
42      public void setSize(int width, int height) {
43          lightbox.setSize(width, height);
44      }
45      
46      public void show() {
47          searchResultsTable.performSearch(searchRequest, lookupMetadata.getResults(), lookupMetadata.getResultReturnKey());
48          lightbox.show();
49      }
50      
51      public void hide() {
52          lightbox.hide();
53      }
54  }