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 | 0 | public SearchResultsLightBox(String title, SearchRequest searchRequest, LookupMetadata lookupMetadata) { |
21 | 0 | VerticalPanel contents = new VerticalPanel(); |
22 | 0 | lightbox = new KSLightBox(title); |
23 | 0 | searchResultsTable = new SearchResultsTable(); |
24 | 0 | searchResultsTable.addStyleName("KS-Advanced-Search-Results-Table"); |
25 | 0 | searchResultsTable.setWithMslable(false); |
26 | 0 | closeButton = new KSButton("Close"); |
27 | 0 | this.searchRequest = searchRequest; |
28 | 0 | this.lookupMetadata = lookupMetadata; |
29 | 0 | contents.add(searchResultsTable); |
30 | 0 | contents.add(closeButton); |
31 | |
|
32 | 0 | closeButton.addClickHandler(new ClickHandler() { |
33 | |
@Override |
34 | |
public void onClick(ClickEvent event) { |
35 | 0 | hide(); |
36 | 0 | } |
37 | |
}); |
38 | |
|
39 | 0 | lightbox.setWidget(contents); |
40 | 0 | } |
41 | |
|
42 | |
public void setSize(int width, int height) { |
43 | 0 | lightbox.setSize(width, height); |
44 | 0 | } |
45 | |
|
46 | |
public void show() { |
47 | 0 | searchResultsTable.performSearch(searchRequest, lookupMetadata.getResults(), lookupMetadata.getResultReturnKey()); |
48 | 0 | lightbox.show(); |
49 | 0 | } |
50 | |
|
51 | |
public void hide() { |
52 | 0 | lightbox.hide(); |
53 | 0 | } |
54 | |
} |