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