1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.widgets.field.layout.layouts; |
17 | |
|
18 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
19 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrButton; |
20 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrButton.AbbrButtonType; |
21 | |
|
22 | |
import com.google.gwt.event.dom.client.ClickHandler; |
23 | |
import com.google.gwt.user.client.ui.Composite; |
24 | |
import com.google.gwt.user.client.ui.FlowPanel; |
25 | |
|
26 | |
public class Header extends Composite{ |
27 | 0 | private FlowPanel header = new FlowPanel(); |
28 | |
private SectionTitle title; |
29 | 0 | private AbbrButton help = new AbbrButton(AbbrButtonType.HELP); |
30 | 0 | private AbbrButton delete = new AbbrButton(AbbrButtonType.DELETE); |
31 | |
boolean updateable; |
32 | |
|
33 | 0 | public Header(SectionTitle title, boolean updateable){ |
34 | 0 | this.title = title; |
35 | 0 | this.updateable = updateable; |
36 | |
|
37 | 0 | FlowPanel actions = new FlowPanel(); |
38 | |
|
39 | 0 | if (updateable) |
40 | 0 | actions.add(delete); |
41 | |
|
42 | 0 | header.add(title); |
43 | 0 | header.add(actions); |
44 | 0 | FlowPanel clearDiv = new FlowPanel(); |
45 | 0 | header.add(clearDiv); |
46 | |
|
47 | 0 | clearDiv.setStyleName("clearboth"); |
48 | 0 | header.setStyleName("ks-form-bordered-header"); |
49 | 0 | actions.setStyleName("ks-form-header-title-actions"); |
50 | |
|
51 | 0 | this.initWidget(header); |
52 | 0 | } |
53 | |
|
54 | |
public void addDeleteHandler(ClickHandler handler){ |
55 | 0 | delete.addClickHandler(handler); |
56 | 0 | } |
57 | |
|
58 | |
public void addHelpHandler(ClickHandler handler){ |
59 | 0 | help.addClickHandler(handler); |
60 | 0 | } |
61 | |
|
62 | |
public void setHeaderTitle(String title){ |
63 | 0 | this.title.setText(title); |
64 | 0 | } |
65 | |
|
66 | |
public void setHeaderTitle(SectionTitle title){ |
67 | 0 | header.remove(this.title); |
68 | 0 | this.title = title; |
69 | 0 | header.insert(title, 0); |
70 | 0 | } |
71 | |
} |