001: /*
002: * Copyright (c) 2004 JETA Software, Inc. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without modification,
005: * are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of JETA Software nor the names of its contributors may
015: * be used to endorse or promote products derived from this software without
016: * specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
021: * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
022: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
023: * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
024: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
025: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026: * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: */
029:
030: package com.jeta.forms.gui.formmgr;
031:
032: import java.awt.Container;
033: import java.io.File;
034: import java.util.Collection;
035:
036: import com.jeta.forms.gui.common.FormException;
037: import com.jeta.forms.gui.components.ComponentSource;
038: import com.jeta.forms.gui.form.FormComponent;
039:
040: /**
041: * This interface defines a service for managing all opened forms in the
042: * designer.
043: *
044: * @author Jeff Tassin
045: */
046: public interface FormManager {
047:
048: public static final String COMPONENT_ID = "jeta.forms.formmanager";
049:
050: /**
051: * Activates and shows the form in a top level editor in the application
052: * workspace. Additionally, any nested forms are synchronized with the
053: * latest changes in the new view. This is important because we can have
054: * multiple views of the same form.
055: */
056: void activateForm(String formId);
057:
058: /**
059: * Closes the form in the editor.
060: */
061: void closeForm(String formId);
062:
063: /**
064: * DesActivates the forms in the given editor. Additionally, any nested
065: * forms are synchronized with the latest changes in the new view. This is
066: * important because we can have multiple views of the same form.
067: */
068: void deactivateForms(Container editor);
069:
070: /**
071: * @return the current editor
072: */
073: Container getCurrentEditor();
074:
075: /**
076: * @return a collection of Form Ids that are current opened in the manager.
077: */
078: Collection getForms();
079:
080: /**
081: * @return the form that has current formId. Null is returned if the form is
082: * not in cache.
083: */
084: FormComponent getForm(String formId);
085:
086: /**
087: * Installs the mouse and keyboard handlers for the given component. Note
088: * that we don't do this in the GridComponent itself because handlers are
089: * only installed in design mode.
090: */
091: void installHandlers(ComponentSource compsrc, Container comp);
092:
093: /**
094: * Opens a form from a absolute file path.
095: */
096: FormComponent openLinkedForm(String path) throws FormException;
097:
098: /**
099: * Opens a form from a absolute file path.
100: */
101: FormComponent openLinkedForm(File f) throws FormException;
102:
103: /**
104: * Opens an embedded form.
105: */
106: void openEmbeddedForm(FormComponent comp);
107:
108: /**
109: * @return true if the given form is opened in a top level editor.
110: */
111: boolean isOpened(String formId);
112:
113: /**
114: * Removes a form from the cache.
115: */
116: void removeForm(String oldId);
117:
118: /**
119: * Registers a form with this FormManager. This is mainly used for embedded
120: * forms.
121: */
122: void registerForm(FormComponent fc);
123:
124: /**
125: * Only shows the form in a top level editor. No synchronization is made
126: * with any other views.
127: */
128: void showForm(String formId);
129: }
|