Changeset 15108
- Timestamp:
- 04/01/07 12:26:03 (2 years ago)
- Files:
-
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/api/NavigationContext.java (modified) (9 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/api/WebActions.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/ArchivedVersionsPathElement.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/DocumentPathElement.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/TextPathElement.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/VersionDocumentPathElement.java (modified) (3 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/resolver/ContextStringWrapper.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/rest/RestHelper.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/rest/RestURLMaker.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/DocumentLinkTagHandler.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/MethodResultTagHandler.java (modified) (3 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/RestDocumentLinkTagHandler.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/jsf/GenericValueHolderRule.java (modified) (10 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tree/HtmlLazyTreeRenderer.java (modified) (5 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tree/LazyTreeModel.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tree/LazyTreeWalker.java (modified) (5 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/util/BadDocumentUriException.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/util/BaseURL.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/util/ComponentTagUtils.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/util/DocumentLocationImpl.java (modified) (1 diff)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/util/DocumentLocator.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/util/SeamContextHelper.java (modified) (2 diffs)
- org.nuxeo.ecm.platform.ui.web/trunk/test/src/org/nuxeo/ecm/platform/ui/web/util/TestFancyURL.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/api/NavigationContext.java
r14797 r15108 243 243 244 244 /** 245 * Return the current documentManager if any or create a new session to the246 * currently selected repository location 245 * Returns the current documentManager if any or create a new session to the 246 * currently selected repository location. 247 247 * 248 248 * @throws ClientException … … 255 255 * @return 256 256 */ 257 public String navigateToDocument(DocumentModel docModel, VersionModel versionModel) throws ClientException; 258 259 /** 260 * get the currentDocument ant put it in Page context 257 public String navigateToDocument(DocumentModel docModel, 258 VersionModel versionModel) throws ClientException; 259 260 /** 261 * Gets the currentDocument and puts it in Page context. 262 * 261 263 * @return 262 264 */ … … 264 266 265 267 /** 266 * get the currentDomain ant put it in Page context 268 * Gets the currentDomain and puts it in Page context. 269 * 267 270 * @return 268 271 */ … … 270 273 271 274 /** 272 * get the currentWorkspace ant put it in Page context 275 * Gets the currentWorkspace and puts it in Page context. 276 * 273 277 * @return 274 278 */ … … 276 280 277 281 /** 278 * get the currentContentRootWorkspace and put it in Page context 282 * Gets the currentContentRootWorkspace and puts it in Page context. 283 * 279 284 * @return 280 285 */ … … 282 287 283 288 /** 284 * get the current ServerLocation and put it in Page Context 289 * Gets the current ServerLocation and puts it in Page Context. 290 * 285 291 * @return 286 292 */ … … 288 294 289 295 /** 290 * get children of currentDocuments and put it in Page context 296 * Gets children of currentDocuments and put it in Page context. 297 * 291 298 * @return 292 299 */ … … 295 302 296 303 /** 297 * get the current Content Root (Workspaces, Sections, Templates ...) 304 * Gets the current Content Root (Workspaces, Sections, Templates...). 305 * 298 306 * @return 299 307 */ … … 301 309 302 310 /** 303 * get the current Workspace 311 * Gets the current Workspace. 312 * 304 313 * @return 305 314 */ 306 315 public DocumentModel getCurrentWorkspace(); 307 316 308 309 /**310 * set the current ContentRoot317 /** 318 * Sets the current ContentRoot. 319 * 311 320 * @param currentContentRoot 312 321 */ org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/api/WebActions.java
r13814 r15108 17 17 import java.util.List; 18 18 19 import javax.annotation.security.PermitAll;20 19 import javax.ejb.Remote; 21 import javax.ejb.Remove;22 20 23 import org.jboss.seam.annotations.Destroy;24 21 import org.nuxeo.ecm.platform.actions.Action; 25 22 import org.nuxeo.ecm.platform.actions.ActionContext; org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/ArchivedVersionsPathElement.java
r13464 r15108 26 26 public class ArchivedVersionsPathElement implements PathElement { 27 27 28 public static final String TYPE = "ArchivedVersionsPathElement"; 29 28 30 private static final long serialVersionUID = 8965065837815754773L; 29 31 30 32 private DocumentModel docModel; 31 32 public static final String TYPE = "ArchivedVersionsPathElement";33 33 34 34 public ArchivedVersionsPathElement(DocumentModel docModel) { org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/DocumentPathElement.java
r13464 r15108 23 23 public class DocumentPathElement implements PathElement { 24 24 25 public static final String TYPE = "DocumentPathElement"; 26 25 27 private static final long serialVersionUID = 3539843847014749832L; 26 28 27 29 protected DocumentModel docModel; 28 29 public static final String TYPE = "DocumentPathElement";30 30 31 31 public DocumentPathElement(DocumentModel docModel) { org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/TextPathElement.java
r13464 r15108 21 21 public class TextPathElement implements PathElement { 22 22 23 public static final String TYPE = "TextPathElement"; 24 23 25 private static final long serialVersionUID = -2697484542006976062L; 24 25 public static final String TYPE = "TextPathElement";26 26 27 27 private String name; … … 31 31 } 32 32 33 /* (non-Javadoc)34 * @see org.nuxeo.ecm.webapp.context.PathElement#getName()35 */36 33 public String getName() { 37 34 return name; 38 35 } 39 36 40 /* (non-Javadoc)41 * @see org.nuxeo.ecm.webapp.context.PathElement#getType()42 */43 37 public String getType() { 44 38 return TYPE; org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/VersionDocumentPathElement.java
r13464 r15108 25 25 public class VersionDocumentPathElement extends DocumentPathElement { 26 26 27 public static final String TYPE = "VersionDocumentPathElement"; 28 27 29 private static final long serialVersionUID = -2151946234154284611L; 28 public static final String TYPE = "VersionDocumentPathElement";29 30 30 31 public VersionDocumentPathElement(DocumentModel docModel) { … … 32 33 } 33 34 34 /*35 * (non-Javadoc)36 *37 * @see org.nuxeo.ecm.platform.ui.web.pathelements#getName()38 */39 35 public String getName() { 40 36 try { … … 49 45 } 50 46 51 /*52 * (non-Javadoc)53 *54 * @see org.nuxeo.ecm.platform.ui.web.pathelements#getType()55 */56 47 public String getType() { 57 48 return TYPE; org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/resolver/ContextStringWrapper.java
r15094 r15108 13 13 private String value; 14 14 15 public ContextStringWrapper(String val ) {16 this.value = val ;15 public ContextStringWrapper(String value) { 16 this.value = value; 17 17 } 18 18 … … 25 25 } 26 26 27 @Override 27 28 public String toString() { 28 29 return this.value; 29 30 } 30 31 32 // FIXME: this doesn't implement the equals() contract (not symetric). 33 @Override 31 34 public boolean equals(Object val) { 32 return this.value.equals(val); 35 return value.equals(val); 36 } 37 38 @Override 39 public int hashCode() { 40 return value.hashCode(); 33 41 } 34 42 org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/rest/RestHelper.java
r14130 r15108 1 1 package org.nuxeo.ecm.platform.ui.web.rest; 2 2 3 import static org.jboss.seam.ScopeType.CONVERSATION;4 3 import static org.jboss.seam.ScopeType.EVENT; 5 6 import java.awt.List;7 4 8 5 import org.apache.commons.logging.Log; … … 23 20 public class RestHelper { 24 21 25 private String repositoryName;22 private static Log log = LogFactory.getLog(RestHelper.class); 26 23 27 private String documentId;24 private String repositoryName; 28 25 29 private String currentTab;26 private String documentId; 30 27 31 @In(create = true) 32 NavigationContext navigationContext; 28 private String currentTab; 33 29 34 @In(create = true)35 WebActions webActions;30 @In(create = true) 31 NavigationContext navigationContext; 36 32 37 private static Log log = LogFactory.getLog(RestHelper.class); 33 @In(create = true) 34 WebActions webActions; 38 35 39 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)40 public String initContextFromRestRequest() {41 String outcome = null;36 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 37 public String initContextFromRestRequest() { 38 String outcome = null; 42 39 43 if ((repositoryName != null)44 && ((navigationContext.getSelectedServerLocation() == null) || 45 (!navigationContext.getSelectedServerLocation().getName().equals(repositoryName)))) {40 if ((repositoryName != null) 41 && ((navigationContext.getSelectedServerLocation() == null) || (!navigationContext.getSelectedServerLocation().getName().equals( 42 repositoryName)))) { 46 43 47 RepositoryLocation repo = new RepositoryLocation(repositoryName); 48 try { 49 navigationContext.setCurrentServerLocation(repo); 50 // do some navigation 51 DocumentRef docRef = new IdRef(documentId); 52 outcome = navigationContext.navigateTo(repo, docRef); 53 if ((currentTab != null)&&(!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME))) 54 webActions.setCurrentTabAction(currentTab); 55 } catch (ClientException e) { 56 // TODO Auto-generated catch block 57 e.printStackTrace(); 58 } 59 // use redirect to get context initialized 60 // return outcome; 61 } 62 if ((documentId != null) 63 && (!navigationContext.getCurrentDocument().getId().equals( 64 documentId))) { 65 // do some navigation 66 DocumentRef docRef = new IdRef(documentId); 67 try { 68 outcome = navigationContext.navigateToRef(docRef); 69 } catch (ClientException e) { 70 // TODO Auto-generated catch block 71 e.printStackTrace(); 72 } 73 } 44 RepositoryLocation repo = new RepositoryLocation(repositoryName); 45 try { 46 navigationContext.setCurrentServerLocation(repo); 47 // do some navigation 48 DocumentRef docRef = new IdRef(documentId); 49 outcome = navigationContext.navigateTo(repo, docRef); 50 if ((currentTab != null) 51 && (!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME))) { 52 webActions.setCurrentTabAction(currentTab); 53 } 54 } catch (ClientException e) { 55 // TODO Auto-generated catch block 56 e.printStackTrace(); 57 } 58 // use redirect to get context initialized 59 // return outcome; 60 } 61 if ((documentId != null) 62 && (!navigationContext.getCurrentDocument().getId().equals( 63 documentId))) { 64 // do some navigation 65 DocumentRef docRef = new IdRef(documentId); 66 try { 67 outcome = navigationContext.navigateToRef(docRef); 68 } catch (ClientException e) { 69 // TODO Auto-generated catch block 70 e.printStackTrace(); 71 } 72 } 74 73 75 if ((currentTab != null) 76 && (!webActions.getCurrentTabAction().getId() 77 .equals(currentTab))) { 78 if (!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME)) 79 webActions.setCurrentTabAction(currentTab); 80 } 74 if ((currentTab != null) 75 && (!webActions.getCurrentTabAction().getId() 76 .equals(currentTab))) { 77 if (!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME)) { 78 webActions.setCurrentTabAction(currentTab); 79 } 80 } 81 81 82 return null;83 }82 return null; 83 } 84 84 85 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)86 public String getCurrentTab() {87 String cTab = webActions.getCurrentTabAction().getId();88 log.debug("Retrive currentTab :" + cTab);89 return cTab;90 }85 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 86 public String getCurrentTab() { 87 String cTab = webActions.getCurrentTabAction().getId(); 88 log.debug("Retrive currentTab :" + cTab); 89 return cTab; 90 } 91 91 92 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)93 public void setCurrentTab(String currentTab) {94 log.debug("setting curentTab from URL :" + currentTab);95 // log.debug("navigationContext contains :" +96 // webActions.getCurrentTabAction().getId());97 this.currentTab = currentTab;98 // if (!currentTab.equals(webActions.getCurrentTabAction().getId()))99 // webActions.setCurrentTabAction(currentTab);100 }92 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 93 public void setCurrentTab(String currentTab) { 94 log.debug("setting curentTab from URL :" + currentTab); 95 // log.debug("navigationContext contains :" + 96 // webActions.getCurrentTabAction().getId()); 97 this.currentTab = currentTab; 98 // if (!currentTab.equals(webActions.getCurrentTabAction().getId())) 99 // webActions.setCurrentTabAction(currentTab); 100 } 101 101 102 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)103 public String getDocumentId() {104 String dId = navigationContext.getCurrentDocument().getId();105 log.debug("getting DocumentId from context : " + dId);106 return dId;107 }102 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 103 public String getDocumentId() { 104 String dId = navigationContext.getCurrentDocument().getId(); 105 log.debug("getting DocumentId from context : " + dId); 106 return dId; 107 } 108 108 109 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)110 public void setDocumentId(String documentId) {111 log.debug("Setting DocumentId from URL : " + documentId);112 // log.debug("navigationContext contains : " +113 // navigationContext.getCurrentDocument().getId());114 this.documentId = documentId;109 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 110 public void setDocumentId(String documentId) { 111 log.debug("Setting DocumentId from URL : " + documentId); 112 // log.debug("navigationContext contains : " + 113 // navigationContext.getCurrentDocument().getId()); 114 this.documentId = documentId; 115 115 116 }116 } 117 117 118 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)119 public String getRepositoryName() {120 return navigationContext.getCurrentServerLocation().getName();121 }118 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 119 public String getRepositoryName() { 120 return navigationContext.getCurrentServerLocation().getName(); 121 } 122 122 123 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true)124 public void setRepositoryName(String repositoryName) {125 this.repositoryName = repositoryName;126 }123 @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 124 public void setRepositoryName(String repositoryName) { 125 this.repositoryName = repositoryName; 126 } 127 127 128 128 } org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/rest/RestURLMaker.java
r14759 r15108 25 25 NavigationContext navigationContext; 26 26 27 @In(value="org.jboss.seam.core.manager") 28 public Manager conversationManager; 29 30 @In 31 private TypeManager typeManager; 32 33 34 private String baseURL=""; 35 36 /* 37 * return url like http://server:8080/nuxeo/nxdoc/repo/uuid/view/tab 38 */ 39 public String getDocumentFullURL(RepositoryLocation repo, DocumentRef docRef,String view, String tab, Boolean propagateConversation) 40 { 41 String returnURL=getDocumentURL(repo, docRef, view, tab, propagateConversation); 42 43 returnURL=BaseURL.getServerURL() + returnURL.substring(1); 44 45 return returnURL; 46 } 47 48 /* 49 * return url like /nuxeo/nxdoc/repo/uuid/view/tab 50 */ 51 public String getDocumentURL(RepositoryLocation repo, DocumentRef docRef,String view, String tab, Boolean propagateConversation) 52 { 53 String returnURL=""; 54 55 if (FancyURLConfig.USE_FANCY_URL) 56 { 57 DocumentLocation docLoc = new DocumentLocationImpl(repo,docRef); 58 DocumentView dv = new DocumentViewImpl(docLoc,view,tab,null); 59 60 returnURL=FancyURLMapper.getFancyURL(dv); 61 if (propagateConversation) 62 returnURL+="?"+getConversationPropagationSuffix(); 63 } 64 else 65 { 66 returnURL = getSimpleURL(repo, docRef, view, tab); 67 if (propagateConversation) 68 returnURL+="&"+getConversationPropagationSuffix(); 69 } 70 71 return "/"+BaseURL.getWebAppName()+returnURL; 72 } 73 74 public String getDocumentURL(DocumentRef docRef,String view, String tab) 75 { 76 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 77 return getDocumentURL(repo, docRef, view, tab,true); 78 } 79 80 public String getDocumentURL(DocumentRef docRef) 81 { 82 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 83 return getDocumentURL(repo, docRef, FancyURLConfig.DEFAULT_VIEW_ID, FancyURLConfig.DEFAULT_TAB_NAME,true); 84 } 85 86 public String getDocumentURLFromDocumentModel(DocumentModel doc) 87 { 88 String jsfViewId=getDefaultViewId(doc); 89 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 90 return getDocumentURL(repo, doc.getRef(), jsfViewId, FancyURLConfig.DEFAULT_TAB_NAME,true); 91 } 92 93 public String getDocumentURLFromDocumentModelWithTab(DocumentModel doc,String tabId) 94 { 95 String jsfViewId=getDefaultViewId(doc); 96 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 97 return getDocumentURL(repo, doc.getRef(), jsfViewId, tabId,true); 98 } 99 100 public String getDocumentURL() 101 { 102 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 103 return getDocumentURLFromDocumentModel(currentDoc); 104 } 105 106 public String getDocumentURLForParentConversation() 107 { 108 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 109 String url = getDocumentURL(currentDoc.getRef()); 110 111 url=url.replace(getConversationPropagationSuffix(), getMainConversationPropagationSuffix()); 112 return url; 113 } 114 115 116 public String getDocumentPermLink() 117 { 118 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 119 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 120 return getDocumentURL(repo, currentDoc.getRef(), FancyURLConfig.DEFAULT_VIEW_ID, FancyURLConfig.DEFAULT_TAB_NAME,false); 121 } 122 123 public String switchTabForCurrentDocument(String tab) 124 { 125 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 126 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 127 return getDocumentURL(repo, currentDoc.getRef(), FancyURLConfig.DEFAULT_VIEW_ID, tab,true); 128 } 27 @In(value="org.jboss.seam.core.manager") 28 public Manager conversationManager; 29 30 @In 31 private TypeManager typeManager; 32 33 private String baseURL=""; 34 35 /** 36 * @return url like http://server:8080/nuxeo/nxdoc/repo/uuid/view/tab 37 */ 38 public String getDocumentFullURL(RepositoryLocation repo, 39 DocumentRef docRef, String view, String tab, 40 Boolean propagateConversation) { 41 String returnURL = getDocumentURL(repo, docRef, view, tab, 42 propagateConversation); 43 44 returnURL = BaseURL.getServerURL() + returnURL.substring(1); 45 46 return returnURL; 47 } 48 49 /** 50 * @return url like /nuxeo/nxdoc/repo/uuid/view/tab 51 */ 52 public String getDocumentURL(RepositoryLocation repo, DocumentRef docRef, 53 String view, String tab, Boolean propagateConversation) { 54 String returnURL = ""; 55 56 if (FancyURLConfig.USE_FANCY_URL) { 57 DocumentLocation docLoc = new DocumentLocationImpl(repo, docRef); 58 DocumentView dv = new DocumentViewImpl(docLoc, view, tab, null); 59 60 returnURL = FancyURLMapper.getFancyURL(dv); 61 if (propagateConversation) { 62 returnURL += "?" + getConversationPropagationSuffix(); 63 } 64 } else { 65 returnURL = getSimpleURL(repo, docRef, view, tab); 66 if (propagateConversation) { 67 returnURL += "&" + getConversationPropagationSuffix(); 68 } 69 } 70 71 return "/" + BaseURL.getWebAppName() + returnURL; 72 } 73 74 public String getDocumentURL(DocumentRef docRef, String view, String tab) { 75 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 76 return getDocumentURL(repo, docRef, view, tab, true); 77 } 78 79 public String getDocumentURL(DocumentRef docRef) { 80 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 81 return getDocumentURL(repo, docRef, FancyURLConfig.DEFAULT_VIEW_ID, 82 FancyURLConfig.DEFAULT_TAB_NAME, true); 83 } 84 85 public String getDocumentURLFromDocumentModel(DocumentModel doc) { 86 String jsfViewId = getDefaultViewId(doc); 87 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 88 return getDocumentURL(repo, doc.getRef(), jsfViewId, 89 FancyURLConfig.DEFAULT_TAB_NAME, true); 90 } 91 92 public String getDocumentURLFromDocumentModelWithTab(DocumentModel doc, 93 String tabId) { 94 String jsfViewId = getDefaultViewId(doc); 95 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 96 return getDocumentURL(repo, doc.getRef(), jsfViewId, tabId, true); 97 } 98 99 public String getDocumentURL() { 100 DocumentModel currentDoc = navigationContext.getCurrentDocument(); 101 return getDocumentURLFromDocumentModel(currentDoc); 102 } 103 104 public String getDocumentURLForParentConversation() { 105 DocumentModel currentDoc = navigationContext.getCurrentDocument(); 106 String url = getDocumentURL(currentDoc.getRef()); 107 108 url = url.replace(getConversationPropagationSuffix(), 109 getMainConversationPropagationSuffix()); 110 return url; 111 } 112 113 public String getDocumentPermLink() { 114 DocumentModel currentDoc = navigationContext.getCurrentDocument(); 115 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 116 return getDocumentURL(repo, currentDoc.getRef(), 117 FancyURLConfig.DEFAULT_VIEW_ID, 118 FancyURLConfig.DEFAULT_TAB_NAME, false); 119 } 120 121 public String switchTabForCurrentDocument(String tab) { 122 DocumentModel currentDoc = navigationContext.getCurrentDocument(); 123 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 124 return getDocumentURL(repo, currentDoc.getRef(), 125 FancyURLConfig.DEFAULT_VIEW_ID, tab, true); 126 } 129 127 130 128 @Factory(value = "baseURL", scope = CONVERSATION) 131 public String getBaseURL() 132 { 133 if (baseURL.equals("")) 134 { 135 baseURL=BaseURL.getBaseURL(); 136 } 137 return baseURL; 129 public String getBaseURL() { 130 if (baseURL.equals("")) { 131 baseURL = BaseURL.getBaseURL(); 132 } 133 return baseURL; 138 134 } 139 135 140 136 @Factory(value = "needBaseURL", scope = CONVERSATION) 141 public boolean getNeedBaseURL() 142 { 143 return FancyURLConfig.NEED_BASE_URL; 144 } 145 146 147 private String getSimpleURL(RepositoryLocation repo, DocumentRef docRef,String view, String tab) 148 { 149 String returnURL=""; 150 151 returnURL+="/" + view + ".faces?"; 152 returnURL+=FancyURLConfig.GET_URL_Server_Param + "=" + repo.getName() + "&"; 153 returnURL+=FancyURLConfig.GET_URL_Doc_Param + "=" + docRef.toString() + "&"; 154 returnURL+=FancyURLConfig.GET_URL_Tab_Param + "=" + tab; 155 156 // XXX deal with encoding 157 return returnURL; 158 } 159 160 private String getConversationPropagationSuffix() 161 { 162 String suffix=""; 163 164 suffix+=conversationManager.getConversationIdParameter()+"=" + conversationManager.getCurrentConversationId(); 165 if (conversationManager.isLongRunningConversation()) 166 suffix+="&"+conversationManager.getConversationIsLongRunningParameter() + "true"; 167 168 return suffix; 169 } 170 171 private String getMainConversationPropagationSuffix() 172 { 173 String suffix=""; 174 175 String cId=conversationManager.getCurrentConversationId(); 176 if (conversationManager.isNestedConversation()) 177 cId =conversationManager.getParentConversationId(); 178 179 suffix+=conversationManager.getConversationIdParameter()+"=" + cId; 180 if (conversationManager.isLongRunningConversation()) 181 suffix+="&"+conversationManager.getConversationIsLongRunningParameter() + "true"; 182 183 return suffix; 184 } 185 186 187 private Map<String,String> type2ViewMapper = new HashMap<String,String>(); 188 189 private String getDefaultViewId(DocumentModel doc) 190 { 191 String docType=doc.getType(); 192 193 if (type2ViewMapper.containsKey(docType)) 194 return type2ViewMapper.get(docType); 195 196 String viewId = typeManager.getType(docType).getDefaultView(); 197 198 // cache it for later use 199 type2ViewMapper.put(docType, viewId); 200 201 return viewId; 202 203 204 } 137 public boolean getNeedBaseURL() { 138 return FancyURLConfig.NEED_BASE_URL; 139 } 140 141 private String getSimpleURL(RepositoryLocation repo, DocumentRef docRef, 142 String view, String tab) { 143 String returnURL = ""; 144 145 returnURL += "/" + view + ".faces?"; 146 returnURL += FancyURLConfig.GET_URL_Server_Param + "=" + repo.getName() 147 + "&"; 148 returnURL += FancyURLConfig.GET_URL_Doc_Param + "=" + docRef.toString() 149 + "&"; 150 returnURL += FancyURLConfig.GET_URL_Tab_Param + "=" + tab; 151 152 // XXX deal with encoding 153 return returnURL; 154 } 155 156 private String getConversationPropagationSuffix() { 157 String suffix = ""; 158 159 suffix += conversationManager.getConversationIdParameter() + "=" 160 + conversationManager.getCurrentConversationId(); 161 if (conversationManager.isLongRunningConversation()) { 162 suffix += "&" 163 + conversationManager.getConversationIsLongRunningParameter() 164 + "true"; 165 } 166 167 return suffix; 168 } 169 170 private String getMainConversationPropagationSuffix() { 171 String suffix = ""; 172 173 String cId = conversationManager.getCurrentConversationId(); 174 if (conversationManager.isNestedConversation()) { 175 cId = conversationManager.getParentConversationId(); 176 } 177 178 suffix += conversationManager.getConversationIdParameter() + "=" + cId; 179 if (conversationManager.isLongRunningConversation()) { 180 suffix += "&" 181 + conversationManager.getConversationIsLongRunningParameter() 182 + "true"; 183 } 184 185 return suffix; 186 } 187 188 private Map<String, String> type2ViewMapper = new HashMap<String, String>(); 189 190 private String getDefaultViewId(DocumentModel doc) { 191 String docType = doc.getType(); 192 193 if (type2ViewMapper.containsKey(docType)) { 194 return type2ViewMapper.get(docType); 195 } 196 197 String viewId = typeManager.getType(docType).getDefaultView(); 198 199 // cache it for later use 200 type2ViewMapper.put(docType, viewId); 201 202 return viewId; 203 } 205 204 206 205 } org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/DocumentLinkTagHandler.java
r14130 r15108 63 63 @Override 64 64 /** 65 * Set action after component has been created65 * Sets action after component has been created. 66 66 * 67 67 */ … … 113 113 return viewName; 114 114 } 115 115 116 } org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/MethodResultTagHandler.java
r14031 r15108 17 17 import java.io.IOException; 18 18 19 import javax.el.ELException;20 19 import javax.el.MethodExpression; 21 20 import javax.el.ValueExpression; 22 import javax.faces.FacesException;23 21 import javax.faces.component.UIComponent; 24 22 … … 26 24 27 25 import com.sun.facelets.FaceletContext; 28 import com.sun.facelets.FaceletException;29 import com.sun.facelets.el.LegacyValueBinding;30 26 import com.sun.facelets.tag.MetaTagHandler; 31 27 import com.sun.facelets.tag.TagAttribute; … … 61 57 62 58 public void apply(FaceletContext ctx, UIComponent parent) 63 throws IOException , FacesException, FaceletException, ELException{59 throws IOException { 64 60 String nameStr = name.getValue(ctx); 65 61 // resolve given value as a method binding, paramtypes ignored for now org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/RestDocumentLinkTagHandler.java
r15094 r15108 4 4 import javax.el.MethodExpression; 5 5 import javax.el.ValueExpression; 6 import javax.faces.application.Application;7 import javax.faces.component.ActionSource;8 6 import javax.faces.component.UIComponent; 9 7 import javax.faces.component.ValueHolder; 10 import javax.faces.el.MethodBinding;11 8 12 9 import org.apache.commons.logging.Log; 13 10 import org.apache.commons.logging.LogFactory; 14 11 import org.nuxeo.ecm.platform.ui.web.binding.MethodValueExpression; 15 import org.nuxeo.ecm.platform.ui.web.tag.jsf.GenericValueHolderRule;16 17 import sun.rmi.runtime.GetThreadPoolAction;18 12 19 13 import com.sun.facelets.FaceletContext; … … 53 47 return mr; 54 48 } 55 56 49 <
