001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.sql.framework.ui.model;
042:
043: import java.awt.Point;
044:
045: import javax.swing.undo.UndoManager;
046: import javax.swing.undo.UndoableEditSupport;
047:
048: import org.netbeans.modules.sql.framework.model.SQLCanvasObject;
049: import org.netbeans.modules.sql.framework.model.SQLConnectableObject;
050: import org.netbeans.modules.sql.framework.model.SQLObject;
051: import org.netbeans.modules.sql.framework.model.SQLObjectEvent;
052: import org.netbeans.modules.sql.framework.model.SQLOperator;
053: import org.netbeans.modules.sql.framework.model.VisibleSQLPredicate;
054: import org.netbeans.modules.sql.framework.ui.event.SQLDataEvent;
055: import org.netbeans.modules.sql.framework.ui.event.SQLDataListener;
056: import org.netbeans.modules.sql.framework.ui.event.SQLLinkEvent;
057:
058: import com.sun.sql.framework.exception.BaseException;
059: import org.netbeans.modules.sql.framework.model.DBTable;
060:
061: public interface SQLUIModel {
062:
063: public void addJavaOperator(SQLOperator javaOp);
064:
065: public void addObject(SQLObject sqlObject) throws BaseException;
066:
067: public void addObjectIgnoreUndo(SQLObject sqlObject)
068: throws BaseException;
069:
070: /**
071: * Adds a SourceTableImpl instance using the given DBTable instance as a template, if
072: * it does not already exist.
073: *
074: * @param srcTable DBTable to serve as template for the new SourceTableImpl instance.
075: * @return new SourceTableImpl instance
076: * @throws BaseException if error occurs during creation
077: */
078: public SQLObject addSourceTable(DBTable srcTable, Point loc)
079: throws BaseException;
080:
081: public void addSQLDataListener(SQLDataListener l);
082:
083: public void addSQLObject(SQLObject sqlObject) throws BaseException;
084:
085: /**
086: * Adds a TargetTableImpl instance using the given DBTable instance as a template, if
087: * it does not already exist.
088: *
089: * @param targetTable DBTable to serve as template for the new TargetTableImpl
090: * instance.
091: * @return SourceTableImpl representing the contents of the given template object; may
092: * be a pre-existing object.
093: * @throws BaseException if error occurs during creation
094: */
095: public SQLObject addTargetTable(DBTable targetTable, Point loc)
096: throws BaseException;
097:
098: public void clearJavaOperators();
099:
100: public void clearListener();
101:
102: /**
103: * Called when a link is created in collaboration view
104: *
105: * @param srcObject object which is source of new link
106: * @param srcFieldName -
107: * @param destObject object which is destination of new link
108: * @param destFieldName -
109: * @throws BaseException if error occurs during linking
110: */
111: public void createLink(SQLCanvasObject srcObject,
112: String srcFieldName, SQLConnectableObject destObject,
113: String destFieldName) throws BaseException;
114:
115: /**
116: * Called when a link is created in collaboration view
117: *
118: * @param srcObject object which is source of new link
119: * @param srcFieldName -
120: * @param destObject object which is destination of new link
121: * @param destFieldName -
122: * @throws BaseException if error occurs during linking
123: */
124: public void createLinkIgnoreUndo(SQLCanvasObject srcObject,
125: String srcFieldName, SQLConnectableObject destObject,
126: String destFieldName) throws BaseException;
127:
128: public SQLCanvasObject createObject(String className)
129: throws BaseException;
130:
131: public void createVisiblePredicateRefObj(
132: VisibleSQLPredicate predicate);
133:
134: public void fireChildObjectCreatedEvent(final SQLDataEvent evt);
135:
136: public void fireChildObjectDeletedEvent(final SQLDataEvent evt);
137:
138: public void fireSQLDataCreationEvent(final SQLDataEvent evt)
139: throws BaseException;
140:
141: public void fireSQLDataDeletionEvent(final SQLDataEvent evt);
142:
143: public void fireSQLDataUpdatedEvent(final SQLDataEvent evt);
144:
145: public void fireSQLLinkCreationEvent(final SQLLinkEvent evt);
146:
147: public void fireSQLLinkDeletionEvent(final SQLLinkEvent evt);
148:
149: public UndoableEditSupport getUndoEditSupport();
150:
151: public UndoManager getUndoManager();
152:
153: /**
154: * Check if a java operator is used in the model.
155: *
156: * @return true if a java operator is used.
157: */
158: public boolean isContainsJavaOperators();
159:
160: public boolean isDirty();
161:
162: /**
163: * called when an sql object is added
164: *
165: * @param evt event object
166: */
167: public void objectAdded(SQLObjectEvent evt);
168:
169: /**
170: * called when an sql object is removed
171: *
172: * @param evt event object
173: */
174: public void objectRemoved(SQLObjectEvent evt);
175:
176: public void removeJavaOperator(SQLOperator javaOp);
177:
178: /**
179: * Removes a link from backend model object.
180: *
181: * @param srcObject object which is source of link removed
182: * @param srcFieldName -
183: * @param destObject object which is destination of link removed
184: * @param destFieldName -
185: * @throws BaseException if error occurs during unlinking
186: */
187: public void removeLink(SQLCanvasObject srcObject,
188: String srcFieldName, SQLConnectableObject destObject,
189: String destFieldName) throws BaseException;
190:
191: /**
192: * Removes a link from backend model object.
193: *
194: * @param srcObject object which is source of link removed
195: * @param srcFieldName -
196: * @param destObject object which is destination of link removed
197: * @param destFieldName -
198: * @throws BaseException if error occurs during unlinking
199: */
200: public void removeLinkIgnoreUndo(SQLCanvasObject srcObject,
201: String srcFieldName, SQLConnectableObject destObject,
202: String destFieldName) throws BaseException;
203:
204: public void removeObject(SQLObject sqlObject) throws BaseException;
205:
206: public void removeObjectIgnoreUndo(SQLObject sqlObject)
207: throws BaseException;
208:
209: public void removeSQLDataListener(SQLDataListener l);
210:
211: public void setDirty(boolean dirty);
212:
213: }
|