KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > frontend > editor > PartEditor


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
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, 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, DocumentEditorForm documentEditorForm, Repository repository) throws Exception JavaDoc;
34
35     /**
36      * Returns the URI to the form template.
37      */

38     public String JavaDoc getFormTemplate();
39
40     /**
41      * Loads existing data into the part form.
42      */

43     public void load(Form form, Document document, Part part, Repository repository) throws Exception JavaDoc;
44
45     /**
46      * Saves the part data (could be removing the part if the editor is empty).
47      *
48      * <p>Note: the form has an attribute called "partType" that contains the {@link org.outerj.daisy.repository.schema.PartType}
49      * for which this editor serves. That way, you know which part this form represents.
50      */

51     public void save(Form form, Document document) throws Exception JavaDoc;
52 }
53
Popular Tags