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 org.apache.cocoon.forms.formmodel.Form;
19: import org.outerj.daisy.repository.Part;
20: import org.outerj.daisy.repository.Document;
21: import org.outerj.daisy.repository.Repository;
22: import org.outerj.daisy.repository.schema.PartTypeUse;
23:
24: /**
25: * Interface to be implemented by part editors.
26: *
27: * <p>A PartEditor instance is instanciated through a {@link PartEditorFactory}.
28: */
29: public interface PartEditor {
30: /**
31: * Returns a form for the specified PartTypeUse.
32: */
33: public Form getForm(PartTypeUse partTypeUse,
34: DocumentEditorForm documentEditorForm, Repository repository)
35: throws Exception;
36:
37: /**
38: * Returns the URI to the form template.
39: */
40: public String getFormTemplate();
41:
42: /**
43: * Loads existing data into the part form.
44: */
45: public void load(Form form, Document document, Part part,
46: Repository repository) throws Exception;
47:
48: /**
49: * Saves the part data (could be removing the part if the editor is empty).
50: *
51: * <p>Note: the form has an attribute called "partType" that contains the {@link org.outerj.daisy.repository.schema.PartType}
52: * for which this editor serves. That way, you know which part this form represents.
53: */
54: public void save(Form form, Document document) throws Exception;
55: }
|