01: /*
02: * This file is part of "SnipSnap Radeox Rendering Engine".
03: *
04: * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
05: * All Rights Reserved.
06: *
07: * Please visit http://radeox.org/ for updates and contact.
08: *
09: * --LICENSE NOTICE--
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: * --LICENSE NOTICE--
22: */
23:
24: package examples;
25:
26: import org.radeox.engine.BaseRenderEngine;
27: import org.radeox.api.engine.WikiRenderEngine;
28:
29: // cut:start-1
30: public class MyWikiRenderEngine extends BaseRenderEngine implements
31: WikiRenderEngine {
32:
33: public boolean exists(String name) {
34: // make a lookup in your wiki if the page exists
35: return name.equals("SnipSnap") || name.equals("stephan");
36: }
37:
38: public boolean showCreate() {
39: // we always want to show a create link, not only e.g.
40: // if a user is registered
41: return true;
42: }
43:
44: public void appendLink(StringBuffer buffer, String name, String view) {
45: buffer.append("<a href=\"/show?wiki=");
46: buffer.append(name);
47: buffer.append("\">");
48: buffer.append(view);
49: buffer.append("</a>");
50: }
51:
52: public void appendLink(StringBuffer buffer, String name,
53: String view, String anchor) {
54: buffer.append("<a href=\"/show?wiki=");
55: buffer.append(name);
56: buffer.append("#");
57: buffer.append(anchor);
58: buffer.append("\">");
59: buffer.append(view);
60: buffer.append("</a>");
61: }
62:
63: public void appendCreateLink(StringBuffer buffer, String name,
64: String view) {
65: buffer.append(name);
66: buffer.append("<a href=\"/create?wiki=");
67: buffer.append(name);
68: buffer.append("\">");
69: buffer.append("?</a>");
70: }
71:
72: public String getName() {
73: return "my-wiki";
74: }
75: }
76: // cut:end-1
|