01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.frontend.editor;
17:
18: import java.util.Map;
19:
20: import org.apache.avalon.framework.context.Context;
21: import org.apache.avalon.framework.service.ServiceManager;
22: import org.apache.cocoon.forms.formmodel.Form;
23: import org.outerj.daisy.frontend.util.FormHelper;
24: import org.outerj.daisy.repository.Document;
25: import org.outerj.daisy.repository.Part;
26: import org.outerj.daisy.repository.Repository;
27: import org.outerj.daisy.repository.schema.PartTypeUse;
28:
29: public class NonEditablePartEditor implements PartEditor {
30: private ServiceManager serviceManager;
31:
32: public NonEditablePartEditor(ServiceManager serviceManager) {
33: this .serviceManager = serviceManager;
34: }
35:
36: public Form getForm(PartTypeUse partTypeUse,
37: DocumentEditorForm documentEditorForm, Repository repository)
38: throws Exception {
39: return FormHelper.createForm(serviceManager,
40: "resources/form/parteditor_noedit_definition.xml");
41: }
42:
43: public String getFormTemplate() {
44: return "resources/form/parteditor_noedit_template.xml";
45: }
46:
47: public void load(Form form, Document document, Part part,
48: Repository repository) throws Exception {
49: // do nothing
50: }
51:
52: public void save(Form form, Document document) throws Exception {
53: // do nothing
54: }
55:
56: public static class Factory implements PartEditorFactory {
57: public PartEditor getPartEditor(Map properties,
58: ServiceManager serviceManager, Context context) {
59: return new NonEditablePartEditor(serviceManager);
60: }
61: }
62:
63: }
|