Coverage Report - org.kuali.student.common.ui.client.CommonUITest
 
Classes in this File Line Coverage Branch Coverage Complexity
CommonUITest
0%
0/20
N/A
1.6
CommonUITest$TestLightboxContent
0%
0/15
0%
0/2
1.6
CommonUITest$TestLightboxContent$1
0%
0/4
0%
0/2
1.6
CommonUITest$TestLightboxContent$2
0%
0/4
0%
0/2
1.6
 
 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;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.student.common.ui.client.widgets.ApplicationPanel;
 22  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 23  
 import org.kuali.student.common.ui.client.widgets.headers.KSHeader;
 24  
 import org.kuali.student.common.ui.client.widgets.table.SimpleWidgetTable;
 25  
 
 26  
 import com.google.gwt.core.client.EntryPoint;
 27  
 import com.google.gwt.event.dom.client.ClickEvent;
 28  
 import com.google.gwt.event.dom.client.ClickHandler;
 29  
 import com.google.gwt.user.client.ui.AbsolutePanel;
 30  
 import com.google.gwt.user.client.ui.Composite;
 31  
 import com.google.gwt.user.client.ui.HTML;
 32  
 import com.google.gwt.user.client.ui.HorizontalPanel;
 33  
 import com.google.gwt.user.client.ui.Label;
 34  
 import com.google.gwt.user.client.ui.RootPanel;
 35  
 import com.google.gwt.user.client.ui.VerticalPanel;
 36  
 import com.google.gwt.user.client.ui.Widget;
 37  
 
 38  0
 public class CommonUITest implements EntryPoint {
 39  
            
 40  
     @Override
 41  
     public void onModuleLoad() {
 42  0
                 final AbsolutePanel panel = ApplicationPanel.get();
 43  
                 
 44  
                 //panel.add(new TableDemoPanel());
 45  
                 //panel.add(new KSLightBoxDemo());
 46  
 //                panel.add(new HeaderDemo());
 47  0
                 KSHeader ksHeader = new KSHeader();
 48  0
                 panel.add(ksHeader);
 49  
                 /*
 50  
             panel.add(new Button("Test Notifications", new ClickHandler() {
 51  
             @Override
 52  
             public void onClick(final ClickEvent event) {
 53  
                             KSNotifier.add(new KSNotification("Thisisalongmessagethatwillneedtowordwrapbutnotallofitisverywordwrapfriendlyasyoucanplainlysee", false, 10000));
 54  
                             new Timer() {
 55  
                                                 
 56  
                                                 @Override
 57  
                                                 public void run() {
 58  
                                 KSNotifier.add(new KSNotification("Short message <a href='http://xkcd.com/' target='_blank'>with html</a>", true, 10000));
 59  
                                         new Timer() {
 60  
                                                                 
 61  
                                                                 @Override
 62  
                                                                 public void run() {
 63  
                                                 KSNotifier.add(new KSNotification(new Image("images/common/KS_logo_white_transparent.png"), 10000));
 64  
                                                                 }
 65  
                                                         }.schedule(5000);
 66  
                                                 }
 67  
                                         }.schedule(5000);
 68  
             }
 69  
             }));
 70  
 
 71  
                 // flood out the body to test scrolling
 72  
                 for (int i=0; i<500; i++) {
 73  
                         panel.add(new Label("label " + i));
 74  
                 }
 75  
                 */
 76  0
         }
 77  
         
 78  0
         public static class TestLightboxContent extends Composite {
 79  0
                 final VerticalPanel panel = new VerticalPanel();
 80  0
                 final HorizontalPanel buttonPanel = new HorizontalPanel();
 81  0
                 final HorizontalPanel horizontalContent = new HorizontalPanel();
 82  0
                 final VerticalPanel verticalContent = new VerticalPanel();
 83  
                 
 84  0
                 public TestLightboxContent() {
 85  0
                         super.initWidget(panel);
 86  0
                         panel.add(buttonPanel);
 87  0
                         panel.add(horizontalContent);
 88  0
                         panel.add(verticalContent);
 89  
 
 90  0
             for (int i=0; i<50; i++) {
 91  0
                 horizontalContent.add(new HTML("<div style='padding-left: 1em'>item&nbsp;" + i + "</div>"));
 92  0
                 verticalContent.add(new Label("item " + i));
 93  
             }
 94  
             
 95  0
                         buttonPanel.add(new KSButton("horizontal", new ClickHandler() {
 96  
                                 @Override
 97  
                                 public void onClick(ClickEvent event) {
 98  0
                                         for (int i=0; i<10; i++) {
 99  0
                                                 horizontalContent.add(new HTML("<div style='padding-left: 1em'>item&nbsp;" + i + "</div>"));
 100  
                                         }
 101  0
                                 }
 102  
                         }));
 103  
                         
 104  0
                         buttonPanel.add(new KSButton("vertical", new ClickHandler() {
 105  
                                 @Override
 106  
                                 public void onClick(ClickEvent event) {
 107  0
                                         for (int i=0; i<10; i++) {
 108  0
                                                 verticalContent.add(new Label("item " + i));
 109  
                                         }
 110  0
                                 }
 111  
                         }));
 112  
                         
 113  0
                 }
 114  
         }
 115  
 
 116  
     public void onModuleLoad_Original() {
 117  
             /*final ClickHandler handler = new ClickHandler(){
 118  
 
 119  
                         @Override
 120  
                         public void onClick(ClickEvent event) {
 121  
                                 // TODO Auto-generated method stub
 122  
                                 
 123  
                         }};
 124  
                         
 125  
             KSWrapper wrapper = new KSWrapper();
 126  
             StylishDropDown dropDown = new StylishDropDown("Navigation", Theme.INSTANCE.getCommonImages().getWarningIcon(), MenuImageLocation.RIGHT);
 127  
             dropDown.addStyleName("KS-Navigation-DropDown");
 128  
             dropDown.setShowSelectedItem(true);
 129  
             List<KSMenuItemData> items = new ArrayList<KSMenuItemData>();
 130  
             items.add(new KSMenuItemData("Curriculum Management"){{setClickHandler(handler); setShownIcon(Theme.INSTANCE.getCommonImages().getOkIcon());}});
 131  
             items.add(new KSMenuItemData("Organizations"));
 132  
             items.add(new KSMenuItemData("Rice"));
 133  
             dropDown.setArrowImage(Theme.INSTANCE.getCommonImages().getDropDownIconWhite());
 134  
             dropDown.setItems(items);
 135  
             
 136  
             StylishDropDown dropDown2 = new StylishDropDown("Propose New Curriculum", Theme.INSTANCE.getCommonImages().getWarningIcon(), MenuImageLocation.LEFT);
 137  
             dropDown2.addStyleName("KS-LPNavigation-DropDown");
 138  
             dropDown2.setShowSelectedItem(false);
 139  
             List<KSMenuItemData> proposeItems = new ArrayList<KSMenuItemData>();
 140  
             proposeItems.add(new KSMenuItemData("Courses"){{
 141  
                     addSubItem(new KSMenuItemData("Academic Course", handler));
 142  
                     addSubItem(new KSMenuItemData("Non Academic Course", handler));
 143  
             }});
 144  
             proposeItems.add(new KSMenuItemData("Programs"){{
 145  
                     addSubItem(new KSMenuItemData("Undergraduate"){{
 146  
                             addSubItem(new KSMenuItemData("Associate Degree", handler));
 147  
                         addSubItem(new KSMenuItemData("Baccalaureate Degree Major", handler));
 148  
                         addSubItem(new KSMenuItemData("Baccalaureate Degree Minor", handler));
 149  
                         addSubItem(new KSMenuItemData("Undergraduate Certificate", handler));
 150  
                     }});
 151  
                     addSubItem(new KSMenuItemData("Graduate"){{
 152  
                             addSubItem(new KSMenuItemData("Graduate Certificate", handler));
 153  
                         addSubItem(new KSMenuItemData("Masters Degree", handler));
 154  
                         addSubItem(new KSMenuItemData("Doctoral Degree", handler));
 155  
                     }});
 156  
                     addSubItem(new KSMenuItemData("Professional"){{
 157  
                             addSubItem(new KSMenuItemData("Professional Degree", handler));
 158  
                         addSubItem(new KSMenuItemData("Professional Certificate", handler));
 159  
                     }});
 160  
             }});
 161  
             
 162  
             proposeItems.add(new KSMenuItemData("Experiential Learning"){{
 163  
                     addSubItem(new KSMenuItemData("Externship", handler));
 164  
                     addSubItem(new KSMenuItemData("Internship", handler));
 165  
                     addSubItem(new KSMenuItemData("Practicum", handler));
 166  
             }});
 167  
             
 168  
             dropDown2.setItems(proposeItems);
 169  
             
 170  
             //KSLumLandingPage landing = new KSLumLandingPage();
 171  
             //wrapper.setContent(landing);
 172  
             
 173  
             RootPanel.get().add(new KSDatePicker());
 174  
             RootPanel.get().add(dropDown);
 175  
             RootPanel.get().add(dropDown2);*/
 176  
             //final KSLabel label = new KSLabel("Name");
 177  
 
 178  
             //RootPanel.get().add(label);
 179  
 /*            final KSTitleContainerImpl title = new KSTitleContainerImpl();
 180  
             title.setTitle("NAME1");
 181  
             KSButton button = new KSButton("Change", new ClickHandler(){
 182  
 
 183  
                         @Override
 184  
                         public void onClick(ClickEvent event) {
 185  
                                 title.setTitle("NEW NAME");
 186  
                                 //label.
 187  
                         }});
 188  
             RootPanel.get().add(title);*/        
 189  0
             List<String> columns = new ArrayList<String>();
 190  0
         columns.add("Name");
 191  0
         columns.add("Permissions");
 192  0
         columns.add("Workflow Permissions");
 193  0
         columns.add("Remove Person");
 194  0
         SimpleWidgetTable table = new SimpleWidgetTable(columns);
 195  0
         List<Widget> widgets = new ArrayList<Widget>();
 196  0
         widgets.add(new Label("Hello"));
 197  0
         widgets.add(new Label("Hello2"));
 198  0
         widgets.add(new Label(""));
 199  0
         widgets.add(new Label("Hello4"));
 200  0
         table.addRow(widgets);
 201  0
             RootPanel.get().add(table);
 202  
             
 203  
 /*            KSWrapper wrapper = new KSWrapper();
 204  
 
 205  
             KSTitleContainerImpl container = new KSTitleContainerImpl("Introduction to Geology", "Unsubmitted Proposal", "Workflow Overview");
 206  
             KSTabPanel tabPanel = new KSTabPanel();
 207  
             container.setContent(tabPanel);
 208  
 
 209  
             VerticalPanel vPanel = new VerticalPanel();
 210  
             vPanel.add(new KSButton("Button"));
 211  
             vPanel.add(new KSLabel("Label"));
 212  
             vPanel.add(Theme.INSTANCE.getCommonImages().getAsterisk());
 213  
             vPanel.add(new KSRichEditor());
 214  
             KSBasicMenu menu = new KSBasicMenu();
 215  
             List<KSMenuItemData> menuItems = new ArrayList<KSMenuItemData>();
 216  
             menuItems.add(new KSMenuItemData("Item 1")
 217  
             {{
 218  
                     addSubItem(new KSMenuItemData("Child 1"){{setClickHandler(new ClickHandler(){
 219  
 
 220  
                                 @Override
 221  
                                 public void onClick(ClickEvent event) {
 222  
                                         
 223  
                                         
 224  
                                 }
 225  
                         });}});
 226  
                     addSubItem(new KSMenuItemData("Child 2"){{setClickHandler(new ClickHandler(){
 227  
 
 228  
                                 @Override
 229  
                                 public void onClick(ClickEvent event) {
 230  
                                         
 231  
                                         
 232  
                                 }
 233  
                         });}});
 234  
             }});
 235  
             menuItems.add(new KSMenuItemData("Item 2")
 236  
             {{
 237  
                     addSubItem(new KSMenuItemData("Child 1"){{setClickHandler(new ClickHandler(){
 238  
 
 239  
                                 @Override
 240  
                                 public void onClick(ClickEvent event) {
 241  
                                         
 242  
                                         
 243  
                                 }
 244  
                         });}});
 245  
                     addSubItem(new KSMenuItemData("Child 2"){{setClickHandler(new ClickHandler(){
 246  
 
 247  
                                 @Override
 248  
                                 public void onClick(ClickEvent event) {
 249  
                                         
 250  
                                         
 251  
                                 }
 252  
                         });}});
 253  
                     
 254  
             }});
 255  
             menu.setTitle("Menu Title");
 256  
             menu.setDescription("Choose an Item");
 257  
             menu.setItems(menuItems);
 258  
             vPanel.add(menu);
 259  
             VerticalPanel vPanel2 = new VerticalPanel();
 260  
             vPanel2.add(new KSLabel("Summary Content"));
 261  
             VerticalPanel vPanel3 = new VerticalPanel();
 262  
             vPanel3.add(new KSLabel("Comments!"));
 263  
             
 264  
             tabPanel.addTab("1", "EDIT PROPOSAL", vPanel);
 265  
             tabPanel.addTab("2", "PROPOSAL SUMMARY", vPanel2);
 266  
             tabPanel.addTab("3", "Add & View Comments", vPanel3, TabPosition.RIGHT);
 267  
             tabPanel.selectTab("1");
 268  
             
 269  
             wrapper.setContent(container);
 270  
             List<KSLabel> headerLinks = new ArrayList<KSLabel>();
 271  
             headerLinks.add(new KSLabel("KUALI REFERENCE UNIVERSITY"));
 272  
             headerLinks.add(new KSLabel("KRU PORTAL"));
 273  
             headerLinks.add(new KSLabel("DIRECTORIES"));
 274  
             headerLinks.add(new KSLabel("SEARCH KRU"));
 275  
             wrapper.setHeaderCustomLinks(headerLinks);
 276  
             List<KSLabel> footerLinks = new ArrayList<KSLabel>();
 277  
             footerLinks.add(new KSLabel("KUALI REFERENCE UNIVERSITY"));
 278  
             footerLinks.add(new KSLabel("KRU PORTAL"));
 279  
             footerLinks.add(new KSLabel("DIRECTORIES"));
 280  
             footerLinks.add(new KSLabel("SEARCH KRU"));
 281  
             wrapper.setFooterLinks(footerLinks);
 282  
             RootPanel.get().add(wrapper);*/
 283  0
     }
 284  
 }