1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.widgets.buttongroups; |
17 | |
|
18 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
19 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
20 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
21 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.SearchCancelEnum; |
22 | |
import org.kuali.student.common.ui.client.widgets.buttonlayout.ButtonRow; |
23 | |
|
24 | |
import com.google.gwt.event.dom.client.ClickEvent; |
25 | |
import com.google.gwt.event.dom.client.ClickHandler; |
26 | |
|
27 | |
public class SearchCancelGroup extends ButtonGroup<SearchCancelEnum>{ |
28 | |
|
29 | 0 | public SearchCancelGroup(Callback<SearchCancelEnum> callback){ |
30 | 0 | layout = new ButtonRow(); |
31 | 0 | this.addCallback(callback); |
32 | |
|
33 | 0 | addButton(SearchCancelEnum.SEARCH); |
34 | 0 | addLinkToSecondaryGroup(SearchCancelEnum.CANCEL); |
35 | |
|
36 | 0 | this.initWidget(layout); |
37 | 0 | } |
38 | |
|
39 | |
private void addButton(final SearchCancelEnum type){ |
40 | 0 | KSButton button = new KSButton(type.getText(), new ClickHandler(){ |
41 | |
|
42 | |
@Override |
43 | |
public void onClick(ClickEvent event) { |
44 | 0 | sendCallbacks(type); |
45 | 0 | } |
46 | |
}); |
47 | 0 | layout.addButton(button); |
48 | 0 | buttonMap.put(type, button); |
49 | 0 | } |
50 | |
|
51 | |
private void addLinkToSecondaryGroup(final SearchCancelEnum type){ |
52 | 0 | KSButton button = new KSButton(type.getText(), ButtonStyle.DEFAULT_ANCHOR); |
53 | 0 | button.addClickHandler(new ClickHandler(){ |
54 | |
|
55 | |
@Override |
56 | |
public void onClick(ClickEvent event) { |
57 | 0 | sendCallbacks(type); |
58 | 0 | } |
59 | |
}); |
60 | 0 | ((ButtonRow)layout).addButtonToSecondaryGroup(button); |
61 | 0 | buttonMap.put(type, button); |
62 | 0 | } |
63 | |
} |