View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.common.ui.client.configurable.mvc.sections;
17  
18  import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
19  import org.kuali.student.common.ui.client.widgets.KSButton;
20  import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
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 MultiplicityHeader extends Composite{
27  	
28  	private FlowPanel header = new FlowPanel();
29  	private FlowPanel actions = new FlowPanel();
30  	private FlowPanel clearDiv = new FlowPanel();
31  	private SectionTitle title;
32  	private KSButton help;
33  	private KSButton delete = null;
34  	
35  	public MultiplicityHeader(SectionTitle title, boolean readOnly){
36  		this.title = title;
37  		header.add(title);
38  		
39  		help = new KSButton("?", ButtonStyle.HELP);
40  		actions.add(help);
41  		
42  		if(!readOnly){
43  			delete = new KSButton("X", ButtonStyle.DELETE);
44  			actions.add(delete);
45  		}
46  		
47  		actions.setStyleName("ks-form-header-title-actions");
48  		
49  		header.add(actions);
50  		
51  		clearDiv.setStyleName("clear");
52  		header.add(clearDiv);
53  		this.initWidget(header);
54  	}
55  
56  	public void addDeleteHandler(ClickHandler handler){
57  		if(delete!=null){
58  			delete.addClickHandler(handler);
59  		}
60  	}
61  	
62  	public void addHelpHandler(ClickHandler handler){
63  		help.addClickHandler(handler);
64  	}
65  	
66  }