Develop and Download Open Source Software

Browse CVS Repository

Contents of /pal/wiki/src/main/java/jp/sf/pal/wiki/callback/WikiLinkGeneratorCallback.java

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sat Jan 27 15:38:33 2007 UTC (17 years, 1 month ago) by shinsuke
Branch: MAIN
CVS Tags: RELEASE-0_1, HEAD
File MIME type: text/x-java
updated wiki converter. supported page navigation. sync up with the latest teeda.

1 /*
2 * Copyright 2004-2006 The Portal Application Laboratory Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package jp.sf.pal.wiki.callback;
17
18 import java.util.HashMap;
19 import java.util.Iterator;
20 import java.util.Map;
21
22 import javax.faces.context.FacesContext;
23 import javax.portlet.PortletURL;
24 import javax.portlet.RenderResponse;
25
26 import org.seasar.teeda.core.portlet.FacesPortlet;
27
28 import jp.sf.stconv.wiki.pipeline.callback.LinkGeneratorCallback;
29
30 /**
31 * @author shinsuke
32 *
33 */
34 public class WikiLinkGeneratorCallback implements LinkGeneratorCallback {
35
36 private Map attributes;
37
38 public WikiLinkGeneratorCallback() {
39 }
40
41 /*
42 * (non-Javadoc)
43 *
44 * @see jp.sf.stconv.wiki.pipeline.callback.LinkGeneratorCallback#addAttribute(java.lang.String,
45 * java.lang.String)
46 */
47 public void addAttribute(String key, String value) {
48 attributes.put(key, value);
49 }
50
51 /*
52 * (non-Javadoc)
53 *
54 * @see jp.sf.stconv.wiki.pipeline.callback.LinkGeneratorCallback#getUrl()
55 */
56 public String getUrl() {
57 Object r = FacesContext.getCurrentInstance().getExternalContext()
58 .getResponse();
59 if (r instanceof RenderResponse) {
60 // PortletURL portletURL = ((RenderResponse) r).createActionURL();
61 PortletURL portletURL = ((RenderResponse) r).createRenderURL();
62 if (portletURL != null) {
63 for (Iterator i = attributes.entrySet().iterator(); i.hasNext();) {
64 Map.Entry entry = (Map.Entry) i.next();
65 if (entry.getKey() != null && entry.getValue() != null) {
66 portletURL.setParameter((String) entry.getKey(),
67 (String) entry.getValue());
68 }
69 }
70 portletURL.setParameter(FacesPortlet.VIEW_ID, FacesContext
71 .getCurrentInstance().getViewRoot().getViewId());
72 return portletURL.toString();
73 }
74 }
75 return "";
76 }
77
78 /*
79 * (non-Javadoc)
80 *
81 * @see jp.sf.stconv.wiki.pipeline.callback.LinkGeneratorCallback#init()
82 */
83 public void init() {
84 if (attributes != null) {
85 attributes.clear();
86 } else {
87 attributes = new HashMap();
88 }
89 }
90
91 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26