Changeset 5106

Show
Ignore:
Timestamp:
07/15/08 16:27:49 (3 months ago)
Author:
magi@…
Message:

Updated book tests: Tables, notifications, printing.

Location:
trunk
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebContent/ITMILL/themes/tests-book/styles.css

    r4719 r5106  
    1010 
    1111/*****************************************************************************/ 
    12 /* For example_Tree()                                                  */ 
     12/* For example_Table()                                                       */ 
     13/*****************************************************************************/ 
     14/* Table rows contain three-row TextField components. */ 
     15.i-table-components-inside .i-table-cell-content { 
     16        height: 54px; /* 3*18px = 54px. */ 
     17} 
     18 
     19/*****************************************************************************/ 
     20/* For example_Tree()                                                        */ 
    1321/*****************************************************************************/ 
    1422 
  • trunk/src/com/itmill/toolkit/tests/book/BookTestApplication.java

    r5100 r5106  
    5757import com.itmill.toolkit.ui.Window; 
    5858import com.itmill.toolkit.ui.Button.ClickEvent; 
     59import com.itmill.toolkit.ui.Window.Notification; 
    5960 
    6061public class BookTestApplication extends com.itmill.toolkit.Application { 
     
    140141                        "progress/window", "progress/thread", "progress", 
    141142                        "customlayout", "spacing", "margin", "clientinfo", 
    142                         "fillinform/templates"}; 
     143                        "fillinform/templates", "notification", "print"}; 
    143144                for (int i = 0; i < examples.length; i++) { 
    144145                    main.addComponent(new Label("<a href='" + context.toString() + 
     
    215216            } else if (example.equals("fillinform")) { 
    216217                example_FillInForm(main, param); 
     218            } else if (example.equals("notification")) { 
     219                example_Notification(main, param); 
     220            } else if (example.equals("print")) { 
     221                example_Print(main, param); 
    217222            } else { 
    218223                ; // main.addComponent(new Label("Unknown test '"+example+"'.")); 
     
    13321337        } 
    13331338    } 
     1339 
     1340    void example_Notification(final Window main, String param) { 
     1341        final Window sub1 = new Window(""); 
     1342        main.addWindow(sub1); 
     1343         
     1344        sub1.showNotification("The default notification"); 
     1345         
     1346        //Notification notif = new Notification("Title"); 
     1347    } 
     1348 
     1349    void example_Print(final Window main, String param) { 
     1350        if (param != null && param.equals("simple")) {         
     1351            main.addComponent(new Label("<input type='button' onClick='print()' value='Click to Print'/>", Label.CONTENT_XHTML)); 
     1352            return; 
     1353        } 
     1354 
     1355        // A button to open the printer-friendly page. 
     1356        Button printButton = new Button("Click to Print"); 
     1357        main.addComponent(printButton); 
     1358        printButton.addListener(new Button.ClickListener() { 
     1359            public void buttonClick(ClickEvent event) { 
     1360                // Create a window that contains stuff you want to print. 
     1361                Window printWindow = new Window("Window to Print"); 
     1362                 
     1363                // Have some content to print. 
     1364                printWindow.addComponent(new Label("Here's some dynamic content.")); 
     1365                 
     1366                // To execute the print() JavaScript, we need to run it 
     1367                // from a custom layout. 
     1368                CustomLayout scriptLayout = new CustomLayout("printpage"); 
     1369                printWindow.addComponent (scriptLayout); 
     1370                 
     1371                // Add the printing window as an application-level window. 
     1372                main.getApplication().addWindow(printWindow); 
     1373         
     1374                // Open the printing window as a new browser window 
     1375                main.open(new ExternalResource(printWindow.getURL()), "_new"); 
     1376            }  
     1377        }); 
     1378 
     1379        //main.addComponent(new Label("<p>Print this!</p>\n<script type='text/javascript'>print();</script>", Label.CONTENT_XHTML)); 
     1380    } 
    13341381}