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 public SearchCancelGroup(Callback<SearchCancelEnum> callback){
30 layout = new ButtonRow();
31 this.addCallback(callback);
32
33 addButton(SearchCancelEnum.SEARCH);
34 addLinkToSecondaryGroup(SearchCancelEnum.CANCEL);
35
36 this.initWidget(layout);
37 }
38
39 private void addButton(final SearchCancelEnum type){
40 KSButton button = new KSButton(type.getText(), new ClickHandler(){
41
42 @Override
43 public void onClick(ClickEvent event) {
44 sendCallbacks(type);
45 }
46 });
47 layout.addButton(button);
48 buttonMap.put(type, button);
49 }
50
51 private void addLinkToSecondaryGroup(final SearchCancelEnum type){
52 KSButton button = new KSButton(type.getText(), ButtonStyle.DEFAULT_ANCHOR);
53 button.addClickHandler(new ClickHandler(){
54
55 @Override
56 public void onClick(ClickEvent event) {
57 sendCallbacks(type);
58 }
59 });
60 ((ButtonRow)layout).addButtonToSecondaryGroup(button);
61 buttonMap.put(type, button);
62 }
63 }