diff options
161 files changed, 4284 insertions, 2155 deletions
diff --git a/WebContent/ITMILL/themes/example/favicon.ico b/WebContent/ITMILL/themes/contacts/favicon.ico Binary files differindex 2c731f8f85..2c731f8f85 100644 --- a/WebContent/ITMILL/themes/example/favicon.ico +++ b/WebContent/ITMILL/themes/contacts/favicon.ico diff --git a/WebContent/ITMILL/themes/contacts/icons/32/arrow-down.png b/WebContent/ITMILL/themes/contacts/icons/32/arrow-down.png Binary files differnew file mode 100644 index 0000000000..20c33b70fb --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/arrow-down.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/arrow-left.png b/WebContent/ITMILL/themes/contacts/icons/32/arrow-left.png Binary files differnew file mode 100644 index 0000000000..ed2aae2cb0 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/arrow-left.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/arrow-right.png b/WebContent/ITMILL/themes/contacts/icons/32/arrow-right.png Binary files differnew file mode 100644 index 0000000000..bd7707ec8a --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/arrow-right.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/arrow-up.png b/WebContent/ITMILL/themes/contacts/icons/32/arrow-up.png Binary files differnew file mode 100644 index 0000000000..01c1a8ec83 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/arrow-up.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/attention.png b/WebContent/ITMILL/themes/contacts/icons/32/attention.png Binary files differnew file mode 100644 index 0000000000..6b00733567 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/attention.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/calendar.png b/WebContent/ITMILL/themes/contacts/icons/32/calendar.png Binary files differnew file mode 100644 index 0000000000..789ad9031c --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/calendar.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/cancel.png b/WebContent/ITMILL/themes/contacts/icons/32/cancel.png Binary files differnew file mode 100644 index 0000000000..725240d558 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/cancel.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-add.png b/WebContent/ITMILL/themes/contacts/icons/32/document-add.png Binary files differnew file mode 100644 index 0000000000..26bca0d112 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-add.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-delete.png b/WebContent/ITMILL/themes/contacts/icons/32/document-delete.png Binary files differnew file mode 100644 index 0000000000..43e9a43e5b --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-delete.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-doc.png b/WebContent/ITMILL/themes/contacts/icons/32/document-doc.png Binary files differnew file mode 100644 index 0000000000..8df20cfdcf --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-doc.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-edit.png b/WebContent/ITMILL/themes/contacts/icons/32/document-edit.png Binary files differnew file mode 100644 index 0000000000..1d17383ca7 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-edit.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-image.png b/WebContent/ITMILL/themes/contacts/icons/32/document-image.png Binary files differnew file mode 100644 index 0000000000..88c78665b8 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-image.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-pdf.png b/WebContent/ITMILL/themes/contacts/icons/32/document-pdf.png Binary files differnew file mode 100644 index 0000000000..048a02fddf --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-pdf.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-ppt.png b/WebContent/ITMILL/themes/contacts/icons/32/document-ppt.png Binary files differnew file mode 100644 index 0000000000..7fd7385cbd --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-ppt.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-txt.png b/WebContent/ITMILL/themes/contacts/icons/32/document-txt.png Binary files differnew file mode 100644 index 0000000000..25264732c6 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-txt.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-web.png b/WebContent/ITMILL/themes/contacts/icons/32/document-web.png Binary files differnew file mode 100644 index 0000000000..72fd847ac3 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-web.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document-xsl.png b/WebContent/ITMILL/themes/contacts/icons/32/document-xsl.png Binary files differnew file mode 100644 index 0000000000..2ff4607ad3 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document-xsl.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/document.png b/WebContent/ITMILL/themes/contacts/icons/32/document.png Binary files differnew file mode 100644 index 0000000000..1a38dcc304 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/document.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/email-reply.png b/WebContent/ITMILL/themes/contacts/icons/32/email-reply.png Binary files differnew file mode 100644 index 0000000000..fd0203f768 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/email-reply.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/email-send.png b/WebContent/ITMILL/themes/contacts/icons/32/email-send.png Binary files differnew file mode 100644 index 0000000000..dc34ac694d --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/email-send.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/email.png b/WebContent/ITMILL/themes/contacts/icons/32/email.png Binary files differnew file mode 100644 index 0000000000..bef86e6cbb --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/email.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/folder-add.png b/WebContent/ITMILL/themes/contacts/icons/32/folder-add.png Binary files differnew file mode 100644 index 0000000000..e0b78d6e1d --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/folder-add.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/folder-delete.png b/WebContent/ITMILL/themes/contacts/icons/32/folder-delete.png Binary files differnew file mode 100644 index 0000000000..8e3c4a404c --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/folder-delete.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/folder.png b/WebContent/ITMILL/themes/contacts/icons/32/folder.png Binary files differnew file mode 100644 index 0000000000..7577a17ac3 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/folder.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/globe.png b/WebContent/ITMILL/themes/contacts/icons/32/globe.png Binary files differnew file mode 100644 index 0000000000..6c7d469ba2 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/globe.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/help.png b/WebContent/ITMILL/themes/contacts/icons/32/help.png Binary files differnew file mode 100644 index 0000000000..218910c98d --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/help.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/lock.png b/WebContent/ITMILL/themes/contacts/icons/32/lock.png Binary files differnew file mode 100644 index 0000000000..4fc16565f0 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/lock.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/note.png b/WebContent/ITMILL/themes/contacts/icons/32/note.png Binary files differnew file mode 100644 index 0000000000..e7e035dc8c --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/note.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/ok.png b/WebContent/ITMILL/themes/contacts/icons/32/ok.png Binary files differnew file mode 100644 index 0000000000..ac0438828c --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/ok.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/reload.png b/WebContent/ITMILL/themes/contacts/icons/32/reload.png Binary files differnew file mode 100644 index 0000000000..c3556ec890 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/reload.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/settings.png b/WebContent/ITMILL/themes/contacts/icons/32/settings.png Binary files differnew file mode 100644 index 0000000000..92eda74c54 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/settings.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/trash-full.png b/WebContent/ITMILL/themes/contacts/icons/32/trash-full.png Binary files differnew file mode 100644 index 0000000000..a9707e76d6 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/trash-full.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/trash.png b/WebContent/ITMILL/themes/contacts/icons/32/trash.png Binary files differnew file mode 100644 index 0000000000..6eaac86166 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/trash.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/user.png b/WebContent/ITMILL/themes/contacts/icons/32/user.png Binary files differnew file mode 100644 index 0000000000..ebb5a7f9f8 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/user.png diff --git a/WebContent/ITMILL/themes/contacts/icons/32/users.png b/WebContent/ITMILL/themes/contacts/icons/32/users.png Binary files differnew file mode 100644 index 0000000000..af225a9e46 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/icons/32/users.png diff --git a/WebContent/ITMILL/themes/contacts/images/gradient.png b/WebContent/ITMILL/themes/contacts/images/gradient.png Binary files differnew file mode 100644 index 0000000000..d609412ce2 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/images/gradient.png diff --git a/WebContent/ITMILL/themes/contacts/images/logo.png b/WebContent/ITMILL/themes/contacts/images/logo.png Binary files differnew file mode 100644 index 0000000000..7999626a66 --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/images/logo.png diff --git a/WebContent/ITMILL/themes/contacts/images/table-header-bg.png b/WebContent/ITMILL/themes/contacts/images/table-header-bg.png Binary files differnew file mode 100644 index 0000000000..a7b13ae6aa --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/images/table-header-bg.png diff --git a/WebContent/ITMILL/themes/contacts/styles.css b/WebContent/ITMILL/themes/contacts/styles.css new file mode 100644 index 0000000000..942da3362f --- /dev/null +++ b/WebContent/ITMILL/themes/contacts/styles.css @@ -0,0 +1,89 @@ + @import url(../default/styles.css); + +/* Add some padding to the tree */ +.i-tree { + padding-top: 8px; + padding-left: 4px; +} + +.toolbar .i-button { + display: block; + width: 65px; + height: 55px; + background: transparent; + border: none; + text-align: center; +} + +.toolbar .i-button img { + display: block; + margin-left: auto; + margin-right: auto; + margin-bottom: 5px; +} + +.toolbar .i-button span { + font-size: x-small; + text-shadow: #fafafa 1px 1px 0; +} + +.i-app { + background: #d0e2ec; + font-family: "Lucida Grande", Helvetica, Arial, sans-serif; + color: #222; +} + +.toolbar { + background: #ccc url(images/gradient.png) repeat-x bottom left; +} + +.i-panel-caption-view { + color: #004b98; +} + +.view { + background: white; +} + + /* Theme table to look bit lighter */ +.i-table-header-wrap { + height: 20px; + border: none; + border-bottom: 1px solid #555; + background: transparent url(images/table-header-bg.png) repeat-x; +} + +.i-table-caption-container { + font-size: 11px; + color: #000; + font-weight: bold; + text-shadow: #fff 0 1px 0; + padding-top: 1px; +} + +.i-table-body { + border: none; +} + +.i-table-row-odd { + background: #f1f5fa; +} + +.i-table-row:hover { + background: #fff; +} + +.i-table-row-odd:hover { + background: #f1f5fa; +} + +.i-table .i-selected { + background: #3d80df; +} + +.i-table-cell-content { + padding: 2px 0 2px 3px; + line-height: normal; + font-size: 85%; +} + diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.001.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.001.jpg Binary files differnew file mode 100644 index 0000000000..516fcd45c3 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.001.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.002.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.002.jpg Binary files differnew file mode 100644 index 0000000000..5f581611db --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.002.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.003.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.003.jpg Binary files differnew file mode 100644 index 0000000000..7fa826f3cf --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.003.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.004.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.004.jpg Binary files differnew file mode 100644 index 0000000000..88b823daaa --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.004.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.005.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.005.jpg Binary files differnew file mode 100644 index 0000000000..4105fa3165 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.005.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.006.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.006.jpg Binary files differnew file mode 100644 index 0000000000..188e23e359 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.006.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.007.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.007.jpg Binary files differnew file mode 100644 index 0000000000..dbe47e943f --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.007.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.008.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.008.jpg Binary files differnew file mode 100644 index 0000000000..77ab44d61b --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.008.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.009.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.009.jpg Binary files differnew file mode 100644 index 0000000000..a352f9b810 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.009.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.010.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.010.jpg Binary files differnew file mode 100644 index 0000000000..04187d5c0f --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.010.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.011.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.011.jpg Binary files differnew file mode 100644 index 0000000000..dcd2eac380 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.011.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.012.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.012.jpg Binary files differnew file mode 100644 index 0000000000..64f6888538 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.012.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.013.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.013.jpg Binary files differnew file mode 100644 index 0000000000..b2a682dc59 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.013.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.014.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.014.jpg Binary files differnew file mode 100644 index 0000000000..1309129736 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.014.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.015.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.015.jpg Binary files differnew file mode 100644 index 0000000000..8b8f37983f --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.015.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.016.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.016.jpg Binary files differnew file mode 100644 index 0000000000..814a24fd69 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.016.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.017.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.017.jpg Binary files differnew file mode 100644 index 0000000000..1c3d33c3ef --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.017.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.018.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.018.jpg Binary files differnew file mode 100644 index 0000000000..dfe01102da --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.018.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.019.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.019.jpg Binary files differnew file mode 100644 index 0000000000..7cd7c651d1 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.019.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.020.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.020.jpg Binary files differnew file mode 100644 index 0000000000..e5a230ec27 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.020.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.021.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.021.jpg Binary files differnew file mode 100644 index 0000000000..02963bf204 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.021.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/slideshow-example.022.jpg b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.022.jpg Binary files differnew file mode 100644 index 0000000000..a71be00a45 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/slideshow-example.022.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.001.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.001.jpg Binary files differnew file mode 100644 index 0000000000..67cd5c335e --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.001.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.002.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.002.jpg Binary files differnew file mode 100644 index 0000000000..52d3abd251 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.002.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.003.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.003.jpg Binary files differnew file mode 100644 index 0000000000..543a881022 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.003.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.004.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.004.jpg Binary files differnew file mode 100644 index 0000000000..5a965d819c --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.004.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.005.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.005.jpg Binary files differnew file mode 100644 index 0000000000..2caa735aa6 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.005.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.006.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.006.jpg Binary files differnew file mode 100644 index 0000000000..c6cae8631c --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.006.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.007.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.007.jpg Binary files differnew file mode 100644 index 0000000000..a6ca7afbe6 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.007.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.008.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.008.jpg Binary files differnew file mode 100644 index 0000000000..7de2a40023 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.008.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.009.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.009.jpg Binary files differnew file mode 100644 index 0000000000..ca80a4711a --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.009.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.010.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.010.jpg Binary files differnew file mode 100644 index 0000000000..5cb256b25a --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.010.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.011.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.011.jpg Binary files differnew file mode 100644 index 0000000000..b4f145eb26 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.011.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.012.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.012.jpg Binary files differnew file mode 100644 index 0000000000..69f145868e --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.012.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.013.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.013.jpg Binary files differnew file mode 100644 index 0000000000..2295878063 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.013.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.014.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.014.jpg Binary files differnew file mode 100644 index 0000000000..d686aba2f9 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.014.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.015.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.015.jpg Binary files differnew file mode 100644 index 0000000000..5551d930ae --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.015.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.016.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.016.jpg Binary files differnew file mode 100644 index 0000000000..cfc411eb55 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.016.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.017.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.017.jpg Binary files differnew file mode 100644 index 0000000000..3b81ce7cce --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.017.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.018.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.018.jpg Binary files differnew file mode 100644 index 0000000000..76722e6079 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.018.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.019.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.019.jpg Binary files differnew file mode 100644 index 0000000000..4db0dc5fcb --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.019.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.020.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.020.jpg Binary files differnew file mode 100644 index 0000000000..0d98c75670 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.020.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.021.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.021.jpg Binary files differnew file mode 100644 index 0000000000..71afa939b0 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.021.jpg diff --git a/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.022.jpg b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.022.jpg Binary files differnew file mode 100644 index 0000000000..1e6657f6cb --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/images/thumbs/slideshow-example.022.jpg diff --git a/WebContent/ITMILL/themes/coverflow/styles.css b/WebContent/ITMILL/themes/coverflow/styles.css new file mode 100644 index 0000000000..ae3f903d52 --- /dev/null +++ b/WebContent/ITMILL/themes/coverflow/styles.css @@ -0,0 +1,5 @@ +@import url(../default/styles.css); + +.i-app, body.i-generated-body { + background-color: black; +}
\ No newline at end of file diff --git a/WebContent/ITMILL/themes/example/icons/ok.png b/WebContent/ITMILL/themes/example/icons/ok.png Binary files differdeleted file mode 100644 index 89591faef2..0000000000 --- a/WebContent/ITMILL/themes/example/icons/ok.png +++ /dev/null diff --git a/WebContent/ITMILL/themes/example/layouts/Contact.html b/WebContent/ITMILL/themes/example/layouts/Contact.html deleted file mode 100644 index a37425078c..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/Contact.html +++ /dev/null @@ -1,30 +0,0 @@ - -<h3>Contact Sales</h3> -<p> -Do you want us to send you an offer? Or have our sales team contact -you on another matter? Please fill out the enclosed form and we'll get -back to you as soon as possible. You can also call us or send us an -e-mail. -</p> - -<h3>Report a Bug</h3> -<p> -If you have found an issue with IT Mill Toolkit, demo applications or -documentation, please report it to us. Fill out the following form to -send us any relevant information about the issue. -Click here -</p> - -<h3>A job for a real expert</h3> -<p> -We are always interested in new and keen talents! Finnish language -skills are required so please fill out the application form. -Click here for the form -</p> - -<h3>You feedback is always welcome</h3> -<p> -Please give us feedback on our site, products and services. We are -happy to receive positive as well as negative comments as they help us -improve ourselves even further! -</p> diff --git a/WebContent/ITMILL/themes/example/layouts/Developers.html b/WebContent/ITMILL/themes/example/layouts/Developers.html deleted file mode 100644 index 50e054a4f4..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/Developers.html +++ /dev/null @@ -1,17 +0,0 @@ - -<h3>Developers</h3> - -<p> -This section contains information for developers using IT Mill Toolkit -to create Java web applications. -</p> - -<p> -Start by reading the example application walk-through, get familiar -with the application structure and install the development environment. -</p> - -<p> -Simple. You'll be ready to build your own Ajax web applications in -Java language. -</p> diff --git a/WebContent/ITMILL/themes/example/layouts/News.html b/WebContent/ITMILL/themes/example/layouts/News.html deleted file mode 100644 index f6ab7c7f7f..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/News.html +++ /dev/null @@ -1,40 +0,0 @@ - -<h3>News</h3> - -<p> -IT Mill was founded in 2000 to develop this new programming paradigm -that would support the creation of real user interfaces for real -application using real programming languages. -</p> - -<p> -IT Mill has been offering high-quality expert services to support its -customers' software development from the start. This model has made it -possible for the company to grow and develop realistically and solely -on net income. -</p> - -<p> -The development of company's proprietary MillstoneTM technology -started at the end of 2000 in cooperation with Tekes, the National -Technology Agency of Finland. The first new Millstone customer -applications were launched already in 2001. -</p> - -<p> -Version 3.0 of the Millstone user interface library was published -using an open LGPL license in December 2002, making it possible to use -the library free of charge all around the world. -</p> - -<p> -Until 2005 more than 50 % of IT Mill's turnover was derived from sales -of Millstone specialist services, with the rest coming from sales of -other software development services and outsourcing services. -</p> - -<p> -In late 2006 IT Mill ensured funding of the new generation of -Millstone. IT Mill Toolkit was released in early 2007. -</p> - diff --git a/WebContent/ITMILL/themes/example/layouts/Products.html b/WebContent/ITMILL/themes/example/layouts/Products.html deleted file mode 100644 index 1b9b74c128..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/Products.html +++ /dev/null @@ -1,25 +0,0 @@ - -<h3>Top 5 reasons to choose IT Mill Toolkit</h3> - -<p> -1. High compatibility with web browsers and application servers -</p> - -<p> -2. Real savings in cross-browser application development and testing -</p> - -<p> -3. Ready-made components that make applications easy to maintain -and easy to extend -</p> - -<p> -4. Supports all stages of the application development cycle from -design to maintenance -</p> - -<p> -5. Proven in production - since 2001 -</p> - diff --git a/WebContent/ITMILL/themes/example/layouts/Support.html b/WebContent/ITMILL/themes/example/layouts/Support.html deleted file mode 100644 index aca7e2a66d..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/Support.html +++ /dev/null @@ -1,16 +0,0 @@ - -<h3>Support</h3> - -<p> -IT Mill offers a service, one that is expert, flexible and reliable. -We cover the gamut of software development - we are technology -consultants, a turnkey systems providers, a support center for the -customer's internal product development. -</p> - -<p> -We offer maintenance as well as additional development services for -all the software we build. However, it is one of our principles that -the customer should always be free to solicit competing bids for -further development and software maintenance. -</p> diff --git a/WebContent/ITMILL/themes/example/layouts/Welcome.html b/WebContent/ITMILL/themes/example/layouts/Welcome.html deleted file mode 100644 index 964753da5b..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/Welcome.html +++ /dev/null @@ -1,20 +0,0 @@ - -<h3>Welcome</h3> - -<p> -IT Mill is a specialist in enterprise web user interface design and -technology. We offer a variety of products and services for enterprise -application user interface design, -analysis and -implementation. Our -flagship product is IT Mill Toolkit - a server-side component -framework for Java EE. IT Mill Toolkit enables creation of highly -usable browser applications in real Java. -</p> - -<p> -IT Mill Toolkit is a web user interface framework for developing -high-quality web applications for enterprise and professional use. By -using standard Java tools and the enterprise environment (Java EE - -formerly J2EE) we have created the most elegant and complete -architecture for developing user interfaces for web business -applications - for your benefit. -</p>
\ No newline at end of file diff --git a/WebContent/ITMILL/themes/example/layouts/icon_intro.png b/WebContent/ITMILL/themes/example/layouts/icon_intro.png Binary files differdeleted file mode 100644 index 032712985c..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/icon_intro.png +++ /dev/null diff --git a/WebContent/ITMILL/themes/example/layouts/mainLayout.html b/WebContent/ITMILL/themes/example/layouts/mainLayout.html deleted file mode 100644 index 5679ecbc62..0000000000 --- a/WebContent/ITMILL/themes/example/layouts/mainLayout.html +++ /dev/null @@ -1,33 +0,0 @@ - -<!-- Toolkit components are placed with divs that have matching -location tag --> - -<table> - <tr> - <td><img src="icon_intro.png" /></td> - <td width="80%"><b>This is an example application that uses custom layouts</b></td> - <td align="right"> - <!-- login components --> - <table align="right"> - <tr> - <td><div location="loginUser"></div></td> - <td><div location="loginPassword"></div></td> - <td><div style="width:100px;margin-top:1em" location="loginButton"></div></td> - </tr> - </table> - </td> - </tr> -</table> - -<table> - <tr> - <!-- menu component --> - <td valign="top" width="150"> - <div location="menu"></div> - </td> - <!-- body component, updated by menu clicked event --> - <td valign="top"> - <div location="body"></div> - </td> - </tr> -</table> diff --git a/WebContent/ITMILL/themes/example/styles.css b/WebContent/ITMILL/themes/example/styles.css deleted file mode 100644 index 9ddb8f5b0e..0000000000 --- a/WebContent/ITMILL/themes/example/styles.css +++ /dev/null @@ -1,39 +0,0 @@ -@import url(../default/styles.css); - -.i-generated-body { - /* full height layout does not need scrollable body; - avoids excess scrollbars if moving sub-window over the window area */ - overflow:hidden; -} - -/****************************************************************************** - * For FormExample.java - ******************************************************************************/ -.i-form legend { - color: #464f52; -} - -.i-orderedlayout-formroot td { - vertical-align: top; -} - -/****************************************************************************** - * For GeneratedColumnExample.java. - ******************************************************************************/ -/* Align columns generated with ValueColumnGenerator to right. */ -.i-label-column-type-value { - text-align: right; -} - -/* The total value column is displayed in bold. */ -.i-label-column-total { - font-weight: bold; - text-align: right; -} - -/* Display calculated values in blue color. */ -.i-label-column-price, .i-label-column-consumption, .i-label-column-dailycost { - color: blue; - text-align: right; -} - diff --git a/WebContent/ITMILL/themes/toolkittunes/images/album-cover.jpg b/WebContent/ITMILL/themes/toolkittunes/images/album-cover.jpg Binary files differnew file mode 100644 index 0000000000..677e4f2cb1 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/album-cover.jpg diff --git a/WebContent/ITMILL/themes/toolkittunes/images/coverflow-view.png b/WebContent/ITMILL/themes/toolkittunes/images/coverflow-view.png Binary files differnew file mode 100644 index 0000000000..5e15b84cd3 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/coverflow-view.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/grid-view.png b/WebContent/ITMILL/themes/toolkittunes/images/grid-view.png Binary files differnew file mode 100644 index 0000000000..21f4205fdc --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/grid-view.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/icon-music.png b/WebContent/ITMILL/themes/toolkittunes/images/icon-music.png Binary files differnew file mode 100644 index 0000000000..1e97148ecf --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/icon-music.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/jump-to.png b/WebContent/ITMILL/themes/toolkittunes/images/jump-to.png Binary files differnew file mode 100644 index 0000000000..55d4632245 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/jump-to.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/max.png b/WebContent/ITMILL/themes/toolkittunes/images/max.png Binary files differnew file mode 100644 index 0000000000..28e93b8116 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/max.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/mute.png b/WebContent/ITMILL/themes/toolkittunes/images/mute.png Binary files differnew file mode 100644 index 0000000000..9788008cb8 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/mute.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/next.png b/WebContent/ITMILL/themes/toolkittunes/images/next.png Binary files differnew file mode 100644 index 0000000000..98a5e6cbbe --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/next.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/play.png b/WebContent/ITMILL/themes/toolkittunes/images/play.png Binary files differnew file mode 100644 index 0000000000..66b2160a25 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/play.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/prev.png b/WebContent/ITMILL/themes/toolkittunes/images/prev.png Binary files differnew file mode 100644 index 0000000000..425f4c4e7f --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/prev.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/progress-knob.png b/WebContent/ITMILL/themes/toolkittunes/images/progress-knob.png Binary files differnew file mode 100644 index 0000000000..23934226ea --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/progress-knob.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/selected-bg.png b/WebContent/ITMILL/themes/toolkittunes/images/selected-bg.png Binary files differnew file mode 100644 index 0000000000..8785f279f9 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/selected-bg.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/status-bg.png b/WebContent/ITMILL/themes/toolkittunes/images/status-bg.png Binary files differnew file mode 100644 index 0000000000..7af0c88380 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/status-bg.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/table-header-bg.png b/WebContent/ITMILL/themes/toolkittunes/images/table-header-bg.png Binary files differnew file mode 100644 index 0000000000..2d43b2fe10 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/table-header-bg.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/table-view.png b/WebContent/ITMILL/themes/toolkittunes/images/table-view.png Binary files differnew file mode 100644 index 0000000000..083fb581bb --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/table-view.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/toggle-visualization.png b/WebContent/ITMILL/themes/toolkittunes/images/toggle-visualization.png Binary files differnew file mode 100644 index 0000000000..41effd5bd2 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/toggle-visualization.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/top-bg.png b/WebContent/ITMILL/themes/toolkittunes/images/top-bg.png Binary files differnew file mode 100644 index 0000000000..4b01255bd5 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/top-bg.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/volume-bar.png b/WebContent/ITMILL/themes/toolkittunes/images/volume-bar.png Binary files differnew file mode 100644 index 0000000000..eb4365fe9a --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/volume-bar.png diff --git a/WebContent/ITMILL/themes/toolkittunes/images/volume-knob.png b/WebContent/ITMILL/themes/toolkittunes/images/volume-knob.png Binary files differnew file mode 100644 index 0000000000..6341060e04 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/images/volume-knob.png diff --git a/WebContent/ITMILL/themes/toolkittunes/styles.css b/WebContent/ITMILL/themes/toolkittunes/styles.css new file mode 100644 index 0000000000..d6015627f7 --- /dev/null +++ b/WebContent/ITMILL/themes/toolkittunes/styles.css @@ -0,0 +1,316 @@ +@import url(../default/styles.css); + +.i-generated-body { + /* full height layout does not need scrollable body; + avoids excess scrollbars if moving sub-window over the window area */ + overflow:hidden; +} + +/****************************************************************************** + * For FormExample.java + ******************************************************************************/ +.i-form legend { + color: #464f52; +} + +.i-orderedlayout-formroot td { + vertical-align: top; +} + +/****************************************************************************** + * For GeneratedColumnExample.java. + ******************************************************************************/ +/* Align columns generated with ValueColumnGenerator to right. */ +.i-label-column-type-value { + text-align: right; +} + +/* The total value column is displayed in bold. */ +.i-label-column-total { + font-weight: bold; + text-align: right; +} + +/* Display calculated values in blue color. */ +.i-label-column-price, .i-label-column-consumption, .i-label-column-dailycost { + color: blue; + text-align: right; +} + + + +/****************************************************************************** + * For ToolkitTunesLayout.java + ******************************************************************************/ + +.tTunes, .tTunes select, .tTunes button { + font-size: 11px; + line-height: 14px; + color: #000; + font-family: "Lucida Grande", Helvetica, Arial, sans-serif; +} + +.tTunes .top { + background: transparent url(images/top-bg.png) repeat-x; +} + +/* Hide all button captions */ +.tTunes .top .i-button span { + display: none; +} + +.tTunes .playback .i-button { + width: 31px; + height: 32px; + overflow: hidden; + padding: 0; + border: none; +} + +.tTunes .playback .play { + width: 37px; + height: 38px; + background: transparent url(images/play.png); +} + +.tTunes .playback .prev { + background: transparent url(images/prev.png); +} + +.tTunes .playback .next { + background: transparent url(images/next.png); +} + +.tTunes .volume .mute { + width: 13px; + height: 14px; + background: transparent url(images/mute.png) no-repeat left bottom; + border: none; + padding: 0; + overflow: hidden; +} + +.tTunes .volume .max { + width: 17px; + height: 14px; + background: transparent url(images/max.png) no-repeat right bottom; + border: none; + padding: 0; + overflow: hidden; +} + +.tTunes .volume .i-slider { + border: none; +} + +.tTunes .volume .i-slider-base { + background: transparent url(images/volume-bar.png) no-repeat 0 50%; + height: 6px; + border: none; + border-top: 1px solid #aaa; +} + +.tTunes .volume .i-slider-handle { + background: transparent url(images/volume-knob.png) no-repeat; + margin-top: -3px; +} + +.tTunes .status { + background: transparent url(images/status-bg.png) repeat-x; + line-height: 12px; + border-right: 1px solid #959985; + border-left: 1px solid #959985; + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} + +.tTunes .status .i-orderedlayout-margin-top { + padding-top: 3px; +} +.tTunes .status .i-orderedlayout-margin-bottom { + padding-bottom: 3px; +} +.tTunes .status .i-orderedlayout-margin-left { + padding-left: 9px; +} +.tTunes .status .i-orderedlayout-margin-right { + padding-right: 9px; +} + +.tTunes .status .i-label { + white-space: nowrap; +} + +.tTunes .status .i-slider { + border: 1px solid #000; + border-left: none; + border-right: none; + height: 7px; + margin: 0; +} + +.tTunes .status .i-slider-base { + border: none; + height: 7px; + border-left: 1px solid #000; + border-right: 1px solid #000; + background: transparent; +} + +.tTunes .status .i-slider-handle { + margin: 0; + width: 7px; + height: 7px; + background: transparent url(images/progress-knob.png); +} + +.tTunes .toggle-vis, +.tTunes .jump { + width: 11px; + height: 11px; + overflow: hidden; + border: none; + background: transparent url(images/toggle-visualization.png); + padding: 0; +} + +.tTunes .jump {en; + border: none; + background: transparent url(images/jump-to.png); +} + + +.tTunes .viewmode-table, +.tTunes .viewmode-grid, +.tTunes .viewmode-coverflow { + border: none; + width: 27px; + height: 22px; + overflow: hidden; +} + +.tTunes .viewmode-table { + background: transparent url(images/table-view.png) no-repeat right top; +} + +.tTunes .viewmode-grid { + background: transparent url(images/grid-view.png) no-repeat; +} + +.tTunes .viewmode-coverflow { + background: transparent url(images/coverflow-view.png) no-repeat; +} + + + +.tTunes .i-splitpanel-horizontal .i-splitpanel-hsplitter { + width: 1px; + background: #404040; +} + +.tTunes .i-splitpanel-horizontal .i-splitpanel-hsplitter div { + width: 3px; + border: none; + background: transparent; +} + + + +.tTunes .sidebar { + background: #d1d7e2; +} + +.tTunes .sidebar .i-label { + padding: 7px 0 3px 10px; + font-weight: bold; + text-transform: uppercase; + color: #505d6d; + text-shadow: #fff 0 1px 0; +} + +.tTunes .sidebar .i-button { + text-align: left; + border: none; + background: transparent; + line-height: 15px; + padding: 2px 0; +} + +.tTunes .sidebar .i-button span { + padding-left: 25px; +} + +.tTunes .sidebar .selected { + background: transparent url(images/selected-bg.png) repeat-x; + color: #fff; + font-weight: bold; + text-shadow: #384359 0 1px 0; + padding: 0; +} + +.tTunes .sidebar .selected span { + display: block; + background: transparent url(images/icon-music.png) no-repeat 25px 1px; + padding: 2px 0 2px 45px; +} + +.tTunes .sidebar .i-caption { + background: transparent url(images/table-header-bg.png) repeat-x; + padding: 1px 0; + font-weight: bold; + text-shadow: #eee 0 1px 0; + text-align: center; + color: #202020; + border-top: 1px solid #404040; + border-bottom: 1px solid #555; +} + +.tTunes .sidebar .i-captiontext { + float: none; +} + + +.tTunes .i-table-header-wrap { + height: 16px; + border: none; + border-bottom: 1px solid #555; + background: transparent url(images/table-header-bg.png) repeat-x; +} + +.tTunes .i-table-caption-container { + font-size: 11px; + color: #000; + font-weight: bold; + text-shadow: #fff 0 1px 0; + padding-top: 1px; +} + +.tTunes .i-table-body { + border: none; +} + +.tTunes .i-table-row-odd { + background: #f1f5fa; +} + +.tTunes .i-table-row:hover { + background: #fff; +} + +.tTunes .i-table-row-odd:hover { + background: #f1f5fa; +} + +.tTunes .i-table .i-selected { + background: #3d80df; +} + +.tTunes .i-table-cell-content { + padding: 0 0 0 3px; + line-height: normal; +} + +.tTunes .i-table select { + padding: 0 2px; +}
\ No newline at end of file diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 1bb319a7f4..f702c484b6 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -3,642 +3,512 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
-<!--
- THIS IS THE DEVELOPMENT web.xml
-
- Package web.xml can be found in build/package, please update it too when
- making changes that should affect the package.
--->
+ <!--
+ THIS IS THE DEVELOPMENT web.xml Package web.xml can be found in
+ build/package, please update it too when making changes that should
+ affect the package.
+ -->
<web-app>
- <display-name>IT Mill Toolkit</display-name>
- <description>IT Mill Toolkit examples</description>
-
- <context-param>
- <param-name>productionMode</param-name>
- <param-value>false</param-value>
- <description>IT Mill Toolkit production mode</description>
- </context-param>
- - <!-- Permit use of IT Mill Testing Tools for this servlet continer --> - <context-param> - <param-name>testingToolsActive</param-name> - <param-value>true</param-value> - <description>IT Mill Testing Tools activation</description> - </context-param> - - <context-param> - <param-name>testingToolsServerUri</param-name> - <param-value>http://192.168.1.242:8099/TestingToolsServer</param-value> - <description>IT Mill Testing Tools URI</description> - </context-param> - -<servlet> - <servlet-name>ITMillToolkitApplicationRunner</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>applicationRunner</param-name> - <param-value>true</param-value> - </init-param> - </servlet> - - - <servlet> - <servlet-name>RobustnessComplex</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.tests.robustness.RobustnessComplex</param-value> - </init-param> - </servlet> - - <servlet> - <servlet-name>RobustnessSimple</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.tests.robustness.RobustnessSimple</param-value> - </init-param> - </servlet> - - - <servlet> - <servlet-name>DemoTestBench</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.testbench.TestBench</param-value> - </init-param> - </servlet> -
- <servlet>
- <servlet-name>TestForNativeWindowing</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.TestForNativeWindowing</param-value>
- </init-param>
- </servlet>
-
-<servlet>
- <servlet-name>TestSplitPanel</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.TestSplitPanel</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>FeatureBrowser</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.featurebrowser.FeatureBrowser</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>Sampler</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.sampler.SamplerApplication</param-value>
- </init-param>
- <init-param>
- <param-name>widgetset</param-name>
- <param-value>com.itmill.toolkit.demo.sampler.gwt.SamplerWidgetSet</param-value>
- </init-param>
-
- </servlet>
-
- <servlet>
- <servlet-name>TestBench</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.TestBench</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>RandomLayoutStress</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.RandomLayoutStress</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>Reservr</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.reservation.ReservationApplication</param-value>
- </init-param>
- <init-param>
- <param-name>widgetset</param-name>
- <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>SimpleReserver</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.reservation.simple.SimpleReserver</param-value>
- </init-param>
- <init-param>
- <param-name>widgetset</param-name>
- <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>CalendarDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.reservation.CalendarDemo</param-value>
- </init-param>
- <init-param>
- <param-name>widgetset</param-name>
- <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>SelectDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.SelectDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>BufferedComponents</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.BufferedComponents</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>TableDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.TableDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>CustomLayoutDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.CustomLayoutDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>LayoutDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.LayoutDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>FilterSelect</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.FilterSelect</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>FeaturesApplication</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.featurebrowser.FeaturesApplication</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>Parameters</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.Parameters</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>UpgradingSample</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.UpgradingSample</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>QueryContainerDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.QueryContainerDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>TreeFilesystemContainer</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.TreeFilesystemContainer</param-value>
- </init-param>
- <!-- Set this property if demo cannot access context base directory
- because of Application Server or Servlet Container security constraints-->
- <!--
- <init-param>
- <param-name>sampleDirectory</param-name>
- <param-value>/mySampleDirectory</param-value>
- </init-param>
- -->
- </servlet>
-
- <servlet>
- <servlet-name>TreeFilesystem</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.TreeFilesystem</param-value>
- </init-param>
- <!-- Set this property if demo cannot access context base directory
- because of Application Server or Servlet Container security constraints-->
- <!--
- <init-param>
- <param-name>sampleDirectory</param-name>
- <param-value>/mySampleDirectory</param-value>
- </init-param>
- -->
- </servlet>
-
- <servlet>
- <servlet-name>ModalWindow</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.tests.ModalWindow</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>HelloWorld</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.HelloWorld</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>Calc</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.Calc</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>KeyboardShortcut</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.KeyboardShortcut</param-value>
- </init-param>
- </servlet>
-
- <servlet> - <servlet-name>CustomGwtComponentDemo</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.CustomGwtComponentDemo</param-value> - </init-param> - </servlet> + <display-name>IT Mill Toolkit</display-name>
+ <description>IT Mill Toolkit examples</description>
+
+ <context-param>
+ <param-name>productionMode</param-name>
+ <param-value>false</param-value>
+ <description>IT Mill Toolkit production mode</description>
+ </context-param>
+ <!-- Permit use of IT Mill Testing Tools for this servlet continer --> + <context-param> + <param-name>testingToolsActive</param-name> + <param-value>true</param-value> + <description>IT Mill Testing Tools activation</description> + </context-param> - <servlet> - <servlet-name>ColorPickerApplication</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.colorpicker.ColorPickerApplication</param-value> - </init-param> - <init-param> - <param-name>widgetset</param-name> - <param-value>com.itmill.toolkit.demo.colorpicker.gwt.ColorPickerWidgetSet</param-value> - </init-param> - </servlet>
-
- <servlet>
- <servlet-name>CachingDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.CachingDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>NotificationDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.NotificationDemo</param-value>
- </init-param>
- </servlet>
+ <context-param> + <param-name>testingToolsServerUri</param-name> + <param-value>http://192.168.1.242:8099/TestingToolsServer</param-value> + <description>IT Mill Testing Tools URI</description> + </context-param> - <servlet> - <servlet-name>BookTestServlet</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.tests.book.BookTestApplication</param-value> - </init-param> - </servlet> + <servlet> + <servlet-name>ITMillToolkitApplicationRunner</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>applicationRunner</param-name> + <param-value>true</param-value> + </init-param> + </servlet> - <servlet> - <servlet-name>WindowTestServlet</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.tests.book.WindowTestApplication</param-value> - </init-param> - </servlet> - <servlet> - <servlet-name>ChatServlet</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.tests.book.ChatApplication</param-value> - </init-param> - </servlet> + <servlet> + <servlet-name>RobustnessSimple</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>application</param-name> + <param-value>com.itmill.toolkit.tests.robustness.RobustnessSimple</param-value> + </init-param> + </servlet> - <servlet>
- <servlet-name>BrowserDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.BrowserDemo</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>WindowedDemos</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.WindowedDemos</param-value>
- </init-param>
- </servlet> -
- <servlet>
- <servlet-name>PortletDemo</servlet-name>
- <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.itmill.toolkit.demo.PortletDemo</param-value>
- </init-param>
- </servlet>
- <servlet-mapping>
- <servlet-name>PortletDemo</servlet-name>
- <url-pattern>/PortletDemo/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
- - <servlet-mapping> - <servlet-name>ITMillToolkitApplicationRunner</servlet-name> - <url-pattern>/run/*</url-pattern> - </servlet-mapping>
-
- <servlet-mapping> - <servlet-name>DemoTestBench</servlet-name> - <url-pattern>/DemoTestBench/*</url-pattern> - </servlet-mapping> -
- <servlet-mapping>
- <servlet-name>TestForNativeWindowing</servlet-name>
- <url-pattern>/TestForNativeWindowing/*</url-pattern>
- </servlet-mapping>
-
-
- <servlet-mapping> - <servlet-name>RobustnessSimple</servlet-name> - <url-pattern>/RobustnessSimple/*</url-pattern> - </servlet-mapping> - - <servlet-mapping> - <servlet-name>RobustnessComplex</servlet-name> - <url-pattern>/RobustnessComplex/*</url-pattern> - </servlet-mapping> -
- <servlet-mapping>
- <servlet-name>TestSplitPanel</servlet-name>
- <url-pattern>/TestSplitPanel/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>RandomLayoutStress</servlet-name>
- <url-pattern>/RandomLayoutStress/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>TestBench</servlet-name>
- <url-pattern>/TestBench/*</url-pattern>
- </servlet-mapping> - <servlet-mapping>
- <servlet-name>TestBench</servlet-name>
- <url-pattern>/t/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Reservr</servlet-name>
- <url-pattern>/Reservr/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>SimpleReserver</servlet-name>
- <url-pattern>/SimpleReserver/*</url-pattern>
- <!-- portlet style=height:400px -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>CalendarDemo</servlet-name>
- <url-pattern>/CalendarDemo/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>SelectDemo</servlet-name>
- <url-pattern>/SelectDemo/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>BufferedComponents</servlet-name>
- <url-pattern>/BufferedComponents/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>TableDemo</servlet-name>
- <url-pattern>/TableDemo/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>CustomLayoutDemo</servlet-name>
- <url-pattern>/CustomLayoutDemo/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>LayoutDemo</servlet-name>
- <url-pattern>/LayoutDemo/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>FilterSelect</servlet-name>
- <url-pattern>/FilterSelect/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>FeatureBrowser</servlet-name>
- <url-pattern>/FeatureBrowser/*</url-pattern>
- <!-- portlet style=height:650px -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>Sampler</servlet-name>
- <url-pattern>/sampler/*</url-pattern>
- <!-- portlet style=height:650px -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>FeaturesApplication</servlet-name>
- <url-pattern>/FeaturesApplication/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>Parameters</servlet-name>
- <url-pattern>/Parameters/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>UpgradingSample</servlet-name>
- <url-pattern>/UpgradingSample/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>QueryContainerDemo</servlet-name>
- <url-pattern>/QueryContainerDemo/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>TreeFilesystemContainer</servlet-name>
- <url-pattern>/TreeFilesystemContainer/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>TreeFilesystem</servlet-name>
- <url-pattern>/TreeFilesystem/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>ModalWindow</servlet-name>
- <url-pattern>/ModalWindow/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>HelloWorld</servlet-name>
- <url-pattern>/HelloWorld/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>Calc</servlet-name>
- <url-pattern>/Calc/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>KeyboardShortcut</servlet-name>
- <url-pattern>/KeyboardShortcut/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping> - <servlet-name>CustomGwtComponentDemo</servlet-name> - <url-pattern>/customgwt/*</url-pattern> - </servlet-mapping> + <servlet> + <servlet-name>DemoTestBench</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>application</param-name> + <param-value>com.itmill.toolkit.demo.testbench.TestBench</param-value> + </init-param> + </servlet>
+ <servlet>
+ <servlet-name>TestForNativeWindowing</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.TestForNativeWindowing</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>TestSplitPanel</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.TestSplitPanel</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FeatureBrowser</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.featurebrowser.FeatureBrowser</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>Sampler</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.sampler.SamplerApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>widgetset</param-name>
+ <param-value>com.itmill.toolkit.demo.sampler.gwt.SamplerWidgetSet</param-value>
+ </init-param>
+
+ </servlet>
+
+ <servlet>
+ <servlet-name>AddressBook</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.tutorial.addressbook.AddressBookApplication</param-value>
+ </init-param>
+
+ </servlet>
+
+ <servlet>
+ <servlet-name>TestBench</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.TestBench</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>RandomLayoutStress</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.RandomLayoutStress</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>Reservr</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.reservation.ReservationApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>widgetset</param-name>
+ <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>SimpleReserver</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.reservation.simple.SimpleReserver</param-value>
+ </init-param>
+ <init-param>
+ <param-name>widgetset</param-name>
+ <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>CalendarDemo</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.reservation.CalendarDemo</param-value>
+ </init-param>
+ <init-param>
+ <param-name>widgetset</param-name>
+ <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>CustomLayoutDemo</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.CustomLayoutDemo</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>LayoutDemo</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.LayoutDemo</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ToolkitTunesLayout</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.ToolkitTunesLayout</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>Coverflow</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.coverflow.CoverflowApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>widgetset</param-name>
+ <param-value>com.itmill.toolkit.demo.coverflow.gwt.CoverflowWidgetSet</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FeaturesApplication</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.featurebrowser.FeaturesApplication</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>Parameters</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.Parameters</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>UpgradingSample</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.UpgradingSample</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>QueryContainerDemo</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.QueryContainerDemo</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>TreeFilesystemContainer</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.TreeFilesystemContainer</param-value>
+ </init-param>
+ <!--
+ Set this property if demo cannot access context base directory
+ because of Application Server or Servlet Container security
+ constraints
+ -->
+ <!--
+ <init-param> <param-name>sampleDirectory</param-name>
+ <param-value>/mySampleDirectory</param-value> </init-param>
+ -->
+ </servlet>
+
+ <servlet>
+ <servlet-name>TreeFilesystem</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.TreeFilesystem</param-value>
+ </init-param>
+ <!--
+ Set this property if demo cannot access context base directory
+ because of Application Server or Servlet Container security
+ constraints
+ -->
+ <!--
+ <init-param> <param-name>sampleDirectory</param-name>
+ <param-value>/mySampleDirectory</param-value> </init-param>
+ -->
+ </servlet>
+
+ <servlet>
+ <servlet-name>ModalWindow</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.ModalWindow</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>HelloWorld</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.HelloWorld</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>Calc</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.demo.Calc</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet> + <servlet-name>ColorPickerApplication</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>application</param-name> + <param-value>com.itmill.toolkit.demo.colorpicker.ColorPickerApplication</param-value> + </init-param> + <init-param>
+ <param-name>widgetset</param-name>
+ <param-value>com.itmill.toolkit.demo.colorpicker.gwt.ColorPickerWidgetSet</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet> + <servlet-name>BookTestServlet</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>application</param-name> + <param-value>com.itmill.toolkit.tests.book.BookTestApplication</param-value> + </init-param> + </servlet> - <servlet-mapping> - <servlet-name>ColorPickerApplication</servlet-name> - <url-pattern>/colorpicker/*</url-pattern> - </servlet-mapping> -
- <servlet-mapping>
- <servlet-name>CachingDemo</servlet-name>
- <url-pattern>/CachingDemo/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>NotificationDemo</servlet-name>
- <url-pattern>/NotificationDemo/*</url-pattern>
- <!-- portlet -->
- </servlet-mapping>
+ <servlet> + <servlet-name>WindowTestServlet</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>application</param-name> + <param-value>com.itmill.toolkit.tests.book.WindowTestApplication</param-value> + </init-param> + </servlet> - <servlet-mapping> - <servlet-name>BookTestServlet</servlet-name> - <url-pattern>/book/*</url-pattern> - </servlet-mapping> -
- <servlet-mapping> - <servlet-name>WindowTestServlet</servlet-name> - <url-pattern>/windowtest/*</url-pattern> - </servlet-mapping> + <servlet> + <servlet-name>ChatServlet</servlet-name> + <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> + <init-param> + <param-name>application</param-name> + <param-value>com.itmill.toolkit.tests.book.ChatApplication</param-value> + </init-param> + </servlet> - <servlet-mapping> - <servlet-name>ChatServlet</servlet-name> - <url-pattern>/chat/*</url-pattern>
- <!-- portlet --> - </servlet-mapping> + <servlet-mapping> + <servlet-name>ITMillToolkitApplicationRunner</servlet-name> + <url-pattern>/run/*</url-pattern> + </servlet-mapping>
+
+ <servlet-mapping> + <servlet-name>DemoTestBench</servlet-name> + <url-pattern>/DemoTestBench/*</url-pattern> + </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>TestForNativeWindowing</servlet-name>
+ <url-pattern>/TestForNativeWindowing/*</url-pattern>
+ </servlet-mapping>
+
+
+ <servlet-mapping> + <servlet-name>RobustnessSimple</servlet-name> + <url-pattern>/RobustnessSimple/*</url-pattern> + </servlet-mapping> - <servlet-mapping>
- <servlet-name>BrowserDemo</servlet-name>
- <url-pattern>/BrowserDemo/*</url-pattern>
- <!-- portlet style=height:650px -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>WindowedDemos</servlet-name>
- <url-pattern>/WindowedDemos/*</url-pattern>
- </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>TestSplitPanel</servlet-name>
+ <url-pattern>/TestSplitPanel/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>RandomLayoutStress</servlet-name>
+ <url-pattern>/RandomLayoutStress/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>TestBench</servlet-name>
+ <url-pattern>/TestBench/*</url-pattern>
+ </servlet-mapping> + <servlet-mapping>
+ <servlet-name>TestBench</servlet-name>
+ <url-pattern>/t/*</url-pattern>
+ </servlet-mapping> - <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- </welcome-file-list>
+ <servlet-mapping>
+ <servlet-name>Reservr</servlet-name>
+ <url-pattern>/Reservr/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>SimpleReserver</servlet-name>
+ <url-pattern>/SimpleReserver/*</url-pattern>
+ <!-- portlet style=height:400px -->
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>CalendarDemo</servlet-name>
+ <url-pattern>/CalendarDemo/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>CustomLayoutDemo</servlet-name>
+ <url-pattern>/CustomLayoutDemo/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>LayoutDemo</servlet-name>
+ <url-pattern>/LayoutDemo/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ToolkitTunesLayout</servlet-name>
+ <url-pattern>/ToolkitTunesLayout/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Coverflow</servlet-name>
+ <url-pattern>/Coverflow/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FeatureBrowser</servlet-name>
+ <url-pattern>/FeatureBrowser/*</url-pattern>
+ <!-- portlet style=height:650px -->
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Sampler</servlet-name>
+ <url-pattern>/sampler/*</url-pattern>
+ <!-- portlet style=height:650px -->
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FeaturesApplication</servlet-name>
+ <url-pattern>/FeaturesApplication/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Parameters</servlet-name>
+ <url-pattern>/Parameters/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>UpgradingSample</servlet-name>
+ <url-pattern>/UpgradingSample/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>QueryContainerDemo</servlet-name>
+ <url-pattern>/QueryContainerDemo/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>TreeFilesystemContainer</servlet-name>
+ <url-pattern>/TreeFilesystemContainer/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>TreeFilesystem</servlet-name>
+ <url-pattern>/TreeFilesystem/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ModalWindow</servlet-name>
+ <url-pattern>/ModalWindow/*</url-pattern>
+ <!-- portlet -->
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>HelloWorld</servlet-name>
+ <url-pattern>/HelloWorld/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Calc</servlet-name>
+ <url-pattern>/Calc/*</url-pattern>
+ <!-- portlet -->
+ </servlet-mapping>
+
+ <servlet-mapping> + <servlet-name>ColorPickerApplication</servlet-name> + <url-pattern>/colorpicker/*</url-pattern> + </servlet-mapping>
+ <servlet-mapping> + <servlet-name>BookTestServlet</servlet-name> + <url-pattern>/book/*</url-pattern> + </servlet-mapping>
+ <servlet-mapping> + <servlet-name>WindowTestServlet</servlet-name> + <url-pattern>/windowtest/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ChatServlet</servlet-name> + <url-pattern>/chat/*</url-pattern> + <!-- portlet --> + </servlet-mapping> + + <servlet-mapping>
+ <servlet-name>AddressBook</servlet-name>
+ <url-pattern>/AddressBook/*</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ </welcome-file-list>
</web-app>
diff --git a/WebContent/index.html b/WebContent/index.html index f01a8ab263..845397a3bd 100644 --- a/WebContent/index.html +++ b/WebContent/index.html @@ -105,9 +105,9 @@ <h4>IT Mill Toolkit Sampler</h4> <p><a href="sampler/" title="Open Sampler">Sampler</a> contains examples of most features, as well as combination examples and useful UI patterns that you can use simply by copy-pasting the code.</p> - <h4 id="address-book"><a class="demoapp" href="http://itmill.com/documentation/itmill-toolkit-5-tutorial/" title="Open Address Book">Address Book</a></h4> + <h4 id="address-book"><a class="demoapp" href="AddressBook/" title="Open Address Book">Address Book</a></h4> <h4>Address Book application</h4> - <p>A basic application for managing your contact informations. See the <a href="http://itmill.com/documentation/itmill-toolkit-5-tutorial/" title="Address Book Tutorial">accompanying tutorial</a> and learn how to build the same application.</p> + <p>A basic application for managing your contact informations. See the accompanying tutorial and learn how to build the same application.</p> <ul class="links"> <li><a href="http://itmill.com/documentation/itmill-toolkit-5-tutorial/" class="more">Step-by-step tutorial</a></li> </ul> @@ -121,10 +121,8 @@ <li><a class="demoapp" href="HelloWorld/">Hello world</a> (<a href="doc/example-source/com/itmill/toolkit/demo/HelloWorld.java.html">sources</a>)</li> <li><a class="demoapp" href="Calc/">Calculator</a> (<a href="doc/example-source/com/itmill/toolkit/demo/Calc.java.html">sources</a>)</li> <li><a class="demoapp" href="Reservr">Reservr – reservation application</a> (<a href="doc/example-source/com/itmill/toolkit/demo/reservr">sources</a>)</li> - <!-- - <li><a class="demoapp" href="CoverFlow">CoverFlow – Flex integration</a> (<a href="doc/example-source/com/itmill/toolkit/demo/coverflow">sources</a>)</li> - <li><a class="demoapp" href="ToolkitTunes">ToolkitTunes – advanced layout & theme</a> (<a href="doc/example-source/com/itmill/toolkit/demo/ToolkitTunes.java.html">sources</a>)</li> - --> + <li><a class="demoapp" href="Coverflow/">Coverflow – Flex integration</a> (<a href="doc/example-source/com/itmill/toolkit/demo/coverflow">sources</a>)</li> + <li><a class="demoapp" href="ToolkitTunesLayout/">ToolkitTunes – advanced layout & theme</a> (<a href="doc/example-source/com/itmill/toolkit/demo/ToolkitTunes.java.html">sources</a>)</li> </ul> </div> <!-- /demos --> diff --git a/build/build.xml b/build/build.xml index dc7cb03f5b..696dc6f4d3 100644 --- a/build/build.xml +++ b/build/build.xml @@ -770,6 +770,27 @@ <echo>Compiled SamplerWidgetSet</echo> </target> + <target name="compile-widgetset-coverflow"> + <echo>com.itmill.toolkit.demo.coverflow.gwt.CoverflowWidgetSet</echo> + <java classname="com.google.gwt.dev.GWTCompiler" failonerror="yes" fork="yes" maxmemory="512m"> + <arg value="-out" /> + <arg value="${output-dir}/WebContent/ITMILL/widgetsets" /> + <arg value="com.itmill.toolkit.demo.coverflow.gwt.CoverflowWidgetSet" /> + <arg value="-style" /> + <arg value="OBF" /> + <jvmarg value="-Xss8M"/> + <jvmarg value="-Djava.awt.headless=true"/> + <classpath> + <pathelement location="${gwt-dir}/${platform}/gwt-user.jar" /> + <pathelement location="${gwt-dir}/${platform}/${lib-gwt-dev}" /> + <pathelement location="${result-path}/src" /> + <!-- demo widgetset sources --> + <pathelement path="${output-dir}/WebContent/WEB-INF/src" /> + </classpath> + </java> + <echo>Compiled SamplerWidgetSet</echo> + </target> + <target name="compile-widgetset-colorpicker"> <echo>com.itmill.toolkit.demo.colorpicker.gwt.ColorPickerWidgetSet</echo> <java classname="com.google.gwt.dev.GWTCompiler" failonerror="yes" fork="yes" maxmemory="512m"> @@ -792,7 +813,7 @@ </target> <!-- Builds the client-side engine, i.e., the widgetsets. --> - <target name="compile-client-side" depends="compile-widgetset-default, compile-widgetset-reserver, compile-widgetset-sampler, compile-widgetset-colorpicker"> + <target name="compile-client-side" depends="compile-widgetset-default, compile-widgetset-reserver, compile-widgetset-sampler, compile-widgetset-colorpicker, compile-widgetset-coverflow"> <!-- Building the widgetsets is currently done sequentially, because parallel compilation takes too much memory for most machines. --> </target> @@ -830,6 +851,10 @@ <target name="widgetset-sampler" depends="init-nonpackage, compile-widgetset-sampler"> </target> + <!-- Builds the coverflow widgetset locally, i.e., not for an installation package. --> + <target name="widgetset-coverflow" depends="init-nonpackage, compile-widgetset-coverflow"> + </target> + <!-- Builds the reservation widgetset locally, i.e., not for an installation package. --> <target name="widgetset-reserver" depends="init-nonpackage, compile-widgetset-reserver"> </target> diff --git a/build/package/WebContent/WEB-INF/web.xml b/build/package/WebContent/WEB-INF/web.xml index fdd70fbf70..26878ed651 100644 --- a/build/package/WebContent/WEB-INF/web.xml +++ b/build/package/WebContent/WEB-INF/web.xml @@ -65,64 +65,54 @@ </servlet> <!-- Sampler demo application --> - <servlet> - <servlet-name>Sampler</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.sampler.SamplerApplication</param-value> - </init-param> - <init-param> - <param-name>widgetset</param-name> - <param-value>com.itmill.toolkit.demo.sampler.gwt.SamplerWidgetSet</param-value> - </init-param> - </servlet> - - <!-- Reservr demo application --> <servlet> - <servlet-name>Reservr</servlet-name> + <servlet-name>Sampler</servlet-name> <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.reservation.ReservationApplication</param-value> + <param-value>com.itmill.toolkit.demo.sampler.SamplerApplication</param-value> </init-param> <init-param> <param-name>widgetset</param-name> - <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value> + <param-value>com.itmill.toolkit.demo.sampler.gwt.SamplerWidgetSet</param-value> </init-param> </servlet> - <!-- Version of the Reservr to be run as a portlet --> + <!-- AddressBook demo application --> <servlet> - <servlet-name>SimpleReserver</servlet-name> + <servlet-name>AddressBook</servlet-name> <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.reservation.simple.SimpleReserver</param-value> - </init-param> - <init-param> - <param-name>widgetset</param-name> - <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value> + <param-value>com.itmill.toolkit.demo.tutorial.addressbook.AddressBookApplication</param-value> </init-param> </servlet> - <!-- Buffered components demo app (shown in Windowed demos) --> + <!-- Reservr demo application --> <servlet> - <servlet-name>BufferedComponents</servlet-name> + <servlet-name>Reservr</servlet-name> <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.BufferedComponents</param-value> + <param-value>com.itmill.toolkit.demo.reservation.ReservationApplication</param-value> + </init-param> + <init-param> + <param-name>widgetset</param-name> + <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value> </init-param> </servlet> - <!-- Table demo application (shown in Windowed demos) --> + <!-- Version of the Reservr to be run as a portlet --> <servlet> - <servlet-name>TableDemo</servlet-name> + <servlet-name>SimpleReserver</servlet-name> <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.TableDemo</param-value> + <param-value>com.itmill.toolkit.demo.reservation.simple.SimpleReserver</param-value> + </init-param> + <init-param> + <param-name>widgetset</param-name> + <param-value>com.itmill.toolkit.demo.reservation.gwt.ReservationWidgetSet</param-value> </init-param> </servlet> @@ -140,16 +130,6 @@ </init-param> </servlet> - <!-- Filtering select demo --> - <servlet> - <servlet-name>FilterSelect</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.FilterSelect</param-value> - </init-param> - </servlet> - <!-- Hello world demo application --> <servlet> <servlet-name>HelloWorld</servlet-name> @@ -170,16 +150,6 @@ </init-param> </servlet> - <!-- Keyboard shortcuts demo application --> - <servlet> - <servlet-name>KeyboardShortcut</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.KeyboardShortcut</param-value> - </init-param> - </servlet> - <!-- Color Picker demo application that demonstrates creation of custom widgets @@ -197,74 +167,32 @@ </init-param> </servlet> - <!-- Caching demo application that demonstrates paint optimization --> + <!-- Layout demo (ToolkitTunes) --> <servlet> - <servlet-name>CachingDemo</servlet-name> + <servlet-name>ToolkitTunesLayout</servlet-name> <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.CachingDemo</param-value> + <param-value>com.itmill.toolkit.demo.ToolkitTunesLayout</param-value> </init-param> </servlet> - <!-- Notification demo application --> + <!-- Coverflow demo --> <servlet> - <servlet-name>NotificationDemo</servlet-name> + <servlet-name>Coverflow</servlet-name> <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.NotificationDemo</param-value> + <param-value>com.itmill.toolkit.demo.coverflow.CoverflowApplication</param-value> </init-param> - </servlet> - - <!-- Select demo application (shown in Windowed demos) --> - <servlet> - <servlet-name>SelectDemo</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.SelectDemo</param-value> - </init-param> - </servlet> - - <!-- Browser demo application --> - <servlet> - <servlet-name>BrowserDemo</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.BrowserDemo</param-value> - </init-param> - </servlet> - - <!-- Windowed demos application --> - <servlet> - <servlet-name>WindowedDemos</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.WindowedDemos</param-value> - </init-param> - </servlet> - - <!-- Portlet demo application --> - <servlet> - <servlet-name>PortletDemo</servlet-name> - <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class> - <init-param> - <param-name>application</param-name> - <param-value>com.itmill.toolkit.demo.PortletDemo</param-value> + <param-name>widgetset</param-name> + <param-value>com.itmill.toolkit.demo.coverflow.gwt.CoverflowWidgetSet</param-value> </init-param> </servlet> <!-- Servlet Mappings below - see servlets for comments --> <servlet-mapping> - <servlet-name>PortletDemo</servlet-name> - <url-pattern>/PortletDemo/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet --> - </servlet-mapping> - <servlet-mapping> <servlet-name>ITMillToolkitApplicationRunner</servlet-name> <url-pattern>/run/*</url-pattern> </servlet-mapping> @@ -275,47 +203,31 @@ <servlet-mapping> <servlet-name>SimpleReserver</servlet-name> <url-pattern>/SimpleReserver/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet style=height:400px --> + <!-- Hint for the automatic deployment descriptor generator --> + <!-- portlet style=height:400px --> </servlet-mapping> <servlet-mapping> <servlet-name>CalendarDemo</servlet-name> <url-pattern>/CalendarDemo/*</url-pattern> </servlet-mapping> <servlet-mapping> - <servlet-name>SelectDemo</servlet-name> - <url-pattern>/SelectDemo/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet --> - </servlet-mapping> - <servlet-mapping> - <servlet-name>BufferedComponents</servlet-name> - <url-pattern>/BufferedComponents/*</url-pattern> - </servlet-mapping> - <servlet-mapping> - <servlet-name>TableDemo</servlet-name> - <url-pattern>/TableDemo/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet --> + <servlet-name>FeatureBrowser</servlet-name> + <url-pattern>/FeatureBrowser/*</url-pattern> + <!-- Hint for the automatic deployment descriptor generator --> + <!-- portlet style=height:650px --> </servlet-mapping> <servlet-mapping> - <servlet-name>FilterSelect</servlet-name> - <url-pattern>/FilterSelect/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet --> + <servlet-name>Sampler</servlet-name> + <url-pattern>/sampler/*</url-pattern> + <!-- Hint for the automatic deployment descriptor generator --> + <!-- portlet style=height:650px --> </servlet-mapping> <servlet-mapping> - <servlet-name>FeatureBrowser</servlet-name> - <url-pattern>/FeatureBrowser/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet style=height:650px --> + <servlet-name>AddressBook</servlet-name> + <url-pattern>/AddressBook/*</url-pattern> + <!-- Hint for the automatic deployment descriptor generator --> + <!-- portlet style=height:650px --> </servlet-mapping> - <servlet-mapping> - <servlet-name>Sampler</servlet-name> - <url-pattern>/sampler/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet style=height:650px --> - </servlet-mapping> <servlet-mapping> <servlet-name>HelloWorld</servlet-name> <url-pattern>/HelloWorld/*</url-pattern> @@ -323,36 +235,20 @@ <servlet-mapping> <servlet-name>Calc</servlet-name> <url-pattern>/Calc/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet --> - </servlet-mapping> - <servlet-mapping> - <servlet-name>KeyboardShortcut</servlet-name> - <url-pattern>/KeyboardShortcut/*</url-pattern> + <!-- Hint for the automatic deployment descriptor generator --> + <!-- portlet --> </servlet-mapping> <servlet-mapping> <servlet-name>ColorPickerApplication</servlet-name> <url-pattern>/colorpicker/*</url-pattern> </servlet-mapping> <servlet-mapping> - <servlet-name>CachingDemo</servlet-name> - <url-pattern>/CachingDemo/*</url-pattern> - </servlet-mapping> - <servlet-mapping> - <servlet-name>NotificationDemo</servlet-name> - <url-pattern>/NotificationDemo/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet --> - </servlet-mapping> - <servlet-mapping> - <servlet-name>BrowserDemo</servlet-name> - <url-pattern>/BrowserDemo/*</url-pattern> - <!-- Hint for the automatic deployment descriptor generator --> - <!-- portlet style=height:650px --> + <servlet-name>ToolkitTunesLayout</servlet-name> + <url-pattern>/ToolkitTunesLayout/*</url-pattern> </servlet-mapping> <servlet-mapping> - <servlet-name>WindowedDemos</servlet-name> - <url-pattern>/WindowedDemos/*</url-pattern> + <servlet-name>Coverflow</servlet-name> + <url-pattern>/Coverflow/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> diff --git a/src/com/itmill/toolkit/demo/BrowserDemo.java b/src/com/itmill/toolkit/demo/BrowserDemo.java deleted file mode 100644 index 91756b09fd..0000000000 --- a/src/com/itmill/toolkit/demo/BrowserDemo.java +++ /dev/null @@ -1,80 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import com.itmill.toolkit.data.Property.ValueChangeEvent; -import com.itmill.toolkit.terminal.ExternalResource; -import com.itmill.toolkit.ui.Embedded; -import com.itmill.toolkit.ui.Select; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; - -/** - * Demonstrates the use of Embedded and "suggesting" Select by creating a simple - * web-browser. Note: does not check for recursion. - * - * @author IT Mill Ltd. - * @see com.itmill.toolkit.ui.Window - */ -public class BrowserDemo extends com.itmill.toolkit.Application implements - Select.ValueChangeListener { - - // Default URL to open. - private static final String DEFAULT_URL = "http://www.itmill.com"; - - // The embedded page - Embedded emb = new Embedded(); - - @Override - public void init() { - // Create and set main window - final Window browser = new Window("IT Mill Browser"); - setMainWindow(browser); - - // Use the expand layout to allow one component to use as much - // space as - // possible. - final VerticalLayout exl = new VerticalLayout(); - browser.setLayout(exl); - exl.setSizeFull(); - - // create the address combobox - final Select select = new Select(); - // allow input - select.setNewItemsAllowed(true); - // no empty selection - select.setNullSelectionAllowed(false); - select.setWidth("100%"); - // no 'go' -button clicking necessary - select.setImmediate(true); - // add some pre-configured URLs - select.addItem(DEFAULT_URL); - select.addItem("http://www.google.com"); - select.addItem("http://toolkit.itmill.com/demo"); - // add to layout - exl.addComponent(select); - // add listener and select initial URL - select.addListener(this); - select.setValue(DEFAULT_URL); - - // configure the embedded and add to layout - emb.setType(Embedded.TYPE_BROWSER); - emb.setSizeFull(); - exl.addComponent(emb); - // make the embedded as large as possible - exl.setExpandRatio(emb, 1.0F); - - } - - public void valueChange(ValueChangeEvent event) { - final String url = (String) event.getProperty().getValue(); - if (url != null) { - // the selected url has changed, let's go there - emb.setSource(new ExternalResource(url)); - } - - } - -} diff --git a/src/com/itmill/toolkit/demo/BufferedComponents.java b/src/com/itmill/toolkit/demo/BufferedComponents.java deleted file mode 100644 index e66ba6481a..0000000000 --- a/src/com/itmill/toolkit/demo/BufferedComponents.java +++ /dev/null @@ -1,90 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import com.itmill.toolkit.Application; -import com.itmill.toolkit.data.util.MethodProperty; -import com.itmill.toolkit.data.util.ObjectProperty; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.TextField; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.Notification; - -public class BufferedComponents extends Application { - - private ObjectProperty property; - - private TextField text; - - @Override - public void init() { - - final Window w = new Window("Buffered UI components demo"); - addWindow(w); - - // Create property - final Float floatValue = new Float(1.0f); - property = new ObjectProperty(floatValue); - - // Textfield - text = new TextField("TextField (Buffered, using ObjectProperty)", - property); - text.setImmediate(true); - text.setWriteThrough(false); - w.addComponent(text); - - // Property state - final Label propertyState = new Label(property); - propertyState.setCaption("Property (data source) state"); - w.addComponent(propertyState); - - // Button state - final Label textState = new Label(text); - textState.setCaption("TextField state"); - w.addComponent(textState); - - // Button to change the property - w.addComponent(new Button("increase property value", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - final Float currentValue = (Float) property.getValue(); - property.setValue(new Float( - currentValue.floatValue() + 1.0)); - } - })); - - // Buffering - w.addComponent(new Button("Write through enabled", new MethodProperty( - text, "writeThrough"))); - w.addComponent(new Button("discard", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - text.discard(); - } - })); - Button commit = new Button("commit", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - try { - text.commit(); - w.showNotification("Committed " + property - + " to datasource."); - } catch (Throwable e) { - w.showNotification("Error committing an invalid value: " - + text, Notification.TYPE_WARNING_MESSAGE); - } - } - }); - w.addComponent(commit); - - // Restart button for application - // (easier debugging when you dont have to restart the server to - // make - // code changes) - final Button restart = new Button("restart", this, "close"); - restart.addStyleName(Button.STYLE_LINK); - w.addComponent(restart); - } -} diff --git a/src/com/itmill/toolkit/demo/CachingDemo.java b/src/com/itmill/toolkit/demo/CachingDemo.java deleted file mode 100644 index 820ccca7e2..0000000000 --- a/src/com/itmill/toolkit/demo/CachingDemo.java +++ /dev/null @@ -1,69 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.itmill.toolkit.demo;
-
-import com.itmill.toolkit.terminal.PaintException;
-import com.itmill.toolkit.terminal.PaintTarget;
-import com.itmill.toolkit.ui.Label;
-import com.itmill.toolkit.ui.Layout;
-import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.TabSheet;
-import com.itmill.toolkit.ui.Window;
-
-/**
- * This example is a (simple) demonstration of client-side caching. The content
- * in one tab is intentionally made very slow to produce server-side. When the
- * user changes to this tab for the first time, there will be a 3 second wait
- * before the content shows up, but the second time it shows up immediately
- * since the content has not changed and is cached client-side.
- *
- * @author IT Mill Ltd.
- */
-public class CachingDemo extends com.itmill.toolkit.Application {
-
- @Override
- public void init() {
-
- final Window main = new Window("Client-side caching example");
- setMainWindow(main);
-
- setTheme("example");
-
- final TabSheet ts = new TabSheet();
- main.addComponent(ts);
-
- Layout layout = new OrderedLayout();
- layout.setMargin(true);
- Label l = new Label(
- "This is a normal label, quick to render.<br/>The second tab will be slow to render the first time, after that it will be as quick as this one.");
- l.setCaption("A normal label");
- l.setContentMode(Label.CONTENT_XHTML);
- layout.addComponent(l);
-
- ts.addTab(layout, "Normal", null);
-
- layout = new OrderedLayout();
- layout.setMargin(true);
- l = new Label(
- "The first time you change to this tab, this label is very slow to produce (server-side).<br/> However, it will seem fast the second time you change to this tab, because it has not changed and is cached client-side.") {
- @Override
- public void paintContent(PaintTarget target) throws PaintException {
- try {
- Thread.sleep(3000);
- } catch (final Exception e) {
- // IGNORED
- }
- super.paintContent(target);
- }
-
- };
- l.setCaption("A slow label");
- l.setContentMode(Label.CONTENT_XHTML);
- layout.addComponent(l);
- ts.addTab(layout, "Slow", null);
-
- }
-
-}
diff --git a/src/com/itmill/toolkit/demo/Calc.java b/src/com/itmill/toolkit/demo/Calc.java index bc9e898a52..0955f34d1f 100644 --- a/src/com/itmill/toolkit/demo/Calc.java +++ b/src/com/itmill/toolkit/demo/Calc.java @@ -1,7 +1,3 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - package com.itmill.toolkit.demo; import com.itmill.toolkit.ui.Button; diff --git a/src/com/itmill/toolkit/demo/FilterSelect.java b/src/com/itmill/toolkit/demo/FilterSelect.java deleted file mode 100644 index f4a9472fcd..0000000000 --- a/src/com/itmill/toolkit/demo/FilterSelect.java +++ /dev/null @@ -1,86 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import com.itmill.toolkit.ui.OrderedLayout; -import com.itmill.toolkit.ui.Panel; -import com.itmill.toolkit.ui.Select; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.AbstractSelect.Filtering; - -/** - * The classic "hello, world!" example for IT Mill Toolkit. The class simply - * implements the abstract {@link com.itmill.toolkit.Application#init() init()} - * method in which it creates a Window and adds a Label to it. - * - * @author IT Mill Ltd. - * @see com.itmill.toolkit.Application - * @see com.itmill.toolkit.ui.Window - * @see com.itmill.toolkit.ui.Label - */ -public class FilterSelect extends com.itmill.toolkit.Application { - - private static final String[] firstnames = new String[] { "John", "Mary", - "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Robert", "Paula", - "Lenny", "Kenny", "Nathan", "Nicole", "Laura", "Jos", "Josie", - "Linus" }; - - private static final String[] lastnames = new String[] { "Torvalds", - "Smith", "Adams", "Black", "Wilson", "Richards", "Thompson", - "McGoff", "Halas", "Jones", "Beck", "Sheridan", "Picard", "Hill", - "Fielding", "Einstein" }; - - /** - * The initialization method that is the only requirement for inheriting the - * com.itmill.toolkit.service.Application class. It will be automatically - * called by the framework when a user accesses the application. - */ - @Override - public void init() { - - /* - * - Create new window for the application - Give the window a visible - * title - Set the window to be the main window of the application - */ - final Window main = new Window("Filter select demo"); - setMainWindow(main); - - // default filterin (Starts with) - final Select s1 = new Select(); - for (int i = 0; i < 105; i++) { - s1 - .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))] - + " " - + lastnames[(int) (Math.random() * (lastnames.length - 1))]); - } - s1.setImmediate(true); - - // contains filter - final Select s2 = new Select(); - for (int i = 0; i < 500; i++) { - s2 - .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))] - + " " - + lastnames[(int) (Math.random() * (lastnames.length - 1))]); - } - s2.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); - - // Add selects to UI using ordered layout and panels - final OrderedLayout orderedLayout = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - - final Panel panel1 = new Panel("Select with default filter"); - final Panel panel2 = new Panel("Select with contains filter"); - - panel1.addComponent(s1); - panel2.addComponent(s2); - - orderedLayout.addComponent(panel1); - orderedLayout.addComponent(panel2); - main.addComponent(orderedLayout); - - } - -} diff --git a/src/com/itmill/toolkit/demo/HelloWorld.java b/src/com/itmill/toolkit/demo/HelloWorld.java index bcbf447d09..d77ce235f2 100644 --- a/src/com/itmill/toolkit/demo/HelloWorld.java +++ b/src/com/itmill/toolkit/demo/HelloWorld.java @@ -1,48 +1,22 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - package com.itmill.toolkit.demo; import com.itmill.toolkit.ui.Label; import com.itmill.toolkit.ui.Window; -/** - * The classic "hello, world!" example for IT Mill Toolkit. The class simply - * implements the abstract {@link com.itmill.toolkit.Application#init() init()} - * method in which it creates a Window and adds a Label to it. - * - * @author IT Mill Ltd. - * @see com.itmill.toolkit.Application - * @see com.itmill.toolkit.ui.Window - * @see com.itmill.toolkit.ui.Label - */ public class HelloWorld extends com.itmill.toolkit.Application { /** - * The initialization method that is the only requirement for inheriting the - * com.itmill.toolkit.service.Application class. It will be automatically - * called by the framework when a user accesses the application. + * Init is invoked on application load (when a user accesses the application + * for the first time). */ @Override public void init() { - /* - * - Create new window for the application - Give the window a visible - * title - Set the window to be the main window of the application - */ + // Main window is the primary browser window final Window main = new Window("Hello window"); setMainWindow(main); - /* - * - Create a label with the classic text - Add the label to the main - * window - */ + // "Hello world" text is added to window as a Label component main.addComponent(new Label("Hello World!")); - - /* - * And that's it! The framework will display the main window and its - * contents when the application is accessed with the terminal. - */ } } diff --git a/src/com/itmill/toolkit/demo/KeyboardShortcut.java b/src/com/itmill/toolkit/demo/KeyboardShortcut.java deleted file mode 100644 index 7d3a3a1977..0000000000 --- a/src/com/itmill/toolkit/demo/KeyboardShortcut.java +++ /dev/null @@ -1,147 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import java.util.Date; - -import com.itmill.toolkit.Application; -import com.itmill.toolkit.event.Action; -import com.itmill.toolkit.event.ShortcutAction; -import com.itmill.toolkit.event.Action.Handler; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.HorizontalLayout; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.Panel; -import com.itmill.toolkit.ui.TextField; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; - -/** - * Test application for KeyboardShortcuts - */ -public class KeyboardShortcut extends Application implements Handler { - - private VerticalLayout loki; - - private final Label instructions = new Label( - "<p>Keyboard shortcuts is a must have feature for applications in a " - + "daily use. In IT Mill toolkit shortcuts are binded to " - + "Panel and its subclasses like Windows (most common place)." - + "</p>" - + "<p>Browsers reserve some keyboard combinations for their own" - + " actions, so all combinations cannot be used in web " - + "applications. (see our article on <a href=\"http://www.itmill" - + ".com/articles/Keybindings_in_Web_Browsers.htm\">" - + "www.itmill.com)</a></p>" - + "<p>Focus must be inside web application (eg. not in address " - + "bar) for shortcuts to work. By default app element is focused.</p>" - + "<strong>Shortcuts used in this example:</strong> " - + "<br/>ESC restarts program, ctrl-shift-a (Button A), " - + "ctrl-shift-z (Button Z), ctrl-shift-x (Button X)", - Label.CONTENT_XHTML); - - private final Action ACTION_A = new ShortcutAction("Button a action", - ShortcutAction.KeyCode.A, new int[] { - ShortcutAction.ModifierKey.CTRL, - ShortcutAction.ModifierKey.SHIFT }); - - private final Action ACTION_Z = new ShortcutAction("Button z action", - ShortcutAction.KeyCode.Z, new int[] { - ShortcutAction.ModifierKey.CTRL, - ShortcutAction.ModifierKey.SHIFT }); - - private final Action ACTION_X = new ShortcutAction("Button x action", - ShortcutAction.KeyCode.X, new int[] { - ShortcutAction.ModifierKey.CTRL, - ShortcutAction.ModifierKey.SHIFT }); - - private final Action ACTION_RESTART = new ShortcutAction("Restart ", - ShortcutAction.KeyCode.ESCAPE, null); - - private final Action[] actions = new Action[] { ACTION_A, ACTION_Z, - ACTION_X, ACTION_RESTART }; - - private TextField f; - - @Override - public void init() { - - final Window w = new Window("Keyboard shortcuts demo"); - final VerticalLayout main = new VerticalLayout(); - main.setMargin(true); - main.setSpacing(true); - setMainWindow(w); - w.setLayout(main); - - final Panel p = new Panel("Test application for shortcut actions"); - p.addComponent(instructions); - - final HorizontalLayout buttons = new HorizontalLayout(); - - // Restart button - final Button close = new Button("restart", this, "close"); - final Button a = new Button("Button A", this, "actionAHandler"); - final Button z = new Button("Button Z", this, "actionZHandler"); - final Button x = new Button("Button X", this, "actionXHandler"); - f = new TextField(); - - buttons.addComponent(close); - - buttons.addComponent(a); - buttons.addComponent(z); - buttons.addComponent(x); - buttons.addComponent(f); - p.addComponent(buttons); - - main.addComponent(p); - - loki = new VerticalLayout(); - main.addComponent(loki); - main.setExpandRatio(loki, 1.0f); - - w.addActionHandler(this); - - } - - public Action[] getActions(Object target, Object sender) { - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - if (action == ACTION_A) { - actionAHandler(); - } - if (action == ACTION_Z) { - actionZHandler(); - } - if (action == ACTION_X) { - actionXHandler(); - } - if (action == ACTION_RESTART) { - actionRestartHandler(); - } - } - - public void actionAHandler() { - log("Button A handler fired"); - } - - public void actionZHandler() { - log("Button Z handler fired"); - } - - public void actionXHandler() { - log("Button X handler fired"); - } - - public void actionRestartHandler() { - close(); - } - - public void log(String s) { - loki.addComponentAsFirst(new Label(new Date() + " : " + s)); - } - -} diff --git a/src/com/itmill/toolkit/demo/NotificationDemo.java b/src/com/itmill/toolkit/demo/NotificationDemo.java deleted file mode 100644 index 8abe65ace8..0000000000 --- a/src/com/itmill/toolkit/demo/NotificationDemo.java +++ /dev/null @@ -1,92 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import com.itmill.toolkit.data.Item; -import com.itmill.toolkit.ui.AbstractSelect; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.NativeSelect; -import com.itmill.toolkit.ui.RichTextArea; -import com.itmill.toolkit.ui.TextField; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Button.ClickListener; - -/** - * Demonstrates the use of Notifications. - * - * @author IT Mill Ltd. - * @see com.itmill.toolkit.ui.Window - */ -public class NotificationDemo extends com.itmill.toolkit.Application { - - // Dropdown select for notification type, using the native dropdown - NativeSelect type; - // Textfield for the notification caption - TextField caption; - // Textfield for the notification content - TextField message; - - /** - * The initialization method that is the only requirement for inheriting the - * com.itmill.toolkit.service.Application class. It will be automatically - * called by the framework when a user accesses the application. - */ - @Override - public void init() { - - // Create new window for the application and give the window a visible. - final Window main = new Window("Notification demo"); - // set as main window - setMainWindow(main); - - // Create the 'type' dropdown select. - type = new NativeSelect("Notification type"); - // no empty selection allowed - type.setNullSelectionAllowed(false); - // we want a different caption than the value - type.addContainerProperty("caption", String.class, null); - type.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); - type.setItemCaptionPropertyId("caption"); - // add some content (items) using the Container API - Item i = type.addItem(new Integer( - Window.Notification.TYPE_HUMANIZED_MESSAGE)); - i.getItemProperty("caption").setValue("Humanized message"); - i = type.addItem(new Integer(Window.Notification.TYPE_WARNING_MESSAGE)); - i.getItemProperty("caption").setValue("Warning message"); - i = type.addItem(new Integer(Window.Notification.TYPE_ERROR_MESSAGE)); - i.getItemProperty("caption").setValue("Error message"); - i = type - .addItem(new Integer(Window.Notification.TYPE_TRAY_NOTIFICATION)); - i.getItemProperty("caption").setValue("Tray notification"); - // set the initially selected item - type.setValue(new Integer(Window.Notification.TYPE_HUMANIZED_MESSAGE)); - main.addComponent(type); // add to layout - - // Notification caption - caption = new TextField("Caption"); - caption.setColumns(20); - caption.setValue("Brown Fox!"); - main.addComponent(caption); - - // Notification message - message = new RichTextArea(); - message.setCaption("Message"); - message.setValue("A quick one jumped over the lazy dog."); - main.addComponent(message); // add to layout - - // Button to show the notification - final Button b = new Button("Show notification", new ClickListener() { - // this is an inline ClickListener - public void buttonClick(ClickEvent event) { - // show the notification - getMainWindow().showNotification((String) caption.getValue(), - (String) message.getValue(), - ((Integer) type.getValue()).intValue()); - } - }); - main.addComponent(b); // add button to layout - } -} diff --git a/src/com/itmill/toolkit/demo/PortletDemo.java b/src/com/itmill/toolkit/demo/PortletDemo.java deleted file mode 100644 index 57d8027795..0000000000 --- a/src/com/itmill/toolkit/demo/PortletDemo.java +++ /dev/null @@ -1,153 +0,0 @@ -/**
- *
- */
-package com.itmill.toolkit.demo;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-
-import com.itmill.toolkit.Application;
-import com.itmill.toolkit.terminal.ExternalResource;
-import com.itmill.toolkit.terminal.gwt.server.PortletApplicationContext;
-import com.itmill.toolkit.terminal.gwt.server.PortletApplicationContext.PortletListener;
-import com.itmill.toolkit.ui.Label;
-import com.itmill.toolkit.ui.Link;
-import com.itmill.toolkit.ui.TextField;
-import com.itmill.toolkit.ui.Window;
-import com.itmill.toolkit.ui.Window.Notification;
-
-/**
- * @author marc
- *
- */
-public class PortletDemo extends Application {
-
- Window main = new Window();
- TextField tf = new TextField("Some value");
- Label userInfo = new Label();
- Link portletEdit = new Link();
- Link portletMax = new Link();
- Link someAction = null;
-
- @Override
- public void init() {
- main = new Window();
- setMainWindow(main);
-
- userInfo.setCaption("User info");
- userInfo.setContentMode(Label.CONTENT_PREFORMATTED);
- main.addComponent(userInfo);
-
- tf.setEnabled(false);
- tf.setImmediate(true);
- main.addComponent(tf);
-
- portletEdit.setEnabled(false);
- main.addComponent(portletEdit);
- portletMax.setEnabled(false);
- main.addComponent(portletMax);
-
- if (getContext() instanceof PortletApplicationContext) {
- PortletApplicationContext ctx = (PortletApplicationContext) getContext();
- ctx.addPortletListener(this, new DemoPortletListener());
- } else {
- getMainWindow().showNotification("Not inited via Portal!",
- Notification.TYPE_ERROR_MESSAGE);
- }
-
- }
-
- private class DemoPortletListener implements PortletListener {
-
- public void handleActionRequest(ActionRequest request,
- ActionResponse response) {
-
- main.addComponent(new Label("Action received"));
-
- }
-
- public void handleRenderRequest(RenderRequest request,
- RenderResponse response) {
- // Portlet up-and-running, enable stuff
- portletEdit.setEnabled(true);
- portletMax.setEnabled(true);
-
- // Editable if we're in editmode
- tf.setEnabled((request.getPortletMode() == PortletMode.EDIT));
-
- // Show notification about current mode and state
- getMainWindow().showNotification(
- "Portlet status",
- "Mode: " + request.getPortletMode() + " State: "
- + request.getWindowState(),
- Notification.TYPE_WARNING_MESSAGE);
-
- // Display current user info
- Map uinfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
- if (uinfo != null) {
- String s = "";
- for (Iterator it = uinfo.keySet().iterator(); it.hasNext();) {
- Object key = it.next();
- Object val = uinfo.get(key);
- s += key + ": " + val + "\n";
- }
- if (request.isUserInRole("administrator")) {
- s += "(administrator)";
- }
- userInfo.setValue(s);
- } else {
- userInfo.setValue("-");
- }
-
- // Create Edit/Done link (actionUrl)
- PortletURL url = response.createActionURL();
- try {
- url
- .setPortletMode((request.getPortletMode() == PortletMode.VIEW ? PortletMode.EDIT
- : PortletMode.VIEW));
- portletEdit.setResource(new ExternalResource(url.toString()));
- portletEdit
- .setCaption((request.getPortletMode() == PortletMode.VIEW ? "Edit"
- : "Done"));
- } catch (Exception e) {
- portletEdit.setEnabled(false);
- }
- // Create Maximize/Normal link (actionUrl)
- url = response.createActionURL();
- try {
- url
- .setWindowState((request.getWindowState() == WindowState.NORMAL ? WindowState.MAXIMIZED
- : WindowState.NORMAL));
- portletMax.setResource(new ExternalResource(url.toString()));
- portletMax
- .setCaption((request.getWindowState() == WindowState.NORMAL ? "Maximize"
- : "Back to normal"));
- } catch (Exception e) {
- portletMax.setEnabled(false);
- }
-
- if (someAction == null) {
- url = response.createActionURL();
- try {
- someAction = new Link("An action", new ExternalResource(url
- .toString()));
- main.addComponent(someAction);
- } catch (Exception e) {
- // Oops
- System.err.println("Could not create someAction: " + e);
- }
-
- }
-
- }
- }
-}
diff --git a/src/com/itmill/toolkit/demo/SelectDemo.java b/src/com/itmill/toolkit/demo/SelectDemo.java deleted file mode 100644 index ec0ddcb647..0000000000 --- a/src/com/itmill/toolkit/demo/SelectDemo.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import java.sql.SQLException; - -import com.itmill.toolkit.data.util.QueryContainer; -import com.itmill.toolkit.demo.util.SampleDatabase; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.Panel; -import com.itmill.toolkit.ui.Select; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.AbstractSelect.Filtering; - -/** - * This example demonstrates what is lazy loading feature on Select component. - * Demo Uses similar concepts to QueryContainerDemo. - * - * @author IT Mill Ltd. - * @since 4.0.0 - * - */ -public class SelectDemo extends com.itmill.toolkit.Application { - - // Select component where SQL rows are attached (using QueryContainer) - private final Select select = new Select(); - - private final Select lazySelect = new Select(); - - // Database provided with sample data - private SampleDatabase sampleDatabase; - - /** - * Initialize Application. Demo components are added to main window. - */ - @Override - public void init() { - final Window main = new Window("Select demo"); - setMainWindow(main); - - // Main window contains heading, table, select and tree - final Panel panel = new Panel("Select demo (a.k.a Google Suggests)"); - panel.addComponent(lazySelect); - panel.addComponent(new Label("<hr />", Label.CONTENT_XHTML)); - panel.addComponent(select); - main.addComponent(panel); - - // create demo database - sampleDatabase = new SampleDatabase(); - - initSelects(); - } - - private void initSelects() { - // init select - select.setCaption("All employees default functionality."); - select.setItemCaptionPropertyId("WORKER"); - // populate Toolkit select component with test SQL table rows - try { - final QueryContainer qc = new QueryContainer( - "SELECT ID, UNIT||', '||LASTNAME||' '||FIRSTNAME" - + " AS WORKER FROM employee ORDER BY WORKER", - sampleDatabase.getConnection()); - select.setContainerDataSource(qc); - } catch (final SQLException e) { - e.printStackTrace(); - } - - // init lazySelect - lazySelect.setCaption("All employees with lazy loading " - + "(a.k.a Google Suggests) activated."); - lazySelect.setItemCaptionPropertyId("WORKER"); - lazySelect.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); - - // use same datasource as select object uses - lazySelect.setContainerDataSource(select.getContainerDataSource()); - } - -} diff --git a/src/com/itmill/toolkit/demo/SimpleAddressBook.java b/src/com/itmill/toolkit/demo/SimpleAddressBook.java new file mode 100644 index 0000000000..f43c987036 --- /dev/null +++ b/src/com/itmill/toolkit/demo/SimpleAddressBook.java @@ -0,0 +1,137 @@ +package com.itmill.toolkit.demo; + +import com.itmill.toolkit.Application; +import com.itmill.toolkit.data.Property; +import com.itmill.toolkit.data.Property.ValueChangeEvent; +import com.itmill.toolkit.data.util.IndexedContainer; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Form; +import com.itmill.toolkit.ui.HorizontalLayout; +import com.itmill.toolkit.ui.SplitPanel; +import com.itmill.toolkit.ui.Table; +import com.itmill.toolkit.ui.TextField; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SimpleAddressBook extends Application { + + private static String[] fields = { "First Name", "Last Name", "Company", + "Mobile Phone", "Work Phone", "Home Phone", "Work Email", + "Home Email", "Street", "Zip", "City", "State", "Country" }; + private static String[] visibleCols = new String[] { "Last Name", "First Name", + "Company" }; + + private Table contactList = new Table(); + private Form contactEditor = new Form(); + private HorizontalLayout bottomLeftCorner = new HorizontalLayout(); + private Button contactRemovalButton; + private IndexedContainer addressBookData = createDummyData(); + + public void init() { + initLayout(); + initContactAddRemoveButtons(); + initAddressList(); + initFilteringControls(); + } + + private void initLayout() { + SplitPanel splitPanel = new SplitPanel( + SplitPanel.ORIENTATION_HORIZONTAL); + setMainWindow(new Window("Address Book", splitPanel)); + VerticalLayout left = new VerticalLayout(); + left.setSizeFull(); + left.addComponent(contactList); + contactList.setSizeFull(); + left.setExpandRatio(contactList, 1); + splitPanel.addComponent(left); + splitPanel.addComponent(contactEditor); + contactEditor.setSizeFull(); + contactEditor.getLayout().setMargin(true); + contactEditor.setImmediate(true); + bottomLeftCorner.setWidth("100%"); + left.addComponent(bottomLeftCorner); + } + + private void initContactAddRemoveButtons() { + // New item button + bottomLeftCorner.addComponent(new Button("+", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Object id = contactList.addItem(); + contactList.setValue(id); + } + })); + + // Remove item button + contactRemovalButton = new Button("-", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + contactList.removeItem(contactList.getValue()); + contactList.select(null); + } + }); + contactRemovalButton.setVisible(false); + bottomLeftCorner.addComponent(contactRemovalButton); + } + + private String[] initAddressList() { + contactList.setContainerDataSource(addressBookData); + contactList.setVisibleColumns(visibleCols); + contactList.setSelectable(true); + contactList.setImmediate(true); + contactList.addListener(new Property.ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + Object id = contactList.getValue(); + contactEditor.setItemDataSource(id == null ? null : contactList + .getItem(id)); + contactRemovalButton.setVisible(id != null); + } + }); + return visibleCols; + } + + private void initFilteringControls() { + for (final String pn : visibleCols) { + final TextField sf = new TextField(); + bottomLeftCorner.addComponent(sf); + sf.setWidth("100%"); + sf.setValue(pn); + sf.setImmediate(true); + bottomLeftCorner.setExpandRatio(sf, 1); + sf.addListener(new Property.ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + addressBookData.removeContainerFilters(pn); + if (sf.toString().length() > 0 && !pn.equals(sf.toString())) + addressBookData.addContainerFilter(pn, sf.toString(), + true, false); + getMainWindow().showNotification( + "" + addressBookData.size() + " matches found"); + } + }); + } + } + private static IndexedContainer createDummyData() { + + String[] fnames = { "Peter", "Alice", "Joshua", "Mike", "Olivia", + "Nina", "Alex", "Rita", "Dan", "Umberto", "Henrik", "Rene", + "Lisa", "Marge" }; + String[] lnames = { "Smith", "Gordon", "Simpson", "Brown", "Clavel", + "Simons", "Verne", "Scott", "Allison", "Gates", "Rowling", + "Barks", "Ross", "Schneider", "Tate" }; + + IndexedContainer ic = new IndexedContainer(); + + for (String p : fields) + ic.addContainerProperty(p, String.class, ""); + + for (int i = 0; i < 1000; i++) { + Object id = ic.addItem(); + ic.getContainerProperty(id, "First Name").setValue( + fnames[(int) (fnames.length * Math.random())]); + ic.getContainerProperty(id, "Last Name").setValue( + lnames[(int) (lnames.length * Math.random())]); + } + + return ic; + } + +} diff --git a/src/com/itmill/toolkit/demo/TableDemo.java b/src/com/itmill/toolkit/demo/TableDemo.java deleted file mode 100644 index c5eee75959..0000000000 --- a/src/com/itmill/toolkit/demo/TableDemo.java +++ /dev/null @@ -1,182 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import java.sql.SQLException; - -import com.itmill.toolkit.data.util.QueryContainer; -import com.itmill.toolkit.demo.util.SampleDatabase; -import com.itmill.toolkit.event.Action; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.OrderedLayout; -import com.itmill.toolkit.ui.Table; -import com.itmill.toolkit.ui.Window; - -/** - * Similar to QueryContainerDemo - * - * @author IT Mill Ltd. - * @since 4.0.0 - * - */ -public class TableDemo extends com.itmill.toolkit.Application implements - Action.Handler { - - private static final String ACTION_DESCRIPTION = "Use right mouse button to initiate " - + "actions menu.<br />Note: on Opera use meta key " - + "and left mouse button."; - - private static final String TABLE_CAPTION = SampleDatabase.ROWCOUNT - + " dynamically loaded rows from example SQL table"; - - // Table component where SQL rows are attached (using QueryContainer) - private final Table table = new Table(); - - // Label which displays last performed action against table row - private final Label tableLastAction = new Label( - "No action selected for table."); - - // Database provided with sample data - private SampleDatabase sampleDatabase; - - // Example Actions for table - private final Action ACTION1 = new Action("Upload"); - - private final Action ACTION2 = new Action("Download"); - - private final Action ACTION3 = new Action("Show history"); - - private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 }; - - // Button which is used to disable or enable table - // note: when button click event occurs, tableEnabler() method is called - private final Button tableEnabler = new Button("Disable table", this, - "tableEnabler"); - - // Button which is used to hide or show table - // note: when button click event occurs, tableVisibility() method is called - private final Button tableVisibility = new Button("Hide table", this, - "tableVisibility"); - - // Button which is used to hide or show table - // note: when button click event occurs, tableVisibility() method is called - private final Button tableCaption = new Button("Hide caption", this, - "tableCaption"); - - /** - * Initialize Application. Demo components are added to main window. - */ - @Override - public void init() { - final Window main = new Window("Table demo"); - setMainWindow(main); - - // create demo database - sampleDatabase = new SampleDatabase(); - - // Main window contains heading, two buttons, table and label - main - .addComponent(new Label( - "<h1>Table demo</h1>" - + "<b>Rows are loaded from the server as they are needed.<br />" - + "Try scrolling the table to see it in action.</b><br />" - + ACTION_DESCRIPTION, Label.CONTENT_XHTML)); - final OrderedLayout layout = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - layout.addComponent(tableVisibility); - layout.addComponent(tableEnabler); - layout.addComponent(tableCaption); - main.addComponent(layout); - main.addComponent(table); - main.addComponent(tableLastAction); - - // initialize demo components - initTable(); - } - - /** - * Populates table component with all rows from employee table. - * - */ - private void initTable() { - // init table - table.setCaption(TABLE_CAPTION); - table.setPageLength(10); - table.setSelectable(true); - table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX); - table.setColumnCollapsingAllowed(true); - table.setColumnReorderingAllowed(true); - table.setSelectable(true); - // this class handles table actions (see handleActions method below) - table.addActionHandler(this); - table.setDescription(ACTION_DESCRIPTION); - - // populate Toolkit table component with test SQL table rows - try { - final QueryContainer qc = new QueryContainer( - "SELECT * FROM employee", sampleDatabase.getConnection()); - table.setContainerDataSource(qc); - } catch (final SQLException e) { - e.printStackTrace(); - } - // define which columns should be visible on Table component - table.setVisibleColumns(new Object[] { "FIRSTNAME", "LASTNAME", - "TITLE", "UNIT" }); - table.setItemCaptionPropertyId("ID"); - } - - public void tableVisibility() { - if (table.isVisible()) { - tableVisibility.setCaption("Show table"); - table.setVisible(false); - tableEnabler.setEnabled(false); - tableCaption.setEnabled(false); - } else { - tableVisibility.setCaption("Hide table"); - table.setVisible(true); - tableEnabler.setEnabled(true); - tableCaption.setEnabled(true); - } - } - - public void tableEnabler() { - if (table.isEnabled()) { - tableEnabler.setCaption("Enable table"); - table.setEnabled(false); - } else { - tableEnabler.setCaption("Disable table"); - table.setEnabled(true); - } - } - - public void tableCaption() { - if (table.getCaption().equals("")) { - table.setCaption(TABLE_CAPTION); - tableCaption.setCaption("Hide caption"); - } else { - table.setCaption(""); - tableCaption.setCaption("Show caption"); - } - } - - /** - * URIHandler Return example actions - */ - public Action[] getActions(Object target, Object sender) { - return actions; - } - - /** - * Executed by right mouse button on table or tree component. - */ - public void handleAction(Action action, Object sender, Object target) { - if (sender == table) { - tableLastAction.setValue("Last action clicked was '" - + action.getCaption() + "' on item " + target); - } - } - -} diff --git a/src/com/itmill/toolkit/demo/ToolkitTunesLayout.java b/src/com/itmill/toolkit/demo/ToolkitTunesLayout.java index ab8fcdc111..5c8f7774e2 100644 --- a/src/com/itmill/toolkit/demo/ToolkitTunesLayout.java +++ b/src/com/itmill/toolkit/demo/ToolkitTunesLayout.java @@ -3,6 +3,7 @@ package com.itmill.toolkit.demo; import java.util.Random; import com.itmill.toolkit.Application; +import com.itmill.toolkit.terminal.ThemeResource; import com.itmill.toolkit.ui.Button; import com.itmill.toolkit.ui.ComboBox; import com.itmill.toolkit.ui.Embedded; @@ -15,31 +16,30 @@ import com.itmill.toolkit.ui.Table; import com.itmill.toolkit.ui.VerticalLayout; import com.itmill.toolkit.ui.Window; +/** + * Sample application layout, similar (almost identical) to Apple iTunes. + * + * @author IT Mill Ltd. + * + */ public class ToolkitTunesLayout extends Application { @Override public void init() { - // We'll just build the whole UI here, since it will not contain any - // logic + /* + * We'll build the whole UI here, since the application will not contain + * any logic. Otherwise it would be more practical to separate parts of + * the UI into different classes and methods. + */ // Main (browser) window, needed in all Toolkit applications - // final Window browser = new Window("ToolkitTunes Layout demo"); - // setMainWindow(browser); - - // Our player window. We'll make it fill almost the whole browser view, - // and we'll center it on the screen. Note, that the percentage - // dimensions in sub-windows only affect the initial render, after the - // dimensions will be in pixels and will not scale if the user resizes - // the actual browser window. final Window root = new Window("ToolkitTunes"); - root.setWidth("90%"); - root.setHeight("90%"); - root.center(); - // We'll attach the window to the browser view already here, so we won't - // forget it later. - // browser.addWindow(root); + /* + * We'll attach the window to the browser view already here, so we won't + * forget it later. + */ setMainWindow(root); // Our root window contains one VerticalLayout by default, let's make @@ -51,7 +51,7 @@ public class ToolkitTunesLayout extends Application { // modes and search HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); - top.setMargin(true); + top.setMargin(false, true, false, true); // Enable horizontal margins top.setSpacing(true); // Let's attach that one straight away too @@ -64,8 +64,7 @@ public class ToolkitTunesLayout extends Application { HorizontalLayout viewmodes = new HorizontalLayout(); ComboBox search = new ComboBox(); - // Add the components and align them properly (the status component will - // be the highest of them, so align other components to "middle") + // Add the components and align them properly top.addComponent(playback); top.addComponent(volume); top.addComponent(status); @@ -73,14 +72,17 @@ public class ToolkitTunesLayout extends Application { top.addComponent(search); top.setComponentAlignment(playback, "middle"); top.setComponentAlignment(volume, "middle"); + top.setComponentAlignment(status, "middle"); top.setComponentAlignment(viewmodes, "middle"); top.setComponentAlignment(search, "middle"); - // We want our status area to expand if the user resizes the root - // window, and we want it to accommodate as much space as there is - // available. All other components in the top layout should stay fixed - // sized, so we don't need to specify any expand ratios for them (they - // will automatically revert to zero after the following line). + /* + * We want our status area to expand if the user resizes the root + * window, and we want it to accommodate as much space as there is + * available. All other components in the top layout should stay fixed + * sized, so we don't need to specify any expand ratios for them (they + * will automatically revert to zero after the following line). + */ top.setExpandRatio(status, 1.0F); // Playback controls @@ -106,7 +108,7 @@ public class ToolkitTunesLayout extends Application { // Status area status.setWidth("80%"); status.setSpacing(true); - top.setComponentAlignment(status, "center"); + top.setComponentAlignment(status, "middle center"); Button toggleVisualization = new Button("Mode"); Label timeFromStart = new Label("0:00"); @@ -151,8 +153,10 @@ public class ToolkitTunesLayout extends Application { viewmodes.addComponent(viewAsGrid); viewmodes.addComponent(coverflow); - // That covers the top bar. Now let's move on to the sidebar and track - // listing + /* + * That covers the top bar. Now let's move on to the sidebar and track + * listing + */ // We'll need one splitpanel to separate the sidebar and track listing SplitPanel bottom = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); @@ -160,7 +164,6 @@ public class ToolkitTunesLayout extends Application { // The splitpanel is by default 100% x 100%, but we'll need to adjust // our main window layout to accomodate the height - root.getLayout().setHeight("100%"); ((VerticalLayout) root.getLayout()).setExpandRatio(bottom, 1.0F); // Give the sidebar less space than the listing @@ -172,21 +175,28 @@ public class ToolkitTunesLayout extends Application { sidebar.setSizeFull(); bottom.setFirstComponent(sidebar); - // Then we need some labels and buttons, and an album cover image - // The labels and buttons go into their own vertical layout, since we - // want the 'sidebar' layout to be expanding (cover image in the - // bottom). + /* + * Then we need some labels and buttons, and an album cover image The + * labels and buttons go into their own vertical layout, since we want + * the 'sidebar' layout to be expanding (cover image in the bottom). + * VerticalLayout is by default 100% wide. + */ VerticalLayout selections = new VerticalLayout(); Label library = new Label("Library"); Button music = new Button("Music"); + music.setWidth("100%"); Label store = new Label("Store"); Button toolkitTunesStore = new Button("ToolkitTunes Store"); + toolkitTunesStore.setWidth("100%"); Button purchased = new Button("Purchased"); + purchased.setWidth("100%"); Label playlists = new Label("Playlists"); Button genius = new Button("Geniues"); + genius.setWidth("100%"); Button recent = new Button("Recently Added"); + recent.setWidth("100%"); // Lets add them to the 'selections' layout selections.addComponent(library); @@ -202,20 +212,18 @@ public class ToolkitTunesLayout extends Application { sidebar.addComponent(selections); sidebar.setExpandRatio(selections, 1.0F); - // Then comes the cover artwork - Embedded cover = new Embedded(); - // We don't have a source image for it yet, but we'll add it later in - // the theming example - // cover.setSource(new ThemeResource("")); - cover.setWidth("200px"); - cover.setHeight("200px"); + // Then comes the cover artwork (we'll add the actual image in the + // themeing section) + Embedded cover = new Embedded("Currently Playing"); sidebar.addComponent(cover); - sidebar.setComponentAlignment(cover, "center"); - // And lastly, we need the track listing table - // It should fill the whole left side of our bottom layout + /* + * And lastly, we need the track listing table It should fill the whole + * left side of our bottom layout + */ Table listing = new Table(); listing.setSizeFull(); + listing.setSelectable(true); bottom.setSecondComponent(listing); // Add the table headers @@ -264,6 +272,56 @@ public class ToolkitTunesLayout extends Application { albums[new Random().nextInt(albums.length - 1)], genres[new Random().nextInt(genres.length - 1)], s }, i); } + + // We'll align the track time column to right as well + listing.setColumnAlignment("Time", Table.ALIGN_RIGHT); + + // TODO the footer + + // Now what's left to do? Themeing of course. + setTheme("toolkittunes"); + + /* + * Let's give a namespace to our application window. This way, if + * someone uses the same theme for different applications, we don't get + * unwanted style conflicts. + */ + root.setStyleName("tTunes"); + + top.setStyleName("top"); + top.setHeight("75px"); // Same as the background image height + + playback.setStyleName("playback"); + playback.setMargin(false, true, false, false); // Add right-side margin + play.setStyleName("play"); + next.setStyleName("next"); + prev.setStyleName("prev"); + playback.setComponentAlignment(prev, "middle"); + playback.setComponentAlignment(next, "middle"); + + volume.setStyleName("volume"); + mute.setStyleName("mute"); + max.setStyleName("max"); + vol.setWidth("78px"); + + status.setStyleName("status"); + status.setMargin(true); + status.setHeight("46px"); // Height of the background image + + toggleVisualization.setStyleName("toggle-vis"); + jumpToTrack.setStyleName("jump"); + + viewAsTable.setStyleName("viewmode-table"); + viewAsGrid.setStyleName("viewmode-grid"); + coverflow.setStyleName("viewmode-coverflow"); + + sidebar.setStyleName("sidebar"); + + music.setStyleName("selected"); + + cover.setSource(new ThemeResource("images/album-cover.jpg")); + // Because this is an image, it will retain it's aspect ratio + cover.setWidth("100%"); } } diff --git a/src/com/itmill/toolkit/demo/WindowedDemos.java b/src/com/itmill/toolkit/demo/WindowedDemos.java deleted file mode 100644 index 26e745bb8e..0000000000 --- a/src/com/itmill/toolkit/demo/WindowedDemos.java +++ /dev/null @@ -1,97 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.itmill.toolkit.demo; - -import java.util.HashMap; -import java.util.Iterator; - -import com.itmill.toolkit.terminal.ExternalResource; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Embedded; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; - -/** - * Embeds other demos in windows using an ExternalResource ("application in - * application"). - * - * @author IT Mill Ltd. - * @see com.itmill.toolkit.ui.Window - */ -public class WindowedDemos extends com.itmill.toolkit.Application { - - // keeps track of created windows - private final HashMap windows = new HashMap(); - - // mapping demo name to URL - private static final HashMap servlets = new HashMap(); - static { - servlets.put("Caching demo", "CachingDemo/"); - servlets.put("Calculator", "Calc/"); - servlets.put("Calendar demo", "CalendarDemo/"); - servlets.put("Select demo", "SelectDemo/"); - servlets.put("Table demo", "TableDemo/"); - servlets.put("Browser demo", "BrowserDemo/"); - servlets.put("Notification demo", "NotificationDemo/"); - } - - @Override - public void init() { - - // Create new window for the application and give the window a visible. - final Window main = new Window("IT Mill Toolkit 5 Windowed Demos"); - // set as main window - setMainWindow(main); - - // Create menu window. - final Window menu = new Window("Select demo"); - menu.setWidth(200); - menu.setHeight(400); - main.addWindow(menu); // add to layout - - // Create a menu button for each demo - for (final Iterator it = servlets.keySet().iterator(); it.hasNext();) { - final String name = (String) it.next(); - final Button b = new Button(name, new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - show(event.getButton().getCaption()); - } - - }); - b.setStyleName("link"); - menu.addComponent(b); - } - - } - - /** - * Shows the specified demo in a separate window. Creates a new window if - * the demo has not been shown already, re-uses old window otherwise. - * - * @param demoName - * the name of the demo to be shown - */ - private void show(String demoName) { - Window w = (Window) windows.get(demoName); - if (w == null) { - w = new Window(demoName); - w.setWidth(560); - w.setHeight(500); - w.setPositionX(202); - w.getLayout().setSizeFull(); - w.getLayout().setMargin(false); - windows.put(demoName, w); - Embedded emb = new Embedded(); - emb.setType(Embedded.TYPE_BROWSER); - emb - .setSource(new ExternalResource((String) servlets - .get(demoName))); - emb.setSizeFull(); - w.addComponent(emb); - } - getMainWindow().addWindow(w); - } - -} diff --git a/src/com/itmill/toolkit/demo/coverflow/Coverflow.java b/src/com/itmill/toolkit/demo/coverflow/Coverflow.java new file mode 100644 index 0000000000..a12aa7021c --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/Coverflow.java @@ -0,0 +1,89 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + +package com.itmill.toolkit.demo.coverflow; + +import com.itmill.toolkit.terminal.PaintException; +import com.itmill.toolkit.terminal.PaintTarget; +import com.itmill.toolkit.ui.AbstractSelect; + +public class Coverflow extends AbstractSelect { + + private String backgroundGradientStart = "FFFFFF"; + private String backgroundGradientEnd = "EEEEEE"; + private boolean scrollbarVisibility = true; + + public String getTag() { + return "cover"; + } + + /** + * Paints the uidl + * @param PaintTarget target + * @throws PaintException + */ + public void paintContent(PaintTarget target) throws PaintException { + // Superclass writes any common attributes in the paint target. + super.paintContent(target); + + target.addAttribute("backgroundGradientStart", backgroundGradientStart); + target.addAttribute("backgroundGradientEnd", backgroundGradientEnd); + target.addAttribute("scrollbarVisibility", scrollbarVisibility); + } + + /** + * The user can specify a background gradient for the coverflow. The input values + * are RGB values for the start and end gradients. + * @param int startR + * @param int startG + * @param int startB + * @param int endR + * @param int endG + * @param int endB + */ + public void setBackgroundColor(int startR, int startG, int startB, int endR, int endG, int endB) { + backgroundGradientStart = ""; + backgroundGradientEnd = ""; + + // Convert all integers to hexadecimal format and make sure they are two characters long (in + // other words, add a zero infront if the value is less than 16 => 0x0F + if(startR < 16) + backgroundGradientStart += "0"; + backgroundGradientStart += Integer.toHexString(Math.max(Math.min(startR,255),0)); + + if(startG < 16) + backgroundGradientStart += "0"; + backgroundGradientStart += Integer.toHexString(Math.max(Math.min(startG,255),0)); + + if(startB < 16) + backgroundGradientStart += "0"; + backgroundGradientStart += Integer.toHexString(Math.max(Math.min(startB,255),0)); + + if(endR < 16) + backgroundGradientEnd += "0"; + backgroundGradientEnd += Integer.toHexString(Math.max(Math.min(endR,255),0)); + + if(endG < 16) + backgroundGradientEnd += "0"; + backgroundGradientEnd += Integer.toHexString(Math.max(Math.min(endG,255),0)); + + if(endB < 16) + backgroundGradientEnd += "0"; + backgroundGradientEnd += Integer.toHexString(Math.max(Math.min(endB,255),0)); + + this.requestRepaint(); + } + + /** + * The user can toggle the visibility of the scrollbar + * @param boolean visible + */ + public void setScrollbarVisibility(boolean visible) { + if(scrollbarVisibility != visible) { + scrollbarVisibility = visible; + this.requestRepaint(); + } + } + +} diff --git a/src/com/itmill/toolkit/demo/coverflow/CoverflowApplication.html b/src/com/itmill/toolkit/demo/coverflow/CoverflowApplication.html new file mode 100644 index 0000000000..59f87c2123 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/CoverflowApplication.html @@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html><head> +<title></title> + <style type="text/css"> + <!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }--> + </style> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +</head><body> + + +<!-- ======================================================== --> +<!-- = Java Sourcecode to HTML automatically converted code = --> +<!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = --> +<!-- = Further information: http://www.java2html.de = --> +<div align="left" class="java"> +<table border="0" cellpadding="3" cellspacing="0" bgcolor="#ffffff"> + <tr> + <!-- start source code --> + <td nowrap="nowrap" valign="top" align="left"> + <code> +<font color="#7f0055"><b>package </b></font><font color="#000000">com.itmill.toolkit.demo.coverflow;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.BufferedReader;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.FileInputStream;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.FileReader;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.IOException;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.InputStream;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.InputStreamReader;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.Reader;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.io.StringReader;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.net.URL;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">java.nio.CharBuffer;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.data.Property;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.terminal.Resource;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.terminal.Sizeable;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.terminal.ThemeResource;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.Button;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.Embedded;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.ExpandLayout;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.Label;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.Window;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.Button.ClickEvent;</font><br /> +<font color="#7f0055"><b>import </b></font><font color="#000000">com.itmill.toolkit.ui.Layout.AlignmentHandler;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#7f0055"><b>public class </b></font><font color="#000000">CoverflowApplication </font><font color="#7f0055"><b>extends </b></font><font color="#000000">com.itmill.toolkit.Application </font><font color="#000000">{</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#000000">Coverflow covers = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Coverflow</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>public </b></font><font color="#7f0055"><b>void </b></font><font color="#000000">init</font><font color="#000000">() {</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#000000">setMainWindow</font><font color="#000000">(</font><font color="#7f0055"><b>new </b></font><font color="#000000">Window</font><font color="#000000">(</font><font color="#2a00ff">"Coverflow"</font><font color="#000000">, createMainLayout</font><font color="#000000">()))</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#000000">setTheme</font><font color="#000000">(</font><font color="#2a00ff">"black"</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#000000">addSlidesToCoverflow</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>private </b></font><font color="#000000">ExpandLayout createMainLayout</font><font color="#000000">() {</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#3f7f5f">// Initialize coverflow component</font><br /> +<font color="#ffffff"> </font><font color="#000000">covers.setHeight</font><font color="#000000">(</font><font color="#990000">150</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">covers.setWidth</font><font color="#000000">(</font><font color="#990000">100</font><font color="#000000">, Sizeable.UNITS_PERCENTAGE</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">covers.setBackgroundColor</font><font color="#000000">(</font><font color="#990000">0</font><font color="#000000">, </font><font color="#990000">0</font><font color="#000000">, </font><font color="#990000">0</font><font color="#000000">, </font><font color="#990000">100</font><font color="#000000">, </font><font color="#990000">100</font><font color="#000000">, </font><font color="#990000">100</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#3f7f5f">// Initialize visible slide viewer</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>final </b></font><font color="#000000">Embedded visibleSlide = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Embedded</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">visibleSlide.setHeight</font><font color="#000000">(</font><font color="#990000">100</font><font color="#000000">, Sizeable.UNITS_PERCENTAGE</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#3f7f5f">// Listen to coverflow changes as change slides when needed</font><br /> +<font color="#ffffff"> </font><font color="#000000">covers.addListener</font><font color="#000000">(</font><font color="#7f0055"><b>new </b></font><font color="#000000">Property.ValueChangeListener</font><font color="#000000">() {</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>public </b></font><font color="#7f0055"><b>void </b></font><font color="#000000">valueChange</font><font color="#000000">(</font><font color="#000000">Property.ValueChangeEvent event</font><font color="#000000">) {</font><br /> +<font color="#ffffff"> </font><font color="#000000">visibleSlide.setSource</font><font color="#000000">((</font><font color="#000000">Resource</font><font color="#000000">) </font><font color="#000000">covers.getValue</font><font color="#000000">())</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"> </font><font color="#000000">})</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#3f7f5f">// Show sources button</font><br /> +<font color="#ffffff"> </font><font color="#000000">Button showSrc = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Button</font><font color="#000000">(</font><font color="#2a00ff">"src"</font><font color="#000000">, </font><font color="#7f0055"><b>new </b></font><font color="#000000">Button.ClickListener</font><font color="#000000">() {</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>public </b></font><font color="#7f0055"><b>void </b></font><font color="#000000">buttonClick</font><font color="#000000">(</font><font color="#000000">ClickEvent event</font><font color="#000000">) {</font><br /> +<font color="#ffffff"> </font><font color="#000000">Window srcWindow = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Window</font><font color="#000000">(</font><font color="#2a00ff">"Source code"</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">srcWindow.setWidth</font><font color="#000000">(</font><font color="#990000">700</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">srcWindow.setHeight</font><font color="#000000">(</font><font color="#990000">500</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">Label l = </font><font color="#7f0055"><b>new </b></font><font color="#000000">Label</font><font color="#000000">(</font><font color="#000000">getSourceCodeForThisClass</font><font color="#000000">()</font><font color="#000000">,</font><br /> +<font color="#ffffff"> </font><font color="#000000">Label.CONTENT_XHTML</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">srcWindow.addComponent</font><font color="#000000">(</font><font color="#000000">l</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">getMainWindow</font><font color="#000000">()</font><font color="#000000">.addWindow</font><font color="#000000">(</font><font color="#000000">srcWindow</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"> </font><font color="#000000">})</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#3f7f5f">// Initialize main layout</font><br /> +<font color="#ffffff"> </font><font color="#000000">ExpandLayout layout = </font><font color="#7f0055"><b>new </b></font><font color="#000000">ExpandLayout</font><font color="#000000">(</font><br /> +<font color="#ffffff"> </font><font color="#000000">ExpandLayout.ORIENTATION_VERTICAL</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.addComponent</font><font color="#000000">(</font><font color="#000000">showSrc</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.setComponentAlignment</font><font color="#000000">(</font><font color="#000000">showSrc, AlignmentHandler.ALIGNMENT_RIGHT,</font><br /> +<font color="#ffffff"> </font><font color="#000000">AlignmentHandler.ALIGNMENT_TOP</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.addComponent</font><font color="#000000">(</font><font color="#000000">visibleSlide</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.setComponentAlignment</font><font color="#000000">(</font><font color="#000000">visibleSlide,</font><br /> +<font color="#ffffff"> </font><font color="#000000">AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,</font><br /> +<font color="#ffffff"> </font><font color="#000000">AlignmentHandler.ALIGNMENT_TOP</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.addComponent</font><font color="#000000">(</font><font color="#000000">covers</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.setComponentAlignment</font><font color="#000000">(</font><font color="#000000">covers,</font><br /> +<font color="#ffffff"> </font><font color="#000000">AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER,</font><br /> +<font color="#ffffff"> </font><font color="#000000">AlignmentHandler.ALIGNMENT_TOP</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.expand</font><font color="#000000">(</font><font color="#000000">visibleSlide</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">layout.setSizeFull</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>return </b></font><font color="#000000">layout;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>private </b></font><font color="#000000">String getSourceCodeForThisClass</font><font color="#000000">() {</font><br /> +<font color="#ffffff"> </font><font color="#000000">String code = </font><font color="#2a00ff">"Could not find source-file"</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>try </b></font><font color="#000000">{</font><br /> +<font color="#ffffff"> </font><font color="#000000">InputStream is = </font><font color="#7f0055"><b>this</b></font><font color="#000000">.getClass</font><font color="#000000">()</font><font color="#000000">.getResource</font><font color="#000000">(</font><br /> +<font color="#ffffff"> </font><font color="#2a00ff">"CoverflowApplication.html"</font><font color="#000000">)</font><font color="#000000">.openStream</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">BufferedReader r = </font><font color="#7f0055"><b>new </b></font><font color="#000000">BufferedReader</font><font color="#000000">(</font><font color="#7f0055"><b>new </b></font><font color="#000000">InputStreamReader</font><font color="#000000">(</font><font color="#000000">is</font><font color="#000000">))</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">StringBuffer buf = </font><font color="#7f0055"><b>new </b></font><font color="#000000">StringBuffer</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">String line;</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>while </b></font><font color="#000000">((</font><font color="#000000">line = r.readLine</font><font color="#000000">()) </font><font color="#000000">!= </font><font color="#7f0055"><b>null</b></font><font color="#000000">) {</font><br /> +<font color="#ffffff"> </font><font color="#000000">buf.append</font><font color="#000000">(</font><font color="#000000">line</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"> </font><font color="#000000">code = buf.toString</font><font color="#000000">()</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">} </font><font color="#7f0055"><b>catch </b></font><font color="#000000">(</font><font color="#000000">IOException ignored</font><font color="#000000">) {</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>return </b></font><font color="#000000">code;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"></font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>private </b></font><font color="#7f0055"><b>void </b></font><font color="#000000">addSlidesToCoverflow</font><font color="#000000">() {</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>for </b></font><font color="#000000">(</font><font color="#7f0055"><b>int </b></font><font color="#000000">i = </font><font color="#990000">1</font><font color="#000000">; i <= </font><font color="#990000">22</font><font color="#000000">; i++</font><font color="#000000">) {</font><br /> +<font color="#ffffff"> </font><font color="#000000">String head = </font><font color="#2a00ff">"../../../IMAGES/"</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">String tail = </font><font color="#2a00ff">"slideshow-example.0" </font><font color="#000000">+ </font><font color="#000000">((</font><font color="#000000">i < </font><font color="#990000">10</font><font color="#000000">) </font><font color="#000000">? </font><font color="#2a00ff">"0" </font><font color="#000000">: </font><font color="#2a00ff">""</font><font color="#000000">) </font><font color="#000000">+ i</font><br /> +<font color="#ffffff"> </font><font color="#000000">+ </font><font color="#2a00ff">".jpg"</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">ThemeResource slide = </font><font color="#7f0055"><b>new </b></font><font color="#000000">ThemeResource</font><font color="#000000">(</font><font color="#000000">head + tail</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">covers.addItem</font><font color="#000000">(</font><font color="#000000">slide</font><font color="#000000">)</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">covers.setItemIcon</font><font color="#000000">(</font><font color="#000000">slide,</font><br /> +<font color="#ffffff"> </font><font color="#7f0055"><b>new </b></font><font color="#000000">ThemeResource</font><font color="#000000">(</font><font color="#000000">head + </font><font color="#2a00ff">"thumbs/" </font><font color="#000000">+ tail</font><font color="#000000">))</font><font color="#000000">;</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#ffffff"> </font><font color="#000000">}</font><br /> +<font color="#000000">}</font></code> + + </td> + <!-- end source code --> + </tr> +</table> +</div> +<!-- = END of automatically generated HTML code = --> +<!-- ======================================================== --> + + +</body></html>
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/CoverflowApplication.java b/src/com/itmill/toolkit/demo/coverflow/CoverflowApplication.java new file mode 100644 index 0000000000..3fa4cd3155 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/CoverflowApplication.java @@ -0,0 +1,109 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + +package com.itmill.toolkit.demo.coverflow; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import com.itmill.toolkit.data.Property; +import com.itmill.toolkit.terminal.Resource; +import com.itmill.toolkit.terminal.Sizeable; +import com.itmill.toolkit.terminal.ThemeResource; +import com.itmill.toolkit.ui.Alignment; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Embedded; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class CoverflowApplication extends com.itmill.toolkit.Application { + + Coverflow covers = new Coverflow(); + + public void init() { + + setMainWindow(new Window("Coverflow", createMainLayout())); + + setTheme("coverflow"); + + addSlidesToCoverflow(); + } + + private VerticalLayout createMainLayout() { + + // Initialize coverflow component + covers.setHeight("150px"); + covers.setWidth("100%"); + covers.setBackgroundColor(0, 0, 0, 100, 100, 100); + + // Initialize visible slide viewer + final Embedded visibleSlide = new Embedded(); + visibleSlide.setHeight(100, Sizeable.UNITS_PERCENTAGE); + + // Listen to coverflow changes as change slides when needed + covers.addListener(new Property.ValueChangeListener() { + public void valueChange(Property.ValueChangeEvent event) { + visibleSlide.setSource((Resource) covers.getValue()); + } + }); + + // Show sources button + Button showSrc = new Button("src", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Window srcWindow = new Window("Source code"); + srcWindow.setWidth("700px"); + srcWindow.setHeight("500px"); + Label l = new Label(getSourceCodeForThisClass(), + Label.CONTENT_XHTML); + srcWindow.addComponent(l); + getMainWindow().addWindow(srcWindow); + } + }); + + // Initialize main layout + VerticalLayout layout = new VerticalLayout(); + layout.addComponent(showSrc); + layout.setComponentAlignment(showSrc, Alignment.TOP_RIGHT); + layout.addComponent(visibleSlide); + layout.setComponentAlignment(visibleSlide, Alignment.TOP_CENTER); + layout.addComponent(covers); + layout.setExpandRatio(visibleSlide, 1); + layout.setSizeFull(); + + return layout; + } + + private String getSourceCodeForThisClass() { + String code = "Could not find source-file"; + try { + InputStream is = this.getClass().getResource( + "CoverflowApplication.html").openStream(); + BufferedReader r = new BufferedReader(new InputStreamReader(is)); + StringBuffer buf = new StringBuffer(); + String line; + while ((line = r.readLine()) != null) { + buf.append(line); + } + code = buf.toString(); + } catch (IOException ignored) { + } + return code; + } + + private void addSlidesToCoverflow() { + for (int i = 1; i <= 22; i++) { + String head = "images/"; + String tail = "slideshow-example.0" + ((i < 10) ? "0" : "") + i + + ".jpg"; + ThemeResource slide = new ThemeResource(head + tail); + covers.addItem(slide); + covers.setItemIcon(slide, + new ThemeResource(head + "thumbs/" + tail)); + } + } +} diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/CoverflowWidgetSet.gwt.xml b/src/com/itmill/toolkit/demo/coverflow/gwt/CoverflowWidgetSet.gwt.xml new file mode 100644 index 0000000000..a3a4e1d2ce --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/CoverflowWidgetSet.gwt.xml @@ -0,0 +1,8 @@ +<module> + <!-- Inherit the NoEntry version to avoid multiple entrypoints --> + <inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSetNoEntry" /> + + <!-- Entry point --> + <entry-point class="com.itmill.toolkit.demo.coverflow.gwt.client.CoverflowWidgetSet"/> + +</module> diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/client/CoverflowWidgetSet.java b/src/com/itmill/toolkit/demo/coverflow/gwt/client/CoverflowWidgetSet.java new file mode 100644 index 0000000000..3d353d7809 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/client/CoverflowWidgetSet.java @@ -0,0 +1,35 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + +package com.itmill.toolkit.demo.coverflow.gwt.client; + +import com.itmill.toolkit.demo.coverflow.gwt.client.ui.ICoverflow; +import com.itmill.toolkit.terminal.gwt.client.DefaultWidgetSet; +import com.itmill.toolkit.terminal.gwt.client.Paintable; +import com.itmill.toolkit.terminal.gwt.client.UIDL; + +public class CoverflowWidgetSet extends DefaultWidgetSet { + /** Creates a widget according to its class name. */ + public Paintable createWidget(UIDL uidl) { + final String className = resolveWidgetTypeName(uidl); + if ("com.itmill.toolkit.demo.coverflow.gwt.client.ui.ICoverflow" + .equals(className)) { + return new ICoverflow(); + } + + // Let the DefaultWidgetSet handle creation of default widgets + return super.createWidget(uidl); + } + + /** Resolves UIDL tag name to class name. */ + protected String resolveWidgetTypeName(UIDL uidl) { + final String tag = uidl.getTag(); + if ("cover".equals(tag)) { + return "com.itmill.toolkit.demo.coverflow.gwt.client.ui.ICoverflow"; + } + + // Let the DefaultWidgetSet handle resolution of default widgets + return super.resolveWidgetTypeName(uidl); + } +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/client/ui/ICoverflow.java b/src/com/itmill/toolkit/demo/coverflow/gwt/client/ui/ICoverflow.java new file mode 100644 index 0000000000..4a452f2ba2 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/client/ui/ICoverflow.java @@ -0,0 +1,336 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + +package com.itmill.toolkit.demo.coverflow.gwt.client.ui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTML; +import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; +import com.itmill.toolkit.terminal.gwt.client.Paintable; +import com.itmill.toolkit.terminal.gwt.client.UIDL; + +public class ICoverflow extends Composite implements Paintable { + private String uidlId; + protected ApplicationConnection client; + private ArrayList coverList = new ArrayList(); + + private Object _selected; + private boolean flashInited = false; + private HTML flash; + private boolean scrollbarVisibility = true; + private String backgroundGradientStart; + private String backgroundGradientEnd; + private boolean colorChanged = false; + private boolean sbVisibilityChanged = false; + private HashMap keyMap = new HashMap(); + + /** + * Constructor + */ + public ICoverflow() { + flash = new HTML(); + + initWidget(flash); + } + + /** + * This method accepts parses the uidl sent by the server + * + * @param UIDL + * uidl + * @param ApplicationConnection + * client + */ + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + // Store variables + uidlId = uidl.getId(); + this.client = client; + String tempColor; + + if (client.updateComponent(this, uidl, true)) { + return; + } + + // Has the scrollbar's visibility status changed? + if (uidl.hasAttribute("scrollbarVisibility")) { + boolean tempVis = uidl.getBooleanAttribute("scrollbarVisibility"); + if (scrollbarVisibility != tempVis) { + scrollbarVisibility = tempVis; + sbVisibilityChanged = true; + } + } + + // Has the start gradient changed? + if (uidl.hasAttribute("backgroundGradientStart")) { + tempColor = uidl.getStringAttribute("backgroundGradientStart") + .toString(); + if (tempColor != backgroundGradientStart) { + backgroundGradientStart = tempColor; + colorChanged = true; + } + } + + // Has the end gradient changed? + if (uidl.hasAttribute("backgroundGradientEnd")) { + tempColor = uidl.getStringAttribute("backgroundGradientEnd") + .toString(); + if (tempColor != backgroundGradientEnd) { + backgroundGradientEnd = tempColor; + colorChanged = true; + } + } + + final UIDL images = uidl.getChildUIDL(0); + + // Check which covers should be removed. This array list contains all + // current + // covers. We remove from this list all covers which are sent with the + // repainted + // uidl. All remaining covers in this list should be "old" ones and are + // should + // be deleted. + + ArrayList newList = new ArrayList(); + + // Iterate through all option elements + for (final Iterator i = images.getChildIterator(); i.hasNext();) { + final UIDL imgUidl = (UIDL) i.next(); + + // Make sure all required attributes exist + if (imgUidl.hasAttribute("caption") && imgUidl.hasAttribute("key") + && imgUidl.hasAttribute("icon")) { + HashMap set = new HashMap(); + + // Update the key map + keyMap.put(imgUidl.getStringAttribute("caption"), imgUidl + .getStringAttribute("key")); + + // Get information + + set.put("icon", client.translateToolkitUri(imgUidl + .getStringAttribute("icon"))); + set.put("caption", imgUidl.getStringAttribute("caption")); + + newList.add(set); + + // Is the current cover selected? + if (imgUidl.hasAttribute("selected")) { + _selected = imgUidl.getStringAttribute("caption"); + } + } + } + + // Deleted items + ArrayList intersectList = new ArrayList(); + intersectList.addAll(coverList); + intersectList.removeAll(newList); + + if (flashInited) { + for (int i = 0; i < intersectList.size(); i++) { + HashMap cover = (HashMap) intersectList.get(i); + removeCover(uidlId, cover.get("caption").toString()); + } + } + + // Added items + intersectList = new ArrayList(); + intersectList.addAll(newList); + intersectList.removeAll(coverList); + + if (flashInited) { + for (int i = 0; i < intersectList.size(); i++) { + HashMap cover = (HashMap) intersectList.get(i); + addCover(uidlId, cover.get("caption").toString(), cover.get( + "icon").toString()); + } + } + + coverList = newList; + + // Has the flash been initialized? + if (!flashInited) { + colorChanged = false; + setFlash(); + initializeMethods(uidlId); + } + + // Inform flash of the selected cover + if (_selected != null && flashInited) { + selectCover(uidlId, _selected.toString()); + } + + if (colorChanged && flashInited) { + setBackgroundColor(uidlId, backgroundGradientStart, + backgroundGradientEnd); + colorChanged = false; + } + + if (sbVisibilityChanged && flashInited) { + toggleScrollbarVisibility(uidlId, scrollbarVisibility); + sbVisibilityChanged = false; + } + + } + + /** + * Inform the server which cover is selected + * + * @param String + * coverKey + */ + public void setCover(String coverId) { + if (uidlId == null || client == null) { + return; + } + + client.updateVariable(uidlId, "selected", new String[] { keyMap.get( + coverId).toString() }, true); + } + + /** + * Initialize the native javascript functions needed for the flash <-> GWT + * communication + * + * @param String + * id + */ + public native void initializeMethods(String id) /*-{ + var app = this; + + if($wnd.itmill.coverflow == null) + var coverflow = []; + else + var coverflow = $wnd.itmill.coverflow; + + coverflow['getCovers_' + id] = function() { + app.@com.itmill.toolkit.demo.coverflow.gwt.client.ui.ICoverflow::getCovers()(); + }; + + coverflow['setCurrent_' + id] = function(selected) { + app.@com.itmill.toolkit.demo.coverflow.gwt.client.ui.ICoverflow::setCover(Ljava/lang/String;)(selected); + }; + + $wnd.itmill.coverflow = coverflow; + }-*/; + + /** + * This function sends all covers to the flash. We cannot do this directly + * in the updateFromUIDL method, because we cannot be sure if the flash has + * been loaded into the browser. The flash will call for this method when + * it's ready. + */ + public void getCovers() { + // Loop through all stored coves + for (int i = 0; i < coverList.size(); i++) { + HashMap set = (HashMap) coverList.get(i); + + try { + // Add the cover + addCover(uidlId, set.get("caption").toString(), set.get("icon") + .toString()); + } catch (Exception e) { + // Do not add covers lacking obligatory data + } + } + // The flash calls for this method, therefore we can be sure that the + // flash has been loaded + // into the browser. + flashInited = true; + + // Set selected cover + if (_selected != null) { + selectCover(uidlId, _selected.toString()); + } + } + + /** + * This function is a native javascript function which adds covers to the + * actual flash. This method works as a bridge between GWT and flash. + * + * @param id + * @param key + * @param caption + * @param icon + */ + public native void addCover(String id, String caption, String icon) /*-{ + try { + $doc['fxcoverflow' + id].addCover(caption.toString(), icon.toString()); + } + catch(e) { + $wnd.alert(e.message); + } + + }-*/; + + /** + * This function tells the flash which cover should be selected. + * + * @param id + * @param key + */ + public native void selectCover(String id, String key) /*-{ + $doc["fxcoverflow" + id].selectCover(key.toString()); + }-*/; + + public native void setBackgroundColor(String id, String startGradient, + String endGradient) /*-{ + $doc["fxcoverflow" + id].setBackgroundColor("0x" + startGradient.toString(), "0x" + endGradient.toString()); + }-*/; + + public native void toggleScrollbarVisibility(String id, boolean visibility) /*-{ + $doc["fxcoverflow" + id].toggleScrollbarVisibility(visibility); + }-*/; + + public native void removeCover(String id, String key) /*-{ + $doc["fxcoverflow" + id].removeCover(key); + }-*/; + + /** + * Set the HTML coding of the flash movie. This isn't done until the + * updateFromUIDL method is called for the first time. The reason is that we + * use an id from the UIDL to uniquely identify all instances of this + * widget. + */ + private void setFlash() { + String html = "<object id=\"fxcoverflow" + + uidlId + + "\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"100%\"" + + " height=\"100%\" codebase=\"http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\">" + + "<param name=\"movie\" value=\"" + + GWT.getModuleBaseURL() + + "coverflowflash.swf\">" + + "<param name=\"quality\" value=\"high\">" + + "<param name=\"flashVars\" value=\"pid=" + + uidlId + + "&sbVis=" + + scrollbarVisibility + + "&bgS=0x" + + backgroundGradientStart + + "&bgE=0x" + + backgroundGradientEnd + + "\" />" + + "<embed name=\"fxcoverflow" + + uidlId + + "\" flashVars=\"pid=" + + uidlId + + "&sbVis=" + + scrollbarVisibility + + "&bgS=0x" + + backgroundGradientStart + + "&bgE=0x" + + backgroundGradientEnd + + "\" src=\"" + + GWT.getModuleBaseURL() + + "coverflowflash.swf\" width=\"100%\" height=\"100%\" " + + "quality=\"high\" " + + "pluginspage=\"http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">" + + "</embed>" + "</object>"; + flash.setHTML(html); + } +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/Cover.as b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/Cover.as new file mode 100644 index 0000000000..61b08ead48 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/Cover.as @@ -0,0 +1,392 @@ +package { + import flash.events.Event; + import flash.display.Loader; + import flash.display.DisplayObject; + import flash.system.LoaderContext; + import flash.display.Bitmap; + import flash.display.BitmapData; + import flash.net.URLRequest; + import mx.controls.Alert; + + import flash.system.Security; + import flash.system.ApplicationDomain; + + import mx.controls.Image; + import mx.core.UIComponent; + import flash.geom.Matrix; + import flash.display.Sprite; + import flash.display.Shape; + import flash.display.Graphics; + import flash.display.GradientType; + import flash.geom.Rectangle; + import flash.geom.Point; + + import sandy.util.*; + + public class Cover extends UIComponent { + // Cover information + private var _caption:String; + private var _uri:String; + private var _imageLoaded:Boolean = false; + + // Actual content information + private var _bitmapData:BitmapData; + private var _bitmap:Bitmap; + private var _img:Image; + private var _distortedShape:Shape; + private var _reflectionBitmap:Bitmap; + private var _reflectionShape:Shape; + + + // Distort information + private var _realAngle:Number = -1; + private var _realScale:Number = -1; + private var _angle:Number = 0; + private var _scale:Number = 1; + private static const perspectiveConstant:Number = .15; + + + // Position information + private var _x:int; + private var _y:int; + + /** + * Constructor + */ + public function Cover(caption:String, uri:String) { + super(); + + // Set this element's size to 100% x 100% + super.percentHeight = 100; + super.percentWidth = 100; + + // Store input data + this._caption = caption; + this._uri = uri; + + // Initialize default image + this._img = new Image(); + this._img.percentHeight = 100; + this._img.percentWidth = 100; + this._bitmapData = new BitmapData(100,100,false, 0xffff0000); + + _distortedShape = new Shape(); + addChild(_distortedShape); + + _reflectionShape = new Shape(); + addChild(_reflectionShape); + + // Create the default image + this._img.source = this.getBitmap(); + + addChildAt(_img, 0); + } + + /** + * Load an image if it hasn't been loaded yet + */ + public function loadImage():void { + if(!_imageLoaded) { + // Create a loader to load the image + var request:URLRequest = new URLRequest(this._uri); + var imageLoader:Loader = new Loader(); + + // Check for restrictions + var imgLdrContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain); + imgLdrContext.checkPolicyFile = true; + + // Set an event listener + imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded); + + // Load the image + imageLoader.load(request, imgLdrContext); + } + } + + /** + * Event handler for image load completion + * @param Event event + */ + private function imgLoaded(event:Event):void { + // Check if we got the image + try { + removeChild(_img); + this._bitmapData = Bitmap(event.currentTarget.content).bitmapData; + + // Set new source for the image + this._img.source = this.getBitmap(); + addChildAt(_img, 0); + + _imageLoaded = true; + invalidateDisplayList(); + } + catch(error:Error) { + // An error occured + Alert.show(error.toString()); + } + } + + /** + * Measure the size of the image + */ + override protected function measure():void { + if(_img != null) + { + measuredHeight = _img.getExplicitOrMeasuredHeight(); + measuredWidth = _img.getExplicitOrMeasuredWidth(); + } + } + + /** + * Update the image on the display + */ + override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { + // Do this if and only iff the angle or the scale has changed. Otherwise we do not + // want to re-draw the image, only move it. + if(_img && (_realAngle != _angle || _realScale != _scale)) + { + var contentWidth:Number = _img.getExplicitOrMeasuredWidth(); + var contentHeight:Number= _img.getExplicitOrMeasuredHeight(); + + _img.setActualSize(contentWidth,contentHeight); + + _realAngle = _angle; + _realScale = _scale; + + // Distort the image + distortImage(_bitmap, _distortedShape, false); + + // Create a reflection + createReflectionBitmap(_bitmap); + } + } + + /** + * This function distorts the target according to its angle + * @param Bitmap bm - The bitmap of the object which is being distorted + * @param Shape target - The target where the distorted image is stored + * @param Boolean refelection - Is this target a reflection? + */ + private function distortImage(bm:Bitmap, target:Shape, reflection:Boolean):void { + // Turn the angle into a value between 0 and 1 + var k:Number = (Math.abs(_angle)/90); + k = Math.sqrt(k); + + var vShear:Number = (_angle >= 0)? k*-perspectiveConstant : k*perspectiveConstant; + var verticalOffset:Number; + + // How much is the width of the image scaled + var hScale:Number = 1 - k; + + // How much lower/higher are the corners "further away" than the one "closer" + verticalOffset = (_img.getExplicitOrMeasuredHeight()*vShear); + + // Is this image a reflection? If yes, then the vertical offset distortion is made in another direction + if(reflection) + verticalOffset *= -1; + + // Initialize the distortion class + var distort:DistortImage = new DistortImage(); + distort.container = target; + distort.target = bm; + distort.smooth = true; + distort.initialize( 5, 5, null ); + + // Distort the images to the left + if(_angle > 0) { + distort.setTransform( + 0,0, + _img.getExplicitOrMeasuredWidth()*hScale,-verticalOffset, + _img.getExplicitOrMeasuredWidth()*hScale,_img.getExplicitOrMeasuredHeight()+verticalOffset, + 0,_img.getExplicitOrMeasuredHeight() + ); + } + // Distort the images to the right + else if(_angle < 0) { + distort.setTransform( + 0,verticalOffset, + _img.getExplicitOrMeasuredWidth()*hScale,0, + _img.getExplicitOrMeasuredWidth()*hScale,_img.getExplicitOrMeasuredHeight(), + 0,_img.getExplicitOrMeasuredHeight()-verticalOffset + ); + } + distort.render(); + + // We use the original image as a reference, but do not want to show it on the screen + _img.visible = false; + + // Align the distorted image correctly + var m:Matrix = target.transform.matrix; + m.tx = 0 - _img.width/2* hScale; + target.transform.matrix = m; + } + + /** + * This function creates a reflection of the target object + * @param DisplayObject target + */ + private function createReflectionBitmap(target:DisplayObject):void { + // Size of the fade + var fadeSize:Number = 0.4; + + // Create a rectangle + var box:Rectangle = new Rectangle(0, 0, target.width, target.height); + + // Create a matrix for the gradient + var gradientMatrix: Matrix = new Matrix(); + // Create a shape object for the gradient + var gradientShape: Shape = new Shape(); + // Apply a gradient on the matrix + gradientMatrix.createGradientBox(target.width, target.height * fadeSize, Math.PI/2, 0, target.height * (1.0 - fadeSize)); + + // Fill the shape with the gradient + gradientShape.graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xFFFFFF], [0, 1], [0, 255], gradientMatrix); + gradientShape.graphics.drawRect(0, target.height * (1.0 - fadeSize), target.width, target.height * fadeSize); + gradientShape.graphics.endFill(); + + // Bitmap representation of the gradient + var gradientBm:BitmapData = new BitmapData(target.width, target.height, true, 0x00000000); + gradientBm.draw(gradientShape, new Matrix()); + + var targetBm:BitmapData = new BitmapData(target.width, target.height, true, 0x00000000); + targetBm.fillRect(box, 0x00000000); + targetBm.draw(target, new Matrix()); + + var reflectionData:BitmapData = new BitmapData(target.width, target.height, true, 0x00000000); + reflectionData.fillRect(box, 0x00000000); + reflectionData.copyPixels(targetBm, box, new Point(), gradientBm); + + // Store the reflection + _reflectionBitmap = new Bitmap(reflectionData); + + // Move the reflection to its correct position + var m:Matrix = _distortedShape.transform.matrix; + m.d = -1; + m.ty = _distortedShape.height*2; + _reflectionShape.transform.matrix = m; + + // Distort the reflection + distortImage(_reflectionBitmap, _reflectionShape, true); + + // Set a transparancy for the reflection + _reflectionShape.alpha = 0.4; + + } + + /** + * Get name + * @return String + */ + public function get caption():String { + return this._caption; + } + + /** + * Set name + * @param String name + */ + public function set caption(caption:String):void { + this._caption = caption; + } + + /** + * Get uri + * @return String + */ + public function get uri():String { + return this._uri; + } + + /** + * Set uri + * @param String uri + */ + public function set uri(uri:String):void { + this._uri = uri; + } + + /** + * Get the bitmap + * @return Bitmap + */ + public function getBitmap():Bitmap { + this._bitmap = new Bitmap(this._bitmapData); + return this._bitmap; + } + + /** + * Get the bitmap data + * @return BitmapData + */ + public function getBitmapData():BitmapData { + return this._bitmapData; + } + + /** + * Set the angle of the cover + * @param Number angle + */ + public function set angle(angle:Number):void { + this._angle = angle; + invalidateDisplayList(); + } + + /** + * Get the angle of the cover + * @return Number + */ + public function get angle():Number { + return this._angle; + } + + /** + * Set the x position of the cover + * @param Number x + */ + public function set xPos(x:Number):void { + this._x = x; + } + + /** + * Get the x position of the cover + * @return Number + */ + public function get xPos():Number { + return this._x; + } + + /** + * Set the y position of the cover + * @param Number y + */ + public function set yPos(y:Number):void { + this._y = y; + } + + /** + * Get the y position of the cover + * @return Number + */ + public function get yPos():Number { + return this._y; + } + + /** + * Set the scale of the cover + * @param Number scale + */ + public function set scale(scale:Number):void { + this._scale = scale; + } + + /** + * Get the scale position of the cover + * @return Number + */ + public function get scale():Number { + return this._scale; + } + + } +} +
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/Coverflow.as b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/Coverflow.as new file mode 100644 index 0000000000..38d924b7dd --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/Coverflow.as @@ -0,0 +1,598 @@ +package { + import flash.events.Event; + import flash.events.MouseEvent; + import flash.utils.Dictionary; + import flash.geom.Matrix; + + import mx.controls.Alert; + import mx.controls.Image; + import mx.controls.HScrollBar; + import mx.core.UIComponent; + import mx.core.Application; + import mx.effects.AnimateProperty; + import mx.effects.easing.Quadratic; + import flash.external.ExternalInterface; + import mx.events.ScrollEvent; + + public class Coverflow extends UIComponent { + // The scrollbar + private var _scrollbar:HScrollBar; + + // _coverList is an array containing all the coverflow objects + private var _coverList:Array = new Array(); + + // Which element is selected + private var _selected:int = -1; + + // Which element is currently being showed + private var _current:Number = 0; + + // How much space (in pixels) is there between each cover + private var _coverSpacing:int = 40; + + // A map between covers and their positions in the coverflow + private var _coverMap:Dictionary; + + // The angle in which the child covers are distorted + private static const _angle:int = 35; + + // The size of the child covers. The default value is 0.8 which means that + // the child covers are 80% of their maximum size + private static const _childScale:Number = 0.8; + + // All covers are scaled to the maximum. These two variables tell us how + // big a cover can be in maximum + private var _maxWidth:int; + private var _maxHeight:int; + + // An object which takes care of animations + private var _animation:AnimateProperty; + + // An object for event handling + private var _eventHandler:EventHandler = new EventHandler(); + + // The unique identifier of this instance of the widget + private var _pid:String; + + // Has the cover list's content changed? + private var _listChanged:Boolean = false; + + /** + * Constructor + */ + public function Coverflow():void { + super(); + + // Initialize the scrollbar + _scrollbar = new HScrollBar(); + _scrollbar.x = 0; + // Add an action listener to the scrollbar which detects when the + // scrollbar's position has been changed. This event should also + // change the selected cover's value + _scrollbar.addEventListener(ScrollEvent.SCROLL, function ():void { selectedCover = Math.round(_scrollbar.scrollPosition); }); + + // Maximize the size of the component + this.percentHeight = 100; + this.percentWidth = 100; + + } + + /** + * This function is called when the flash has finished loading. This + * function will intialize the communication interface between flash + * and GWT. + */ + private function init():void { + // Are we even able to initialize a external communication interface? + if (ExternalInterface.available) { + // These two methods are made available for javascript (they + // can be directly called within javascript code) + ExternalInterface.addCallback("addCover", this.addCover); + ExternalInterface.addCallback("selectCover", this.externalSetCover); + ExternalInterface.addCallback("setBackgroundColor", this.setBackgroundColor); + ExternalInterface.addCallback("toggleScrollbarVisibility", this.toggleScrollbarVisibility); + ExternalInterface.addCallback("removeCover", this.removeCover); + + // Try to call a javascript function + try { + // The function we want to call is getCovers. It tells javascript + // that the flash is now ready to accept information of the covers. + // The name of the function we're about to call is dynamic, meaning + // it is unique for every instance of this widget + ExternalInterface.call("itmill.coverflow['getCovers_" + _pid + "']"); + } catch (error:SecurityError) { + Alert.show("A SecurityError occurred: " + error.message + "\n"); + } catch (error:Error) { + Alert.show("An Error occurred: " + error.message + "\n"); + } + } else { + Alert.show("External interface is not available for this container."); + } + } + + /** + * Adds a new cover to the coverflow list + * @param String name + * @param String uri + */ + private function addCover(name:String, uri:String):void { + // Create an instance of the cover object + var cover:Cover = new Cover(name.toString(), uri.toString()); + + // Mark the list as being modified + _listChanged = true; + + // Load the image + cover.loadImage(); + // Add the cover to our array + _coverList.push(cover); + commitProperties(); + } + + /** + * Measure the size of this component + */ + override protected function measure():void { + super.measure(); + + // What is the maximum size of a cover? It is either 3/4 of the height of the component + // or 1/3 of the width - which ever is smaller. + _maxHeight = _maxWidth = Math.round(Math.min(this.width/3,this.height/4*3)); + } + + /** + * Creates the child elements (covers) + */ + override protected function createChildren():void { + super.createChildren(); + + for(var i:int = 0; i < _coverList.lenght; i++) + addChild(_coverList[i]); + + invalidateDisplayList(); + } + + /** + * Something has changed + */ + override protected function commitProperties():void { + // Remove all old covers + for(i = numChildren-1;i>=0;i--) { + removeChildAt(numChildren-1); + } + + // Create a new mapping between the covers and their position + _coverMap = new Dictionary(true); + + // Loop through the coverlist array + for(var i:int = 0;i<_coverList.length;i++) { + var cover:Cover = _coverList[i]; + // Make sure the cover is loaded + cover.loadImage(); + + // Add an event listener to the cover. We want to know when + // a cover is being clicked. + cover.addEventListener(MouseEvent.CLICK,selectEvent,false,0,true); + // Add the cover to the flash movie + addChildAt(cover,i); + + // Add this cover to the map + _coverMap[cover] = i; + } + + // Add the scrollbar on top of all other elements + addChild(_scrollbar); + + // Update the scrollbar's details + invalidateScrollbar(); + + // update screen + invalidateDisplayList(); + } + + /** + * This function draws the actual content of the flash movie + */ + override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { + if(_selected < 0) { + selectedCover = 0; + return; + } + + // Measure the size of the component + measure(); + // Update the scrollbar's details + invalidateScrollbar(); + + // Check if there are any new covers added to our array + if(_listChanged) { + _eventHandler.dispatchEvent(new Event(EventHandler.DATA_CHANGED)); + _listChanged = false; + } + + // If no covers exist, then do nothing + if(_coverList.length == 0) + return; + + + var cover:Cover; + var index:int = 0; + var m:Matrix; + + // Loop through all covers + for(var i:int=0; i < _coverList.length; i++) { + cover = _coverList[i]; + + // Calculate in which layer position the cover should be + index = (i <= Math.floor(_current))? i : _coverList.length-1-i; + + // Set the real size of the cover + cover.setActualSize(cover.getExplicitOrMeasuredWidth(),cover.getExplicitOrMeasuredHeight()); + + // Calculate in which angle the cover should be at this specific moment + calculateAngle(cover, i); + + // Set the covers layer position + setChildIndex(cover,index); + + // Calculate the cover's size (scale) + calculateScale(cover, i); + + // ...and finally calculate its position (horizontal position, that is) + calculatePosition(cover, i); + + // Resize the cover according to its scale value + m = cover.transform.matrix; + m.a = m.d = cover.scale; + cover.transform.matrix = m; + + // Move the cover to its correct position + cover.move(cover.xPos, cover.yPos); + + } + // Set selected cover on top of all other covers + setChildIndex(_coverList[Math.floor(_current)],_coverList.length-1); + } + + /** + * This function calulcates the position of a cover at any given moment. + * @param Cover c - Which cover is being processed + * @param int index - what is the cover's index (horizontal order number) + */ + private function calculatePosition(c:Cover, index:int):void { + // All covers are aligned so, that their bottom is at 3/4's height of the + // actual flash movie + c.yPos = Math.round(unscaledHeight/4*3-c.getExplicitOrMeasuredHeight()*c.scale); + + // Calculate the position difference between the currently selected item and + // this items index + var diff:Number = _current-index; + + // We want to know the previous and next positions of the item + var prevPos:Number; + var nextPos:Number; + + // We are currently processing a cover which comes from the left to the center (selected) + if(index == Math.floor(_current)) { + // Calculate the previous position + prevPos = unscaledWidth/2 - _maxWidth/2 - _coverSpacing; + // The next position is in the center of the screen + nextPos = unscaledWidth/2; + // Now calculate in which state of the animation we are + c.xPos = nextPos-diff*(nextPos-prevPos); + } + // Same as above, except now we come from right to center + else if(index == Math.ceil(_current)) { + prevPos = unscaledWidth/2; + nextPos = unscaledWidth/2 +_maxWidth/2 + _coverSpacing; + c.xPos = prevPos-diff*(nextPos-prevPos); + } + // Child covers to the left + else if(index < Math.floor(_current)){ + c.xPos = unscaledWidth/2 - _maxWidth/2 - diff*_coverSpacing; + } + // ..and child covers to the right + else { + c.xPos = unscaledWidth/2 +_maxWidth/2 - diff*_coverSpacing; + } + } + + /** + * Calulcates the angle of a cover at any given moment + * @param Cover c + * @param int index + */ + private function calculateAngle(c:Cover, index:int):void { + // This function has the same principle as the the function above + + var diff:Number; + + if(index == Math.floor(_current)) { + diff = _current-Math.floor(_current); + c.angle = _angle*diff; + } + else if(index == Math.ceil(_current)) { + diff = _current-Math.ceil(_current); + c.angle = _angle*diff; + } + else if(index < Math.floor(_current)) + c.angle = _angle; + else + c.angle = -_angle; + } + + /** + * Calculates the size (scale) of a cover at any given moment + * @param Cover c + * @param int index + */ + private function calculateScale(c:Cover, index:int):void { + // Almost same as calculatePosition, except that now we are + // calculating the scaled size of the cover + + var diff:Number = _current-index; + var scalePrev:Number; + var scaleNext:Number; + + if(index == Math.floor(_current)) { + scalePrev = maxScale(c.width, c.height)*_childScale; + scaleNext = maxScale(c.width, c.height); + c.scale = scaleNext-diff*(scaleNext-scalePrev); + } + else if(index == Math.ceil(_current)) { + scalePrev = maxScale(c.width, c.height); + scaleNext = maxScale(c.width, c.height)*_childScale; + c.scale = scalePrev-diff*(scaleNext-scalePrev); + } + else + c.scale = maxScale(c.width, c.height)*_childScale; + + + } + + /** + * Calculate the maximum scale of a cover + * @param Number w - The actual width of the cover + * @param Number h - The actual height of the cover + * @return Number + */ + private function maxScale(w:Number, h:Number):Number { + // The width of the cover is bigger than the height. This means that + // the width will be the restricting factor of this cover's size. + // Therefore we calculate the maximum size of this cover (result given + // as a scale) + if(w > h) + return _maxWidth/w; + + // Height is bigger than width. Same logic as above. + else + return _maxHeight/h; + } + + /** + * What happens when a user clicks on a cover? + * @param MouseEvent e + */ + private function selectEvent(e:MouseEvent):void { + // Use the mapping between the covers and their positions to + // find out which is the index of the cover that was clicked. + // Set this index as the new selected cover. + selectedCover = _coverMap[e.currentTarget]; + } + + /** + * Set the selected cover + * @param int index + */ + public function set selectedCover(index:int):void { + // The selected cover is already selected. Do nothing + if(index == _selected) + return; + + // Validate the index, make sure it's within the coverList's range + if(index >= 0 && index < _coverList.length) { + _selected = index; + + // Animate the changes + animateChange(); + } + } + + /** + * Returns the selected cover + * @return int + */ + public function get selectedCover():int { + return _selected; + } + + /** + * Set the current cover (which cover is actually being shown at this very moment. + * Note that the value can be a decimal value, because the selected cover can be for + * example 3.2, which means that it has moved 20% between the positions 3 and 4. + * @param Number i + */ + public function set current(i:Number):void { + // If ExternalInterface is available and the current cover + // is same as the currently selected cover (in other words, + // the animation has finished), then send the selected cover's + // key to GWT which will then forward it to the server. + if (ExternalInterface.available && i == _selected) { + ExternalInterface.call("itmill.coverflow['setCurrent_" + _pid + "']",_coverList[_selected].caption); + + // Send an event which notifies the scrollbar that the selected cover has changed. + _eventHandler.dispatchEvent(new Event(EventHandler.CURRENT_CHANGED)); + } + + // Update value + _current = i; + // Update display + invalidateDisplayList(); + } + + /** + * Get the value of current + * @return Number + */ + public function get current():Number { + return _current; + } + + /** + * This is a function where an external source can set the selected cover + * (in our case, it could be another widget which is connected to our + * coverflow). + * + * @param String index + */ + private function externalSetCover(id:String):void { + var cover:Cover; + for(var i:int=0; i < _coverList.length; i++) { + cover = _coverList[i]; + + if(cover.caption == id) { + selectedCover = i; + break; + } + } + } + + /** + * With this function we can remove any cover from the cover flow in run time + * + * @param String id + */ + private function removeCover(id:String):void { + var cover:Cover; + + // Loop through all covers and search the correct one + for(var i:int=0; i < _coverList.length; i++) { + cover = _coverList[i]; + + // If the cover's name matches with the given id, then delete it + if(cover.caption == id) { + // First we will however check if we are removing the last + // which is also currently selected + if(i == _coverList.length-1 && i == _selected) { + // Select the previous cover + selectedCover = i-1; + + // Jump to the end of the animation + if(_animation != null && _animation.isPlaying) + _animation.end(); + } + + // Mark the list as having changes + _listChanged = true; + + // Remove the cover from the list + _coverList.splice(i,1); + + // Update + commitProperties(); + break; + } + } + } + + /** + * Gives a references to the event handler + * @return EventHandler + */ + public function get eventHandler():EventHandler { + return _eventHandler; + } + + /** + * Tells us how many covers there are currently added + * @return int + */ + public function get coverCount():int { + return _coverList.length; + } + + /** + * Sets the unique identifier of this widget. This is used to create + * the dynamic function names in the external interface calls. + * @param String p + */ + public function set pid(p:String):void { + if(_pid == null) { + _pid = p; + init(); + } + } + + /** + * Set the background color of the coverflow + * @param String gradientStart + * @param String gradientEnd + */ + public function setBackgroundColor(gradientStart:String, gradientEnd:String):void { + Application.application.setStyle('backgroundGradientColors', [gradientStart, gradientEnd]); + } + + /** + * Make sure the scrollbar is up-to-date, both in size and position wise + */ + private function invalidateScrollbar():void { + _scrollbar.width = unscaledWidth; + _scrollbar.y = unscaledHeight-_scrollbar.getExplicitOrMeasuredHeight()/2; + _scrollbar.maxScrollPosition = coverCount-1; + _scrollbar.scrollPosition = _selected; + _scrollbar.pageSize = 1; + _scrollbar.invalidateDisplayList(); + } + + /** + * Change the visibility status of the scrollbar + * @param String visibility + */ + public function toggleScrollbarVisibility(visibility:String):void { + // Input is a string, because javascript can call directly on this function + if(visibility == "false") + _scrollbar.visible = false; + else + _scrollbar.visible = true; + } + + /** + * Animate the state changes + */ + private function animateChange():void { + // If there already is an animation in process, stop it (jump to the end) and start the new one. + if(_animation != null && _animation.isPlaying) + _animation.end(); + + // Set up a new animation. We want the "current" value go to the "_selected" value + _animation = new AnimateProperty(this); + _animation.property = "current"; + _animation.toValue = _selected; + _animation.target = this; + + // What is the duration of the animation? We don't want the animation to go too fast or too slow. + // An animation where the selected cover is changed with only one position should be relatively + // slow, so that we actually can se an animation. Therefore we've set a minimum length of the + // animation to 400 ms. If we jump over several covers, then we want the animation to be a + // bit longer, so that the animation would be smoother. Therefore we reserve 200ms between every + // cover change. Select which ever is bigger, 400ms or difference between current and selected + // cover * 200ms. + var duration:int = Math.max(400,Math.abs(Math.ceil(_current)-_selected)*200); + + // If we do long jumps (for example by using the slider), we don't want the animation to go + // too long. Therefore we're setting a maximum length for the animation, in this case 2 seconds. + duration = Math.min(2000,duration); + _animation.duration = duration; + + // We don't want the animation to be linear, we want it to slow down in the end + _animation.easingFunction = mx.effects.easing.Quadratic.easeOut; + + // Start the animation + _animation.play(); + } + + } + + +} +
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/EventHandler.as b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/EventHandler.as new file mode 100644 index 0000000000..f9d25be24d --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/EventHandler.as @@ -0,0 +1,16 @@ +package { + import flash.events.EventDispatcher; + import flash.events.Event; + + /** + * This is a simple class created for event handling. Basically it just + * dispatches some custom events related to state changes within the coverflow. + */ + public class EventHandler extends EventDispatcher { + // Events + public static var DATA_CHANGED:String = "data_changed"; + public static var CURRENT_CHANGED:String = "current_changed"; + + + } +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/coverflowflash.mxml b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/coverflowflash.mxml new file mode 100644 index 0000000000..612e8ba52f --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/coverflowflash.mxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> + +<mx:Application + xmlns:mx="http://www.adobe.com/2006/mxml" + horizontalAlign="center" verticalAlign="middle" + creationComplete="{ init(); }" + xmlns:custom="*" + paddingLeft="0" + paddingTop="10" + paddingBottom="0" + paddingRight="0" + > + + <mx:Script> + <![CDATA[ + import mx.controls.Alert; + + private var coverflow:Coverflow = new Coverflow(); + + private function init():void { + coverflow.setBackgroundColor(Application.application.parameters.bgS, Application.application.parameters.bgE); + coverflow.toggleScrollbarVisibility(Application.application.parameters.sbVis); + coverflow.pid = Application.application.parameters.pid; + + container.addChild(coverflow); + + } + + ]]> + </mx:Script> + + <mx:Box width="100%" height="100%" id="container" /> +</mx:Application> + diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/DistortImage.as b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/DistortImage.as new file mode 100644 index 0000000000..101e9e217c --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/DistortImage.as @@ -0,0 +1,306 @@ +/* +# ***** BEGIN LICENSE BLOCK ***** +Copyright the original author or authors. +Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.mozilla.org/MPL/MPL-1.1.html +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +# ***** END LICENSE BLOCK ***** +*/ + + +/* +**************************** +* From a first idea and first implementation of Andre Michelle www.andre-michelle.com +* @version 2.0 +* @author Thomas Pfeiffer - kiroukou - http://www.thomas-pfeiffer.info +* @author Richard Lester - RichL +* @author Didier Brun - foxy - http://www.foxaweb.com +* @author Alex Uhlmann +* @website: http://sandy.media-box.net +* @description: Tesselate a movieclip into several triangles to allow free transform distorsion. +*/ +package sandy.util +{ + import flash.display.BitmapData; + import flash.display.DisplayObject; + import flash.display.Shape; + import flash.display.Sprite; + import flash.geom.Matrix; + import flash.geom.Rectangle; + + public class DistortImage + { + public var smooth : Boolean; + // -- texture to distort + public var texture:BitmapData; + // -- container Sprite or Shape : the display object containing the distorted picture drawn via graphics. + + private var _container:Object; + public function get container() : Object + { + return _container; + } + + public function set container( value : Object ) : void + { + if( ( value is Shape ) || ( value is Sprite ) ) + { + _container = value; + } + else + { + throw new Error('container must be flash.display.Shape or flash.display.Sprite'); + } + } + + // -- target Object : either a BitmapData or a sprite + public var target:Object; + // -- arrays of differents datas types + public var points:Array; + + ///////////////////////// + /// PRIVATE PROPERTIES // + ///////////////////////// + private var offsetRect:Rectangle; + private var _w:Number; + private var _h:Number; + private var _xMin:Number; + private var _xMax:Number; + private var _yMin:Number + private var _yMax:Number; + // -- picture segmentation properties + private var _hseg:Number; + private var _vseg:Number; + private var _hsLen:Number; + private var _vsLen:Number; + private var _tri:Array; + private var _aMcs:Array; + + public function DistortImage() + { + smooth = true; + } + + /* + * @param vseg Number : the vertical precision + * @param hseg Number : the horizontal precision + * @param offsetRect Rectangle : optional, the real bounds to use. + * @throws: An error if target property isn't a BitmapData or a DisplayObject + */ + public function initialize( vseg: Number, hseg: Number, offsetRect: Rectangle = null ) : void + { + if( target is BitmapData ) + { + texture = target as BitmapData; + _w = texture.width; + _h = texture.height; + } + else if( target is DisplayObject ) + { + renderVector( offsetRect ); + } + else + { + throw new Error('target must be flash.display.BitmapData or flash.display.DisplayObject'); + } + _vseg = vseg || 0; + _hseg = hseg || 0; + + // -- + _aMcs = new Array(); + points = new Array(); + _tri = new Array(); + // -- + __init(); + } + + public function render() : void + { + __render(); + } + + /** + * setTransform + * + * @param x0 Number the horizontal coordinate of the first point + * @param y0 Number the vertical coordinate of the first point + * @param x1 Number the horizontal coordinate of the second point + * @param y1 Number the vertical coordinate of the second point + * @param x2 Number the horizontal coordinate of the third point + * @param y2 Number the vertical coordinate of the third point + * @param x3 Number the horizontal coordinate of the fourth point + * @param y3 Number the vertical coordinate of the fourth point + * + * @description : Distort the bitmap to adjust it to those points. + */ + public function setTransform( x0:Number , y0:Number , + x1:Number , y1:Number , + x2:Number , y2:Number , + x3:Number , y3:Number ): void + { + var w:Number = _w; + var h:Number = _h; + var dx30:Number = x3 - x0; + var dy30:Number = y3 - y0; + var dx21:Number = x2 - x1; + var dy21:Number = y2 - y1; + var l:int = points.length; + while( --l > -1 ) + { + var point:SandyPoint = points[ l ]; + var gx:Number = ( point.x - _xMin ) / w; + var gy:Number = ( point.y - _yMin ) / h; + var bx:Number = x0 + gy * ( dx30 ); + var by:Number = y0 + gy * ( dy30 ); + + point.sx = bx + gx * ( ( x1 + gy * ( dx21 ) ) - bx ); + point.sy = by + gx * ( ( y1 + gy * ( dy21 ) ) - by ); + } + __render(); + } + + + + ///////////////////////// + /// PRIVATE METHODS /// + ///////////////////////// + + private function renderVector( offsetRect: Rectangle = null ) : void + { + var vector : DisplayObject = target as DisplayObject; + if( offsetRect != null ) + { + texture = new BitmapData( offsetRect.width , offsetRect.height, true, 0x00000000 ); + } + else + { + texture = new BitmapData( vector.width , vector.height, true, 0x00000000 ); + offsetRect = new Rectangle( 0, 0, texture.width, texture.height ); + } + + var m : Matrix = new Matrix(); + m.translate( offsetRect.x * -1, offsetRect.y * -1 ); + texture.draw( vector, m ); + container.transform.matrix.translate( vector.transform.matrix.tx, vector.transform.matrix.ty ); + _w = offsetRect.width; + _h = offsetRect.height; + } + + private function __init(): void + { + points = new Array(); + _tri = new Array(); + var ix:int, iy:int; + var w2: Number = _w / 2; + var h2: Number = _h / 2; + _xMin = _yMin = 0; + _xMax = _w; _yMax = _h; + _hsLen = _w / ( _hseg + 1 ); + _vsLen = _h / ( _vseg + 1 ); + var x:Number, y:Number; + var p0:SandyPoint, p1:SandyPoint, p2:SandyPoint; + + // -- we create the points + for ( ix = 0 ; ix < _hseg + 2 ; ix++ ) + { + for ( iy = 0 ; iy < _vseg + 2 ; iy++ ) + { + x = ix * _hsLen; + y = iy * _vsLen; + points.push( new SandyPoint( x, y, x, y ) ); + } + } + // -- we create the triangles + for ( ix = 0 ; ix < _vseg + 1 ; ix++ ) + { + for ( iy = 0 ; iy < _hseg + 1 ; iy++ ) + { + p0 = points[ iy + ix * ( _hseg + 2 ) ]; + p1 = points[ iy + ix * ( _hseg + 2 ) + 1 ]; + p2 = points[ iy + ( ix + 1 ) * ( _hseg + 2 ) ]; + __addTriangle( p0, p1, p2 ); + // -- + p0 = points[ iy + ( ix + 1 ) * ( _vseg + 2 ) + 1 ]; + p1 = points[ iy + ( ix + 1 ) * ( _vseg + 2 ) ]; + p2 = points[ iy + ix * ( _vseg + 2 ) + 1 ]; + __addTriangle( p0, p1, p2 ); + } + } + } + + private function __addTriangle( p0:SandyPoint, p1:SandyPoint, p2:SandyPoint ):void + { + var u0:Number, v0:Number, u1:Number, v1:Number, u2:Number, v2:Number; + var tMat:Matrix = new Matrix(); + // -- + u0 = p0.x; v0 = p0.y; + u1 = p1.x; v1 = p1.y; + u2 = p2.x; v2 = p2.y; + tMat.tx = -v0*(_w / (v1 - v0)); + tMat.ty = -u0*(_h / (u2 - u0)); + tMat.a = tMat.d = 0; + tMat.b = _h / (u2 - u0); + tMat.c = _w / (v1 - v0); + // -- + _tri.push( new Triangle( p0, p1, p2, tMat ) ); + } + + private function __render(): void + { + var vertices: Array; + var p0:SandyPoint, p1:SandyPoint, p2:SandyPoint; + var x0:Number, y0:Number; + var ih:Number = 1/_h, iw:Number = 1/_w; + var c:Object = container; c.graphics.clear(); + var a:Triangle; + var sM:Matrix = new Matrix(); + var tM:Matrix = new Matrix(); + //-- + var l:int = _tri.length; + while( --l > -1 ) + { + a = _tri[ l ]; + p0 = a.p0; + p1 = a.p1; + p2 = a.p2; + tM = a.tMat; + // -- + sM.a = ( p1.sx - ( x0 = p0.sx ) ) * iw; + sM.b = ( p1.sy - ( y0 = p0.sy ) ) * iw; + sM.c = ( p2.sx - x0 ) * ih; + sM.d = ( p2.sy - y0 ) * ih; + sM.tx = x0; + sM.ty = y0; + // -- + sM = __concat( sM, tM ); + + c.graphics.beginBitmapFill( texture, sM, false, smooth ); + c.graphics.moveTo( x0, y0 ); + c.graphics.lineTo( p1.sx, p1.sy ); + c.graphics.lineTo( p2.sx, p2.sy ); + c.graphics.endFill(); + } + } + + private function __concat( m1:Matrix, m2:Matrix ):Matrix + { + //Relies on the original triangles being right angled with p0 being the right angle. + //Therefore a = d = zero (before and after invert) + var mat : Matrix = new Matrix(); + mat.a = m1.c * m2.b; + mat.b = m1.d * m2.b; + mat.c = m1.a * m2.c; + mat.d = m1.b * m2.c; + mat.tx = m1.a * m2.tx + m1.c * m2.ty + m1.tx; + mat.ty = m1.b * m2.tx + m1.d * m2.ty + m1.ty; + return mat; + } + } +} diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/SandyPoint.as b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/SandyPoint.as new file mode 100644 index 0000000000..7d5c52ca0c --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/SandyPoint.as @@ -0,0 +1,17 @@ +package sandy.util
+{
+ import flash.geom.Point;
+
+ public class SandyPoint extends Point
+ {
+ public var sx : Number;
+ public var sy : Number;
+
+ public function SandyPoint( x : Number, y : Number, sx : Number, sy : Number )
+ {
+ super( x, y );
+ this.sx = sx;
+ this.sy = sy;
+ }
+ }
+}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/Triangle.as b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/Triangle.as new file mode 100644 index 0000000000..8f08fb6c76 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/flex/sandy/util/Triangle.as @@ -0,0 +1,20 @@ +package sandy.util
+{
+ import flash.geom.Matrix;
+
+ public class Triangle
+ {
+ public var p0 : SandyPoint;
+ public var p1 : SandyPoint;
+ public var p2 : SandyPoint;
+ public var tMat : Matrix;
+
+ public function Triangle( p0 : SandyPoint, p1 : SandyPoint, p2 : SandyPoint, tMat : Matrix )
+ {
+ this.p0 = p0;
+ this.p1 = p1
+ this.p2 = p2;
+ this.tMat = tMat;
+ }
+ }
+}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/coverflow/gwt/public/coverflowflash.swf b/src/com/itmill/toolkit/demo/coverflow/gwt/public/coverflowflash.swf Binary files differnew file mode 100644 index 0000000000..f3c75f4fe3 --- /dev/null +++ b/src/com/itmill/toolkit/demo/coverflow/gwt/public/coverflowflash.swf diff --git a/src/com/itmill/toolkit/demo/m-bullet-blue.gif b/src/com/itmill/toolkit/demo/m-bullet-blue.gif Binary files differdeleted file mode 100644 index fa6b38b4c9..0000000000 --- a/src/com/itmill/toolkit/demo/m-bullet-blue.gif +++ /dev/null diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/AddressBookApplication.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/AddressBookApplication.java new file mode 100644 index 0000000000..b2c38170d6 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/AddressBookApplication.java @@ -0,0 +1,244 @@ +/* +@ITMillApache2LicenseForJavaFiles@ + */ + +package com.itmill.toolkit.demo.tutorial.addressbook; + +import com.itmill.toolkit.Application; +import com.itmill.toolkit.data.Item; +import com.itmill.toolkit.data.Property; +import com.itmill.toolkit.data.Property.ValueChangeEvent; +import com.itmill.toolkit.data.Property.ValueChangeListener; +import com.itmill.toolkit.demo.tutorial.addressbook.data.PersonContainer; +import com.itmill.toolkit.demo.tutorial.addressbook.data.SearchFilter; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.HelpWindow; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.ListView; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.NavigationTree; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.PersonForm; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.PersonList; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.SearchView; +import com.itmill.toolkit.demo.tutorial.addressbook.ui.SharingOptions; +import com.itmill.toolkit.event.ItemClickEvent; +import com.itmill.toolkit.event.ItemClickEvent.ItemClickListener; +import com.itmill.toolkit.terminal.ThemeResource; +import com.itmill.toolkit.ui.Alignment; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Component; +import com.itmill.toolkit.ui.Embedded; +import com.itmill.toolkit.ui.HorizontalLayout; +import com.itmill.toolkit.ui.SplitPanel; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; +import com.itmill.toolkit.ui.Button.ClickListener; +import com.itmill.toolkit.ui.Window.Notification; + +public class AddressBookApplication extends Application implements + ClickListener, ValueChangeListener, ItemClickListener { + + private NavigationTree tree = new NavigationTree(this); + + private Button newContact = new Button("Add contact"); + private Button search = new Button("Search"); + private Button share = new Button("Share"); + private Button help = new Button("Help"); + private SplitPanel horizontalSplit = new SplitPanel( + SplitPanel.ORIENTATION_HORIZONTAL); + + // Lazyly created ui references + private ListView listView = null; + private SearchView searchView = null; + private PersonList personList = null; + private PersonForm personForm = null; + private HelpWindow helpWindow = null; + private SharingOptions sharingOptions = null; + + private PersonContainer dataSource = PersonContainer.createWithTestData(); + + @Override + public void init() { + buildMainLayout(); + setMainComponent(getListView()); + } + + private void buildMainLayout() { + setMainWindow(new Window("Address Book Demo application")); + + setTheme("contacts"); + + VerticalLayout layout = new VerticalLayout(); + layout.setSizeFull(); + + layout.addComponent(createToolbar()); + layout.addComponent(horizontalSplit); + layout.setExpandRatio(horizontalSplit, 1); + + horizontalSplit.setSplitPosition(200, SplitPanel.UNITS_PIXELS); + horizontalSplit.setFirstComponent(tree); + + getMainWindow().setLayout(layout); + } + + private HorizontalLayout createToolbar() { + HorizontalLayout lo = new HorizontalLayout(); + lo.addComponent(newContact); + lo.addComponent(search); + lo.addComponent(share); + lo.addComponent(help); + + search.addListener((ClickListener) this); + share.addListener((ClickListener) this); + help.addListener((ClickListener) this); + newContact.addListener((ClickListener) this); + + search.setIcon(new ThemeResource("icons/32/folder-add.png")); + share.setIcon(new ThemeResource("icons/32/users.png")); + help.setIcon(new ThemeResource("icons/32/help.png")); + newContact.setIcon(new ThemeResource("icons/32/document-add.png")); + + lo.setMargin(true); + lo.setSpacing(true); + + lo.setStyleName("toolbar"); + + lo.setWidth("100%"); + + Embedded em = new Embedded("", new ThemeResource("images/logo.png")); + lo.addComponent(em); + lo.setComponentAlignment(em, Alignment.MIDDLE_RIGHT); + lo.setExpandRatio(em, 1); + + return lo; + } + + private void setMainComponent(Component c) { + horizontalSplit.setSecondComponent(c); + } + + /* + * View getters exist so we can lazily generate the views, resulting in + * faster application startup time. + */ + private ListView getListView() { + if (listView == null) { + personList = new PersonList(this); + personForm = new PersonForm(this); + listView = new ListView(personList, personForm); + } + return listView; + } + + private SearchView getSearchView() { + if (searchView == null) { + searchView = new SearchView(this); + } + return searchView; + } + + private HelpWindow getHelpWindow() { + if (helpWindow == null) { + helpWindow = new HelpWindow(); + } + return helpWindow; + } + + private SharingOptions getSharingOptions() { + if (sharingOptions == null) { + sharingOptions = new SharingOptions(); + } + return sharingOptions; + } + + public PersonContainer getDataSource() { + return dataSource; + } + + public void buttonClick(ClickEvent event) { + final Button source = event.getButton(); + + if (source == search) { + showSearchView(); + } else if (source == help) { + showHelpWindow(); + } else if (source == share) { + showShareWindow(); + } else if (source == newContact) { + addNewContanct(); + } + } + + private void showHelpWindow() { + getMainWindow().addWindow(getHelpWindow()); + } + + private void showShareWindow() { + getMainWindow().addWindow(getSharingOptions()); + } + + private void showListView() { + setMainComponent(getListView()); + } + + private void showSearchView() { + setMainComponent(getSearchView()); + } + + public void valueChange(ValueChangeEvent event) { + Property property = event.getProperty(); + if (property == personList) { + Item item = personList.getItem(personList.getValue()); + if (item != personForm.getItemDataSource()) { + personForm.setItemDataSource(item); + } + } + } + + public void itemClick(ItemClickEvent event) { + if (event.getSource() == tree) { + Object itemId = event.getItemId(); + if (itemId != null) { + if (itemId == NavigationTree.SHOW_ALL) { + // clear previous filters + getDataSource().removeAllContainerFilters(); + showListView(); + } else if (itemId == NavigationTree.SEARCH) { + showSearchView(); + } else if (itemId instanceof SearchFilter) { + search((SearchFilter) itemId); + } + } + } + } + + private void addNewContanct() { + showListView(); + personForm.addContact(); + } + + public void search(SearchFilter searchFilter) { + // clear previous filters + getDataSource().removeAllContainerFilters(); + // filter contacts with given filter + getDataSource().addContainerFilter(searchFilter.getPropertyId(), + searchFilter.getTerm(), true, false); + showListView(); + + getMainWindow().showNotification( + "Searched for " + searchFilter.getPropertyId() + "=*" + + searchFilter.getTerm() + "*, found " + + getDataSource().size() + " item(s).", + Notification.TYPE_TRAY_NOTIFICATION); + } + + public void saveSearch(SearchFilter searchFilter) { + tree.addItem(searchFilter); + tree.setParent(searchFilter, NavigationTree.SEARCH); + // mark the saved search as a leaf (cannot have children) + tree.setChildrenAllowed(searchFilter, false); + // make sure "Search" is expanded + tree.expandItem(NavigationTree.SEARCH); + // select the saved search + tree.setValue(searchFilter); + } + +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/data/Person.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/data/Person.java new file mode 100644 index 0000000000..02f670f4f4 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/data/Person.java @@ -0,0 +1,117 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.data; + +public class Person { + private String firstName = ""; + private String lastName = ""; + private String email = ""; + private String phoneNumber = ""; + private String streetAddress = ""; + private Integer postalCode = null; + private String city = ""; + + /** + * @return the firstName + */ + public String getFirstName() { + return firstName; + } + + /** + * @param firstName + * the firstName to set + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + * @return the lastName + */ + public String getLastName() { + return lastName; + } + + /** + * @param lastName + * the lastName to set + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email + * the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the phoneNumber + */ + public String getPhoneNumber() { + return phoneNumber; + } + + /** + * @param phoneNumber + * the phoneNumber to set + */ + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + /** + * @return the streetAddress + */ + public String getStreetAddress() { + return streetAddress; + } + + /** + * @param streetAddress + * the streetAddress to set + */ + public void setStreetAddress(String streetAddress) { + this.streetAddress = streetAddress; + } + + /** + * @return the postalCode + */ + public Integer getPostalCode() { + return postalCode; + } + + /** + * @param postalCode + * the postalCode to set + */ + public void setPostalCode(Integer postalCode) { + this.postalCode = postalCode; + } + + /** + * @return the city + */ + public String getCity() { + return city; + } + + /** + * @param city + * the city to set + */ + public void setCity(String city) { + this.city = city; + } + +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/data/PersonContainer.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/data/PersonContainer.java new file mode 100644 index 0000000000..b627f7e039 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/data/PersonContainer.java @@ -0,0 +1,91 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.data; + +import java.util.Random; + +import com.itmill.toolkit.data.util.BeanItemContainer; + +public class PersonContainer extends BeanItemContainer<Person> { + + /** + * Natural property order for Person bean. Used in tables and forms. + */ + public static final Object[] NATURAL_COL_ORDER = new Object[] { + "firstName", "lastName", "email", "phoneNumber", "streetAddress", + "postalCode", "city" }; + + /** + * "Human readable" captions for properties in same order as in + * NATURAL_COL_ORDER. + */ + public static final String[] COL_HEADERS_ENGLISH = new String[] { + "First name", "Last name", "Email", "Phone number", + "Street Address", "Postal Code", "City" }; + + public PersonContainer() throws InstantiationException, + IllegalAccessException { + super(Person.class); + } + + public static PersonContainer createWithTestData() { + final String[] fnames = { "Peter", "Alice", "Joshua", "Mike", "Olivia", + "Nina", "Alex", "Rita", "Dan", "Umberto", "Henrik", "Rene", + "Lisa", "Marge" }; + final String[] lnames = { "Smith", "Gordon", "Simpson", "Brown", + "Clavel", "Simons", "Verne", "Scott", "Allison", "Gates", + "Rowling", "Barks", "Ross", "Schneider", "Tate" }; + final String cities[] = { "Amsterdam", "Berlin", "Helsinki", + "Hong Kong", "London", "Luxemburg", "New York", "Oslo", + "Paris", "Rome", "Stockholm", "Tokyo", "Turku" }; + final String streets[] = { "4215 Blandit Av.", "452-8121 Sem Ave", + "279-4475 Tellus Road", "4062 Libero. Av.", "7081 Pede. Ave", + "6800 Aliquet St.", "P.O. Box 298, 9401 Mauris St.", + "161-7279 Augue Ave", "P.O. Box 496, 1390 Sagittis. Rd.", + "448-8295 Mi Avenue", "6419 Non Av.", + "659-2538 Elementum Street", "2205 Quis St.", + "252-5213 Tincidunt St.", "P.O. Box 175, 4049 Adipiscing Rd.", + "3217 Nam Ave", "P.O. Box 859, 7661 Auctor St.", + "2873 Nonummy Av.", "7342 Mi, Avenue", + "539-3914 Dignissim. Rd.", "539-3675 Magna Avenue", + "Ap #357-5640 Pharetra Avenue", "416-2983 Posuere Rd.", + "141-1287 Adipiscing Avenue", "Ap #781-3145 Gravida St.", + "6897 Suscipit Rd.", "8336 Purus Avenue", "2603 Bibendum. Av.", + "2870 Vestibulum St.", "Ap #722 Aenean Avenue", + "446-968 Augue Ave", "1141 Ultricies Street", + "Ap #992-5769 Nunc Street", "6690 Porttitor Avenue", + "Ap #105-1700 Risus Street", + "P.O. Box 532, 3225 Lacus. Avenue", "736 Metus Street", + "414-1417 Fringilla Street", "Ap #183-928 Scelerisque Road", + "561-9262 Iaculis Avenue" }; + PersonContainer c = null; + Random r = new Random(0); + try { + c = new PersonContainer(); + for (int i = 0; i < 100; i++) { + Person p = new Person(); + p.setFirstName(fnames[r.nextInt(fnames.length)]); + p.setLastName(lnames[r.nextInt(lnames.length)]); + p.setCity(cities[r.nextInt(cities.length)]); + p.setEmail(p.getFirstName().toLowerCase() + "." + + p.getLastName().toLowerCase() + "@itmill.com"); + p.setPhoneNumber("+358 02 555 " + r.nextInt(10) + r.nextInt(10) + + r.nextInt(10) + r.nextInt(10)); + int n = r.nextInt(100000); + if (n < 10000) { + n += 10000; + } + p.setPostalCode(n); + p.setStreetAddress(streets[r.nextInt(streets.length)]); + c.addItem(p); + } + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return c; + } + +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/data/SearchFilter.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/data/SearchFilter.java new file mode 100644 index 0000000000..137917a341 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/data/SearchFilter.java @@ -0,0 +1,41 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.data; + +public class SearchFilter { + + private final String term; + private final Object propertyId; + private String searchName; + + public SearchFilter(Object propertyId, String searchTerm, String name) { + this.propertyId = propertyId; + this.term = searchTerm; + this.searchName = name; + } + + /** + * @return the term + */ + public String getTerm() { + return term; + } + + /** + * @return the propertyId + */ + public Object getPropertyId() { + return propertyId; + } + + /** + * @return the name of the search + */ + public String getSearchName() { + return searchName; + } + + @Override + public String toString() { + return getSearchName(); + } + +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/HelpWindow.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/HelpWindow.java new file mode 100644 index 0000000000..d5c08721d4 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/HelpWindow.java @@ -0,0 +1,17 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.Window; + +public class HelpWindow extends Window { + private static final String HELP_HTML_SNIPPET = "This is " + + "an application built during <strong><a href=\"" + + "http://dev.itmill.com/\">Toolkit</a></strong> " + + "tutorial. Hopefully it don't need any real help."; + + public HelpWindow() { + setCaption("Address Book help"); + addComponent(new Label(HELP_HTML_SNIPPET, Label.CONTENT_XHTML)); + } + +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/ListView.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/ListView.java new file mode 100644 index 0000000000..4f5425d39d --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/ListView.java @@ -0,0 +1,12 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import com.itmill.toolkit.ui.SplitPanel; + +public class ListView extends SplitPanel { + public ListView(PersonList personList, PersonForm personForm) { + addStyleName("view"); + setFirstComponent(personList); + setSecondComponent(personForm); + setSplitPosition(40); + } +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/NavigationTree.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/NavigationTree.java new file mode 100644 index 0000000000..c44d27b9ca --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/NavigationTree.java @@ -0,0 +1,28 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import com.itmill.toolkit.demo.tutorial.addressbook.AddressBookApplication; +import com.itmill.toolkit.event.ItemClickEvent.ItemClickListener; +import com.itmill.toolkit.ui.Tree; + +public class NavigationTree extends Tree { + public static final Object SHOW_ALL = "Show all"; + public static final Object SEARCH = "Search"; + + public NavigationTree(AddressBookApplication app) { + addItem(SHOW_ALL); + addItem(SEARCH); + + setChildrenAllowed(SHOW_ALL, false); + + /* + * We want items to be selectable but do not want the user to be able to + * de-select an item. + */ + setSelectable(true); + setNullSelectionAllowed(false); + + // Make application handle item click events + addListener((ItemClickListener) app); + + } +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/PersonForm.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/PersonForm.java new file mode 100644 index 0000000000..f7f9e0aa77 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/PersonForm.java @@ -0,0 +1,176 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import com.itmill.toolkit.data.Item; +import com.itmill.toolkit.data.util.BeanItem; +import com.itmill.toolkit.demo.tutorial.addressbook.AddressBookApplication; +import com.itmill.toolkit.demo.tutorial.addressbook.data.Person; +import com.itmill.toolkit.demo.tutorial.addressbook.data.PersonContainer; +import com.itmill.toolkit.demo.tutorial.addressbook.validators.EmailValidator; +import com.itmill.toolkit.demo.tutorial.addressbook.validators.PostalCodeValidator; +import com.itmill.toolkit.ui.BaseFieldFactory; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.ComboBox; +import com.itmill.toolkit.ui.Component; +import com.itmill.toolkit.ui.Field; +import com.itmill.toolkit.ui.Form; +import com.itmill.toolkit.ui.HorizontalLayout; +import com.itmill.toolkit.ui.TextField; +import com.itmill.toolkit.ui.Button.ClickEvent; +import com.itmill.toolkit.ui.Button.ClickListener; + +public class PersonForm extends Form implements ClickListener { + + private Button save = new Button("Save", (ClickListener) this); + private Button cancel = new Button("Cancel", (ClickListener) this); + private Button edit = new Button("Edit", (ClickListener) this); + private final ComboBox cities = new ComboBox("City"); + + private AddressBookApplication app; + private boolean newContactMode = false; + private Person newPerson = null; + + public PersonForm(AddressBookApplication app) { + this.app = app; + + /* + * Enable buffering so that commit() must be called for the form before + * input is written to the data. (Form input is not written immediately + * through to the underlying object.) + */ + setWriteThrough(false); + + HorizontalLayout footer = new HorizontalLayout(); + footer.setSpacing(true); + footer.addComponent(save); + footer.addComponent(cancel); + footer.addComponent(edit); + footer.setVisible(false); + + setFooter(footer); + + /* Allow the user to enter new cities */ + cities.setNewItemsAllowed(true); + /* We do not want to use null values */ + cities.setNullSelectionAllowed(false); + /* Add an empty city used for selecting no city */ + cities.addItem(""); + + /* Populate cities select using the cities in the data container */ + PersonContainer ds = app.getDataSource(); + for (Iterator<Person> it = ds.getItemIds().iterator(); it.hasNext();) { + String city = (it.next()).getCity(); + cities.addItem(city); + } + + /* + * Field factory for overriding how the component for city selection is + * created + */ + setFieldFactory(new BaseFieldFactory() { + @Override + public Field createField(Item item, Object propertyId, + Component uiContext) { + if (propertyId.equals("city")) { + cities.setWidth("200px"); + return cities; + } + + Field field = super.createField(item, propertyId, uiContext); + if (propertyId.equals("postalCode")) { + TextField tf = (TextField) field; + /* + * We do not want to display "null" to the user when the + * field is empty + */ + tf.setNullRepresentation(""); + + /* Add a validator for postalCode and make it required */ + tf.addValidator(new PostalCodeValidator()); + tf.setRequired(true); + } else if (propertyId.equals("email")) { + /* Add a validator for email and make it required */ + field.addValidator(new EmailValidator()); + field.setRequired(true); + + } + + field.setWidth("200px"); + return field; + } + }); + } + + public void buttonClick(ClickEvent event) { + Button source = event.getButton(); + + if (source == save) { + /* If the given input is not valid there is no point in continuing */ + if (!isValid()) { + return; + } + + commit(); + if (newContactMode) { + /* We need to add the new person to the container */ + Item addedItem = app.getDataSource().addItem(newPerson); + /* + * We must update the form to use the Item from our datasource + * as we are now in edit mode (no longer in add mode) + */ + setItemDataSource(addedItem); + + newContactMode = false; + } + setReadOnly(true); + } else if (source == cancel) { + if (newContactMode) { + newContactMode = false; + /* Clear the form and make it invisible */ + setItemDataSource(null); + } else { + discard(); + } + setReadOnly(true); + } else if (source == edit) { + setReadOnly(false); + } + } + + @Override + public void setItemDataSource(Item newDataSource) { + newContactMode = false; + + if (newDataSource != null) { + List<Object> orderedProperties = Arrays + .asList(PersonContainer.NATURAL_COL_ORDER); + super.setItemDataSource(newDataSource, orderedProperties); + + setReadOnly(true); + getFooter().setVisible(true); + } else { + super.setItemDataSource(null); + getFooter().setVisible(false); + } + } + + @Override + public void setReadOnly(boolean readOnly) { + super.setReadOnly(readOnly); + save.setVisible(!readOnly); + cancel.setVisible(!readOnly); + edit.setVisible(readOnly); + } + + public void addContact() { + // Create a temporary item for the form + newPerson = new Person(); + setItemDataSource(new BeanItem(newPerson)); + newContactMode = true; + setReadOnly(false); + } + +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/PersonList.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/PersonList.java new file mode 100644 index 0000000000..12007683be --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/PersonList.java @@ -0,0 +1,45 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import com.itmill.toolkit.demo.tutorial.addressbook.AddressBookApplication; +import com.itmill.toolkit.demo.tutorial.addressbook.data.Person; +import com.itmill.toolkit.demo.tutorial.addressbook.data.PersonContainer; +import com.itmill.toolkit.terminal.ExternalResource; +import com.itmill.toolkit.ui.Component; +import com.itmill.toolkit.ui.Link; +import com.itmill.toolkit.ui.Table; + +public class PersonList extends Table { + public PersonList(AddressBookApplication app) { + setSizeFull(); + setContainerDataSource(app.getDataSource()); + + setVisibleColumns(PersonContainer.NATURAL_COL_ORDER); + setColumnHeaders(PersonContainer.COL_HEADERS_ENGLISH); + + setColumnCollapsingAllowed(true); + setColumnReorderingAllowed(true); + + /* + * Make table selectable, react immediatedly to user events, and pass + * events to the controller (our main application) + */ + setSelectable(true); + setImmediate(true); + addListener((ValueChangeListener) app); + /* We don't want to allow users to de-select a row */ + setNullSelectionAllowed(false); + + // customize email column to have mailto: links using column generator + addGeneratedColumn("email", new ColumnGenerator() { + public Component generateCell(Table source, Object itemId, + Object columnId) { + Person p = (Person) itemId; + Link l = new Link(); + l.setResource(new ExternalResource("mailto:" + p.getEmail())); + l.setCaption(p.getEmail()); + return l; + } + }); + } + +}
\ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/SearchView.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/SearchView.java new file mode 100644 index 0000000000..4086c95d73 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/SearchView.java @@ -0,0 +1,99 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import com.itmill.toolkit.demo.tutorial.addressbook.AddressBookApplication; +import com.itmill.toolkit.demo.tutorial.addressbook.data.PersonContainer; +import com.itmill.toolkit.demo.tutorial.addressbook.data.SearchFilter; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.CheckBox; +import com.itmill.toolkit.ui.FormLayout; +import com.itmill.toolkit.ui.NativeSelect; +import com.itmill.toolkit.ui.Panel; +import com.itmill.toolkit.ui.TextField; +import com.itmill.toolkit.ui.Button.ClickEvent; +import com.itmill.toolkit.ui.Button.ClickListener; +import com.itmill.toolkit.ui.Window.Notification; + +public class SearchView extends Panel { + + private TextField tf; + private NativeSelect fieldToSearch; + private CheckBox saveSearch; + private TextField searchName; + private AddressBookApplication app; + + public SearchView(final AddressBookApplication app) { + this.app = app; + addStyleName("view"); + + setCaption("Search contacts"); + setSizeFull(); + + /* Use a FormLayout as main layout for this Panel */ + FormLayout formLayout = new FormLayout(); + setLayout(formLayout); + + /* Create UI components */ + tf = new TextField("Search term"); + fieldToSearch = new NativeSelect("Field to search"); + saveSearch = new CheckBox("Save search"); + searchName = new TextField("Search name"); + Button search = new Button("Search"); + + /* Initialize fieldToSearch */ + for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) { + fieldToSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]); + fieldToSearch.setItemCaption(PersonContainer.NATURAL_COL_ORDER[i], + PersonContainer.COL_HEADERS_ENGLISH[i]); + } + + fieldToSearch.setValue("lastName"); + fieldToSearch.setNullSelectionAllowed(false); + + /* Initialize save checkbox */ + saveSearch.setValue(true); + saveSearch.setImmediate(true); + saveSearch.addListener(new ClickListener() { + public void buttonClick(ClickEvent event) { + searchName.setVisible(event.getButton().booleanValue()); + } + }); + + search.addListener(new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + performSearch(); + } + + }); + + /* Add all the created components to the form */ + addComponent(tf); + addComponent(fieldToSearch); + addComponent(saveSearch); + addComponent(searchName); + addComponent(search); + } + + private void performSearch() { + String searchTerm = (String) tf.getValue(); + if (searchTerm == null || searchTerm.equals("")) { + getWindow().showNotification("Search term cannot be empty!", + Notification.TYPE_WARNING_MESSAGE); + return; + } + + SearchFilter searchFilter = new SearchFilter(fieldToSearch.getValue(), + searchTerm, (String) searchName.getValue()); + if (saveSearch.booleanValue()) { + if (searchName.getValue() == null + || searchName.getValue().equals("")) { + getWindow().showNotification( + "Please enter a name for your search!", + Notification.TYPE_WARNING_MESSAGE); + return; + } + app.saveSearch(searchFilter); + } + app.search(searchFilter); + } + +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/SharingOptions.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/SharingOptions.java new file mode 100644 index 0000000000..772247cdfb --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/ui/SharingOptions.java @@ -0,0 +1,39 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.ui; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.CheckBox; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SharingOptions extends Window { + public SharingOptions() { + /* + * Make the window modal, which will disable all other components while + * it is visible + */ + setModal(true); + + /* Make the sub window 50% the size of the browser window */ + setWidth("50%"); + /* + * Center the window both horizontally and vertically in the browser + * window + */ + center(); + + setCaption("Sharing options"); + addComponent(new Label( + "With these setting you can modify contact sharing " + + "options. (non-functional, example of modal dialog)")); + addComponent(new CheckBox("Gmail")); + addComponent(new CheckBox(".Mac")); + Button close = new Button("OK"); + close.addListener(new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + SharingOptions.this.close(); + } + }); + addComponent(close); + } +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/validators/EmailValidator.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/validators/EmailValidator.java new file mode 100644 index 0000000000..609a216f95 --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/validators/EmailValidator.java @@ -0,0 +1,22 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.validators; + +import com.itmill.toolkit.data.Validator; + +public class EmailValidator implements Validator { + + public boolean isValid(Object value) { + if (value == null || !(value instanceof String)) { + return false; + } + + return ((String) value).matches(".+@.+\\..+"); + } + + public void validate(Object value) throws InvalidValueException { + if (!isValid(value)) { + throw new InvalidValueException( + "Email must contain '@' and have full domain."); + } + } + +} diff --git a/src/com/itmill/toolkit/demo/tutorial/addressbook/validators/PostalCodeValidator.java b/src/com/itmill/toolkit/demo/tutorial/addressbook/validators/PostalCodeValidator.java new file mode 100644 index 0000000000..5558a0d1dd --- /dev/null +++ b/src/com/itmill/toolkit/demo/tutorial/addressbook/validators/PostalCodeValidator.java @@ -0,0 +1,22 @@ +package com.itmill.toolkit.demo.tutorial.addressbook.validators; + +import com.itmill.toolkit.data.Validator; + +public class PostalCodeValidator implements Validator { + + public boolean isValid(Object value) { + if (value == null || !(value instanceof String)) { + return false; + } + + return ((String) value).matches("[1-9][0-9]{4}"); + } + + public void validate(Object value) throws InvalidValueException { + if (!isValid(value)) { + throw new InvalidValueException( + "Postal code must be a five digit number and cannot start with a zero."); + } + } + +}
\ No newline at end of file |