r844 - in trunk: . script src/main/java/org/ourproject/kune/app/public src/main/java/org/ourproject/kune/app/public/css src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/chat/client/ctx/rooms src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/docs/client/cnt src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui src/main/java/org/ourproject/kune/docs/client/cnt/reader src/main/java/org/ourproject/kune/docs/client/cnt/reade
Author: vjrj Date: 2008-09-07 16:07:16 +0200 (Sun, 07 Sep 2008) New Revision: 844 Added: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextView.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionCollection.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionDescriptor.java trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRolDTO.java trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContentStatusDTO.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigationItem.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigator.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorImages.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorView.java Removed: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContext.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ControlsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ItemsPanel.java Modified: trunk/pom.xml trunk/script/css-compact-and-tidy.css trunk/src/main/java/org/ourproject/kune/app/public/Kune.html trunk/src/main/java/org/ourproject/kune/app/public/css/all.css trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/FolderViewerPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControl.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlView.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContext.java trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInView.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Toolbar.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java Log: new context navigator (more powerful but already buggy), new actions definition and management, many content/context changes, some bug fixes and enhacements Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/pom.xml 2008-09-07 14:07:16 UTC (rev 844) @@ -31,13 +31,13 @@ <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> - <version>1.5.2</version> + <version>1.5.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-servlet</artifactId> - <version>1.5.2</version> + <version>1.5.0</version> </dependency> <!-- Use new repo --> <!-- http://code.google.com/p/gwt-ext/issues/detail?id=180 --> @@ -56,12 +56,12 @@ <dependency> <groupId>com.allen_sauer.gwt.log.gwt-log</groupId> <artifactId>gwt-log</artifactId> - <version>2.5.0</version> + <version>2.5.2</version> </dependency> <dependency> <groupId>com.allen_sauer.gwt.voices.gwt-voices</groupId> <artifactId>gwt-voices</artifactId> - <version>1.5.1</version> + <version>1.5.5</version> </dependency> <!-- utilities --> Modified: trunk/script/css-compact-and-tidy.css =================================================================== --- trunk/script/css-compact-and-tidy.css 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/script/css-compact-and-tidy.css 2008-09-07 14:07:16 UTC (rev 844) @@ -1,11 +1,28 @@ #!/bin/bash -#!/bin/bash ORIG=src/main/java/org/ourproject/kune/app/public/ CATTMPFILE=`mktemp -t css.1.XXX` || exit 1 CSSTMPFILE=`mktemp -t css.2.XXX` || exit 1 DEST=src/main/java/org/ourproject/kune/app/public/css/all.css DEST2=src/main/java/org/ourproject/kune/app/public/css/richtext.css -CSS='css/reset.css css/fonts-min.css js/ext/resources/css/ext-all.css js/ext/resources/css/xtheme-gray.css css/kune.css css/workspace.css css/chat.css css/docs.css css/kune-new.css' + +EXTTMPFILE=$ORIG/js/ext/resources/css/ext-all.css-tmp + +sed 's/normal 11px/normal 100\%/g' $ORIG/js/ext/resources/css/ext-all.css |\ +sed 's/bold 11px/normal 100\%/g' |\ +sed 's/normal 12px/normal 108\%/g' |\ +sed 's/bold 12px/bold 108\%/g' |\ +sed 's/font-size:11px/font-size:100\%/g' |\ +sed 's/font-size:12px/font-size:108\%/g' |\ +sed 's/ arial,tahoma,helvetica,sans-serif/ arial,sans/g' |\ +sed 's/ tahoma,arial,helvetica,sans-serif/ arial,sans/g' |\ +sed 's/ tahoma,arial,verdana,sans-serif/ arial,sans/g' |\ +sed 's/ tahoma,verdana,helvetica/ arial,sans/g' |\ +sed 's/ tahoma,arial,helvetica/ arial,sans/g' |\ +sed 's/ tahoma,arial,sans-serif/ arial,sans/g' |\ +sed 's/ \"sans serif\",tahoma,verdana,helvetica/ arial,sans/g' |\ +sed 's/ arial,helvetica,tahoma,sans-serif/ arial,sans/g' > $EXTTMPFILE + +CSS='css/reset.css css/fonts-min.css js/ext/resources/css/ext-all.css-tmp js/ext/resources/css/xtheme-gray.css css/kune.css css/workspace.css css/chat.css css/docs.css css/kune-new.css' CSS2='css/reset.css css/fonts-min.css css/base-min.css css/rte.css' function concat { @@ -40,3 +57,5 @@ concat $CSS2 tidy $DEST2 + +rm $EXTTMPFILE Modified: trunk/src/main/java/org/ourproject/kune/app/public/Kune.html =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/Kune.html 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/app/public/Kune.html 2008-09-07 14:07:16 UTC (rev 844) @@ -25,6 +25,7 @@ top: 2px; left: 2px; z-index: 30000; + font-family: arial,sans; } .kune-Progress { @@ -41,7 +42,7 @@ <script type="text/javascript" language="javascript" src="org.ourproject.kune.app.Kune.nocache.js"></script> <iframe id="__gwt_historyFrame" style="width: 0; height: 0; border: 0"></iframe> -<div id="kuneprogresspanel" class="kune-sitebar"> +<div id="kuneprogresspanel" class="k-sitebar"> <table cellspacing="0" summary="Starting" cellpadding="0" border="0" style="height: 16px; margin-top: 5px; margin-left: 5px;"> <tbody> Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-09-07 14:07:16 UTC (rev 844) @@ -33,7 +33,7 @@ .ext-el-mask{z-index:20000;position:absolute;top:0;left:0;-moz-opacity:0.5;opacity:.50;filter:alpha(opacity=50);background-color:#CCC;width:100%;height:100%;zoom:1;} .ext-el-mask-msg{z-index:20001;position:absolute;top:0;left:0;border:1px solid #6593cf;background:#c3daf9 url(../js/ext/resources/images/default/box/tb-blue.gif) repeat-x 0 -16px;padding:2px;} -.ext-el-mask-msg div{padding:5px 10px 5px 10px;background:#eee;border:1px solid #a3bad9;color:#222;font:normal 11px tahoma,arial,helvetica,sans-serif;cursor:wait;} +.ext-el-mask-msg div{padding:5px 10px 5px 10px;background:#eee;border:1px solid #a3bad9;color:#222;font:normal 100% arial,sans;cursor:wait;} .ext-shim{position:absolute;visibility:hidden;left:0;top:0;overflow:hidden;} .ext-ie .ext-shim{filter:alpha(opacity=0);} .ext-ie6 .ext-shim{margin-left:5px;margin-top:3px;} @@ -74,7 +74,7 @@ .x-shadow .xsbl{background:transparent url( ../js/ext/resources/images/default/shadow.png ) no-repeat 0 -12px;} .x-shadow .xsbc{background:transparent url( ../js/ext/resources/images/default/shadow.png ) repeat-x 0 -36px;} .x-shadow .xsbr{background:transparent url( ../js/ext/resources/images/default/shadow.png ) repeat-x 0 -6px;} -.loading-indicator{font-size:11px;background-image:url(../js/ext/resources/images/default/grid/loading.gif);background-repeat:no-repeat;background-position:left;padding-left:20px;line-height:16px;margin:3px;} +.loading-indicator{font-size:100%;background-image:url(../js/ext/resources/images/default/grid/loading.gif);background-repeat:no-repeat;background-position:left;padding-left:20px;line-height:16px;margin:3px;} .x-text-resize{position:absolute;left:-1000px;top:-1000px;visibility:hidden;zoom:1;} .x-drag-overlay{width:100%;height:100%;display:none;position:absolute;left:0;top:0;background-image:url(../js/ext/resources/images/default/s.gif);z-index:20000;} .x-clear{clear:both;height:0;overflow:hidden;line-height:0;font-size:0;} @@ -97,7 +97,7 @@ .x-tab-strip a,.x-tab-strip span,.x-tab-strip em{display:block;} .x-tab-strip a{text-decoration:none!important;-moz-outline:none;outline:none;cursor:pointer;} .x-tab-strip-inner{overflow:hidden;text-overflow:ellipsis;} -.x-tab-strip span.x-tab-strip-text{font:normal 11px tahoma,arial,helvetica;color:#416aa3;white-space:nowrap;cursor:pointer;padding:4px 0;} +.x-tab-strip span.x-tab-strip-text{font:normal 100% arial,sans;color:#416aa3;white-space:nowrap;cursor:pointer;padding:4px 0;} .x-tab-strip .x-tab-with-icon .x-tab-right{padding-left:6px;} .x-tab-strip .x-tab-with-icon span.x-tab-strip-text{padding-left:20px;background-position:0 3px;background-repeat:no-repeat;} .x-tab-strip-over span.x-tab-strip-text{color:#15428b;} @@ -147,7 +147,7 @@ .x-tab-panel-tbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-border-layout-ct .x-tab-panel{background:white;} - .x-form-field{margin:0;font:normal 12px tahoma,arial,helvetica,sans-serif;} + .x-form-field{margin:0;font:normal 108% arial,sans;} .x-form-text,textarea.x-form-field{padding:1px 3px;background:#fff url(../js/ext/resources/images/default/form/text-bg.gif) repeat-x 0 0;border:1px solid #B5B8C8;} textarea.x-form-field{padding:2px 3px;} .x-form-text{height:22px;line-height:18px;vertical-align:middle;} @@ -184,22 +184,22 @@ .ext-ie .x-form-check-wrap input{width:15px;height:15px;} .x-editor .x-form-check-wrap{padding:3px;} .x-editor .x-form-checkbox{height:13px;} -.x-form-grow-sizer{font:normal 12px tahoma,arial,helvetica,sans-serif;left:-10000px;padding:8px 3px;position:absolute;visibility:hidden;top:-10000px;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;zoom:1;} +.x-form-grow-sizer{font:normal 108% arial,sans;left:-10000px;padding:8px 3px;position:absolute;visibility:hidden;top:-10000px;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;zoom:1;} .x-form-grow-sizer p{margin:0!important;border:0 none!important;padding:0!important;} -.x-form-item{font:normal 12px tahoma,arial,helvetica,sans-serif;display:block;margin-bottom:4px;} +.x-form-item{font:normal 108% arial,sans;display:block;margin-bottom:4px;} .x-form-item label{display:block;float:left;width:100px;padding:3px;padding-left:0;clear:left;z-index:2;position:relative;} .x-form-element{padding-left:105px;position:relative;} -.x-form-invalid-msg{color:#e00;padding:2px;padding-left:18px;font:normal 11px tahoma,arial,helvetica,sans-serif;background:transparent url(../js/ext/resources/images/default/shared/warning.gif) no-repeat 0 2px;line-height:16px;width:200px;} +.x-form-invalid-msg{color:#e00;padding:2px;padding-left:18px;font:normal 100% arial,sans;background:transparent url(../js/ext/resources/images/default/shared/warning.gif) no-repeat 0 2px;line-height:16px;width:200px;} .x-form-label-right label{text-align:right;} .x-form-label-top .x-form-item label{width:auto;float:none;clear:none;display:inline;margin-bottom:4px;position:static;} .x-form-label-top .x-form-element{padding-left:0;padding-top:4px;} .x-form-label-top .x-form-item{padding-bottom:4px;} .x-form-empty-field{color:gray;} -.x-small-editor .x-form-field{font:normal 11px arial,tahoma,helvetica,sans-serif;} +.x-small-editor .x-form-field{font:normal 100% arial,sans;} .x-small-editor .x-form-text{height:20px;line-height:16px;vertical-align:middle;} .ext-ie .x-small-editor .x-form-text{margin-top:-1px!important;margin-bottom:-1px!important;height:20px!important;line-height:16px!important;} .ext-strict .x-small-editor .x-form-text{height:16px!important;} -.ext-safari .x-small-editor .x-form-field{font:normal 12px arial,tahoma,helvetica,sans-serif;} +.ext-safari .x-small-editor .x-form-field{font:normal 108% arial,sans;} .ext-ie .x-small-editor .x-form-text{height:20px;line-height:16px;} .ext-border-box .x-small-editor .x-form-text{height:20px;} .x-small-editor .x-form-select-one{height:20px;line-height:16px;vertical-align:middle;} @@ -224,7 +224,7 @@ .x-form .x-form-btns-ct .x-btn-click .x-btn-left{background-position:0 -63px;} .x-form-invalid-icon{width:16px;height:18px;visibility:hidden;position:absolute;left:0;top:0;display:block;background:transparent url(../js/ext/resources/images/default/form/exclamation.gif) no-repeat 0 2px;} .x-fieldset{border:1px solid #B5B8C8;padding:10px;margin-bottom:10px;} -.x-fieldset legend{font:bold 11px tahoma,arial,helvetica,sans-serif;color:#15428b;} +.x-fieldset legend{font:normal 100% arial,sans;color:#15428b;} .ext-ie .x-fieldset legend{margin-bottom:10px;} .ext-ie .x-fieldset{padding-top:0;padding-bottom:10px;} .x-fieldset legend .x-tool-toggle{margin-right:3px;margin-left:0;float:left!important;} @@ -245,8 +245,8 @@ .x-fieldset-bwrap{overflow:hidden;zoom:1;} .x-fieldset-body{overflow:hidden;} -.x-btn{font:normal 11px tahoma,verdana,helvetica;cursor:pointer;white-space:nowrap;} -.x-btn button{border:0 none;background:transparent;font:normal 11px tahoma,verdana,helvetica;padding-left:3px;padding-right:3px;cursor:pointer;margin:0;overflow:visible;width:auto;-moz-outline:0 none;outline:0 none;} +.x-btn{font:normal 100% arial,sans;cursor:pointer;white-space:nowrap;} +.x-btn button{border:0 none;background:transparent;font:normal 100% arial,sans;padding-left:3px;padding-right:3px;cursor:pointer;margin:0;overflow:visible;width:auto;-moz-outline:0 none;outline:0 none;} * html .ext-ie .x-btn button{width:1px;} .ext-gecko .x-btn button{padding-left:0;padding-right:0;} .ext-ie .x-btn button{padding-top:2px;} @@ -279,7 +279,7 @@ .x-toolbar .x-item-disabled .x-btn-icon{opacity:.35;-moz-opacity:.35;filter:alpha(opacity=35);} .x-toolbar td{vertical-align:middle;} .mso .x-toolbar,.x-grid-mso .x-toolbar{border:0 none;background:url(../js/ext/resources/images/default/grid/mso-hd.gif);} -.x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{white-space:nowrap;font:normal 11px tahoma,arial,helvetica,sans-serif;} +.x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{white-space:nowrap;font:normal 100% arial,sans;} .x-toolbar .x-item-disabled{color:gray;cursor:default;opacity:.6;-moz-opacity:.6;filter:alpha(opacity=60);} .x-toolbar .x-item-disabled *{color:gray;cursor:default;} .x-toolbar .x-btn-left{background:none;} @@ -342,7 +342,7 @@ .x-grid-panel .x-panel-mc .x-panel-body{border:1px solid #99bbe8;} .ext-ie .x-grid3 table,.ext-safari .x-grid3 table{table-layout:fixed;} .x-grid3-viewport{overflow:hidden;} -.x-grid3-hd-row td,.x-grid3-row td,.x-grid3-summary-row td{font:normal 11px arial,tahoma,helvetica,sans-serif;-moz-outline:none;-moz-user-focus:normal;} +.x-grid3-hd-row td,.x-grid3-row td,.x-grid3-summary-row td{font:normal 100% arial,sans;-moz-outline:none;-moz-user-focus:normal;} .x-grid3-row td,.x-grid3-summary-row td{line-height:13px;vertical-align:top;padding-left:1px;padding-right:1px;-moz-user-select:none;} .x-grid3-hd-row td{line-height:15px;vertical-align:middle;border-left:1px solid #eee;border-right:1px solid #d0d0d0;} .x-grid3-hd-row .x-grid3-marker-hd{padding:3px;} @@ -392,7 +392,7 @@ .x-grid3-locked td.x-grid3-row-marker,.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker{background:#ebeadb url(../js/ext/resources/images/default/grid/grid-hrow.gif) repeat-x 0 bottom!important;vertical-align:middle!important;color:black;padding:0;border-top:1px solid white;border-bottom:none!important;border-right:1px solid #6fa0df!important;text-align:center;} .x-grid3-locked td.x-grid3-row-marker div,.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div{padding:0 4px;color:#15428b!important;text-align:center;} .x-grid3-dirty-cell{background:transparent url(../js/ext/resources/images/default/grid/dirty.gif) no-repeat 0 0;} -.x-grid3-topbar,.x-grid3-bottombar{font:normal 11px arial,tahoma,helvetica,sans-serif;overflow:hidden;display:none;zoom:1;position:relative;} +.x-grid3-topbar,.x-grid3-bottombar{font:normal 100% arial,sans;overflow:hidden;display:none;zoom:1;position:relative;} .x-grid3-topbar .x-toolbar{border-right:0 none;} .x-grid3-bottombar .x-toolbar{border-right:0 none;border-bottom:0 none;border-top:1px solid #a9bfd3;} .x-props-grid .x-grid3-cell{padding:1px;} @@ -430,7 +430,7 @@ .x-grid3-check-col-on{width:100%;height:16px;background-position:center center;background-repeat:no-repeat;background-color:transparent;background-image:url(../js/ext/resources/images/default/menu/checked.gif);} .x-grid-group,.x-grid-group-body,.x-grid-group-hd{zoom:1;} .x-grid-group-hd{border-bottom:2px solid #99bbe8;cursor:pointer;padding-top:6px;} -.x-grid-group-hd div{background:transparent url(../js/ext/resources/images/default/grid/group-expand-sprite.gif) no-repeat 3px -47px;padding:4px 4px 4px 17px;color:#3764a0;font:bold 11px tahoma,arial,helvetica,sans-serif;} +.x-grid-group-hd div{background:transparent url(../js/ext/resources/images/default/grid/group-expand-sprite.gif) no-repeat 3px -47px;padding:4px 4px 4px 17px;color:#3764a0;font:normal 100% arial,sans;} .x-grid-group-collapsed .x-grid-group-hd div{background-position:3px 3px;} .x-grid-group-collapsed .x-grid-group-body{display:none;} .x-group-by-icon{background-image:url(../js/ext/resources/images/default/grid/group-by.gif);} @@ -438,11 +438,11 @@ .x-show-groups-icon{background-image:url(../js/ext/resources/images/default/grid/group-by.gif);} .ext-ie .x-grid3 .x-editor .x-form-text{position:relative;top:-1px;} .ext-ie .x-props-grid .x-editor .x-form-text{position:static;top:0;} -.x-grid-empty{padding:10px;color:gray;font:normal 11px tahoma,arial,helvetica,sans-serif;} +.x-grid-empty{padding:10px;color:gray;font:normal 100% arial,sans;} .ext-ie7 .x-grid-panel .x-panel-bbar{position:relative;} .x-dd-drag-proxy{position:absolute;left:0;top:0;visibility:hidden;z-index:15000;} -.x-dd-drag-ghost{color:black;font:normal 11px arial,helvetica,sans-serif;-moz-opacity:0.85;opacity:.85;filter:alpha(opacity=85);border-top:1px solid #ddd;border-left:1px solid #ddd;border-right:1px solid #bbb;border-bottom:1px solid #bbb;padding:3px;padding-left:20px;background-color:white;white-space:nowrap;} +.x-dd-drag-ghost{color:black;font:normal 100% arial,helvetica,sans-serif;-moz-opacity:0.85;opacity:.85;filter:alpha(opacity=85);border-top:1px solid #ddd;border-left:1px solid #ddd;border-right:1px solid #bbb;border-bottom:1px solid #bbb;padding:3px;padding-left:20px;background-color:white;white-space:nowrap;} .x-dd-drag-repair .x-dd-drag-ghost{-moz-opacity:0.4;opacity:.4;filter:alpha(opacity=40);border:0 none;padding:0;background-color:transparent;} .x-dd-drag-repair .x-dd-drop-icon{visibility:hidden;} .x-dd-drop-icon{position:absolute;top:3px;left:3px;display:block;width:16px;height:16px;background-color:transparent;background-position:center;background-repeat:no-repeat;z-index:1;} @@ -493,7 +493,7 @@ .x-tree-arrows .x-tree-ec-over .x-tree-elbow-end-minus{background-position:-48px 0;} .x-tree-elbow-plus,.x-tree-elbow-minus,.x-tree-elbow-end-plus,.x-tree-elbow-end-minus{cursor:pointer;} .ext-ie ul.x-tree-node-ct{font-size:0;line-height:0;zoom:1;} -.x-tree-node{color:black;font:normal 11px arial,tahoma,helvetica,sans-serif;white-space:nowrap;} +.x-tree-node{color:black;font:normal 100% arial,sans;white-space:nowrap;} .x-tree-node-el{line-height:18px;cursor:pointer;} .x-tree-node a,.x-dd-drag-ghost a{text-decoration:none;color:black;-khtml-user-select:none;-moz-user-select:none;-kthml-user-focus:normal;-moz-user-focus:normal;-moz-outline:0 none;outline:0 none;} .x-tree-node a span,.x-dd-drag-ghost a span{text-decoration:none;color:black;padding:1px 3px 1px 2px;} @@ -519,7 +519,7 @@ .x-date-picker{border:1px solid #1b376c;border-top:0 none;background:#fff;position:relative;} .x-date-picker a{-moz-outline:0 none;outline:0 none;} .x-date-inner,.x-date-inner td,.x-date-inner th{border-collapse:separate;} -.x-date-middle,.x-date-left,.x-date-right{background:url(../js/ext/resources/images/default/shared/hd-sprite.gif) repeat-x 0 -83px;color:#FFF;font:bold 11px "sans serif",tahoma,verdana,helvetica;overflow:hidden;} +.x-date-middle,.x-date-left,.x-date-right{background:url(../js/ext/resources/images/default/shared/hd-sprite.gif) repeat-x 0 -83px;color:#FFF;font:normal 100% arial,sans;overflow:hidden;} .x-date-middle .x-btn-left,.x-date-middle .x-btn-center,.x-date-middle .x-btn-right{background:transparent!important;vertical-align:middle;} .x-date-middle .x-btn .x-btn-text{color:#fff;} .x-date-middle .x-btn-with-menu .x-btn-center em{background:transparent url(../js/ext/resources/images/default/toolbar/btn-arrow-light.gif) no-repeat right 0;} @@ -532,10 +532,10 @@ .x-date-left a{background-image:url(../js/ext/resources/images/default/shared/left-btn.gif);margin-left:2px;text-decoration:none!important;} table.x-date-inner{width:100%;table-layout:fixed;} .x-date-inner th{width:25px;} -.x-date-inner th{background:#dfecfb url(../js/ext/resources/images/default/shared/glass-bg.gif) repeat-x left top;text-align:right!important;border-bottom:1px solid #a3bad9;font:normal 10px arial,helvetica,tahoma,sans-serif;color:#233d6d;cursor:default;padding:0;border-collapse:separate;} +.x-date-inner th{background:#dfecfb url(../js/ext/resources/images/default/shared/glass-bg.gif) repeat-x left top;text-align:right!important;border-bottom:1px solid #a3bad9;font:normal 10px arial,sans;color:#233d6d;cursor:default;padding:0;border-collapse:separate;} .x-date-inner th span{display:block;padding:2px;padding-right:7px;} .x-date-inner td{border:1px solid #fff;text-align:right;padding:0;} -.x-date-inner a{padding:2px 5px;display:block;font:normal 11px arial,helvetica,tahoma,sans-serif;text-decoration:none;color:black;text-align:right;zoom:1;} +.x-date-inner a{padding:2px 5px;display:block;font:normal 100% arial,sans;text-decoration:none;color:black;text-align:right;zoom:1;} .x-date-inner .x-date-active{cursor:pointer;color:black;} .x-date-inner .x-date-selected a{background:#dfecfb url(../js/ext/resources/images/default/shared/glass-bg.gif) repeat-x left top;border:1px solid #8db2e3;padding:1px 4px;} .x-date-inner .x-date-today a{border:1px solid darkred;padding:1px 4px;} @@ -548,10 +548,10 @@ .x-date-mmenu .x-menu-item{font-size:10px;padding:1px 24px 1px 4px;white-space:nowrap;color:#000;} .x-date-mmenu .x-menu-item .x-menu-item-icon{width:10px;height:10px;margin-right:5px;background-position:center -4px!important;} .x-date-mp{position:absolute;left:0;top:0;background:white;display:none;} -.x-date-mp td{padding:2px;font:normal 11px arial,helvetica,tahoma,sans-serif;} +.x-date-mp td{padding:2px;font:normal 100% arial,sans;} td.x-date-mp-month,td.x-date-mp-year,td.x-date-mp-ybtn{border:0 none;text-align:center;vertical-align:middle;width:25%;} .x-date-mp-ok{margin-right:3px;} -.x-date-mp-btns button{text-decoration:none;text-align:center;text-decoration:none!important;background:#083772;color:white;border:1px solid;border-color:#36c #005 #005 #36c;padding:1px 3px 1px;font:normal 11px arial,helvetica,tahoma,sans-serif;cursor:pointer;} +.x-date-mp-btns button{text-decoration:none;text-align:center;text-decoration:none!important;background:#083772;color:white;border:1px solid;border-color:#36c #005 #005 #36c;padding:1px 3px 1px;font:normal 100% arial,sans;cursor:pointer;} .x-date-mp-btns{background:#dfecfb url(../js/ext/resources/images/default/shared/glass-bg.gif) repeat-x left top;} .x-date-mp-btns td{border-top:1px solid #c5d2df;text-align:center;} td.x-date-mp-month a,td.x-date-mp-year a{display:block;padding:2px 4px;text-decoration:none;text-align:center;color:#15428b;} @@ -573,12 +573,12 @@ .x-tip .x-tip-bc{background:transparent url(../js/ext/resources/images/default/qtip/tip-sprite.gif) no-repeat 0 -121px;height:3px;overflow:hidden;} .x-tip .x-tip-bl{background:transparent url(../js/ext/resources/images/default/qtip/tip-sprite.gif) no-repeat 0 -59px;padding-left:6px;zoom:1;} .x-tip .x-tip-br{background:transparent url(../js/ext/resources/images/default/qtip/tip-sprite.gif) no-repeat right -59px;padding-right:6px;zoom:1;} -.x-tip .x-tip-mc{border:0 none;font:normal 11px tahoma,arial,helvetica,sans-serif;} +.x-tip .x-tip-mc{border:0 none;font:normal 100% arial,sans;} .x-tip .x-tip-ml{background:#fff url(../js/ext/resources/images/default/qtip/tip-sprite.gif) no-repeat 0 -124px;padding-left:6px;zoom:1;} .x-tip .x-tip-mr{background:transparent url(../js/ext/resources/images/default/qtip/tip-sprite.gif) no-repeat right -124px;padding-right:6px;zoom:1;} .ext-ie .x-tip .x-tip-header,.ext-ie .x-tip .x-tip-tc{font-size:0;line-height:0;} -.x-tip .x-tip-header-text{font:bold 11px tahoma,arial,helvetica,sans-serif;padding:0;margin:0 0 2px 0;color:#444;} -.x-tip .x-tip-body{font:normal 11px tahoma,arial,helvetica,sans-serif;margin:0!important;line-height:14px;color:#444;padding:0;} +.x-tip .x-tip-header-text{font:normal 100% arial,sans;padding:0;margin:0 0 2px 0;color:#444;} +.x-tip .x-tip-body{font:normal 100% arial,sans;margin:0!important;line-height:14px;color:#444;padding:0;} .x-tip .x-tip-body .loading-indicator{margin:0;} .x-tip-draggable .x-tip-header,.x-tip-draggable .x-tip-header-text{cursor:move;} .x-form-invalid-tip .x-tip-tc{background:url(../js/ext/resources/images/default/form/error-tip-corners.gif) repeat-x 0 -12px;padding-top:6px;} @@ -598,7 +598,7 @@ .x-menu-list{background:transparent;border:0 none;} .x-menu li{line-height:100%;} .x-menu li.x-menu-sep-li{font-size:1px;line-height:1px;} -.x-menu-list-item{font:normal 11px tahoma,arial,sans-serif;white-space:nowrap;-moz-user-select:none;-khtml-user-select:none;display:block;padding:1px;} +.x-menu-list-item{font:normal 100% arial,sans;white-space:nowrap;-moz-user-select:none;-khtml-user-select:none;display:block;padding:1px;} .x-menu-item-arrow{background:transparent url(../js/ext/resources/images/default/menu/menu-parent.gif) no-repeat right;} .x-menu-sep{display:block;font-size:1px;line-height:1px;margin:2px 3px;background-color:#e0e0e0;border-bottom:1px solid #fff;overflow:hidden;} .x-menu-focus{position:absolute;left:0;top:-5px;width:0;height:0;line-height:1px;} @@ -622,7 +622,7 @@ .x-box-tc{height:8px;background:transparent url(../js/ext/resources/images/default/box/tb.gif) repeat-x 0 0;overflow:hidden;} .x-box-tr{background:transparent url(../js/ext/resources/images/default/box/corners.gif) no-repeat right -8px;} .x-box-ml{background:transparent url(../js/ext/resources/images/default/box/l.gif) repeat-y 0;padding-left:4px;overflow:hidden;zoom:1;} -.x-box-mc{background:#eee url(../js/ext/resources/images/default/box/tb.gif) repeat-x 0 -16px;padding:4px 10px;font-family:"Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif;color:#393939;font-size:12px;} +.x-box-mc{background:#eee url(../js/ext/resources/images/default/box/tb.gif) repeat-x 0 -16px;padding:4px 10px;font-family:"Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif;color:#393939;font-size:108%;} .x-box-mc h3{font-size:14px;font-weight:bold;margin:0 0 4px 0;zoom:1;} .x-box-mr{background:transparent url(../js/ext/resources/images/default/box/r.gif) repeat-y right;padding-right:4px;overflow:hidden;} .x-box-bl{background:transparent url(../js/ext/resources/images/default/box/corners.gif) no-repeat 0 -16px;zoom:1;} @@ -637,7 +637,7 @@ .x-box-blue .x-box-ml{background-image:url(../js/ext/resources/images/default/box/l-blue.gif);} .x-box-blue .x-box-mr{background-image:url(../js/ext/resources/images/default/box/r-blue.gif);} -#x-debug-browser .x-tree .x-tree-node a span{color:#222297;font-size:11px;padding-top:2px;font-family:"monotype","courier new",sans-serif;line-height:18px;} +#x-debug-browser .x-tree .x-tree-node a span{color:#222297;font-size:100%;padding-top:2px;font-family:"monotype","courier new",sans-serif;line-height:18px;} #x-debug-browser .x-tree a i{color:#FF4545;font-style:normal;} #x-debug-browser .x-tree a em{color:#999;} #x-debug-browser .x-tree .x-tree-node .x-tree-selected a span{background:#c3daf9;} @@ -648,23 +648,23 @@ .x-combo-list{border:1px solid #98c0f4;background:#ddecfe;zoom:1;overflow:hidden;} .x-combo-list-inner{overflow:auto;background:white;position:relative;zoom:1;overflow-x:hidden;} -.x-combo-list-hd{font:bold 11px tahoma,arial,helvetica,sans-serif;color:#15428b;background-image:url(../js/ext/resources/images/default/layout/panel-title-light-bg.gif);border-bottom:1px solid #98c0f4;padding:3px;} +.x-combo-list-hd{font:normal 100% arial,sans;color:#15428b;background-image:url(../js/ext/resources/images/default/layout/panel-title-light-bg.gif);border-bottom:1px solid #98c0f4;padding:3px;} .x-resizable-pinned .x-combo-list-inner{border-bottom:1px solid #98c0f4;} -.x-combo-list-item{font:normal 12px tahoma,arial,helvetica,sans-serif;padding:2px;border:1px solid #fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.x-combo-list-item{font:normal 108% arial,sans;padding:2px;border:1px solid #fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} .x-combo-list .x-combo-selected{border:1px dotted #a3bae9!important;background:#DFE8F6;cursor:pointer;} .x-combo-noedit{cursor:pointer;} .x-combo-list .x-toolbar{border-top:1px solid #98c0f4;border-bottom:0 none;} -.x-combo-list-small .x-combo-list-item{font:normal 11px tahoma,arial,helvetica,sans-serif;} +.x-combo-list-small .x-combo-list-item{font:normal 100% arial,sans;} .x-panel{border-style:solid;border-color:#99bbe8;border-width:0;} -.x-panel-header{overflow:hidden;zoom:1;color:#15428b;font:bold 11px tahoma,arial,verdana,sans-serif;padding:5px 3px 4px 5px;border:1px solid #99bbe8;line-height:15px;background:transparent url(../js/ext/resources/images/default/panel/white-top-bottom.gif) repeat-x 0 -1px;} +.x-panel-header{overflow:hidden;zoom:1;color:#15428b;font:normal 100% arial,sans;padding:5px 3px 4px 5px;border:1px solid #99bbe8;line-height:15px;background:transparent url(../js/ext/resources/images/default/panel/white-top-bottom.gif) repeat-x 0 -1px;} .x-panel-body{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;background:white;position:relative;} .x-panel-bbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-panel-tbar .x-toolbar{border:1px solid #99bbe8;border-top:0 none;overflow:hidden;padding:2px;} .x-panel-tbar-noheader .x-toolbar,.x-panel-mc .x-panel-tbar .x-toolbar{border-top:1px solid #99bbe8;border-bottom:0 none;} .x-panel-body-noheader,.x-panel-mc .x-panel-body{border-top:1px solid #99bbe8;} .x-panel-header{overflow:hidden;zoom:1;} -.x-panel-tl .x-panel-header{color:#15428b;font:bold 11px tahoma,arial,verdana,sans-serif;padding:5px 0 4px 0;border:0 none;background:transparent;} +.x-panel-tl .x-panel-header{color:#15428b;font:normal 100% arial,sans;padding:5px 0 4px 0;border:0 none;background:transparent;} .x-panel-tl .x-panel-icon,.x-window-tl .x-panel-icon{padding-left:20px!important;background-repeat:no-repeat;background-position:0 4px;zoom:1;} .x-panel-inline-icon{width:16px;height:16px;background-repeat:no-repeat;background-position:0 0;vertical-align:middle;margin-right:4px;margin-top:-1px;margin-bottom:-1px;} .x-panel-tc{background:transparent url(../js/ext/resources/images/default/panel/top-bottom.gif) repeat-x 0 0;overflow:hidden;} @@ -675,7 +675,7 @@ .x-panel-bc .x-panel-footer{zoom:1;} .x-panel-bl{background:transparent url(../js/ext/resources/images/default/panel/corners-sprite.gif) no-repeat 0 bottom;padding-left:6px;zoom:1;} .x-panel-br{background:transparent url(../js/ext/resources/images/default/panel/corners-sprite.gif) no-repeat right bottom;padding-right:6px;zoom:1;} -.x-panel-mc{border:0 none;padding:0;margin:0;font:normal 11px tahoma,arial,helvetica,sans-serif;padding-top:6px;background:#dfe8f6;} +.x-panel-mc{border:0 none;padding:0;margin:0;font:normal 100% arial,sans;padding-top:6px;background:#dfe8f6;} .x-panel-mc .x-panel-body{background:transparent;border:0 none;} .x-panel-ml{background:#fff url(../js/ext/resources/images/default/panel/left-right.gif) repeat-y 0 0;padding-left:6px;zoom:1;} .x-panel-mr{background:transparent url(../js/ext/resources/images/default/panel/left-right.gif) repeat-y right 0;padding-right:6px;zoom:1;} @@ -758,7 +758,7 @@ .x-window-proxy{background:#C7DFFC;border:1px solid #99bbe8;z-index:12000;overflow:hidden;position:absolute;left:0;top:0;display:none;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);} .x-window-header{overflow:hidden;zoom:1;} .x-window-bwrap{z-index:1;position:relative;zoom:1;} -.x-window-tl .x-window-header{color:#15428b;font:bold 11px tahoma,arial,verdana,sans-serif;padding:5px 0 4px 0;} +.x-window-tl .x-window-header{color:#15428b;font:normal 100% arial,sans;padding:5px 0 4px 0;} .x-window-header-text{cursor:pointer;} .x-window-tc{background:transparent url(../js/ext/resources/images/default/window/top-bottom.png) repeat-x 0 0;overflow:hidden;zoom:1;} .x-window-tl{background:transparent url(../js/ext/resources/images/default/window/left-corners.png) no-repeat 0 0;padding-left:6px;zoom:1;z-index:1;position:relative;} @@ -767,7 +767,7 @@ .x-window-bc .x-window-footer{padding-bottom:6px;zoom:1;font-size:0;line-height:0;} .x-window-bl{background:transparent url(../js/ext/resources/images/default/window/left-corners.png) no-repeat 0 bottom;padding-left:6px;zoom:1;} .x-window-br{background:transparent url(../js/ext/resources/images/default/window/right-corners.png) no-repeat right bottom;padding-right:6px;zoom:1;} -.x-window-mc{border:1px solid #99bbe8;padding:0;margin:0;font:normal 11px tahoma,arial,helvetica,sans-serif;background:#dfe8f6;} +.x-window-mc{border:1px solid #99bbe8;padding:0;margin:0;font:normal 100% arial,sans;background:#dfe8f6;} .x-window-ml{background:transparent url(../js/ext/resources/images/default/window/left-right.png) repeat-y 0 0;padding-left:6px;zoom:1;} .x-window-mr{background:transparent url(../js/ext/resources/images/default/window/left-right.png) repeat-y right 0;padding-right:6px;zoom:1;} .x-panel-nofooter .x-window-bc{height:6px;} @@ -879,15 +879,15 @@ .x-progress-wrap{border:1px solid #6593cf;overflow:hidden;} .x-progress-inner{height:18px;background:#e0e8f3 url(../js/ext/resources/images/default/qtip/bg.gif) repeat-x;position:relative;} .x-progress-bar{height:18px;float:left;width:0;background:#9CBFEE url( ../js/ext/resources/images/default/progress/progress-bg.gif ) repeat-x left center;border-top:1px solid #D1E4FD;border-bottom:1px solid #7FA9E4;border-right:1px solid #7FA9E4;} -.x-progress-text{font-size:11px;font-weight:bold;color:#fff;padding:1px 5px;overflow:hidden;position:absolute;left:0;text-align:center;} +.x-progress-text{font-size:100%;font-weight:bold;color:#fff;padding:1px 5px;overflow:hidden;position:absolute;left:0;text-align:center;} .x-progress-text-back{color:#396095;line-height:16px;} .ext-ie .x-progress-text-back{line-height:15px;} .x-window-dlg .x-window-body{border:0 none!important;padding:5px 10px;overflow:hidden!important;} .x-window-dlg .x-window-mc{border:0 none!important;} -.x-window-dlg .ext-mb-text,.x-window-dlg .x-window-header-text{font-size:12px;} +.x-window-dlg .ext-mb-text,.x-window-dlg .x-window-header-text{font-size:108%;} .x-window-dlg .ext-mb-input{margin-top:4px;width:95%;} -.x-window-dlg .ext-mb-textarea{margin-top:4px;font:normal 12px tahoma,arial,helvetica,sans-serif;} +.x-window-dlg .ext-mb-textarea{margin-top:4px;font:normal 108% arial,sans;} .x-window-dlg .x-progress-wrap{margin-top:4px;} .ext-ie .x-window-dlg .x-progress-wrap{margin-top:6px;} .x-window-dlg .x-msg-box-wait{background:transparent url(../js/ext/resources/images/default/grid/loading.gif) no-repeat left;display:block;width:300px;padding-left:18px;line-height:18px;} @@ -3171,27 +3171,27 @@ text-decoration: underline; } -.k-entity-container-default div { +.k-entity-context-default div { background: #FFD09D none repeat scroll 0% 50%; } -.k-entity-container-green div { +.k-entity-context-green div { background: #CFA none repeat scroll 0% 50%; } -.k-entity-container-blue div { +.k-entity-context-blue div { background: #AACCFF none repeat scroll 0% 50%; } -.k-entity-container-grey div { +.k-entity-context-grey div { background: #B3B3B3 none repeat scroll 0% 50%; } -.k-entity-container-purple div { +.k-entity-context-purple div { background: #DDAFE9 none repeat scroll 0% 50%; } -.k-entity-container-red div { +.k-entity-context-red div { background: #FFAAAA none repeat scroll 0% 50%; } @@ -3462,4 +3462,9 @@ text-decoration: underline; } +/* others */ +.k-linethrough { + text-decoration: line-through; +} + Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-09-07 14:07:16 UTC (rev 844) @@ -336,27 +336,27 @@ text-decoration: underline; } -.k-entity-container-default div { +.k-entity-context-default div { background: #FFD09D none repeat scroll 0% 50%; } -.k-entity-container-green div { +.k-entity-context-green div { background: #CFA none repeat scroll 0% 50%; } -.k-entity-container-blue div { +.k-entity-context-blue div { background: #AACCFF none repeat scroll 0% 50%; } -.k-entity-container-grey div { +.k-entity-context-grey div { background: #B3B3B3 none repeat scroll 0% 50%; } -.k-entity-container-purple div { +.k-entity-context-purple div { background: #DDAFE9 none repeat scroll 0% 50%; } -.k-entity-container-red div { +.k-entity-context-red div { background: #FFAAAA none repeat scroll 0% 50%; } @@ -626,3 +626,8 @@ .k-toolselectoritem-notsel a:hover { text-decoration: underline; } + +/* others */ +.k-linethrough { + text-decoration: line-through; +} Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2008-09-07 14:07:16 UTC (rev 844) @@ -22,7 +22,7 @@ import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummary; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigator; import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter; @@ -81,7 +81,7 @@ }); register(SingletonScope.class, new Factory<RoomsAdmin>(RoomsAdmin.class) { public RoomsAdmin create() { - final RoomsAdminPresenter presenter = new RoomsAdminPresenter($(ContextItems.class), + final RoomsAdminPresenter presenter = new RoomsAdminPresenter($(ContextNavigator.class), $(I18nUITranslationService.class), $$(StateManager.class), $(Session.class), $$(ContentServiceAsync.class)); return presenter; Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-09-07 14:07:16 UTC (rev 844) @@ -123,9 +123,8 @@ public void logout() { if (!emiteDialog.isDialogNotStarted()) { emiteDialog.setOwnPresence(OwnStatus.offline); - final UserChatOptions userChatOptions = getUserChatOptions("[email protected]", ""); - emiteDialog.refreshUserInfo(userChatOptions); - chatOptions.userOptions = userChatOptions; + chatOptions.userOptions = getUserChatOptions("[email protected]", ""); + emiteDialog.refreshUserInfo(chatOptions.userOptions); emiteDialog.setEnableStatusUI(false); } } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,67 +20,64 @@ package org.ourproject.kune.chat.client.ctx.rooms; -import org.ourproject.kune.chat.client.ChatClientTool; import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dto.AccessRightsDTO; import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.StateDTO; import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsImages; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigator; import com.calclab.suco.client.provider.Provider; -import com.calclab.suco.client.signal.Slot; public class RoomsAdminPresenter implements RoomsAdmin { - private final ContextItems contextItems; + private final ContextNavigator contextNavigator; - public RoomsAdminPresenter(final ContextItems contextItems, final I18nTranslationService i18n, + public RoomsAdminPresenter(final ContextNavigator contextNavigator, final I18nTranslationService i18n, final Provider<StateManager> stateManagerProvider, final Session session, final Provider<ContentServiceAsync> contentServiceProvider) { - this.contextItems = contextItems; - final ContextItemsImages images = ContextItemsImages.App.getInstance(); - contextItems.setParentTreeVisible(false); - contextItems.registerType(ChatClientTool.TYPE_CHAT, images.page()); - contextItems.registerType(ChatClientTool.TYPE_ROOM, images.chatGreen()); - contextItems.canCreate(i18n.t("New chat room"), i18n.t("Add a chat room"), new Slot<String>() { - public void onEvent(final String name) { - Site.showProgressProcessing(); - final String groupShortName = session.getCurrentState().getGroup().getShortName(); - final Long containerId = session.getCurrentState().getFolder().getId(); - contentServiceProvider.get().addRoom(session.getUserHash(), groupShortName, containerId, - groupShortName + "-" + name, new AsyncCallbackSimple<StateDTO>() { - public void onSuccess(final StateDTO state) { - final StateManager stateManager = stateManagerProvider.get(); - stateManager.setRetrievedState(state); - // FIXME: Isn't using cache (same in Add folder) - stateManager.reloadContextAndTitles(); - Site.hideProgress(); - } - }); - } - }); + this.contextNavigator = contextNavigator; + // final ContextNavigatorImages images = + // ContextNavigatorImages.App.getInstance(); + // contextNavigator.registerType(ChatClientTool.TYPE_CHAT, + // images.page()); + // contextNavigator.registerType(ChatClientTool.TYPE_ROOM, + // images.chatGreen()); + // contextNavigator.canCreate(i18n.t("New chat room"), i18n.t("Add a + // chat room"), new Slot<String>() { + // public void onEvent(final String name) { + // Site.showProgressProcessing(); + // final String groupShortName = + // session.getCurrentState().getGroup().getShortName(); + // final Long containerId = + // session.getCurrentState().getFolder().getId(); + // contentServiceProvider.get().addRoom(session.getUserHash(), + // groupShortName, containerId, + // groupShortName + "-" + name, new AsyncCallbackSimple<StateDTO>() { + // public void onSuccess(final StateDTO state) { + // final StateManager stateManager = stateManagerProvider.get(); + // stateManager.setRetrievedState(state); + // // FIXME: Isn't using cache (same in Add folder) + // stateManager.reloadContextAndTitles(); + // Site.hideProgress(); + // } + // }); + // } + // }); } public View getView() { - return contextItems.getView(); + return contextNavigator.getView(); } - // FIXME: cierta lógica de negocio en el cliente - // ¿debemos quitarla? es decir, enviar desde el servidor si se puede añadir - // hijos al contenedor public void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) { - contextItems.showContainer(token, container, rights); - final String type = container.getTypeId(); - if (type.equals(ChatClientTool.TYPE_ROOM)) { - contextItems.setControlsVisible(false); - } + // contextNavigator.showContainer(token, container, rights); + // final String type = container.getTypeId(); + // if (type.equals(ChatClientTool.TYPE_ROOM)) { + // contextNavigator.setControlsVisible(false); + // } } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,6 +1,7 @@ package org.ourproject.kune.docs.client; import org.ourproject.kune.docs.client.cnt.DocumentContent; +import org.ourproject.kune.docs.client.cnt.DocumentContentPanel; import org.ourproject.kune.docs.client.cnt.DocumentContentPresenter; import org.ourproject.kune.docs.client.cnt.folder.FolderEditor; import org.ourproject.kune.docs.client.cnt.folder.FolderEditorPresenter; @@ -18,24 +19,22 @@ import org.ourproject.kune.docs.client.cnt.reader.ui.DocumentReaderControlPanel; import org.ourproject.kune.docs.client.cnt.reader.ui.DocumentReaderPanel; import org.ourproject.kune.docs.client.ctx.DocumentContext; +import org.ourproject.kune.docs.client.ctx.DocumentContextPanel; import org.ourproject.kune.docs.client.ctx.DocumentContextPresenter; import org.ourproject.kune.docs.client.ctx.admin.AdminContext; import org.ourproject.kune.docs.client.ctx.admin.AdminContextPresenter; import org.ourproject.kune.docs.client.ctx.admin.AdminContextView; import org.ourproject.kune.docs.client.ctx.admin.ui.AdminContextPanel; -import org.ourproject.kune.docs.client.ctx.folder.FolderContext; -import org.ourproject.kune.docs.client.ctx.folder.FolderContextPresenter; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.platf.client.ui.rate.RateIt; -import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel; import org.ourproject.kune.workspace.client.editor.TextEditor; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.tags.TagsSummary; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigator; import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter; import org.ourproject.kune.workspace.client.ui.newtmp.title.EntitySubTitlePresenter; @@ -58,7 +57,7 @@ register(SingletonScope.class, new Factory<DocumentClientTool>(DocumentClientTool.class) { public DocumentClientTool create() { return new DocumentClientTool(i18n, $(ToolSelector.class), $(WsThemePresenter.class), - $(WorkspaceSkeleton.class), $$(DocumentContent.class), $$(DocumentContext.class)); + $(WorkspaceSkeleton.class), $$(DocumentContext.class)); } }); @@ -75,20 +74,22 @@ register(SingletonScope.class, new Factory<DocumentContent>(DocumentContent.class) { public DocumentContent create() { - final WorkspaceDeckPanel panel = new WorkspaceDeckPanel(); final DocumentContentPresenter presenter = new DocumentContentPresenter($(StateManager.class), - $(I18nUITranslationService.class), $(KuneErrorHandler.class), panel, $(Session.class), + $(I18nUITranslationService.class), $(KuneErrorHandler.class), $(Session.class), $(RateIt.class), $$(DocumentReader.class), $$(DocumentReaderControl.class), $$(TextEditor.class), $$(FolderViewer.class), $$(FolderEditor.class), $$(ContentServiceAsync.class)); + final DocumentContentPanel panel = new DocumentContentPanel($(WorkspaceSkeleton.class)); + presenter.init(panel); return presenter; } }); register(SingletonScope.class, new Factory<DocumentContext>(DocumentContext.class) { public DocumentContext create() { - final WorkspaceDeckPanel view = new WorkspaceDeckPanel(); - final DocumentContextPresenter presenter = new DocumentContextPresenter(view, $$(FolderContext.class), - $$(AdminContext.class)); + final DocumentContextPresenter presenter = new DocumentContextPresenter($(StateManager.class), + $$(ContextNavigator.class), $$(AdminContext.class)); + final DocumentContextPanel panel = new DocumentContextPanel($(WorkspaceSkeleton.class)); + presenter.init(panel); return presenter; } }); @@ -103,21 +104,14 @@ register(SingletonScope.class, new Factory<DocumentReaderControl>(DocumentReaderControl.class) { public DocumentReaderControl create() { - final DocumentReaderControlPresenter presenter = new DocumentReaderControlPresenter(); + final DocumentReaderControlPresenter presenter = new DocumentReaderControlPresenter( + $(DocumentContent.class)); final DocumentReaderControlView view = new DocumentReaderControlPanel(presenter, i18n, ws); presenter.init(view); return presenter; } }); - register(SingletonScope.class, new Factory<FolderContext>(FolderContext.class) { - public FolderContext create() { - final FolderContextPresenter presenter = new FolderContextPresenter($(ContextItems.class), - $(StateManager.class), $(Session.class), i18n, $$(ContentServiceAsync.class)); - return presenter; - } - }); - register(SingletonScope.class, new Factory<FolderEditor>(FolderEditor.class) { public FolderEditor create() { final FolderEditorPanel view = new FolderEditorPanel(); @@ -128,12 +122,14 @@ register(SingletonScope.class, new Factory<FolderViewer>(FolderViewer.class) { public FolderViewer create() { - final FolderViewerView view = new FolderViewerPanel(ws); + final FolderViewerView view = new FolderViewerPanel(); final FolderViewerPresenter presenter = new FolderViewerPresenter(view); return presenter; } }); $(DocumentClientTool.class); + $(DocumentContent.class); + $(DocumentContext.class); } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,9 +20,7 @@ package org.ourproject.kune.docs.client; -import org.ourproject.kune.docs.client.cnt.DocumentContent; import org.ourproject.kune.docs.client.ctx.DocumentContext; -import org.ourproject.kune.platf.client.dto.StateDTO; import org.ourproject.kune.platf.client.tool.AbstractClientTool; import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; @@ -37,14 +35,11 @@ public static final String TYPE_DOCUMENT = "docs.doc"; public static final String NAME = "docs"; private final Provider<DocumentContext> documentContextProvider; - private final Provider<DocumentContent> documentContentProvider; public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector, final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws, - final Provider<DocumentContent> documentContentProvider, final Provider<DocumentContext> documentContextProvider) { super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws); - this.documentContentProvider = documentContentProvider; this.documentContextProvider = documentContextProvider; } @@ -60,15 +55,4 @@ documentContextProvider.get().showAdmin(); } - public void setContent(final StateDTO state) { - documentContentProvider.get().setContent(state); - - // TODO: check trigger interface (setState) - // trigger.setState(state.getStateToken().toString()); - } - - public void setContext(final StateDTO state) { - documentContextProvider.get().setContext(state); - } - } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContent.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,20 +20,20 @@ package org.ourproject.kune.docs.client.cnt; -import org.ourproject.kune.platf.client.dto.StateDTO; - import com.calclab.suco.client.signal.Slot0; public interface DocumentContent { - void onCancel(Slot0 slot); + void onEditCancelled(Slot0 slot); - void onEdit(Slot0 slot); + void onDeleteClicked(); + void onEditClicked(); + + void onEditing(Slot0 slot); + void onSaved(); void onSaveFailed(); - void setContent(StateDTO content); - } Added: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,19 @@ +package org.ourproject.kune.docs.client.cnt; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; + +import com.google.gwt.user.client.ui.Widget; + +public class DocumentContentPanel implements DocumentContentView { + + private final WorkspaceSkeleton ws; + + public DocumentContentPanel(final WorkspaceSkeleton ws) { + this.ws = ws; + } + + public void setContent(final View view) { + ws.getEntityWorkspace().setContent((Widget) view); + } +} Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,11 +20,11 @@ package org.ourproject.kune.docs.client.cnt; +import org.ourproject.kune.docs.client.DocumentClientTool; import org.ourproject.kune.docs.client.cnt.folder.FolderEditor; import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer; import org.ourproject.kune.docs.client.cnt.reader.DocumentReader; import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderControl; -import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dto.StateDTO; import org.ourproject.kune.platf.client.errors.SessionExpiredException; import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; @@ -33,7 +33,6 @@ import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.platf.client.ui.rate.RateIt; -import org.ourproject.kune.workspace.client.component.WorkspaceDeckView; import org.ourproject.kune.workspace.client.editor.TextEditor; import org.ourproject.kune.workspace.client.editor.TextEditorListener; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; @@ -41,11 +40,13 @@ import com.calclab.suco.client.provider.Provider; import com.calclab.suco.client.signal.Signal0; +import com.calclab.suco.client.signal.Slot; import com.calclab.suco.client.signal.Slot0; +import com.calclab.suco.client.signal.Slot2; import com.google.gwt.user.client.rpc.AsyncCallback; public class DocumentContentPresenter implements DocumentContent, TextEditorListener { - private final WorkspaceDeckView view; + private DocumentContentView view; private final StateManager stateManager; private StateDTO content; private final Session session; @@ -55,15 +56,15 @@ private final Provider<FolderEditor> folderEditorProvider; private final Provider<TextEditor> textEditorProvider; private final Provider<FolderViewer> folderViewerProvider; - private final Signal0 onEdit; - private final Signal0 onCancel; + private final Signal0 onEditing; + private final Signal0 onEditCancelled; private final Provider<ContentServiceAsync> contentServiceProvider; private final I18nUITranslationService i18n; private final KuneErrorHandler errorHandler; public DocumentContentPresenter(final StateManager stateManager, final I18nUITranslationService i18n, - final KuneErrorHandler errorHandler, final WorkspaceDeckView view, final Session session, - final RateIt rateIt, final Provider<DocumentReader> docReaderProvider, + final KuneErrorHandler errorHandler, final Session session, final RateIt rateIt, + final Provider<DocumentReader> docReaderProvider, final Provider<DocumentReaderControl> docReaderControlProvider, final Provider<TextEditor> textEditorProvider, final Provider<FolderViewer> folderViewerProvider, final Provider<FolderEditor> folderEditorProvider, @@ -71,7 +72,6 @@ this.stateManager = stateManager; this.i18n = i18n; this.errorHandler = errorHandler; - this.view = view; this.session = session; this.rateIt = rateIt; this.docReaderProvider = docReaderProvider; @@ -80,26 +80,30 @@ this.folderViewerProvider = folderViewerProvider; this.folderEditorProvider = folderEditorProvider; this.contentServiceProvider = contentServiceProvider; - this.onEdit = new Signal0("onEdit"); - this.onCancel = new Signal0("onCancel"); + this.onEditing = new Signal0("onEditing"); + this.onEditCancelled = new Signal0("onEditCancelled"); + stateManager.onStateChanged(new Slot<StateDTO>() { + public void onEvent(final StateDTO state) { + if (state.getToolName().equals(DocumentClientTool.NAME)) { + content = state; + showContent(); + } + } + }); + stateManager.onToolChanged(new Slot2<String, String>() { + public void onEvent(final String oldTool, final String newTool) { + if (oldTool != null && oldTool.equals(DocumentClientTool.NAME)) { + // Detach + } + } + }); } - public View getView() { - return view; + public void init(final DocumentContentView view) { + this.view = view; } - public void onCancel() { - showContent(); - onCancel.fire(); - // Re-enable rateIt widget - rateIt.setVisible(true); - } - - public void onCancel(final Slot0 slot) { - onCancel.add(slot); - } - - public void onDelete() { + public void onDeleteClicked() { Site.showProgressProcessing(); contentServiceProvider.get().delContent(session.getUserHash(), session.getCurrentState().getGroup().getShortName(), content.getDocumentId(), @@ -111,7 +115,19 @@ }); } - public void onEdit() { + public void onEditCancelled() { + showContent(); + onEditCancelled.fire(); + // Re-enable rateIt widget + rateIt.setVisible(true); + textEditorProvider.get().setToolbarVisible(false); + } + + public void onEditCancelled(final Slot0 slot) { + onEditCancelled.add(slot); + } + + public void onEditClicked() { session.check(new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { if (content.hasDocument()) { @@ -119,19 +135,20 @@ rateIt.setVisible(false); final TextEditor editor = textEditorProvider.get(); editor.setContent(content.getContent()); - view.show(editor.getView()); + editor.setToolbarVisible(true); + view.setContent(editor.getView()); } else { final FolderEditor editor = folderEditorProvider.get(); editor.setFolder(content.getFolder()); - view.show(editor.getView()); + view.setContent(editor.getView()); } - onEdit.fire(); + onEditing.fire(); } }); } - public void onEdit(final Slot0 slot) { - onEdit.add(slot); + public void onEditing(final Slot0 slot) { + onEditing.add(slot); } public void onSave(final String text) { @@ -170,12 +187,8 @@ public void onTranslate() { } - public void setContent(final StateDTO content) { - this.content = content; - showContent(); - } - private void showContent() { + textEditorProvider.get().setToolbarVisible(false); if (content.hasDocument()) { docReaderProvider.get().showDocument(content.getContent()); textEditorProvider.get().reset(); @@ -185,7 +198,7 @@ } else { final FolderViewer viewer = folderViewerProvider.get(); viewer.setFolder(content.getFolder()); - view.show(viewer.getView()); + view.setContent(viewer.getView()); } } Added: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,9 @@ +package org.ourproject.kune.docs.client.cnt; + +import org.ourproject.kune.platf.client.View; + +public interface DocumentContentView { + + void setContent(View view); + +} Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/FolderViewerPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/FolderViewerPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/folder/viewer/ui/FolderViewerPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -22,13 +22,12 @@ import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerView; import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.Label; -public class FolderViewerPanel implements FolderViewerView { +public class FolderViewerPanel extends Label implements FolderViewerView { - public FolderViewerPanel(final WorkspaceSkeleton ws) { - ws.getEntityWorkspace().setContent(new Label("Folder properties, translations ..." + Site.IN_DEVELOPMENT)); + public FolderViewerPanel() { + super("Folder properties, translations ..." + Site.IN_DEVELOPMENT); } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControl.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControl.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControl.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,13 +20,10 @@ package org.ourproject.kune.docs.client.cnt.reader; -import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dto.AccessRightsDTO; public interface DocumentReaderControl { - View getView(); - void setRights(AccessRightsDTO accessRights); void show(); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,27 +20,42 @@ package org.ourproject.kune.docs.client.cnt.reader; -import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.docs.client.cnt.DocumentContent; import org.ourproject.kune.platf.client.dto.AccessRightsDTO; +import com.calclab.suco.client.signal.Slot0; + public class DocumentReaderControlPresenter implements DocumentReaderControl { private DocumentReaderControlView view; + private final DocumentContent docContent; - public View getView() { - return view; + public DocumentReaderControlPresenter(final DocumentContent docContent) { + this.docContent = docContent; + docContent.onEditing(new Slot0() { + public void onEvent() { + view.hide(); + } + }); + docContent.onEditCancelled(new Slot0() { + public void onEvent() { + view.show(); + } + }); } public void init(final DocumentReaderControlView view) { this.view = view; } - public void onDelete() { + public void onDeleteClicked() { + // docContent.onDeleteClicked(); } - public void onEdit() { + public void onEditClicked() { + // docContent.onEditClicked(); } - public void onTranslate() { + public void onTranslateClicked() { } public void setRights(final AccessRightsDTO accessRights) { Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlView.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderControlView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -24,12 +24,14 @@ public interface DocumentReaderControlView extends View { - public void setDeleteEnabled(boolean isEnabled); + void hide(); - public void setEditEnabled(boolean isEnabled); + void setDeleteEnabled(boolean isEnabled); - public void setTranslateEnabled(boolean isEnabled); + void setEditEnabled(boolean isEnabled); - public void show(); + void setTranslateEnabled(boolean isEnabled); + void show(); + } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -22,53 +22,60 @@ import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderControlPresenter; import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderControlView; -import org.ourproject.kune.platf.client.ui.CustomPushButton; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.Toolbar; import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Widget; +import com.gwtext.client.core.EventObject; +import com.gwtext.client.widgets.Button; +import com.gwtext.client.widgets.ToolbarButton; +import com.gwtext.client.widgets.event.ButtonListenerAdapter; -public class DocumentReaderControlPanel extends HorizontalPanel implements DocumentReaderControlView { - private final CustomPushButton editBtn; - private final CustomPushButton deleteBtn; - private final CustomPushButton translateBtn; +public class DocumentReaderControlPanel implements DocumentReaderControlView { + private final ToolbarButton editBtn; + private final ToolbarButton deleteBtn; + private final ToolbarButton translateBtn; + private final Widget space1; + private final Widget space2; public DocumentReaderControlPanel(final DocumentReaderControlPresenter presenter, final I18nUITranslationService i18n, final WorkspaceSkeleton ws) { - editBtn = new CustomPushButton(i18n.tWithNT("Edit", "used in button"), new ClickListener() { - public void onClick(final Widget sender) { - presenter.onEdit(); - editBtn.removeStyleDependentName("up-hovering"); + editBtn = new ToolbarButton(i18n.tWithNT("Edit", "used in button"), new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + presenter.onEditClicked(); } }); - deleteBtn = new CustomPushButton(i18n.tWithNT("Delete", "used in button"), new ClickListener() { - public void onClick(final Widget sender) { - presenter.onDelete(); - deleteBtn.removeStyleDependentName("up-hovering"); + deleteBtn = new ToolbarButton(i18n.tWithNT("Delete", "used in button"), new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + presenter.onDeleteClicked(); } }); - translateBtn = new CustomPushButton(i18n.tWithNT("Translate", "used in button"), new ClickListener() { - public void onClick(final Widget sender) { - presenter.onTranslate(); - translateBtn.removeStyleDependentName("up-hovering"); + translateBtn = new ToolbarButton(i18n.tWithNT("Translate", "used in button"), new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + presenter.onTranslateClicked(); ws.showAlertMessage(i18n.t("Alert"), i18n.t("Sorry, this functionality is currently in development")); } }); - add(editBtn); - add(deleteBtn); - add(translateBtn); - deleteBtn.addStyleName("kune-Button-Small-lSpace"); - translateBtn.addStyleName("kune-Button-Small-lSpace"); + final Toolbar contentTopBar = ws.getEntityWorkspace().getContentTopBar(); + contentTopBar.add(editBtn); + space1 = contentTopBar.addSpacer(); + contentTopBar.add(deleteBtn); + space2 = contentTopBar.addSpacer(); + contentTopBar.add(translateBtn); setEditEnabled(false); setDeleteEnabled(false); setTranslateEnabled(false); + hide(); } + public void hide() { + this.setVisible(false); + } + public void setDeleteEnabled(final boolean isEnabled) { deleteBtn.setVisible(isEnabled); } @@ -82,7 +89,14 @@ } public void show() { + this.setVisible(true); + } + private void setVisible(final boolean visible) { + editBtn.setVisible(visible); + deleteBtn.setVisible(visible); + translateBtn.setVisible(visible); + space1.setVisible(visible); + space2.setVisible(visible); } - } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContext.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContext.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContext.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,12 +20,9 @@ package org.ourproject.kune.docs.client.ctx; -import org.ourproject.kune.platf.client.dto.StateDTO; public interface DocumentContext { - void setContext(StateDTO state); - void showAdmin(); void showFolders(); Added: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,19 @@ +package org.ourproject.kune.docs.client.ctx; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; + +public class DocumentContextPanel implements DocumentContextView { + + private final WorkspaceSkeleton ws; + + public DocumentContextPanel(final WorkspaceSkeleton ws) { + this.ws = ws; + } + + @Deprecated + public void setContainer(final View view) { + // ws.getEntityWorkspace().setContext((Widget) view); + } + +} Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,64 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.docs.client.ctx; - -import org.ourproject.kune.docs.client.ctx.admin.AdminContext; -import org.ourproject.kune.docs.client.ctx.folder.FolderContext; -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.workspace.client.component.WorkspaceDeckView; - -import com.calclab.suco.client.provider.Provider; - -public class DocumentContextPresenter implements DocumentContext { - private final WorkspaceDeckView view; - private final Provider<FolderContext> folderContextProvider; - private final Provider<AdminContext> adminContextProvider; - - public DocumentContextPresenter(final WorkspaceDeckView view, final Provider<FolderContext> folderContexProvider, - final Provider<AdminContext> adminContextProvider) { - this.view = view; - this.folderContextProvider = folderContexProvider; - this.adminContextProvider = adminContextProvider; - } - - public View getView() { - return view; - } - - public void setContext(final StateDTO content) { - final StateToken state = content.getStateToken(); - folderContextProvider.get().setContainer(state, content.getFolder(), content.getFolderRights()); - adminContextProvider.get().setState(content); - view.show(folderContextProvider.get().getView()); - } - - public void showAdmin() { - final AdminContext adminContext = adminContextProvider.get(); - view.show(adminContext.getView()); - } - - public void showFolders() { - final FolderContext folderContext = folderContextProvider.get(); - view.show(folderContext.getView()); - } -} Added: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,68 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.ourproject.kune.docs.client.ctx; + +import org.ourproject.kune.docs.client.DocumentClientTool; +import org.ourproject.kune.docs.client.ctx.admin.AdminContext; +import org.ourproject.kune.platf.client.dto.StateDTO; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigator; + +import com.calclab.suco.client.provider.Provider; +import com.calclab.suco.client.signal.Slot; + +public class DocumentContextPresenter implements DocumentContext { + private DocumentContextView view; + private final Provider<ContextNavigator> contextNavigatorProvider; + private final Provider<AdminContext> adminContextProvider; + + public DocumentContextPresenter(final StateManager stateManager, + final Provider<ContextNavigator> contextNavigatorProvider, final Provider<AdminContext> adminContextProvider) { + this.contextNavigatorProvider = contextNavigatorProvider; + this.adminContextProvider = adminContextProvider; + stateManager.onStateChanged(new Slot<StateDTO>() { + public void onEvent(final StateDTO state) { + if (DocumentClientTool.NAME.equals(state.getToolName())) { + setState(state); + } + } + }); + } + + public void init(final DocumentContextView view) { + this.view = view; + } + + public void showAdmin() { + final AdminContext adminContext = adminContextProvider.get(); + view.setContainer(adminContext.getView()); + } + + public void showFolders() { + view.setContainer(contextNavigatorProvider.get().getView()); + } + + private void setState(final StateDTO state) { + contextNavigatorProvider.get().setState(state); + adminContextProvider.get().setState(state); + showFolders(); + } +} Added: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextView.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/DocumentContextView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,10 @@ +package org.ourproject.kune.docs.client.ctx; + +import org.ourproject.kune.platf.client.View; + +public interface DocumentContextView { + + @Deprecated + void setContainer(View view); + +} Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContext.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContext.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContext.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,32 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.docs.client.ctx.folder; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.AccessRightsDTO; -import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.StateToken; - -public interface FolderContext { - View getView(); - - void setContainer(StateToken currentState, ContainerDTO folder, AccessRightsDTO accessRightsDTO); -} Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,92 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.docs.client.ctx.folder; - -import org.ourproject.kune.docs.client.DocumentClientTool; -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.AccessRightsDTO; -import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.sitebar.Site; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsImages; - -import com.calclab.suco.client.provider.Provider; -import com.calclab.suco.client.signal.Slot; - -public class FolderContextPresenter implements FolderContext { - private final ContextItems contextItems; - - public FolderContextPresenter(final ContextItems contextItems, final StateManager stateManager, - final Session session, final I18nTranslationService i18n, - final Provider<ContentServiceAsync> contentServiceProvider) { - this.contextItems = contextItems; - final ContextItemsImages contextImages = ContextItemsImages.App.getInstance(); - contextItems.registerType(DocumentClientTool.TYPE_DOCUMENT, contextImages.pageWhite()); - contextItems.registerType(DocumentClientTool.TYPE_FOLDER, contextImages.folder()); - contextItems.canCreate(i18n.t("New document"), i18n.t("Add a document"), new Slot<String>() { - public void onEvent(final String name) { - Site.showProgressProcessing(); - contentServiceProvider.get().addContent(session.getUserHash(), - session.getCurrentState().getGroup().getShortName(), - session.getCurrentState().getFolder().getId(), name, new AsyncCallbackSimple<StateDTO>() { - public void onSuccess(final StateDTO state) { - Site.info(i18n.t("Created, now you can edit the document")); - stateManager.setRetrievedState(state); - Site.hideProgress(); - } - }); - } - }); - contextItems.canCreate(i18n.t("New folder"), i18n.t("Add a folder"), new Slot<String>() { - public void onEvent(final String name) { - Site.showProgressProcessing(); - contentServiceProvider.get().addFolder(session.getUserHash(), - session.getCurrentState().getGroup().getShortName(), - session.getCurrentState().getFolder().getId(), name, new AsyncCallbackSimple<StateDTO>() { - public void onSuccess(final StateDTO state) { - Site.info(i18n.t("Folder created")); - stateManager.setRetrievedState(state); - // FIXME: Isn't using cache - stateManager.reloadContextAndTitles(); - Site.hideProgress(); - } - }); - } - }); - contextItems.setParentTreeVisible(true); - } - - public View getView() { - return contextItems.getView(); - } - - public void setContainer(final StateToken state, final ContainerDTO container, final AccessRightsDTO rights) { - contextItems.showContainer(state, container, rights); - } - -} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionManager.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,31 @@ +package org.ourproject.kune.platf.client.actions; + +import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; + +import com.calclab.suco.client.signal.Slot0; + +public class ActionManager { + + private final WorkspaceSkeleton ws; + + public ActionManager(final WorkspaceSkeleton ws) { + this.ws = ws; + } + + public void doAction(final ClientActionDescriptor<?> action, final Object parameter) { + if (action.isMustBeConfirmed()) { + ws.askConfirmation(action.getConfirmationTitle(), action.getConfirmationText(), new Slot0() { + public void onEvent() { + action.fireOnPerformCall(parameter); + } + }, new Slot0() { + public void onEvent() { + action.fireOnNotConfirmed(parameter); + } + }); + } else { + action.fireOnPerformCall(parameter); + } + } + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionPosition.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,5 @@ +package org.ourproject.kune.platf.client.actions; + +public enum ActionPosition { + topbar, bottombar, itemMenu, topBarAndItemMenu, bootombarAndItemMenu +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionCollection.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionCollection.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionCollection.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,9 @@ +package org.ourproject.kune.platf.client.actions; + +import java.util.ArrayList; + +public class ClientActionCollection<T> extends ArrayList<ClientActionDescriptor<T>> { + + private static final long serialVersionUID = 1L; + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionDescriptor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionDescriptor.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ClientActionDescriptor.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,158 @@ +package org.ourproject.kune.platf.client.actions; + +import org.ourproject.kune.platf.client.dto.AccessRolDTO; +import org.ourproject.kune.platf.client.services.ImageDescriptor; + +import com.allen_sauer.gwt.log.client.Log; +import com.calclab.suco.client.signal.Slot; + +public class ClientActionDescriptor<T> { + + private String iconUrl; + private ImageDescriptor iconDescriptor; + private String textDescription; + private String toolTip; + + private boolean mustBeConfirmed; + private String confirmationTitle; + private String confirmationText; + + private boolean isMenuAction; + private String parentMenuTitle; + private String parentMenuIconUrl; + private String parentSubMenuTitle; + + private final Slot<T> onPerformCall; + private final Slot<T> onNotConfirmed; + + private AccessRolDTO accessRol; + + private ActionPosition actionPosition; + + public ClientActionDescriptor(final AccessRolDTO accessRolDTO, final ActionPosition actionPosition, + final Slot<T> onPerformCall) { + accessRol = accessRolDTO; + this.actionPosition = actionPosition; + this.onPerformCall = onPerformCall; + mustBeConfirmed = false; + onNotConfirmed = null; + isMenuAction = false; + } + + @SuppressWarnings("unchecked") + public void fireOnNotConfirmed(final Object parameter) { + if (onNotConfirmed != null) { + onNotConfirmed.onEvent((T) parameter); + } + } + + @SuppressWarnings("unchecked") + public void fireOnPerformCall(final Object parameter) { + onPerformCall.onEvent((T) parameter); + } + + public AccessRolDTO getAccessRol() { + return accessRol; + } + + public ActionPosition getActionPosition() { + return actionPosition; + } + + public String getConfirmationText() { + return confirmationText; + } + + public String getConfirmationTitle() { + return confirmationTitle; + } + + public ImageDescriptor getIconDescriptor() { + return iconDescriptor; + } + + public String getIconUrl() { + return iconUrl; + } + + public String getParentMenuIconUrl() { + return parentMenuIconUrl; + } + + public String getParentMenuTitle() { + return parentMenuTitle; + } + + public String getParentSubMenuTitle() { + return parentSubMenuTitle; + } + + public String getText() { + return textDescription; + } + + public String getToolTip() { + return toolTip; + } + + public boolean isMenuAction() { + return isMenuAction; + } + + public boolean isMustBeConfirmed() { + return mustBeConfirmed; + } + + public void setAccessRol(final AccessRolDTO accessRol) { + this.accessRol = accessRol; + } + + public void setConfirmationText(final String confirmationText) { + this.confirmationText = confirmationText; + } + + public void setConfirmationTitle(final String confirmationTitle) { + this.confirmationTitle = confirmationTitle; + } + + public void setIconDescriptor(final ImageDescriptor iconDescriptor) { + this.iconDescriptor = iconDescriptor; + } + + public void setIconUrl(final String iconUrl) { + this.iconUrl = iconUrl; + } + + public void setMustBeConfirmed(final boolean mustBeConfirmed) { + this.mustBeConfirmed = mustBeConfirmed; + } + + public void setActionPosition(final ActionPosition actionPosition) { + this.actionPosition = actionPosition; + } + + public void setParentMenuIconUrl(final String parentMenuIconUrl) { + this.parentMenuIconUrl = parentMenuIconUrl; + } + + public void setParentMenuTitle(final String parentMenuTitle) { + isMenuAction = true; + this.parentMenuTitle = parentMenuTitle; + } + + public void setParentSubMenuTitle(final String parentSubMenuTitle) { + if (parentMenuTitle == null) { + Log.warn("Please set parentMenuTitle before"); + } + this.parentSubMenuTitle = parentSubMenuTitle; + } + + public void setTextDescription(final String textDescription) { + this.textDescription = textDescription; + } + + public void setToolTip(final String toolTip) { + this.toolTip = toolTip; + } + +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRolDTO.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRolDTO.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRolDTO.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,5 @@ +package org.ourproject.kune.platf.client.dto; + +public enum AccessRolDTO { + Administrator, Editor, Viewer +} Added: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContentStatusDTO.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContentStatusDTO.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContentStatusDTO.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,5 @@ +package org.ourproject.kune.platf.client.dto; + +public enum ContentStatusDTO { + publicVisible, nonPublicVisible, markForDelection +} \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2008-09-07 14:07:16 UTC (rev 844) @@ -25,8 +25,8 @@ import com.google.gwt.user.client.rpc.IsSerializable; public class StateToken implements IsSerializable { + public static final String SEPARATOR = "."; private static final String[] EMPTY = new String[0]; - private static final String DOT = "."; public static String encode(final String group, final String tool, final String folder, final String document) { String encoded = ""; @@ -34,13 +34,13 @@ encoded += group; } if (tool != null) { - encoded += DOT + tool; + encoded += SEPARATOR + tool; } if (folder != null) { - encoded += DOT + folder; + encoded += SEPARATOR + folder; } if (document != null) { - encoded += DOT + document; + encoded += SEPARATOR + document; } return encoded; } @@ -80,6 +80,10 @@ encoded = null; } + public StateToken clone() { + return new StateToken(this.getEncoded()); + } + public String getDocument() { return document; } @@ -103,7 +107,7 @@ String publicUrl = "http://"; if (group != null) { - publicUrl += group + DOT; + publicUrl += group + SEPARATOR; } // FIXME: Maybe get from InitData the site.domain @@ -113,10 +117,10 @@ publicUrl += tool; } if (folder != null) { - publicUrl += DOT + folder; + publicUrl += SEPARATOR + folder; } if (document != null) { - publicUrl += DOT + document; + publicUrl += SEPARATOR + document; } return publicUrl; @@ -155,24 +159,28 @@ return getDocument() != null; } - public void setDocument(final String document) { + public StateToken setDocument(final String document) { this.document = document; encoded = null; + return this; } - public void setFolder(final String folder) { + public StateToken setFolder(final String folder) { this.folder = folder; encoded = null; + return this; } - public void setGroup(final String group) { + public StateToken setGroup(final String group) { this.group = group; encoded = null; + return this; } - public void setTool(final String tool) { + public StateToken setTool(final String tool) { this.tool = tool; encoded = null; + return this; } public String toString() { Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-09-07 14:07:16 UTC (rev 844) @@ -2,6 +2,7 @@ import org.ourproject.kune.chat.client.ChatClientModule; import org.ourproject.kune.docs.client.DocumentClientModule; +import org.ourproject.kune.platf.client.actions.ActionManager; import org.ourproject.kune.platf.client.app.Application; import org.ourproject.kune.platf.client.app.ApplicationDefault; import org.ourproject.kune.platf.client.app.HistoryWrapper; @@ -85,9 +86,9 @@ import org.ourproject.kune.workspace.client.tags.TagsSummary; import org.ourproject.kune.workspace.client.tags.TagsSummaryPanel; import org.ourproject.kune.workspace.client.tags.TagsSummaryPresenter; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsPanel; -import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsPresenter; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigator; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigatorPanel; +import org.ourproject.kune.workspace.client.ui.ctx.items.ContextNavigatorPresenter; import org.ourproject.kune.workspace.client.ui.newtmp.entitylogo.EntityLogo; import org.ourproject.kune.workspace.client.ui.newtmp.entitylogo.EntityLogoPanel; import org.ourproject.kune.workspace.client.ui.newtmp.entitylogo.EntityLogoPresenter; @@ -560,7 +561,7 @@ register(SingletonScope.class, new Factory<TextEditor>(TextEditor.class) { public TextEditor create() { final TextEditorPresenter presenter = new TextEditorPresenter(null, true); - final TextEditorPanel panel = new TextEditorPanel(presenter, i18n); + final TextEditorPanel panel = new TextEditorPanel(presenter, i18n, ws); presenter.init(panel); return presenter; } @@ -575,11 +576,18 @@ } }); - register(SingletonScope.class, new Factory<ContextItems>(ContextItems.class) { - public ContextItems create() { - final ContextItemsPresenter presenter = new ContextItemsPresenter(i18n, $(StateManager.class), - $(Session.class), $$(ContentServiceAsync.class)); - final ContextItemsPanel panel = new ContextItemsPanel(presenter, i18n, $(StateManager.class), ws); + register(SingletonScope.class, new Factory<ActionManager>(ActionManager.class) { + public ActionManager create() { + return new ActionManager(ws); + } + }); + + register(SingletonScope.class, new Factory<ContextNavigator>(ContextNavigator.class) { + public ContextNavigator create() { + final ContextNavigatorPresenter presenter = new ContextNavigatorPresenter($(StateManager.class), + $(Session.class), $$(ContentServiceAsync.class), i18n); + final ContextNavigatorPanel panel = new ContextNavigatorPanel(presenter, i18n, $(StateManager.class), + ws, $$(ActionManager.class)); presenter.init(panel); return presenter; } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-09-07 14:07:16 UTC (rev 844) @@ -34,6 +34,8 @@ void gotoContainer(Long containerId); + void gotoToken(StateToken state); + void gotoToken(String token); void onGroupChanged(Slot2<String, String> slot); @@ -54,6 +56,4 @@ void setSocialNetwork(SocialNetworkResultDTO socialNet); - void setState(StateToken state); - } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-09-07 14:07:16 UTC (rev 844) @@ -81,11 +81,15 @@ final StateToken newStateToken = session.getCurrentState().getStateToken(); newStateToken.setDocument(null); newStateToken.setFolder(containerId.toString()); - setState(newStateToken); + gotoToken(newStateToken); } + public void gotoToken(final StateToken state) { + history.newItem(state.getEncoded()); + } + public void gotoToken(final String token) { - setState(new StateToken(token)); + gotoToken(new StateToken(token)); } public void onGroupChanged(final Slot2<String, String> slot) { @@ -131,6 +135,7 @@ onHistoryChanged(history.getToken()); } + @Deprecated public void reloadContextAndTitles() { contentProvider.getContent(session.getUserHash(), new StateToken(history.getToken()), new AsyncCallbackSimple<StateDTO>() { @@ -151,7 +156,6 @@ public void setRetrievedState(final StateDTO content) { final StateToken state = content.getStateToken(); contentProvider.cache(state, content); - setState(state); } public void setSocialNetwork(final SocialNetworkResultDTO socialNet) { @@ -168,10 +172,6 @@ } } - public void setState(final StateToken state) { - history.newItem(state.getEncoded()); - } - private void checkGroupAndToolChange(final StateDTO oldState, final StateDTO newState) { final String oldGroupName = oldState != null ? oldState.getGroup().getShortName() : null; final String newGroupName = newState.getGroup().getShortName(); @@ -187,34 +187,11 @@ } private void loadContent(final StateDTO state) { - session.setCurrent(state); onStateChanged.fire(state); - // final GroupDTO group = state.getGroup(); - // app.setGroupState(group.getShortName()); - // final boolean isAdmin = state.getGroupRights().isAdministrable(); - // if (isAdmin) { - // workspace.getThemeMenuComponent().setVisible(true); - // } else { - // workspace.getThemeMenuComponent().setVisible(false); - // } - // workspace.showGroup(group, isAdmin); - - // final String toolName = state.getToolName(); - // workspace.setTool(toolName); - - // final ClientTool clientTool = app.getTool(toolName); - // clientTool.setContent(state); - // clientTool.setContext(state); - // workspace.getContentTitleComponent().setState(state); - // workspace.getContentSubTitleComponent().setState(state); - // workspace.getContentBottomToolBarComponent().setRate(state, - // session.isLogged()); - // workspace.setContent(clientTool.getContent()); - // workspace.setContext(clientTool.getContext()); - // workspace.getLicenseComponent().setLicense(state); Site.hideProgress(); } + @Deprecated private void loadContextOnly(final StateDTO state) { session.setCurrent(state); // /final String toolName = state.getToolName(); @@ -226,8 +203,9 @@ private void onHistoryChanged(final StateToken newState) { contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateDTO>() { public void onSuccess(final StateDTO newState) { - loadContent(newState); + session.setCurrent(newState); checkGroupAndToolChange(oldState, newState); + loadContent(newState); oldState = newState; } }); @@ -238,7 +216,8 @@ onHistoryChanged(new StateToken()); } else { final StateDTO currentState = session.getCurrentState(); - checkGroupAndToolChange(oldState, currentState); + session.setCurrent(oldState); + checkGroupAndToolChange(currentState, oldState); loadContent(oldState); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java 2008-09-07 14:07:16 UTC (rev 844) @@ -20,14 +20,9 @@ package org.ourproject.kune.platf.client.tool; -import org.ourproject.kune.platf.client.dto.StateDTO; public interface ClientTool { String getName(); - void setContent(StateDTO state); - - void setContext(StateDTO state); - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditor.java 2008-09-07 14:07:16 UTC (rev 844) @@ -24,18 +24,18 @@ public interface TextEditor { + public String getContent(); + public View getView(); - public View getToolBar(); - - public void setContent(String content); - - public String getContent(); - public void onSaved(); public void onSaveFailed(); public void reset(); + public void setContent(String content); + + public void setToolbarVisible(boolean visible); + } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorListener.java 2008-09-07 14:07:16 UTC (rev 844) @@ -21,7 +21,9 @@ package org.ourproject.kune.workspace.client.editor; public interface TextEditorListener { - void onCancel(); + void onEditCancelled(); + void onSave(String text); + } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -22,6 +22,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Timer; @@ -40,12 +41,13 @@ private final Timer saveTimer; private final I18nTranslationService i18n; - public TextEditorPanel(final TextEditorPresenter presenter, final I18nTranslationService i18n) { + public TextEditorPanel(final TextEditorPresenter presenter, final I18nTranslationService i18n, + final WorkspaceSkeleton ws) { this.presenter = presenter; this.i18n = i18n; gwtRTarea = new RichTextArea(); - textEditorToolbar = new TextEditorToolbar(gwtRTarea, presenter, i18n); + textEditorToolbar = new TextEditorToolbar(gwtRTarea, presenter, i18n, ws); initWidget(gwtRTarea); gwtRTarea.setWidth("97%"); @@ -117,6 +119,10 @@ textEditorToolbar.setTextSaveButton(text); } + public void setToolBarVisible(final boolean visible) { + textEditorToolbar.setVisible(visible); + } + public void showSaveBeforeDialog() { MessageBox.confirm(i18n.t("Save confirmation"), i18n.t("Save before close?"), new MessageBox.ConfirmCallback() { public void execute(final String btnID) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -31,104 +31,103 @@ private boolean saveAndCloseConfirmed; public TextEditorPresenter(final TextEditorListener listener, final boolean isAutoSave) { - this.listener = listener; - autoSave = isAutoSave; - savePending = false; - editingHtml = false; - saveAndCloseConfirmed = false; + this.listener = listener; + autoSave = isAutoSave; + savePending = false; + editingHtml = false; + saveAndCloseConfirmed = false; + } + public String getContent() { + return view.getHTML(); } - public void init(final TextEditorView view) { - this.view = view; - this.view.setEnabledSaveButton(false); - this.view.setEnabled(true); + public View getView() { + return view; } - public void setContent(final String html) { - this.view.setHTML(html); + public void init(final TextEditorView view) { + this.view = view; + this.view.setEnabledSaveButton(false); + this.view.setEnabled(true); } public void onEdit() { - if (!savePending) { - savePending = true; - view.setEnabledSaveButton(true); - if (autoSave) { - view.scheduleSave(10000); - } - } + if (!savePending) { + savePending = true; + view.setEnabledSaveButton(true); + if (autoSave) { + view.scheduleSave(10000); + } + } } - protected void onSave() { - listener.onSave(view.getHTML()); + public void onSaveAndClose() { + saveAndCloseConfirmed = true; + onSave(); } - protected void onCancel() { - if (savePending) { - view.saveTimerCancel(); - view.showSaveBeforeDialog(); - } else { - onCancelConfirmed(); - } + public void onSaved() { + if (saveAndCloseConfirmed) { + onCancelConfirmed(); + } else { + reset(); + } } - protected void onCancelConfirmed() { - reset(); - listener.onCancel(); + public void onSaveFailed() { + view.scheduleSave(20000); + if (saveAndCloseConfirmed) { + saveAndCloseConfirmed = false; + } } - protected void onEditHTML() { - if (editingHtml) { - // normal editor - String html = view.getText(); - view.setHTML(html); - view.editHTML(false); - editingHtml = false; - } else { - // html editor - String html = view.getHTML(); - view.setText(html); - view.editHTML(true); - editingHtml = true; - } + public void reset() { + view.saveTimerCancel(); + savePending = false; + saveAndCloseConfirmed = false; + view.setEnabledSaveButton(false); } - public void onSaved() { - if (saveAndCloseConfirmed) { - onCancelConfirmed(); - } else { - reset(); - } + public void setContent(final String html) { + this.view.setHTML(html); } - public void reset() { - view.saveTimerCancel(); - savePending = false; - saveAndCloseConfirmed = false; - view.setEnabledSaveButton(false); + public void setToolbarVisible(final boolean visible) { + view.setToolBarVisible(visible); } - public void onSaveFailed() { - view.scheduleSave(20000); - if (saveAndCloseConfirmed) { - saveAndCloseConfirmed = false; - } + protected void onCancel() { + if (savePending) { + view.saveTimerCancel(); + view.showSaveBeforeDialog(); + } else { + onCancelConfirmed(); + } } - public View getView() { - return view; + protected void onCancelConfirmed() { + reset(); + listener.onEditCancelled(); } - public View getToolBar() { - return view.getToolBar(); + protected void onEditHTML() { + if (editingHtml) { + // normal editor + final String html = view.getText(); + view.setHTML(html); + view.editHTML(false); + editingHtml = false; + } else { + // html editor + final String html = view.getHTML(); + view.setText(html); + view.editHTML(true); + editingHtml = true; + } } - public String getContent() { - return view.getHTML(); + protected void onSave() { + listener.onSave(view.getHTML()); } - - public void onSaveAndClose() { - saveAndCloseConfirmed = true; - onSave(); - } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-09-07 14:07:16 UTC (rev 844) @@ -21,7 +21,6 @@ package org.ourproject.kune.workspace.client.editor; import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.ui.CustomPushButton; import org.ourproject.kune.platf.client.ui.KuneUiUtils; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; import org.ourproject.kune.platf.client.ui.form.FileUploadFormSample; @@ -31,6 +30,7 @@ import org.ourproject.kune.platf.client.ui.palette.ColorSelectListener; import org.ourproject.kune.platf.client.ui.palette.WebSafePalettePanel; import org.ourproject.kune.platf.client.ui.palette.WebSafePalettePresenter; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Command; @@ -47,6 +47,7 @@ import com.google.gwt.user.client.ui.ToggleButton; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; +import com.gwtext.client.core.EventObject; import com.gwtext.client.data.ArrayReader; import com.gwtext.client.data.DateFieldDef; import com.gwtext.client.data.FieldDef; @@ -55,8 +56,11 @@ import com.gwtext.client.data.RecordDef; import com.gwtext.client.data.Store; import com.gwtext.client.data.StringFieldDef; +import com.gwtext.client.widgets.Button; import com.gwtext.client.widgets.MessageBox; +import com.gwtext.client.widgets.ToolbarButton; import com.gwtext.client.widgets.MessageBox.PromptCallback; +import com.gwtext.client.widgets.event.ButtonListenerAdapter; /** * A sample toolbar for use with {@link RichTextArea}. It provides a simple UI @@ -71,192 +75,192 @@ */ private class EventListener implements ClickListener, ChangeListener, KeyboardListener { - private ImageChooser ic; + private ImageChooser ic; - public void onChange(final Widget sender) { - fireEdit(); - } + public void onChange(final Widget sender) { + fireEdit(); + } - public void onClick(final Widget sender) { - if (sender == bold) { - basic.toggleBold(); - } else if (sender == italic) { - basic.toggleItalic(); - } else if (sender == underline) { - basic.toggleUnderline(); - } else if (sender == subscript) { - basic.toggleSubscript(); - } else if (sender == superscript) { - basic.toggleSuperscript(); - } else if (sender == strikethrough) { - extended.toggleStrikethrough(); - } else if (sender == indent) { - extended.rightIndent(); - } else if (sender == outdent) { - extended.leftIndent(); - } else if (sender == justifyLeft) { - basic.setJustification(RichTextArea.Justification.LEFT); - } else if (sender == justifyCenter) { - basic.setJustification(RichTextArea.Justification.CENTER); - } else if (sender == justifyRight) { - basic.setJustification(RichTextArea.Justification.RIGHT); - } else if (sender == insertImage) { - showImagePanel(); - } else if (sender == createLink) { - MessageBox.prompt("Insert a link", "Enter a link URL:", new PromptCallback() { - public void execute(final String btnID, final String text) { - if (btnID.equals("ok") && text != null) { - extended.createLink(text); - } - } - }); - showLinkPanel(); - } else if (sender == backColor) { - showPalette(sender, sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 20); - palettePresenter.addColorSelectListener(new ColorSelectListener() { - public void onColorSelected(final String color) { - basic.setBackColor(color); - popupPalette.hide(); - palettePresenter.reset(); - } - }); - } else if (sender == fontColor) { - showPalette(sender, sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 20); - palettePresenter.addColorSelectListener(new ColorSelectListener() { - public void onColorSelected(final String color) { - basic.setForeColor(color); - popupPalette.hide(); - palettePresenter.reset(); - } - }); - } else if (sender == removeLink) { - extended.removeLink(); - } else if (sender == hr) { - extended.insertHorizontalRule(); - } else if (sender == ol) { - extended.insertOrderedList(); - } else if (sender == ul) { - extended.insertUnorderedList(); - } else if (sender == removeFormat) { - extended.removeFormat(); - } else if (sender == richText) { - // We use the RichTextArea's onKeyUp event to update the - // toolbar status. - // This will catch any cases where the user moves the cursur - // using the - // keyboard, or uses one of the browser's built-in keyboard - // shortcuts. - updateStatus(); - } - if (sender != richText) { - // some button pressed is equiv to edit - fireEdit(); - } - } + public void onClick(final Widget sender) { + if (sender == bold) { + basic.toggleBold(); + } else if (sender == italic) { + basic.toggleItalic(); + } else if (sender == underline) { + basic.toggleUnderline(); + } else if (sender == subscript) { + basic.toggleSubscript(); + } else if (sender == superscript) { + basic.toggleSuperscript(); + } else if (sender == strikethrough) { + extended.toggleStrikethrough(); + } else if (sender == indent) { + extended.rightIndent(); + } else if (sender == outdent) { + extended.leftIndent(); + } else if (sender == justifyLeft) { + basic.setJustification(RichTextArea.Justification.LEFT); + } else if (sender == justifyCenter) { + basic.setJustification(RichTextArea.Justification.CENTER); + } else if (sender == justifyRight) { + basic.setJustification(RichTextArea.Justification.RIGHT); + } else if (sender == insertImage) { + showImagePanel(); + } else if (sender == createLink) { + MessageBox.prompt("Insert a link", "Enter a link URL:", new PromptCallback() { + public void execute(final String btnID, final String text) { + if (btnID.equals("ok") && text != null) { + extended.createLink(text); + } + } + }); + showLinkPanel(); + } else if (sender == backColor) { + showPalette(sender, sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 20); + palettePresenter.addColorSelectListener(new ColorSelectListener() { + public void onColorSelected(final String color) { + basic.setBackColor(color); + popupPalette.hide(); + palettePresenter.reset(); + } + }); + } else if (sender == fontColor) { + showPalette(sender, sender.getAbsoluteLeft(), sender.getAbsoluteTop() + 20); + palettePresenter.addColorSelectListener(new ColorSelectListener() { + public void onColorSelected(final String color) { + basic.setForeColor(color); + popupPalette.hide(); + palettePresenter.reset(); + } + }); + } else if (sender == removeLink) { + extended.removeLink(); + } else if (sender == hr) { + extended.insertHorizontalRule(); + } else if (sender == ol) { + extended.insertOrderedList(); + } else if (sender == ul) { + extended.insertUnorderedList(); + } else if (sender == removeFormat) { + extended.removeFormat(); + } else if (sender == richText) { + // We use the RichTextArea's onKeyUp event to update the + // toolbar status. + // This will catch any cases where the user moves the cursur + // using the + // keyboard, or uses one of the browser's built-in keyboard + // shortcuts. + updateStatus(); + } + if (sender != richText) { + // some button pressed is equiv to edit + fireEdit(); + } + } - public void onKeyDown(final Widget sender, final char keyCode, final int modifiers) { - if (sender == removeLink && keyCode == KeyboardListener.KEY_ENTER) { - fireEditHTML(); - } - } + public void onKeyDown(final Widget sender, final char keyCode, final int modifiers) { + if (sender == removeLink && keyCode == KeyboardListener.KEY_ENTER) { + fireEditHTML(); + } + } - public void onKeyPress(final Widget sender, final char keyCode, final int modifiers) { - } + public void onKeyPress(final Widget sender, final char keyCode, final int modifiers) { + } - public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) { - if (sender == richText) { - // We use the RichTextArea's onKeyUp event to update the - // toolbar status. - // This will catch any cases where the user moves the cursur - // using the - // keyboard, or uses one of the browser's built-in keyboard - // shortcuts. - updateStatus(); - fireEdit(); - } - } + public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) { + if (sender == richText) { + // We use the RichTextArea's onKeyUp event to update the + // toolbar status. + // This will catch any cases where the user moves the cursur + // using the + // keyboard, or uses one of the browser's built-in keyboard + // shortcuts. + updateStatus(); + fireEdit(); + } + } - private Object[][] getData() { - return new Object[][] { - // new Object[]{"Pirates of the Caribbean", new Integer(2120), new - // Long(1180231870000l), "images/view/carribean.jpg"}, - // new Object[]{"Resident Evil", new Integer(2120), new - // Long(1180231870000l), "images/view/resident_evil.jpg"}, - // new Object[]{"Blood Diamond", new Integer(2120), new - // Long(1180231870000l), "images/view/blood_diamond.jpg"}, - // new Object[]{"No Reservations", new Integer(2120), new - // Long(1180231870000l), "images/view/no_reservations.jpg"}, - // new Object[]{"Casino Royale", new Integer(2120), new - // Long(1180231870000l), "images/view/casino_royale.jpg"}, - // new Object[]{"Good Shepherd", new Integer(2120), new - // Long(1180231870000l), "images/view/good_shepherd.jpg"}, - // new Object[]{"Ghost Rider", new Integer(2120), new - // Long(1180231870000l), "images/view/ghost_rider.jpg"}, - // new Object[]{"Batman Begins", new Integer(2120), new - // Long(1180231870000l), "images/view/batman_begins.jpg"}, - // new Object[]{"Last Samurai", new Integer(2120), new - // Long(1180231870000l), "images/view/last_samurai.jpg"}, - // new Object[]{"Italian Job", new Integer(2120), new - // Long(1180231870000l), "images/view/italian_job.jpg"}, - // new Object[]{"Mission Impossible III", new Integer(2120), new - // Long(1180231870000l), "images/view/mi3.jpg"}, - // new Object[]{"Mr & Mrs Smith", new Integer(2120), new - // Long(1180231870000l), "images/view/smith.jpg"}, - // new Object[]{"Inside Man", new Integer(2120), new - // Long(1180231870000l), "images/view/inside_man.jpg"}, - // new Object[]{"The Island", new Integer(2120), new - // Long(1180231870000l), "images/view/island.jpg"} - }; - } + private Object[][] getData() { + return new Object[][] { + // new Object[]{"Pirates of the Caribbean", new Integer(2120), new + // Long(1180231870000l), "images/view/carribean.jpg"}, + // new Object[]{"Resident Evil", new Integer(2120), new + // Long(1180231870000l), "images/view/resident_evil.jpg"}, + // new Object[]{"Blood Diamond", new Integer(2120), new + // Long(1180231870000l), "images/view/blood_diamond.jpg"}, + // new Object[]{"No Reservations", new Integer(2120), new + // Long(1180231870000l), "images/view/no_reservations.jpg"}, + // new Object[]{"Casino Royale", new Integer(2120), new + // Long(1180231870000l), "images/view/casino_royale.jpg"}, + // new Object[]{"Good Shepherd", new Integer(2120), new + // Long(1180231870000l), "images/view/good_shepherd.jpg"}, + // new Object[]{"Ghost Rider", new Integer(2120), new + // Long(1180231870000l), "images/view/ghost_rider.jpg"}, + // new Object[]{"Batman Begins", new Integer(2120), new + // Long(1180231870000l), "images/view/batman_begins.jpg"}, + // new Object[]{"Last Samurai", new Integer(2120), new + // Long(1180231870000l), "images/view/last_samurai.jpg"}, + // new Object[]{"Italian Job", new Integer(2120), new + // Long(1180231870000l), "images/view/italian_job.jpg"}, + // new Object[]{"Mission Impossible III", new Integer(2120), new + // Long(1180231870000l), "images/view/mi3.jpg"}, + // new Object[]{"Mr & Mrs Smith", new Integer(2120), new + // Long(1180231870000l), "images/view/smith.jpg"}, + // new Object[]{"Inside Man", new Integer(2120), new + // Long(1180231870000l), "images/view/inside_man.jpg"}, + // new Object[]{"The Island", new Integer(2120), new + // Long(1180231870000l), "images/view/island.jpg"} + }; + } - private void showImagePanel() { - // i18n: - FileUploadFormSample fileUploadFormSample = new FileUploadFormSample(); - BasicDialog dialog = new BasicDialog("Insert image", false, true, 400, 400); - dialog.add(fileUploadFormSample); - dialog.show(); + private void showImagePanel() { + // i18n: + final FileUploadFormSample fileUploadFormSample = new FileUploadFormSample(); + final BasicDialog dialog = new BasicDialog("Insert image", false, true, 400, 400); + dialog.add(fileUploadFormSample); + dialog.show(); - if (ic == null) { - MemoryProxy dataProxy = new MemoryProxy(getData()); - RecordDef recordDef = new RecordDef(new FieldDef[] { new StringFieldDef("name"), - new IntegerFieldDef("size"), new DateFieldDef("lastmod", "timestamp"), - new StringFieldDef("url") }); - ArrayReader reader = new ArrayReader(recordDef); - final Store store = new Store(dataProxy, reader, true); - store.load(); + if (ic == null) { + final MemoryProxy dataProxy = new MemoryProxy(getData()); + final RecordDef recordDef = new RecordDef(new FieldDef[] { new StringFieldDef("name"), + new IntegerFieldDef("size"), new DateFieldDef("lastmod", "timestamp"), + new StringFieldDef("url") }); + final ArrayReader reader = new ArrayReader(recordDef); + final Store store = new Store(dataProxy, reader, true); + store.load(); - ic = new ImageChooser("Image Chooser", 515, 400, store); - } + ic = new ImageChooser("Image Chooser", 515, 400, store); + } - ic.show(new ImageChooserCallback() { - public void onImageSelection(final ImageData data) { - // Element el = DomHelper.append("images", - // Format.format("<img src='{0}' - // style='margin:20px;visibility:hidden;'/>", - // data.getUrl())); - // ExtElement extEl = new ExtElement(el); - // extEl.show(true).frame(); - } - }); - // MessageBox.prompt("Insert image", "Enter an image URL:", new - // PromptCallback() { - // public void execute(final String btnID, final String text) { - // if (btnID.equals("ok") && text != null) { - // extended.insertImage(text); - // } - // } - // }); + ic.show(new ImageChooserCallback() { + public void onImageSelection(final ImageData data) { + // Element el = DomHelper.append("images", + // Format.format("<img src='{0}' + // style='margin:20px;visibility:hidden;'/>", + // data.getUrl())); + // ExtElement extEl = new ExtElement(el); + // extEl.show(true).frame(); + } + }); + // MessageBox.prompt("Insert image", "Enter an image URL:", new + // PromptCallback() { + // public void execute(final String btnID, final String text) { + // if (btnID.equals("ok") && text != null) { + // extended.insertImage(text); + // } + // } + // }); - } + } - private void showLinkPanel() { - } + private void showLinkPanel() { + } } private static final RichTextArea.FontSize[] fontSizesConstants = new RichTextArea.FontSize[] { - RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL, - RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE, - RichTextArea.FontSize.XX_LARGE }; + RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL, + RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE, + RichTextArea.FontSize.XX_LARGE }; private final TextEditorImages images = (TextEditorImages) GWT.create(TextEditorImages.class); private final EventListener listener = new EventListener(); @@ -267,7 +271,6 @@ private final VerticalPanel outer = new VerticalPanel(); private final HorizontalPanel topPanel = new HorizontalPanel(); - private final HorizontalPanel subtopPanel = new HorizontalPanel(); private ToggleButton bold; private ToggleButton italic; private ToggleButton underline; @@ -290,8 +293,8 @@ private PushButton fontColor; private MenuBar fonts; private MenuBar fontSizes; - private final CustomPushButton save; - private final CustomPushButton close; + private final ToolbarButton save; + private final ToolbarButton close; private WebSafePalettePanel palettePanel; private final TextEditorPresenter panelListener; private PopupPanel popupPalette; @@ -305,235 +308,246 @@ * the rich text area to be controlled */ public TextEditorToolbar(final RichTextArea richText, final TextEditorPresenter panelListener, - final I18nTranslationService i18n) { - this.richText = richText; - this.i18n = i18n; - this.basic = richText.getBasicFormatter(); - this.extended = richText.getExtendedFormatter(); + final I18nTranslationService i18n, final WorkspaceSkeleton ws) { + this.richText = richText; + this.i18n = i18n; + this.basic = richText.getBasicFormatter(); + this.extended = richText.getExtendedFormatter(); - this.panelListener = panelListener; + this.panelListener = panelListener; - initWidget(outer); + initWidget(outer); - outer.add(topPanel); - outer.add(subtopPanel); - outer.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); - setStyleName("gwt-RichTextToolbar"); + outer.add(topPanel); + outer.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); + setStyleName("gwt-RichTextToolbar"); - if (basic != null) { - topPanel.add(bold = createToggleButton(images.bold(), i18n.t("Toggle Bold"))); - topPanel.add(italic = createToggleButton(images.italic(), i18n.t("Toggle Italic"))); - topPanel.add(underline = createToggleButton(images.underline(), i18n.t("Toggle Underline"))); - } + save = new ToolbarButton(i18n.tWithNT("Save", "used in button"), new ButtonListenerAdapter() { + @Override + public void onClick(final Button button, final EventObject e) { + if (!save.isDisabled()) { + fireSave(); + } + } + }); - if (extended != null) { - topPanel.add(strikethrough = createToggleButton(images.strikeout(), i18n.t("Toggle Strikethrough"))); - } + close = new ToolbarButton(i18n.tWithNT("Close", "used in button"), new ButtonListenerAdapter() { + @Override + public void onClick(final Button button, final EventObject e) { + if (!close.isDisabled()) { + fireCancel(); + } + } + }); - if (basic != null) { - topPanel.add(subscript = createToggleButton(images.subscript(), i18n.t("Toggle Subscript"))); - topPanel.add(superscript = createToggleButton(images.superscript(), i18n.t("Toggle Superscript"))); - topPanel.add(justifyLeft = createPushButton(images.alignleft(), i18n.t("Left Justify"))); - topPanel.add(justifyCenter = createPushButton(images.centerpara(), i18n.t("Center"))); - topPanel.add(justifyRight = createPushButton(images.alignright(), i18n.t("Right Justify"))); - } + close.addStyleName("kune-Button-Large-lrSpace"); + topPanel.add(save); + topPanel.add(close); - if (extended != null) { - topPanel.add(indent = createPushButton(images.incrementindent(), i18n.t("Indent Right"))); - topPanel.add(outdent = createPushButton(images.decrementindent(), i18n.t("Indent Left"))); - topPanel.add(hr = createPushButton(images.hfixedline(), i18n.t("Insert Horizontal Rule"))); - topPanel.add(ol = createPushButton(images.defaultnumbering(), i18n.t("Insert Ordered List"))); - topPanel.add(ul = createPushButton(images.defaultbullet(), i18n.t("Insert Unordered List"))); - topPanel.add(insertImage = createPushButton(images.images(), i18n.t("Insert Image"))); - topPanel.add(createLink = createPushButton(images.link(), i18n.t("Create Link"))); - topPanel.add(removeLink = createPushButton(images.linkBreak(), i18n.t("Remove Link"))); - topPanel.add(removeFormat = createPushButton(images.removeFormat(), i18n.t("Remove Formatting"))); - } + if (basic != null) { + topPanel.add(bold = createToggleButton(images.bold(), i18n.t("Toggle Bold"))); + topPanel.add(italic = createToggleButton(images.italic(), i18n.t("Toggle Italic"))); + topPanel.add(underline = createToggleButton(images.underline(), i18n.t("Toggle Underline"))); + } - if (basic != null) { - topPanel.add(backColor = createPushButton(images.backcolor(), i18n.t("Background Color"))); - topPanel.add(fontColor = createPushButton(images.fontcolor(), i18n.t("Font Color"))); - topPanel.add(fonts = createFontsMenu()); - topPanel.add(fontSizes = createFontSizesMenu()); + if (extended != null) { + topPanel.add(strikethrough = createToggleButton(images.strikeout(), i18n.t("Toggle Strikethrough"))); + } - // We only use these listeners for updating status, so don't - // hook them up - // unless at least basic editing is supported. - richText.addKeyboardListener(listener); - richText.addClickListener(listener); - } + if (basic != null) { + topPanel.add(subscript = createToggleButton(images.subscript(), i18n.t("Toggle Subscript"))); + topPanel.add(superscript = createToggleButton(images.superscript(), i18n.t("Toggle Superscript"))); + topPanel.add(justifyLeft = createPushButton(images.alignleft(), i18n.t("Left Justify"))); + topPanel.add(justifyCenter = createPushButton(images.centerpara(), i18n.t("Center"))); + topPanel.add(justifyRight = createPushButton(images.alignright(), i18n.t("Right Justify"))); + } - save = new CustomPushButton(i18n.tWithNT("Save", "used in button"), new ClickListener() { - public void onClick(final Widget sender) { - if (save.isEnabled()) { - fireSave(); - } - } - }); + if (extended != null) { + topPanel.add(indent = createPushButton(images.incrementindent(), i18n.t("Indent Right"))); + topPanel.add(outdent = createPushButton(images.decrementindent(), i18n.t("Indent Left"))); + topPanel.add(hr = createPushButton(images.hfixedline(), i18n.t("Insert Horizontal Rule"))); + topPanel.add(ol = createPushButton(images.defaultnumbering(), i18n.t("Insert Ordered List"))); + topPanel.add(ul = createPushButton(images.defaultbullet(), i18n.t("Insert Unordered List"))); + topPanel.add(insertImage = createPushButton(images.images(), i18n.t("Insert Image"))); + topPanel.add(createLink = createPushButton(images.link(), i18n.t("Create Link"))); + topPanel.add(removeLink = createPushButton(images.linkBreak(), i18n.t("Remove Link"))); + topPanel.add(removeFormat = createPushButton(images.removeFormat(), i18n.t("Remove Formatting"))); + } - close = new CustomPushButton(i18n.tWithNT("Close", "used in button"), new ClickListener() { - public void onClick(final Widget sender) { - if (close.isEnabled()) { - fireCancel(); - } - } - }); + if (basic != null) { + topPanel.add(backColor = createPushButton(images.backcolor(), i18n.t("Background Color"))); + topPanel.add(fontColor = createPushButton(images.fontcolor(), i18n.t("Font Color"))); + topPanel.add(fonts = createFontsMenu()); + topPanel.add(fontSizes = createFontSizesMenu()); - close.addStyleName("kune-Button-Large-lrSpace"); + // We only use these listeners for updating status, so don't + // hook them up + // unless at least basic editing is supported. + richText.addKeyboardListener(listener); + richText.addClickListener(listener); + } - // if (basic != null) { - // topPanel.add(editHtml = createToggleButton(images.editHtml(), - // i18n.t("Edit HTML"))); - // } + // if (basic != null) { + // topPanel.add(editHtml = createToggleButton(images.editHtml(), + // i18n.t("Edit HTML"))); + // } - subtopPanel.add(save); - subtopPanel.add(close); + ws.getEntityWorkspace().getContentTopBar().add(this); + super.setVisible(false); } public void editHTML(final boolean edit) { - boolean enable = !edit; - if (basic != null) { - bold.setEnabled(enable); - italic.setEnabled(enable); - underline.setEnabled(enable); - subscript.setEnabled(enable); - superscript.setEnabled(enable); - justifyLeft.setEnabled(enable); - justifyCenter.setEnabled(enable); - justifyRight.setEnabled(enable); - backColor.setEnabled(enable); - fontColor.setEnabled(enable); - } - if (extended != null) { - strikethrough.setEnabled(enable); - indent.setEnabled(enable); - outdent.setEnabled(enable); - insertImage.setEnabled(enable); - createLink.setEnabled(enable); - removeLink.setEnabled(enable); - ol.setEnabled(enable); - ul.setEnabled(enable); - hr.setEnabled(enable); - removeFormat.setEnabled(enable); - fonts.setVisible(enable); - fontSizes.setVisible(enable); - } + final boolean enable = !edit; + if (basic != null) { + bold.setEnabled(enable); + italic.setEnabled(enable); + underline.setEnabled(enable); + subscript.setEnabled(enable); + superscript.setEnabled(enable); + justifyLeft.setEnabled(enable); + justifyCenter.setEnabled(enable); + justifyRight.setEnabled(enable); + backColor.setEnabled(enable); + fontColor.setEnabled(enable); + } + if (extended != null) { + strikethrough.setEnabled(enable); + indent.setEnabled(enable); + outdent.setEnabled(enable); + insertImage.setEnabled(enable); + createLink.setEnabled(enable); + removeLink.setEnabled(enable); + ol.setEnabled(enable); + ul.setEnabled(enable); + hr.setEnabled(enable); + removeFormat.setEnabled(enable); + fonts.setVisible(enable); + fontSizes.setVisible(enable); + } } public void setEnabledCloseButton(final boolean enabled) { - close.setEnabled(enabled); + if (enabled) { + close.enable(); + } else { + close.disable(); + } } public void setEnabledSaveButton(final boolean enabled) { - save.setEnabled(enabled); + if (enabled) { + save.enable(); + } else { + save.disable(); + } } public void setTextSaveButton(final String text) { - save.setText(text); + save.setText(text); } public void showPalette(final Widget sender, final int left, final int top) { - if (palettePanel == null) { - palettePresenter = new WebSafePalettePresenter(); - palettePanel = new WebSafePalettePanel(palettePresenter); - } - popupPalette = new PopupPanel(true, true); - popupPalette.setVisible(false); - popupPalette.show(); - popupPalette.setPopupPosition(left, top); - popupPalette.setWidget(palettePanel); - popupPalette.setVisible(true); + if (palettePanel == null) { + palettePresenter = new WebSafePalettePresenter(); + palettePanel = new WebSafePalettePanel(palettePresenter); + } + popupPalette = new PopupPanel(true, true); + popupPalette.setVisible(false); + popupPalette.show(); + popupPalette.setPopupPosition(left, top); + popupPalette.setWidget(palettePanel); + popupPalette.setVisible(true); } private MenuBar createFontSizesMenu() { - MenuBar menu = new MenuBar(); - MenuBar submenu = new MenuBar(true); - String fontSizes[] = { i18n.t("Extra small"), i18n.t("Very small"), i18n.t("small"), i18n.t("Medium"), - i18n.t("Large"), i18n.t("Very large"), i18n.t("Extra large") }; + final MenuBar menu = new MenuBar(); + final MenuBar submenu = new MenuBar(true); + final String fontSizes[] = { i18n.t("Extra small"), i18n.t("Very small"), i18n.t("small"), i18n.t("Medium"), + i18n.t("Large"), i18n.t("Very large"), i18n.t("Extra large") }; - KuneUiUtils.setQuickTip(menu, i18n.t("Font Size")); - menu.addItem(images.fontheight().getHTML(), true, submenu); - for (int i = 0; i < fontSizes.length; i++) { - final String f = fontSizes[i]; - final int fontSize = i; - submenu.addItem("<font size=\"" + (i + 1) + "\">" + f + "</font>", true, new Command() { - public void execute() { - basic.setFontSize(fontSizesConstants[fontSize]); - fireEdit(); - } - }); - } - menu.setStyleName("RichTextToolbar-menu"); - submenu.setStyleName("RichTextToolbar-submenu"); - return menu; + KuneUiUtils.setQuickTip(menu, i18n.t("Font Size")); + menu.addItem(images.fontheight().getHTML(), true, submenu); + for (int i = 0; i < fontSizes.length; i++) { + final String f = fontSizes[i]; + final int fontSize = i; + submenu.addItem("<font size=\"" + (i + 1) + "\">" + f + "</font>", true, new Command() { + public void execute() { + basic.setFontSize(fontSizesConstants[fontSize]); + fireEdit(); + } + }); + } + menu.setStyleName("RichTextToolbar-menu"); + submenu.setStyleName("RichTextToolbar-submenu"); + return menu; } private MenuBar createFontsMenu() { - MenuBar menu = new MenuBar(); - MenuBar submenu = new MenuBar(true); - String fontName[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" }; + final MenuBar menu = new MenuBar(); + final MenuBar submenu = new MenuBar(true); + final String fontName[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" }; - KuneUiUtils.setQuickTip(menu, i18n.t("Font Type")); - menu.addItem(images.charfontname().getHTML(), true, submenu); - for (int i = 0; i < fontName.length; i++) { - final String f = fontName[i]; - submenu.addItem("<span style=\"font-family: " + f + "\">" + f + "</span>", true, new Command() { - public void execute() { - basic.setFontName(f); - fireEdit(); - } - }); - } - menu.setStyleName("RichTextToolbar-menu"); - submenu.setStyleName("RichTextToolbar-submenu"); - return menu; + KuneUiUtils.setQuickTip(menu, i18n.t("Font Type")); + menu.addItem(images.charfontname().getHTML(), true, submenu); + for (int i = 0; i < fontName.length; i++) { + final String f = fontName[i]; + submenu.addItem("<span style=\"font-family: " + f + "\">" + f + "</span>", true, new Command() { + public void execute() { + basic.setFontName(f); + fireEdit(); + } + }); + } + menu.setStyleName("RichTextToolbar-menu"); + submenu.setStyleName("RichTextToolbar-submenu"); + return menu; } private PushButton createPushButton(final AbstractImagePrototype img, final String tip) { - PushButton pb = new PushButton(img.createImage()); - pb.addClickListener(listener); - KuneUiUtils.setQuickTip(pb, tip); - return pb; + final PushButton pb = new PushButton(img.createImage()); + pb.addClickListener(listener); + KuneUiUtils.setQuickTip(pb, tip); + return pb; } private ToggleButton createToggleButton(final AbstractImagePrototype img, final String tip) { - ToggleButton tb = new ToggleButton(img.createImage()); - tb.addClickListener(listener); - KuneUiUtils.setQuickTip(tb, tip); - return tb; + final ToggleButton tb = new ToggleButton(img.createImage()); + tb.addClickListener(listener); + KuneUiUtils.setQuickTip(tb, tip); + return tb; } private void fireCancel() { - panelListener.onCancel(); + panelListener.onCancel(); } private void fireEdit() { - panelListener.onEdit(); + panelListener.onEdit(); } private void fireEditHTML() { - panelListener.onEditHTML(); + panelListener.onEditHTML(); } private void fireSave() { - panelListener.onSave(); + panelListener.onSave(); } /** * Updates the status of all the stateful buttons. */ private void updateStatus() { - if (basic != null) { - bold.setDown(basic.isBold()); - italic.setDown(basic.isItalic()); - underline.setDown(basic.isUnderlined()); - subscript.setDown(basic.isSubscript()); - superscript.setDown(basic.isSuperscript()); - } + if (basic != null) { + bold.setDown(basic.isBold()); + italic.setDown(basic.isItalic()); + underline.setDown(basic.isUnderlined()); + subscript.setDown(basic.isSubscript()); + superscript.setDown(basic.isSuperscript()); + } - if (extended != null) { - strikethrough.setDown(extended.isStrikethrough()); - } + if (extended != null) { + strikethrough.setDown(extended.isStrikethrough()); + } } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -30,6 +30,12 @@ public String getText(); + public View getToolBar(); + + public void saveTimerCancel(); + + public void scheduleSave(int delayMillis); + public void setEnabled(boolean enabled); public void setEnabledCancelButton(boolean enabled); @@ -44,12 +50,8 @@ public void setTextSaveButton(String text); + public void setToolBarVisible(boolean visible); + public void showSaveBeforeDialog(); - public void scheduleSave(int delayMillis); - - public void saveTimerCancel(); - - public View getToolBar(); - } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -69,7 +69,7 @@ view.center(); Site.hideProgress(); } else { - stateManager.setState(previousToken); + stateManager.gotoToken(previousToken); Site.info(i18n.t("Sign in or register to create a group")); } } @@ -94,12 +94,12 @@ public void onCancel() { view.hide(); reset(); - stateManager.setState(previousToken); + stateManager.gotoToken(previousToken); } public void onClose() { reset(); - stateManager.setState(previousToken); + stateManager.gotoToken(previousToken); } public void onFinish() { @@ -130,7 +130,7 @@ } public void onSuccess(final StateToken token) { - stateManager.setState(token); + stateManager.gotoToken(token); view.hide(); reset(); view.unMask(); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -19,6 +19,9 @@ */ package org.ourproject.kune.workspace.client.sitebar.login; +import java.util.Date; + +import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; import org.ourproject.kune.platf.client.ui.dialogs.InfoDialog; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; @@ -27,7 +30,9 @@ import org.ourproject.kune.workspace.client.sitebar.msg.SimpleMessagePanel; import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; +import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.Cookies; import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Label; @@ -174,6 +179,14 @@ }); } + public void setCookie(final String userHash) { + // http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ + final long duration = Session.SESSION_DURATION; + final Date expires = new Date(System.currentTimeMillis() + duration); + Cookies.setCookie(Site.USERHASH, userHash, expires, null, "/", false); + GWT.log("Received hash: " + userHash, null); + } + public void setRegisterMessage(final String message, final SiteErrorType type) { messagesRegisterPanel.setMessage(message, type, type); messagesRegisterPanel.show(); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -19,8 +19,6 @@ */ package org.ourproject.kune.workspace.client.sitebar.login; -import java.util.Date; - import org.ourproject.kune.platf.client.dto.I18nCountryDTO; import org.ourproject.kune.platf.client.dto.I18nLanguageDTO; import org.ourproject.kune.platf.client.dto.StateToken; @@ -39,7 +37,6 @@ import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode; import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.Cookies; import com.google.gwt.user.client.rpc.AsyncCallback; public class SignInPresenter implements SignIn { @@ -67,7 +64,7 @@ view.center(); Site.hideProgress(); } else { - stateManager.setState(previousStateToken); + stateManager.gotoToken(previousStateToken); } } @@ -95,14 +92,14 @@ resetMessages(); reset(); view.hide(); - stateManager.setState(previousStateToken); + stateManager.gotoToken(previousStateToken); } public void onClose() { reset(); view.hideMessages(); if (!session.isLogged()) { - stateManager.setState(previousStateToken); + stateManager.gotoToken(previousStateToken); } } @@ -180,8 +177,8 @@ } public void onSuccess(final UserInfoDTO userInfoDTO) { - stateManager.setState(previousStateToken); onSignIn(userInfoDTO); + stateManager.gotoToken(previousStateToken); view.hide(); view.unMask(); } @@ -191,8 +188,9 @@ } private void onSignIn(final UserInfoDTO userInfoDTO) { - setCookie(userInfoDTO); - session.setUserHash(userInfoDTO.getUserHash()); + final String userHash = userInfoDTO.getUserHash(); + view.setCookie(userHash); + session.setUserHash(userHash); session.setCurrentUserInfo(userInfoDTO); final I18nLanguageDTO language = userInfoDTO.getLanguage(); i18n.changeCurrentLanguage(language.getCode()); @@ -207,12 +205,4 @@ view.hideMessages(); } - private void setCookie(final UserInfoDTO userInfoDTO) { - // http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ - final String sessionId = userInfoDTO.getUserHash(); - final long duration = Session.SESSION_DURATION; - final Date expires = new Date(System.currentTimeMillis() + duration); - Cookies.setCookie(Site.USERHASH, sessionId, expires, null, "/", false); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInView.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/SignInView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -64,6 +64,8 @@ public void unMask(); + void setCookie(String userHash); + void setRegisterMessage(String message, SiteErrorType type); void setSignInMessage(String message, SiteErrorType type); Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,45 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.AccessRightsDTO; -import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.StateToken; - -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public interface ContextItems { - - public void canCreate(String buttonTitle, String promptMessage, Slot<String> slot); - - public View getView(); - - public void registerType(String typeName, AbstractImagePrototype pageWhite); - - public void setControlsVisible(boolean visible); - - public void setParentTreeVisible(boolean visible); - - public void showContainer(StateToken state, ContainerDTO container, AccessRightsDTO rights); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,87 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.ImageBundle; - -/** - * - * http://code.google.com/p/google-web-toolkit/wiki/ImageBundleDesign - * - */ -public interface ContextItemsImages extends ImageBundle { - - public static class App { - private static ContextItemsImages ourInstance = null; - - public static synchronized ContextItemsImages getInstance() { - if (ourInstance == null) { - ourInstance = (ContextItemsImages) GWT.create(ContextItemsImages.class); - } - return ourInstance; - } - } - - @Resource("bullet_arrow_right.png") - AbstractImagePrototype bulletArrowRight(); - - @Resource("chat-blue.png") - AbstractImagePrototype chatBlue(); - - @Resource("chat-green.png") - AbstractImagePrototype chatGreen(); - - @Resource("folder.png") - AbstractImagePrototype folder(); - - @Resource("folder_add.png") - AbstractImagePrototype folderAdd(); - - @Resource("folder-go-up.png") - AbstractImagePrototype folderGoUp(); - - @Resource("folder-go-up-light.png") - AbstractImagePrototype folderGoUpLight(); - - @Resource("folderpathmenu.png") - AbstractImagePrototype folderpathmenu(); - - @Resource("go-up.png") - AbstractImagePrototype goUp(); - - @Resource("go-up-light.png") - AbstractImagePrototype goUpLight(); - - @Resource("page.png") - AbstractImagePrototype page(); - - @Resource("page_add.png") - AbstractImagePrototype pageAdd(); - - @Resource("page_white.png") - AbstractImagePrototype pageWhite(); - - @Resource("page_white_add.png") - AbstractImagePrototype pageWhiteAdd(); - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,130 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.ui.HorizontalLine; -import org.ourproject.kune.platf.client.ui.IconLabel; -import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; - -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.DockPanel; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.gwtext.client.widgets.MessageBox; - -public class ContextItemsPanel extends DockPanel implements ContextItemsView { - private final VerticalPanel controls; - private final ItemsPanel items; - private final ContextTopBar topBar; - private final I18nTranslationService i18n; - - public ContextItemsPanel(final ContextItemsPresenter presenter, final I18nTranslationService i18n, - final StateManager stateManager, final WorkspaceSkeleton ws) { - this.i18n = i18n; - topBar = new ContextTopBar(presenter, i18n, stateManager); - addTopBar(topBar); - - items = new ItemsPanel(presenter); - add(items, DockPanel.NORTH); - final HTML expand = new HTML("<b></b>"); - add(expand, DockPanel.CENTER); - controls = new VerticalPanel(); - add(controls, DockPanel.SOUTH); - controls.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); - final HorizontalLine horizontalLine = new HorizontalLine(); - controls.add(horizontalLine); - - // setHeight("100%"); - expand.setHeight("15px"); - setCellHeight(expand, "15px"); - addStyleName("kune-NavigationBar"); - controls.setWidth("100%"); - controls.setCellWidth(horizontalLine, "100%"); - horizontalLine.setWidth("100%"); - } - - public void addCommand(final String buttonText, final String promptMessage, final Slot<String> slot) { - final IconLabel iconLabel = new IconLabel(Images.App.getInstance().addGreen(), buttonText); - iconLabel.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - promptName(promptMessage, slot); - } - }); - iconLabel.addStyleName("kune-ContextItemsPanel-LabelLink"); - controls.add(iconLabel); - - } - - public void addItem(final String name, final String type, final String event, final boolean editable) { - items.add(name, type, event, editable); - } - - public void clear() { - items.clear(); - } - - public void promptName(final String title, final Slot<String> slot) { - MessageBox.prompt(title, i18n.t("Please enter a name:"), new MessageBox.PromptCallback() { - public void execute(final String btnID, final String text) { - slot.onEvent(text); - } - }); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - items.registerType(typeName, image); - } - - public void selectItem(final int index) { - } - - public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) { - topBar.setAbsolutePath(absolutePath); - } - - public void setControlsVisible(final boolean visible) { - controls.setVisible(visible); - } - - public void setCurrentName(final String name) { - topBar.currentFolder.setText(name); - } - - public void setParentButtonEnabled(final boolean isEnabled) { - topBar.btnGoParent.setVisible(isEnabled); - topBar.btnGoParentDisabled.setVisible(!isEnabled); - } - - public void setParentTreeVisible(final boolean visible) { - topBar.firstRow.setVisible(visible); - } - - private void addTopBar(final Widget widget) { - add(topBar, DockPanel.NORTH); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,129 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import java.util.List; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.AccessRightsDTO; -import org.ourproject.kune.platf.client.dto.ContainerDTO; -import org.ourproject.kune.platf.client.dto.ContentDTO; -import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.sitebar.Site; - -import com.calclab.suco.client.provider.Provider; -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public class ContextItemsPresenter implements ContextItems { - protected ContextItemsView view; - private final I18nTranslationService i18n; - private final StateManager stateManager; - private final Session session; - private final Provider<ContentServiceAsync> contentServiceProvider; - - public ContextItemsPresenter(final I18nTranslationService i18n, final StateManager stateManager, - final Session session, final Provider<ContentServiceAsync> contentServiceProvider) { - this.i18n = i18n; - this.stateManager = stateManager; - this.session = session; - this.contentServiceProvider = contentServiceProvider; - } - - public void canCreate(final String buttonText, final String promptMessage, final Slot<String> slot) { - view.addCommand(buttonText, promptMessage, slot); - } - - public View getView() { - return view; - } - - public void init(final ContextItemsView view) { - this.view = view; - } - - public void onGoUp() { - final StateDTO state = session.getCurrentState(); - final StateToken token = state.getStateToken(); - token.setDocument(null); - token.setFolder(state.getFolder().getParentFolderId().toString()); - stateManager.setState(token); - } - - public void onTitleRename(final String newName, final String token) { - Site.showProgressSaving(); - final StateDTO currentState = session.getCurrentState(); - contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(), token, - newName, new AsyncCallbackSimple<String>() { - public void onSuccess(final String result) { - stateManager.reloadContextAndTitles(); - Site.hideProgress(); - } - }); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - view.registerType(typeName, image); - } - - public void setControlsVisible(final boolean visible) { - view.setControlsVisible(visible); - } - - public void setParentTreeVisible(final boolean visible) { - view.setParentTreeVisible(visible); - } - - public void showContainer(final StateToken state, final ContainerDTO container, final AccessRightsDTO rights) { - state.setDocument(null); - if (container.getParentFolderId() == null) { - // We translate root folder names (documents, chat room, - // etcetera) - view.setCurrentName(i18n.t(container.getName())); - } else { - view.setCurrentName(container.getName()); - } - view.clear(); - final List<ContainerDTO> folders = container.getChilds(); - for (int index = 0; index < folders.size(); index++) { - final ContainerDTO child = folders.get(index); - state.setFolder(child.getId().toString()); - view.addItem(child.getName(), child.getTypeId(), state.getEncoded(), rights.isEditable()); - } - - state.setFolder(container.getId().toString()); - final List<ContentDTO> contents = container.getContents(); - for (int index = 0; index < contents.size(); index++) { - final ContentDTO dto = contents.get(index); - state.setDocument(dto.getId().toString()); - view.addItem(dto.getTitle(), dto.getTypeId(), state.getEncoded(), rights.isEditable()); - } - view.setParentButtonEnabled(container.getParentFolderId() != null); - view.setControlsVisible(rights.isEditable()); - view.setAbsolutePath(container.getAbsolutePath()); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,51 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; - -import com.calclab.suco.client.signal.Slot; -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public interface ContextItemsView extends View { - - void addCommand(String buttonTitle, String promptMessage, Slot<String> slot); - - void addItem(String name, String type, String event, boolean editable); - - void clear(); - - void registerType(String typeName, AbstractImagePrototype image); - - void selectItem(int index); - - void setAbsolutePath(ContainerSimpleDTO[] absolutePath); - - void setControlsVisible(boolean isVisible); - - void setCurrentName(String name); - - void setParentButtonEnabled(boolean isEnabled); - - void setParentTreeVisible(boolean b); - -} Added: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigationItem.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigationItem.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigationItem.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,68 @@ +package org.ourproject.kune.workspace.client.ui.ctx.items; + +import org.ourproject.kune.platf.client.actions.ClientActionCollection; +import org.ourproject.kune.platf.client.dto.ContentStatusDTO; +import org.ourproject.kune.platf.client.dto.StateToken; + +public class ContextNavigationItem { + private final String id; + private final String parentId; + private final String iconUrl; + private final String text; + private final ContentStatusDTO contentStatusDTO; + private final StateToken token; + private final ClientActionCollection<StateToken> actionCollection; + private final boolean allowDrag; + private final boolean allowDrop; + + public ContextNavigationItem(final String id, final String parentId, final String iconUrl, final String text, + final ContentStatusDTO contentStatusDTO, final StateToken token, final boolean allowDrag, + final boolean allowDrop, final ClientActionCollection<StateToken> actionCollection) { + this.id = id; + this.parentId = parentId; + this.iconUrl = iconUrl; + this.text = text; + this.contentStatusDTO = contentStatusDTO; + this.token = token; + this.allowDrag = allowDrag; + this.allowDrop = allowDrop; + this.actionCollection = actionCollection; + } + + public ClientActionCollection<StateToken> getActionCollection() { + return actionCollection; + } + + public ContentStatusDTO getContentStatus() { + return contentStatusDTO; + } + + public String getIconUrl() { + return iconUrl; + } + + public String getId() { + return id; + } + + public String getParentId() { + return parentId; + } + + public StateToken getStateToken() { + return token; + } + + public String getText() { + return text; + } + + public boolean isDraggable() { + return allowDrag; + } + + public boolean isDroppable() { + return allowDrop; + } + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigator.java (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItems.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigator.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,38 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.ourproject.kune.workspace.client.ui.ctx.items; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.ClientActionDescriptor; +import org.ourproject.kune.platf.client.dto.StateDTO; +import org.ourproject.kune.platf.client.dto.StateToken; + +public interface ContextNavigator { + + public View getView(); + + public void setState(StateDTO state); + + void addAction(String contentTypeId, ClientActionDescriptor<StateToken> action); + + void removeAction(String contentTypeId, ClientActionDescriptor<StateToken> action); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorImages.java (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsImages.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorImages.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,88 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.ourproject.kune.workspace.client.ui.ctx.items; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.AbstractImagePrototype; +import com.google.gwt.user.client.ui.ImageBundle; + +/** + * + * http://code.google.com/p/google-web-toolkit/wiki/ImageBundleDesign + * + */ +public interface ContextNavigatorImages extends ImageBundle { + + public static class App { + private static ContextNavigatorImages ourInstance = null; + + @Deprecated + public static synchronized ContextNavigatorImages getInstance() { + if (ourInstance == null) { + ourInstance = (ContextNavigatorImages) GWT.create(ContextNavigatorImages.class); + } + return ourInstance; + } + } + + @Resource("bullet_arrow_right.png") + AbstractImagePrototype bulletArrowRight(); + + @Resource("chat-blue.png") + AbstractImagePrototype chatBlue(); + + @Resource("chat-green.png") + AbstractImagePrototype chatGreen(); + + @Resource("folder.png") + AbstractImagePrototype folder(); + + @Resource("folder_add.png") + AbstractImagePrototype folderAdd(); + + @Resource("folder-go-up.png") + AbstractImagePrototype folderGoUp(); + + @Resource("folder-go-up-light.png") + AbstractImagePrototype folderGoUpLight(); + + @Resource("folderpathmenu.png") + AbstractImagePrototype folderpathmenu(); + + @Resource("go-up.png") + AbstractImagePrototype goUp(); + + @Resource("go-up-light.png") + AbstractImagePrototype goUpLight(); + + @Resource("page.png") + AbstractImagePrototype page(); + + @Resource("page_add.png") + AbstractImagePrototype pageAdd(); + + @Resource("page_white.png") + AbstractImagePrototype pageWhite(); + + @Resource("page_white_add.png") + AbstractImagePrototype pageWhiteAdd(); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPanel.java (from rev 842, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-08-30 14:57:17 UTC (rev 842) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,310 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.ourproject.kune.workspace.client.ui.ctx.items; + +import java.util.HashMap; + +import org.ourproject.kune.platf.client.actions.ActionManager; +import org.ourproject.kune.platf.client.actions.ClientActionCollection; +import org.ourproject.kune.platf.client.actions.ClientActionDescriptor; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.Toolbar; +import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton; + +import com.allen_sauer.gwt.log.client.Log; +import com.calclab.suco.client.provider.Provider; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.DeferredCommand; +import com.gwtext.client.core.EventObject; +import com.gwtext.client.data.Node; +import com.gwtext.client.widgets.Button; +import com.gwtext.client.widgets.Editor; +import com.gwtext.client.widgets.Panel; +import com.gwtext.client.widgets.ToolbarButton; +import com.gwtext.client.widgets.ToolbarMenuButton; +import com.gwtext.client.widgets.event.ButtonListenerAdapter; +import com.gwtext.client.widgets.event.EditorListenerAdapter; +import com.gwtext.client.widgets.form.TextField; +import com.gwtext.client.widgets.menu.BaseItem; +import com.gwtext.client.widgets.menu.Item; +import com.gwtext.client.widgets.menu.Menu; +import com.gwtext.client.widgets.menu.MenuItem; +import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter; +import com.gwtext.client.widgets.tree.TreeEditor; +import com.gwtext.client.widgets.tree.TreeNode; +import com.gwtext.client.widgets.tree.TreePanel; +import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter; +import com.gwtext.client.widgets.tree.event.TreePanelListenerAdapter; + +public class ContextNavigatorPanel implements ContextNavigatorView { + + private TreePanel treePanel; + private TreeEditor treeEditor; + private final HashMap<String, Menu> contextMenus; + private final HashMap<String, Menu> toolbarMenus; + private final WorkspaceSkeleton ws; + private final Provider<ActionManager> actionManagerProvider; + private final StateManager stateManager; + + public ContextNavigatorPanel(final ContextNavigatorPresenter presenter, final I18nTranslationService i18n, + final StateManager stateManager, final WorkspaceSkeleton ws, + final Provider<ActionManager> actionManagerProvider) { + this.stateManager = stateManager; + this.ws = ws; + this.actionManagerProvider = actionManagerProvider; + + contextMenus = new HashMap<String, Menu>(); + toolbarMenus = new HashMap<String, Menu>(); + } + + public void addItem(final ContextNavigationItem item) { + final String nodeId = item.getId(); + if (treePanel.getNodeById(nodeId) == null) { + final TreeNode child = new TreeNode(item.getText()); + child.setId(nodeId); + child.setHref("#" + item.getStateToken().toString()); + child.setAllowDrag(item.isDraggable()); + child.setAllowDrop(item.isDroppable()); + switch (item.getContentStatus()) { + case publicVisible: + child.enable(); + break; + case markForDelection: + child.setCls("k-linethrough"); + case nonPublicVisible: + child.disable(); + break; + } + contextMenus.put(nodeId, createItemMenu(item.getActionCollection(), item.getStateToken())); + final TreeNode parent = treePanel.getNodeById(item.getParentId()); + if (parent != null) { + Log.info("Adding child node: " + nodeId + " to folder: " + item.getParentId()); + if (!item.getStateToken().hasAll()) { + child.setExpandable(true); + child.addListener(new TreeNodeListenerAdapter() { + public void onExpand(final Node node) { + treePanel.getNodeById(node.getId()).select(); + stateManager.gotoToken(node.getAttribute("href").substring(1)); + } + }); + } + parent.appendChild(child); + } else { + Log.error("Error building file tree, parent folder not found"); + } + } else { + // the node already created + if (contextMenus.get(nodeId) == null && item.getActionCollection() != null) { + contextMenus.put(nodeId, createItemMenu(item.getActionCollection(), item.getStateToken())); + } + } + + } + + public void clear() { + if (treePanel != null) { + treePanel.clear(); + } + contextMenus.clear(); + toolbarMenus.clear(); + } + + public void editItem(final String id) { + treeEditor.startEdit(getNode(id)); + } + + public void selectItem(final String id) { + final TreeNode item = getNode(id); + if (item != null) { + item.select(); + // item.ensureVisible(); + } else { + Log.error("Error building file tree, current token not found"); + } + } + + public void setBottomActions(final StateToken stateToken, final ClientActionCollection<StateToken> operations) { + final Toolbar toolBar = ws.getEntityWorkspace().getContextBottomBar(); + setToolbarOperations(toolBar, stateToken, operations); + } + + public void setRootItem(final String id, final String text, final StateToken stateToken) { + if (treePanel == null || treePanel.getNodeById(id) == null) { + createTreePanel(id); + } + } + + public void setTopActions(final StateToken stateToken, final ClientActionCollection<StateToken> operations) { + final Toolbar toolBar = ws.getEntityWorkspace().getContextTopBar(); + setToolbarOperations(toolBar, stateToken, operations); + } + + private Menu createItemMenu(final ClientActionCollection<StateToken> operationCollection, + final StateToken stateToken) { + if (operationCollection != null) { + final Menu menu = new Menu(); + // Remove if when retrieved rights of siblings + for (final ClientActionDescriptor<StateToken> operation : operationCollection) { + final Item item = new Item(operation.getText()); + item.setIcon(operation.getIconUrl()); + menu.addItem(item); + item.addListener(new BaseItemListenerAdapter() { + public void onClick(final BaseItem item, final EventObject e) { + DeferredCommand.addCommand(new Command() { + public void execute() { + actionManagerProvider.get().doAction(operation, stateToken); + } + }); + } + }); + } + return menu; + } + return null; + } + + private Menu createToolbarMenu(final String iconUrl, final String menuTitle) { + Menu menu; + menu = new Menu(); + final ToolbarMenuButton toolbarMenu = new ToolbarMenuButton(menuTitle); + if (iconUrl != null) { + toolbarMenu.setIcon(iconUrl); + } + toolbarMenu.setMenu(menu); + toolbarMenus.put(menuTitle, menu); + return menu; + } + + private void createTreePanel(final String rootId) { + if (treePanel != null) { + clear(); + } + treePanel = new TreePanel(); + treePanel.setAnimate(true); + treePanel.setBorder(false); + treePanel.setRootVisible(false); + treePanel.setUseArrows(true); + final TreeNode root = new TreeNode(); + root.setAllowDrag(false); + root.setExpanded(true); + root.setId(rootId); + root.expand(); + treePanel.addListener(new TreePanelListenerAdapter() { + public void onContextMenu(final TreeNode node, final EventObject e) { + final Menu menu = contextMenus.get(node.getId()); + if (menu != null) { + menu.showAt(e.getXY()); + } else { + Log.info("Empty item menu"); + } + } + }); + treePanel.setLines(false); + treePanel.setEnableDD(true); + treePanel.setRootNode(root); + final TextField field = new TextField(); + treeEditor = new TreeEditor(treePanel, field); + treeEditor.addListener(new EditorListenerAdapter() { + // public boolean doBeforeComplete(final Editor source, final Object + // value, final Object startValue) { + // return false; + // } + + public void onComplete(final Editor source, final Object value, final Object startValue) { + // TODO Auto-generated method stub + } + }); + final Panel panel = new Panel(); + panel.setBorder(false); + panel.add(treePanel); + ws.getEntityWorkspace().setContext(panel); + } + + private void doOperation(final ClientActionDescriptor<StateToken> operation, final StateToken stateToken) { + actionManagerProvider.get().doAction(operation, stateToken); + } + + private TreeNode getNode(final String id) { + final TreeNode node = treePanel.getNodeById(id); + if (node == null) { + Log.error("Id: " + id + " not found in context navigator"); + } + return node; + } + + private void setToolbarOperations(final Toolbar toolBar, final StateToken stateToken, + final ClientActionCollection<StateToken> operations) { + toolBar.removeAll(); + for (final ClientActionDescriptor<StateToken> operation : operations) { + Log.info("Procesing operation: " + operation.getText()); + if (!operation.isMenuAction()) { + final ToolbarButton button = new ToolbarButton(operation.getText(), new ButtonListenerAdapter() { + @Override + public void onClick(final Button button, final EventObject e) { + doOperation(operation, stateToken); + } + }); + button.setIcon(operation.getIconUrl()); + button.setTooltip(operation.getToolTip()); + toolBar.add(button); + } else { + // Menu operation + final Item item = new Item(operation.getText(), new BaseItemListenerAdapter() { + @Override + public void onClick(BaseItem item, EventObject e) { + doOperation(operation, stateToken); + } + }); + item.setIcon(operation.getIconUrl()); + + final String menuTitle = operation.getParentMenuTitle(); + final String menuSubTitle = operation.getParentSubMenuTitle(); + final String subMenuKey = menuTitle + "-" + menuSubTitle; + Menu menu = toolbarMenus.get(menuTitle); + Menu subMenu = toolbarMenus.get(subMenuKey); + if (menuSubTitle != null) { + if (subMenu == null) { + subMenu = new Menu(); + final MenuItem subMenuItem = new MenuItem(menuSubTitle, subMenu); + if (menu == null) { + menu = createToolbarMenu(operation.getParentMenuIconUrl(), menuTitle); + toolBar.add(menu); + } + menu.addItem(subMenuItem); + toolBar.doLayoutIfNeeded(); + toolbarMenus.put(subMenuKey, subMenu); + } + subMenu.addItem(item); + } else { + // Menu operation without submenu + if (menu == null) { + menu = createToolbarMenu(operation.getParentMenuIconUrl(), menuTitle); + toolBar.add(menu); + } + menu.addItem(item); + toolBar.doLayoutIfNeeded(); + } + } + } + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPresenter.java (from rev 842, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-08-30 14:57:17 UTC (rev 842) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorPresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,417 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.ourproject.kune.workspace.client.ui.ctx.items; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.ourproject.kune.docs.client.DocumentClientTool; +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.ActionPosition; +import org.ourproject.kune.platf.client.actions.ClientActionCollection; +import org.ourproject.kune.platf.client.actions.ClientActionDescriptor; +import org.ourproject.kune.platf.client.dto.AccessRightsDTO; +import org.ourproject.kune.platf.client.dto.AccessRolDTO; +import org.ourproject.kune.platf.client.dto.ContainerDTO; +import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; +import org.ourproject.kune.platf.client.dto.ContentDTO; +import org.ourproject.kune.platf.client.dto.ContentStatusDTO; +import org.ourproject.kune.platf.client.dto.StateDTO; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.dto.UserInfoDTO; +import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; +import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; +import org.ourproject.kune.workspace.client.sitebar.Site; + +import com.calclab.suco.client.provider.Provider; +import com.calclab.suco.client.signal.Slot; +import com.calclab.suco.client.signal.Slot0; +import com.calclab.suco.client.signal.Slot2; + +public class ContextNavigatorPresenter implements ContextNavigator { + + private ContextNavigatorView view; + private final StateManager stateManager; + private final Session session; + private final Provider<ContentServiceAsync> contentServiceProvider; + private final I18nUITranslationService i18n; + private final HashMap<String, ClientActionCollection<StateToken>> actions; + private final ArrayList<String> draggables; + private final ArrayList<String> droppables; + + public ContextNavigatorPresenter(final StateManager stateManager, final Session session, + final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n) { + this.stateManager = stateManager; + this.session = session; + this.contentServiceProvider = contentServiceProvider; + this.i18n = i18n; + actions = new HashMap<String, ClientActionCollection<StateToken>>(); + draggables = new ArrayList<String>(); + droppables = new ArrayList<String>(); + createActions(); + registerDragDropTypes(); + } + + public void addAction(final String contentTypeId, final ClientActionDescriptor<StateToken> action) { + ClientActionCollection<StateToken> actionColl = actions.get(contentTypeId); + if (actionColl == null) { + actionColl = new ClientActionCollection<StateToken>(); + actions.put(contentTypeId, actionColl); + } + actionColl.add(action); + } + + public View getView() { + return view; + } + + public void init(final ContextNavigatorView view) { + this.view = view; + stateManager.onGroupChanged(new Slot2<String, String>() { + public void onEvent(final String oldGroup, final String newGroup) { + if (oldGroup != null) { + view.clear(); + } + } + }); + stateManager.onToolChanged(new Slot2<String, String>() { + public void onEvent(final String oldTool, final String newTool) { + if (oldTool != null) { + view.clear(); + } + } + }); + session.onUserSignIn(new Slot<UserInfoDTO>() { + public void onEvent(final UserInfoDTO parameter) { + view.clear(); + } + }); + session.onUserSignOut(new Slot0() { + public void onEvent() { + view.clear(); + } + }); + } + + public void onTitleRename(final String newName, final String token) { + Site.showProgressSaving(); + final StateDTO currentState = session.getCurrentState(); + contentServiceProvider.get().rename(session.getUserHash(), currentState.getGroup().getShortName(), token, + newName, new AsyncCallbackSimple<String>() { + public void onSuccess(final String result) { + stateManager.reloadContextAndTitles(); + Site.hideProgress(); + } + }); + } + + public void registerDraggableType(final String type) { + draggables.add(type); + } + + public void registerDroppableType(final String type) { + droppables.add(type); + } + + public void removeAction(final String contentTypeId, final ClientActionDescriptor<StateToken> action) { + actions.get(contentTypeId).remove(action); + } + + public void setState(final StateDTO state) { + final StateToken stateToken = state.getStateToken().clone(); + final String treeId = genId(stateToken); + + final ContainerDTO container = state.getFolder(); + createTreePath(stateToken, container.getAbsolutePath()); + + boolean visible = false; + AccessRightsDTO rights = null; + + String containerTreeId; + + if (state.hasDocument()) { + rights = state.getContentRights(); + visible = rights.isVisible(); + containerTreeId = genId(stateToken.clone().setDocument(null)); + } else { + rights = state.getFolderRights(); + visible = rights.isVisible(); + final Long folderId = container.getParentFolderId(); + containerTreeId = genId(stateToken.clone().setDocument(null).setFolder( + folderId == null ? null : folderId.toString())); + } + + // here check deletion mark + + final ClientActionCollection<StateToken> topActions = new ClientActionCollection<StateToken>(); + final ClientActionCollection<StateToken> itemActions = new ClientActionCollection<StateToken>(); + final ClientActionCollection<StateToken> bottomActions = new ClientActionCollection<StateToken>(); + + boolean add = false; + for (final ClientActionDescriptor<StateToken> action : actions.get(state.getTypeId())) { + switch (action.getAccessRol()) { + case Administrator: + add = rights.isAdministrable(); + break; + case Editor: + add = rights.isEditable(); + break; + case Viewer: + add = rights.isVisible(); + break; + } + if (add) { + switch (action.getActionPosition()) { + case topBarAndItemMenu: + itemActions.add(action); + case topbar: + topActions.add(action); + break; + case bootombarAndItemMenu: + itemActions.add(action); + case bottombar: + bottomActions.add(action); + break; + case itemMenu: + itemActions.add(action); + break; + } + } + } + + view.setTopActions(stateToken, topActions); + view.setBottomActions(stateToken, bottomActions); + + final ContextNavigationItem item = new ContextNavigationItem(treeId, containerTreeId, "", state.getTitle(), + visible ? ContentStatusDTO.publicVisible : ContentStatusDTO.nonPublicVisible, stateToken, isDraggable( + state.getTypeId(), rights.isAdministrable()), isDroppable(state.getTypeId(), rights + .isAdministrable()), itemActions); + view.addItem(item); + + for (final ContentDTO content : container.getContents()) { + final StateToken siblingToken = stateToken.clone().setDocument(content.getId().toString()); + final StateToken siblingParentToken = stateToken.clone().setDocument(null); + // TODO: rights not correct + final ContextNavigationItem sibling = new ContextNavigationItem(genId(siblingToken), + genId(siblingParentToken), "", content.getTitle(), ContentStatusDTO.publicVisible, siblingToken, + isDraggable(content.getTypeId(), rights.isAdministrable()), isDroppable(content.getTypeId(), rights + .isAdministrable()), null); + view.addItem(sibling); + + } + + for (final ContainerDTO siblingFolder : container.getChilds()) { + final StateToken siblingToken = stateToken.clone().setDocument(null).setFolder( + siblingFolder.getId().toString()); + final StateToken siblingParentToken = stateToken.clone().setDocument(null).setFolder( + siblingFolder.getParentFolderId().toString()); + // TODO: rights not correct + final ContextNavigationItem sibling = new ContextNavigationItem(genId(siblingToken), + genId(siblingParentToken), "", siblingFolder.getName(), ContentStatusDTO.publicVisible, + siblingToken, isDraggable(container.getTypeId(), rights.isAdministrable()), isDroppable(container + .getTypeId(), rights.isAdministrable()), null); + view.addItem(sibling); + } + view.selectItem(treeId); + } + + private void createActions() { + final ClientActionDescriptor<StateToken> addFolder = new ClientActionDescriptor<StateToken>( + AccessRolDTO.Editor, ActionPosition.topBarAndItemMenu, new Slot<StateToken>() { + public void onEvent(final StateToken parameter) { + contentServiceProvider.get().addFolder(session.getUserHash(), + session.getCurrentState().getGroup().getShortName(), new Long(parameter.getFolder()), + i18n.t("New folder"), new AsyncCallbackSimple<StateDTO>() { + public void onSuccess(final StateDTO state) { + setState(state); + stateManager.setRetrievedState(state); + stateManager.reload(); + view.editItem(genId(state.getStateToken())); + } + }); + } + }); + addFolder.setTextDescription(i18n.t("New folder")); + addFolder.setParentMenuTitle(i18n.t("New")); + + final ClientActionDescriptor<StateToken> addDoc = new ClientActionDescriptor<StateToken>(AccessRolDTO.Editor, + ActionPosition.topBarAndItemMenu, new Slot<StateToken>() { + public void onEvent(final StateToken token) { + contentServiceProvider.get().addContent(session.getUserHash(), + session.getCurrentState().getGroup().getShortName(), + session.getCurrentState().getFolder().getId(), i18n.t("New document"), + new AsyncCallbackSimple<StateDTO>() { + public void onSuccess(final StateDTO state) { + setState(state); + stateManager.setRetrievedState(state); + stateManager.reload(); + view.editItem(genId(state.getStateToken())); + } + }); + + } + }); + addDoc.setTextDescription(i18n.t("New document")); + addDoc.setParentMenuTitle(i18n.t("New")); + + final ClientActionDescriptor<StateToken> delContainer = new ClientActionDescriptor<StateToken>( + AccessRolDTO.Administrator, ActionPosition.itemMenu, new Slot<StateToken>() { + public void onEvent(final StateToken token) { + Site.info("Sorry, in development"); + } + }); + delContainer.setTextDescription(i18n.t("Delete")); + delContainer.setMustBeConfirmed(true); + delContainer.setConfirmationTitle(i18n.t("Please confirm")); + delContainer.setConfirmationText(i18n.t("You will delete it and also all its contents. Are you sure?")); + + final ClientActionDescriptor<StateToken> delContent = new ClientActionDescriptor<StateToken>( + AccessRolDTO.Administrator, ActionPosition.itemMenu, new Slot<StateToken>() { + public void onEvent(final StateToken token) { + contentServiceProvider.get().delContent(session.getUserHash(), + session.getCurrentState().getGroup().getShortName(), token.getDocument(), + new AsyncCallbackSimple<String>() { + public void onSuccess(final String result) { + final StateToken parent = token.clone(); + parent.setDocument(null); + stateManager.gotoToken(parent); + } + }); + } + }); + delContent.setTextDescription(i18n.t("Delete")); + delContent.setMustBeConfirmed(true); + delContent.setConfirmationTitle(i18n.t("Please confirm")); + delContent.setConfirmationText(i18n.t("Are you sure?")); + + final ClientActionDescriptor<StateToken> go = new ClientActionDescriptor<StateToken>(AccessRolDTO.Viewer, + ActionPosition.itemMenu, new Slot<StateToken>() { + public void onEvent(final StateToken token) { + stateManager.gotoToken(token); + } + }); + go.setTextDescription(i18n.t("Open")); + + final ClientActionDescriptor<StateToken> rename = new ClientActionDescriptor<StateToken>(AccessRolDTO.Editor, + ActionPosition.itemMenu, new Slot<StateToken>() { + public void onEvent(final StateToken stateToken) { + view.editItem(genId(stateToken)); + } + }); + rename.setTextDescription(i18n.t("Rename")); + + addAction(DocumentClientTool.TYPE_FOLDER, go); + addAction(DocumentClientTool.TYPE_FOLDER, addDoc); + addAction(DocumentClientTool.TYPE_FOLDER, addFolder); + addAction(DocumentClientTool.TYPE_FOLDER, delContainer); + addAction(DocumentClientTool.TYPE_FOLDER, rename); + addAction(DocumentClientTool.TYPE_ROOT, addDoc); + addAction(DocumentClientTool.TYPE_ROOT, addFolder); + addAction(DocumentClientTool.TYPE_DOCUMENT, go); + addAction(DocumentClientTool.TYPE_DOCUMENT, delContent); + addAction(DocumentClientTool.TYPE_DOCUMENT, rename); + } + + // public void showContainer(final StateToken state, final ContainerDTO + // container, final AccessRightsDTO rights) { + // final StateToken stateLoc = state.clone(); + // + // createTreePath(stateLoc, container.getAbsolutePath()); + // + // stateLoc.setDocument(null); + // view.clear(); + // final List<ContainerDTO> folders = container.getChilds(); + // for (int index = 0; index < folders.size(); index++) { + // final ContainerDTO folder = folders.get(index); + // stateLoc.setFolder(folder.getId().toString()); + // // view.addItem(folder.getName(), folder.getTypeId(), + // // stateLoc.getEncoded(), rights.isEditable()); + // final String parentFolderId = folder.getParentFolderId() == null ? null : + // folder.getParentFolderId() + // .toString(); + // final String token = StateToken.encode(stateLoc.getGroup(), + // stateLoc.getTool(), folder.getId().toString(), + // null); + // view.addItem(folder.getId(), folder.getName(), parentFolderId, "#" + + // token, false); + // } + // + // stateLoc.setFolder(container.getId().toString()); + // final List<ContentDTO> contents = container.getContents(); + // for (int index = 0; index < contents.size(); index++) { + // final ContentDTO dto = contents.get(index); + // stateLoc.setDocument(dto.getId().toString()); + // // view.addItem(dto.getTitle(), dto.getTypeId(), + // // stateLoc.getEncoded(), rights.isEditable()); + // final String token = StateToken.encode(stateLoc.getGroup(), + // stateLoc.getTool(), stateLoc.getFolder(), dto + // .getId().toString()); + // view.addItem(dto.getId(), dto.getTitle(), stateLoc.getFolder(), "#" + + // token, true); + // } + // // view.selectItem(state.isComplete() ? state.getDocument() : + // // state.getFolder(), state.isComplete()); + // } + + private void createTreePath(final StateToken state, final ContainerSimpleDTO[] absolutePath) { + for (int i = 0; i < absolutePath.length; i++) { + final ContainerSimpleDTO folder = absolutePath[i]; + final String parentFolderId = folder.getParentFolderId() == null ? null : folder.getParentFolderId() + .toString(); + final StateToken folderStateToken = state.clone().setDocument(null).setFolder(folder.getId().toString()); + final StateToken parentStateToken = state.clone().setDocument(null).setFolder(parentFolderId); + if (folder.getParentFolderId() != null) { + // Bad rights, draggable/droppable + final ContextNavigationItem parent = new ContextNavigationItem(genId(folderStateToken), + genId(parentStateToken), "", folder.getName(), ContentStatusDTO.publicVisible, + folderStateToken, false, true, null); + view.addItem(parent); + } else { + // create root folder + view.setRootItem(genId(folderStateToken), i18n.t("contents"), folderStateToken); + } + } + } + + private String genId(final StateToken token) { + return "k-" + token.toString().replace(StateToken.SEPARATOR, "-"); + } + + private boolean isDraggable(final String typeId, final boolean administrable) { + return administrable && draggables.contains(typeId); + } + + private boolean isDroppable(final String typeId, final boolean administrable) { + return administrable && droppables.contains(typeId); + } + + @Deprecated + private void registerDragDropTypes() { + draggables.add(DocumentClientTool.TYPE_DOCUMENT); + draggables.add(DocumentClientTool.TYPE_FOLDER); + droppables.add(DocumentClientTool.TYPE_ROOT); + droppables.add(DocumentClientTool.TYPE_FOLDER); + droppables.add(DocumentClientTool.TYPE_DOCUMENT); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorView.java (from rev 841, trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsView.java 2008-08-11 01:20:37 UTC (rev 841) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextNavigatorView.java 2008-09-07 14:07:16 UTC (rev 844) @@ -0,0 +1,43 @@ +/* + * + * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.ourproject.kune.workspace.client.ui.ctx.items; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.actions.ClientActionCollection; +import org.ourproject.kune.platf.client.dto.StateToken; + +public interface ContextNavigatorView extends View { + + void addItem(ContextNavigationItem contextNavigationItem); + + void clear(); + + void editItem(String id); + + void selectItem(String id); + + void setBottomActions(StateToken stateToken, ClientActionCollection<StateToken> actions); + + void setRootItem(String id, String text, StateToken stateToken); + + void setTopActions(StateToken stateToken, ClientActionCollection<StateToken> actions); + +} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,123 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.ui.KuneUiUtils; -import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator; - -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.MenuBar; -import com.google.gwt.user.client.ui.PushButton; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; - -class ContextTopBar extends VerticalPanel { - - public final Label currentFolder; - public final PushButton btnGoParent; - public final Image btnGoParentDisabled; - public final HorizontalPanel firstRow; - private final ContextItemsImages img; - private final MenuBar pathSubmenu; - private final I18nTranslationService i18n; - private final StateManager stateManager; - - public ContextTopBar(final ContextItemsPresenter presenter, final I18nTranslationService i18n, - final StateManager stateManager) { - this.i18n = i18n; - this.stateManager = stateManager; - img = ContextItemsImages.App.getInstance(); - firstRow = new HorizontalPanel(); - final HorizontalPanel secondRow = new HorizontalPanel(); - final HorizontalPanel iconBarHP = new HorizontalPanel(); - final HorizontalPanel currentFolderHP = new HorizontalPanel(); - btnGoParent = new PushButton(img.folderGoUp().createImage(), img.folderGoUpLight().createImage()); - btnGoParent.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - presenter.onGoUp(); - } - }); - - KuneUiUtils.setQuickTip(btnGoParent, i18n.t("Go to parent folder")); - btnGoParentDisabled = img.folderGoUpLight().createImage(); - final MenuBar pathMenu = new MenuBar(); - pathSubmenu = new MenuBar(true); - // Layout - add(firstRow); - add(secondRow); - firstRow.add(iconBarHP); - secondRow.add(currentFolderHP); - // iconBarHP.add(btnGoParent); - final RoundedBorderDecorator buttonRounded = new RoundedBorderDecorator(pathMenu, RoundedBorderDecorator.ALL, - RoundedBorderDecorator.SIMPLE); - iconBarHP.add(buttonRounded); - pathMenu.addItem(img.folderpathmenu().getHTML(), true, pathSubmenu); - KuneUiUtils.setQuickTip(pathMenu, i18n.t("Navigation tree")); - currentFolderHP.add(btnGoParent); - currentFolderHP.add(btnGoParentDisabled); - currentFolder = new Label("Current Container"); - currentFolderHP.add(currentFolder); - - // Set properties - addStyleName("kune-NavigationBar"); - firstRow.addStyleName("topBar"); - firstRow.addStyleName("topBar-margin"); - secondRow.addStyleName("topBar"); - firstRow.setWidth("100%"); - secondRow.setWidth("100%"); - setCellWidth(firstRow, "100%"); - setCellWidth(secondRow, "100%"); - firstRow.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); - iconBarHP.addStyleName("kune-topBar-iconBar"); - iconBarHP.setCellVerticalAlignment(btnGoParent, VerticalPanel.ALIGN_MIDDLE); - iconBarHP.setCellVerticalAlignment(buttonRounded, VerticalPanel.ALIGN_MIDDLE); - pathMenu.setStyleName("pathMenu"); - buttonRounded.setColor("AAA"); - btnGoParent.addStyleName("kune-pointer"); - } - - public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) { - pathSubmenu.clearItems(); - String indent = ""; - for (int i = 0; i < absolutePath.length; i++) { - final ContainerSimpleDTO folder = absolutePath[i]; - String folderName = folder.getName(); - if (i == 0) { - // We translate root folders - folderName = i18n.t(folderName); - } - pathSubmenu.addItem(indent + img.folder().getHTML() + " " + folderName, true, new Command() { - public void execute() { - stateManager.gotoContainer(folder.getId()); - } - }); - indent = indent + "  "; - } - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ControlsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ControlsPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ControlsPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,29 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import com.google.gwt.user.client.ui.VerticalPanel; - -class ControlsPanel extends VerticalPanel { - - public ControlsPanel() { - } -} Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ItemsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ItemsPanel.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ItemsPanel.java 2008-09-07 14:07:16 UTC (rev 844) @@ -1,60 +0,0 @@ -/* - * - * Copyright (C) 2007-2008 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.ourproject.kune.workspace.client.ui.ctx.items; - -import java.util.HashMap; - -import org.ourproject.kune.platf.client.ui.EditableClickListener; -import org.ourproject.kune.platf.client.ui.EditableIconLabel; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; -import com.google.gwt.user.client.ui.VerticalPanel; - -class ItemsPanel extends VerticalPanel { - private final HashMap<String, AbstractImagePrototype> fileIcons; - private final ContextItemsPresenter presenter; - - public ItemsPanel(final ContextItemsPresenter presenter) { - this.presenter = presenter; - addStyleName("kune-NavigationBar"); - addStyleName("Items"); - fileIcons = new HashMap<String, AbstractImagePrototype>(); - } - - public void add(final String name, final String type, final String token, final boolean editable) { - // IconHyperlink item = new IconHyperlink((AbstractImagePrototype) - // fileIcons.get(type), name, event); - EditableIconLabel item = new EditableIconLabel(fileIcons.get(type), name, token, true, - new EditableClickListener() { - public void onEdited(String text) { - presenter.onTitleRename(text, token); - } - }); - item.setEditable(editable); - item.addStyleName("Items"); - item.addStyleName("kune-floatleft"); - add(item); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - fileIcons.put(typeName, image); - } -} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java 2008-09-07 14:07:16 UTC (rev 844) @@ -11,17 +11,17 @@ public class EntityWorkspace extends DefaultBorderLayout { private final Panel content; - private final Panel container; + private final Panel context; private final TitleBar title; private final TitleBar subTitle; private final TitleBar bottom; private final Toolbar contentTopBar; private final Toolbar contentBottomBar; - private final Toolbar containerTopBar; - private final Toolbar containerBottomBar; + private final Toolbar contextTopBar; + private final Toolbar contextBottomBar; private final RoundedPanel roundedTitle; private final RoundedPanel roundedBottom; - private final DefaultBorderLayout containerWrap; + private final DefaultBorderLayout contextWrap; public EntityWorkspace() { final Panel titles = new Panel(); @@ -48,37 +48,36 @@ bottomPanel.add(roundedBottom, new AnchorLayoutData("100% -" + DEF_TOOLBAR_HEIGHT)); final DefaultBorderLayout contentWrap = new DefaultBorderLayout(); - containerWrap = new DefaultBorderLayout(); + contextWrap = new DefaultBorderLayout(); contentWrap.setBorder(true); - containerWrap.setBorder(true); + contextWrap.setBorder(true); content = new Panel(); - container = new Panel(); + context = new Panel(); content.setBorder(false); - container.setBorder(false); - container.setCollapsible(true); - content.setPaddings(5); - container.setPaddings(5); + context.setBorder(false); + context.setCollapsible(true); + content.setPaddings(7); content.setAutoScroll(true); - container.setAutoScroll(true); + context.setAutoScroll(true); contentTopBar = new Toolbar(); contentBottomBar = new Toolbar(); - containerTopBar = new Toolbar(); - containerBottomBar = new Toolbar(); + contextTopBar = new Toolbar(); + contextBottomBar = new Toolbar(); contentTopBar.addStyleName("k-toolbar-bottom-line"); contentBottomBar.addStyleName("k-toolbar-top-line"); - containerTopBar.addStyleName("k-toolbar-bottom-line"); - containerBottomBar.addStyleName("k-toolbar-top-line"); + contextTopBar.addStyleName("k-toolbar-bottom-line"); + contextBottomBar.addStyleName("k-toolbar-top-line"); contentWrap.add(contentTopBar.getPanel(), Position.NORTH, false, DEF_TOOLBAR_HEIGHT); - containerWrap.add(containerTopBar.getPanel(), Position.NORTH, false, DEF_TOOLBAR_HEIGHT); + contextWrap.add(contextTopBar.getPanel(), Position.NORTH, false, DEF_TOOLBAR_HEIGHT); contentWrap.add(content, Position.CENTER); - containerWrap.add(container, Position.CENTER); + contextWrap.add(context, Position.CENTER); contentWrap.add(contentBottomBar.getPanel(), Position.SOUTH, false, DEF_TOOLBAR_HEIGHT); - containerWrap.add(containerBottomBar.getPanel(), Position.SOUTH, false, DEF_TOOLBAR_HEIGHT); + contextWrap.add(contextBottomBar.getPanel(), Position.SOUTH, false, DEF_TOOLBAR_HEIGHT); add(titles, DefaultBorderLayout.Position.NORTH, DEF_TOOLBAR_HEIGHT * 2); add(contentWrap.getPanel(), DefaultBorderLayout.Position.CENTER); - add(containerWrap.getPanel(), DefaultBorderLayout.Position.EAST, true, 175); + add(contextWrap.getPanel(), DefaultBorderLayout.Position.EAST, true, 175); add(bottomPanel, DefaultBorderLayout.Position.SOUTH, DEF_TOOLBAR_HEIGHT + 2); } @@ -86,14 +85,6 @@ return bottom; } - public Toolbar getContainerBottomBar() { - return containerBottomBar; - } - - public Toolbar getContainerTopBar() { - return containerTopBar; - } - public Toolbar getContentBottomBar() { return contentBottomBar; } @@ -102,6 +93,14 @@ return contentTopBar; } + public Toolbar getContextBottomBar() { + return contextBottomBar; + } + + public Toolbar getContextTopBar() { + return contextTopBar; + } + public TitleBar getSubTitle() { return subTitle; } @@ -110,14 +109,14 @@ return title; } - public void setContainer(final Widget widget) { - setPanel(container, widget); - } - public void setContent(final Widget widget) { setPanel(content, widget); } + public void setContext(final Widget widget) { + setPanel(context, widget); + } + public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { final String themeS = newTheme.toString(); if (oldTheme != null) { @@ -126,7 +125,7 @@ subTitle.removeStyleDependentName(previousThemeS); bottom.removeStyleDependentName(previousThemeS); super.removeStyle("k-entityworkspace-" + previousThemeS); - container.removeStyleName("k-entity-container-" + previousThemeS); + context.removeStyleName("k-entity-context-" + previousThemeS); } super.addStyle("k-entityworkspace-" + newTheme); roundedTitle.setCornerStyleName("k-entity-title-rd-" + newTheme); @@ -134,6 +133,6 @@ title.addStyleDependentName(themeS); subTitle.addStyleDependentName(themeS); bottom.addStyleDependentName(themeS); - container.addStyleName("k-entity-container-" + newTheme); + context.addStyleName("k-entity-context-" + newTheme); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Toolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Toolbar.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/Toolbar.java 2008-09-07 14:07:16 UTC (rev 844) @@ -26,9 +26,7 @@ public void add(final Widget widget) { childPanel.add(widget); - if (container.isRendered()) { - container.doLayout(false); - } + doLayoutIfNeeded(); } public Widget addFill() { @@ -57,8 +55,24 @@ container.addClass(cls); } + public void doLayoutIfNeeded() { + if (container.isRendered()) { + container.doLayout(false); + } + } + public Panel getPanel() { return container; } + public void remove(final Widget widget) { + childPanel.remove(widget); + doLayoutIfNeeded(); + } + + public void removeAll() { + childPanel.clear(); + doLayoutIfNeeded(); + } + } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/WorkspaceSkeleton.java 2008-09-07 14:07:16 UTC (rev 844) @@ -3,7 +3,9 @@ import org.ourproject.kune.platf.client.ui.DefaultBorderLayout; import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme; -import com.google.gwt.user.client.ui.Label; +import com.calclab.suco.client.signal.Slot0; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.gwtext.client.core.ExtElement; @@ -32,7 +34,6 @@ mainPanel.add(sitebar, DefaultBorderLayout.Position.NORTH, DefaultBorderLayout.DEF_TOOLBAR_HEIGHT); mainPanel.add(entity.getPanel(), DefaultBorderLayout.Position.CENTER); container.add(mainPanel.getPanel()); - getEntityWorkspace().getContentTopBar().add(new Label("Sorry, kune workspace under heavy refactorization")); new Viewport(container); } @@ -40,6 +41,22 @@ entity.addToEntityMainHeader(widget); } + public void askConfirmation(final String title, final String message, final Slot0 onConfirmed, final Slot0 onCancel) { + MessageBox.confirm(title, message, new MessageBox.ConfirmCallback() { + public void execute(final String btnID) { + if (btnID.equals("yes")) { + DeferredCommand.addCommand(new Command() { + public void execute() { + onConfirmed.onEvent(); + } + }); + } else { + onCancel.onEvent(); + } + } + }); + } + public EntitySummary getEntitySummary() { return entity.getEntitySummary(); } @@ -64,6 +81,15 @@ extRootBody.mask(message, "x-mask-loading"); } + public void promptMessage(final String title, final String message, final Slot0 onEnter) { + MessageBox.prompt(title, message, new MessageBox.PromptCallback() { + public void execute(final String btnID, final String text) { + // FIXME: use btnID + onEnter.onEvent(); + } + }); + } + public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { entity.setTheme(oldTheme, newTheme); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/themes/WsThemePresenter.java 2008-09-07 14:07:16 UTC (rev 844) @@ -29,6 +29,7 @@ session.onInitDataReceived(new Slot<InitDataDTO>() { public void onEvent(final InitDataDTO initData) { view.setThemes(initData.getWsThemes()); + setTheme(new WsTheme(initData.getWsThemes()[0])); } }); stateManager.onStateChanged(new Slot<StateDTO>() { Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-08-30 16:58:14 UTC (rev 843) +++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java 2008-09-07 14:07:16 UTC (rev 844) @@ -64,7 +64,7 @@ viewReset(); EasyMock.replay(view); listener.onSave("foo"); - listener.onCancel(); + listener.onEditCancelled(); EasyMock.replay(listener); presenter.init(view); presenter.onEdit();
participants (1)
-
vjrj