| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 14 |  |   | 
  | 15 |  |   | 
  | 16 |  |   | 
  | 17 |  |   | 
  | 18 |  |   | 
  | 19 |  |  package org.kuali.student.common.ui.client.widgets.field.layout.layouts; | 
  | 20 |  |   | 
  | 21 |  |  import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; | 
  | 22 |  |  import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonLayout; | 
  | 23 |  |  import org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement; | 
  | 24 |  |   | 
  | 25 |  |  import com.google.gwt.event.dom.client.ClickHandler; | 
  | 26 |  |  import com.google.gwt.user.client.ui.FlowPanel; | 
  | 27 |  |  import com.google.gwt.user.client.ui.Widget; | 
  | 28 |  |   | 
  | 29 |  |   | 
  | 30 |  |   | 
  | 31 |  |   | 
  | 32 |  |   | 
  | 33 |  |   | 
  | 34 |  |   | 
  | 35 |  |   | 
  | 36 |  |  public abstract class HeadedLayout extends FieldLayout { | 
  | 37 | 0 |      protected FlowPanel body = new FlowPanel(); | 
  | 38 | 0 |      protected VerticalFieldLayout verticalLayout = new VerticalFieldLayout(); | 
  | 39 |  |      protected Header header; | 
  | 40 |  |      protected boolean updateable; | 
  | 41 |  |      protected SectionTitle title; | 
  | 42 |  |   | 
  | 43 |  |      public HeadedLayout( ){ | 
  | 44 | 0 |              super(); | 
  | 45 | 0 |                   this.hasValidation = true; | 
  | 46 | 0 |                   this.add(body); | 
  | 47 |  |             | 
  | 48 | 0 |      } | 
  | 49 |  |   | 
  | 50 |  |      protected abstract void buildHeader(String titleText, boolean updateable) ; | 
  | 51 |  |       | 
  | 52 |  |      public abstract void setLayoutTitle(SectionTitle layoutTitle) ; | 
  | 53 |  |   | 
  | 54 |  |   | 
  | 55 |  |          @Override | 
  | 56 |  |      public void addFieldToLayout(FieldElement field) { | 
  | 57 | 0 |          verticalLayout.addField(field); | 
  | 58 |  |   | 
  | 59 | 0 |      } | 
  | 60 |  |   | 
  | 61 |  |      @Override | 
  | 62 |  |      public void addLayoutToLayout(FieldLayout layout) { | 
  | 63 | 0 |          verticalLayout.addLayoutToLayout(layout); | 
  | 64 |  |   | 
  | 65 | 0 |      } | 
  | 66 |  |   | 
  | 67 |  |      @Override | 
  | 68 |  |      public void addWidgetToLayout(Widget widget) { | 
  | 69 | 0 |          verticalLayout.addWidgetToLayout(widget); | 
  | 70 | 0 |      } | 
  | 71 |  |   | 
  | 72 |  |      @Override | 
  | 73 |  |      public void removeFieldLayoutComponentFromLayout( | 
  | 74 |  |              FieldLayoutComponent component) { | 
  | 75 | 0 |          verticalLayout.removeFieldLayoutComponentFromLayout(component); | 
  | 76 |  |   | 
  | 77 | 0 |      } | 
  | 78 |  |   | 
  | 79 |  |      @Override | 
  | 80 |  |      public void removeWidgetFromLayout(Widget widget) { | 
  | 81 | 0 |          verticalLayout.removeWidgetFromLayout(widget); | 
  | 82 | 0 |      } | 
  | 83 |  |   | 
  | 84 |  |       @Override | 
  | 85 |  |      public void addButtonLayoutToLayout(ButtonLayout buttonLayout) { | 
  | 86 | 0 |          if(buttonLayout != null){ | 
  | 87 | 0 |              body.add(buttonLayout); | 
  | 88 |  |          } | 
  | 89 |  |   | 
  | 90 | 0 |      } | 
  | 91 |  |   | 
  | 92 |  |      public void addDeleteHandler(ClickHandler handler) { | 
  | 93 | 0 |          getHeader().addDeleteHandler(handler); | 
  | 94 |  |   | 
  | 95 | 0 |      } | 
  | 96 |  |   | 
  | 97 |  |      public Header getHeader() { | 
  | 98 | 0 |          return header; | 
  | 99 |  |      } | 
  | 100 |  |   | 
  | 101 |  |      public void setHeader(Header header) { | 
  | 102 | 0 |          this.header = header; | 
  | 103 | 0 |      } | 
  | 104 |  |   | 
  | 105 |  |      public void setUpdateable(boolean updateable) { | 
  | 106 | 0 |          this.updateable = updateable; | 
  | 107 | 0 |      } | 
  | 108 |  |   | 
  | 109 |  |   | 
  | 110 |  |   | 
  | 111 |  |  } |