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.view.conditionbuilder;
042:
043: import java.util.ArrayList;
044: import java.util.List;
045:
046: import org.netbeans.modules.sql.framework.ui.graph.IGraphController;
047: import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
048: import org.netbeans.modules.sql.framework.ui.graph.IOperatorXmlInfoModel;
049: import org.netbeans.modules.sql.framework.ui.graph.IToolBar;
050: import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
051: import org.netbeans.modules.sql.framework.ui.graph.impl.OperatorXmlInfoModel;
052: import org.netbeans.modules.sql.framework.ui.graph.view.impl.SQLToolBar;
053: import org.netbeans.modules.sql.framework.ui.model.SQLUIModel;
054: import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
055: import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.actions.ShowTableTreeAction;
056: import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.actions.ValidateSQLAction;
057: import org.netbeans.modules.sql.framework.ui.view.graph.AbstractSQLViewFactory;
058:
059: /**
060: * @author Ritesh Adval
061: * @version $Revision$
062: */
063: public class ConditionBuilderTextViewFactory extends
064: AbstractSQLViewFactory {
065: private IGraphView gView;
066:
067: private IGraphViewContainer gViewContainer;
068: private OperatorXmlInfoModel operatorModel;
069: private IToolBar toolBar;
070:
071: public ConditionBuilderTextViewFactory(
072: IGraphViewContainer gContainer, int toolBarType) {
073: this .gViewContainer = gContainer;
074:
075: // Operator Model has to be created only once
076: this .operatorModel = OperatorXmlInfoModel
077: .getInstance(this .gViewContainer.getOperatorFolder());
078: this .toolbarType = toolBarType;
079: // TODO: We need to restore operator category.
080: super .setSQLToolBar();
081: }
082:
083: /**
084: * create a graph controller
085: *
086: * @return
087: */
088: public IGraphController createGraphController() {
089: return null;
090: }
091:
092: /**
093: * create a graph view
094: *
095: * @return graph view
096: */
097: public IGraphView createGraphView() {
098: return null;
099: }
100:
101: /**
102: * create a tool bar
103: *
104: * @return tool bar
105: */
106: public IToolBar createToolBar() {
107: toolBar = new SQLToolBar(this );
108: return toolBar;
109: }
110:
111: /**
112: * get graph view pop up actions
113: *
114: * @return actions
115: */
116: public List getGraphActions() {
117: return null;
118: }
119:
120: /**
121: * Gets the current graph controller
122: *
123: * @return graph controller
124: */
125: public IGraphController getGraphController() {
126: return null;
127: }
128:
129: /**
130: * Gets graph view currently associated with this manager.
131: *
132: * @return current instance of IGraphView
133: */
134: public IGraphView getGraphView() {
135: return this .gView;
136: }
137:
138: /**
139: * get graph view container
140: *
141: * @return graph view container
142: */
143: public Object getGraphViewContainer() {
144: return this .gViewContainer;
145: }
146:
147: /**
148: * Gets operator view (toolbar) currently associated with this manager.
149: *
150: * @return current instance of IToolBar
151: */
152: public IToolBar getOperatorView() {
153: return toolBar;
154: }
155:
156: /**
157: * get operator xml info model which is defined in netbeans layer.xml file
158: *
159: * @return operator xml info model
160: */
161: public IOperatorXmlInfoModel getOperatorXmlInfoModel() {
162: return operatorModel;
163: }
164:
165: /**
166: * get sql model
167: *
168: * @return sql model
169: */
170: public SQLUIModel getSQLModel() {
171: return null;
172: }
173:
174: /**
175: * return toolbar actions
176: *
177: * @return toolbar actions
178: */
179: public List getToolBarActions() {
180: ArrayList actions = new ArrayList();
181: // Use seperate instance as ShowTableTreeAction is used in other toolbar also.
182: actions.add(new ShowTableTreeAction());
183: actions.add(GraphAction.getAction(ValidateSQLAction.class));
184:
185: return actions;
186: }
187:
188: }
|