Coverage Report - org.kuali.student.common.ui.client.widgets.buttonlayout.ButtonColumn
 
Classes in this File Line Coverage Branch Coverage Complexity
ButtonColumn
0%
0/45
0%
0/4
1.25
 
 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.widgets.buttonlayout;
 17  
 
 18  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 19  
 
 20  
 import com.google.gwt.user.client.ui.DockPanel;
 21  
 import com.google.gwt.user.client.ui.HasAlignment;
 22  
 import com.google.gwt.user.client.ui.SimplePanel;
 23  
 import com.google.gwt.user.client.ui.VerticalPanel;
 24  
 import com.google.gwt.user.client.ui.Widget;
 25  
 
 26  
 public class ButtonColumn extends ButtonLayoutTwoGroups{
 27  0
     private VerticalPanel topPanel = new VerticalPanel();
 28  0
     private VerticalPanel bottomPanel = new VerticalPanel();
 29  0
     private SimplePanel contentPanel = new SimplePanel();
 30  0
     private DockPanel mainPanel = new DockPanel();
 31  0
     private Widget content = null;
 32  
 
 33  0
     public ButtonColumn(){
 34  0
         setupDefaultStyles();
 35  0
         mainPanel.add(contentPanel, DockPanel.WEST);
 36  0
         mainPanel.add(topPanel, DockPanel.NORTH);
 37  0
         mainPanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);
 38  0
         mainPanel.add(bottomPanel, DockPanel.SOUTH);
 39  0
         this.initWidget(mainPanel);
 40  0
     }
 41  
 
 42  0
     public ButtonColumn(boolean contentRight){
 43  0
         setupDefaultStyles();
 44  0
         if(contentRight){
 45  0
             mainPanel.add(contentPanel, DockPanel.EAST);
 46  
         }
 47  
         else{
 48  0
             mainPanel.add(contentPanel, DockPanel.WEST);
 49  
         }
 50  0
         mainPanel.add(topPanel, DockPanel.NORTH);
 51  0
         mainPanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);
 52  0
         mainPanel.add(bottomPanel, DockPanel.SOUTH);
 53  0
         this.initWidget(mainPanel);
 54  0
     }
 55  
 
 56  
     private void setupDefaultStyles(){
 57  0
         mainPanel.addStyleName("KS-Button-Column-MainPanel");
 58  0
         topPanel.addStyleName("KS-Button-Column-TopPanel");
 59  0
         bottomPanel.addStyleName( "KS-Button-Column-BottomPanel");
 60  0
         contentPanel.addStyleName("KS-Button-Column-ContentPanel");
 61  0
     }
 62  
 
 63  
     @Override
 64  
     protected void onLoad() {
 65  0
         super.onLoad();
 66  0
         if(content != null){
 67  0
             mainPanel.setHeight(content.getOffsetHeight() + "px");
 68  
         }
 69  0
     }
 70  
 
 71  
     @Override
 72  
     public void setContent(Widget w) {
 73  0
         contentPanel.setWidget(w);
 74  0
         content = w;
 75  0
     }
 76  
 
 77  
     @Override
 78  
     public void addButtonToPrimaryGroup(KSButton button) {
 79  0
         button.addStyleName("KS-Button-Column-Button");
 80  0
         topPanel.add(button);
 81  0
         buttons.add(button);
 82  0
     }
 83  
 
 84  
     @Override
 85  
     public void addButtonToSecondaryGroup(KSButton button) {
 86  0
         button.addStyleName("KS-Button-Column-Button");
 87  0
         bottomPanel.add(button);
 88  0
         buttons.add(button);
 89  0
     }
 90  
 
 91  
     @Override
 92  
     public void addButton(KSButton button) {
 93  0
         this.addButtonToPrimaryGroup(button);
 94  
 
 95  0
     }
 96  
 }