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