001: /*
002: * The contents of this file are subject to the terms of the Common
003: * Development and Distribution License (the License). You may not use this
004: The contents of this file are subject to the terms of either the GNU
005: General Public License Version 2 only ("GPL") or the Common
006: Development and Distribution License("CDDL") (collectively, the
007: "License"). You may not use this file except in compliance with the
008: License. You can obtain a copy of the License at
009: http://www.netbeans.org/cddl-gplv2.html
010: or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
011: specific language governing permissions and limitations under the
012: License. When distributing the software, include this License Header
013: Notice in each file and include the License file at
014: nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
015: particular file as subject to the "Classpath" exception as provided
016: by Sun in the GPL Version 2 section of the License file that
017: accompanied this code. If applicable, add the following below the
018: License Header, with the fields enclosed by brackets [] replaced by
019: your own identifying information:
020: "Portions Copyrighted [year] [name of copyright owner]"
021:
022: Contributor(s):
023: *
024: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
025: If you wish your version of this file to be governed by only the CDDL
026: or only the GPL Version 2, indicate your decision by adding
027: "[Contributor] elects to include this software in this distribution
028: under the [CDDL or GPL Version 2] license." If you do not indicate a
029: single choice of license, a recipient has the option to distribute
030: your version of this file under either the CDDL, the GPL Version 2 or
031: to extend the choice of license to its licensees as provided above.
032: However, if you add GPL Version 2 code and therefore, elected the GPL
033: Version 2 license, then the option applies only if the new code is
034: made subject to such option by the copyright holder.
035: *
036: */
037:
038: package org.netbeans.modules.etl.ui.palette;
039:
040: import java.util.ArrayList;
041: import java.util.List;
042:
043: import org.openide.nodes.Index;
044: import org.openide.nodes.Node;
045:
046: /**
047: *
048: * @author nithya
049: */
050: public class OperatorChildren extends Index.ArrayChildren {
051:
052: private Category category;
053:
054: private String[][] items = new String[][] {
055: {
056: "0",
057: "String Operators",
058: "org/netbeans/modules/sql/framework/ui/resources/images/numberToHex.png",
059: "Number To Hex" },
060: {
061: "1",
062: "String Operators",
063: "org/netbeans/modules/sql/framework/ui/resources/images/leftTrim.png",
064: "Left Trim" },
065: {
066: "2",
067: "String Operators",
068: "org/netbeans/modules/sql/framework/ui/resources/images/length.png",
069: "Length" },
070: {
071: "3",
072: "String Operators",
073: "org/netbeans/modules/sql/framework/ui/resources/images/replace.gif",
074: "Replace" },
075: {
076: "4",
077: "String Operators",
078: "org/netbeans/modules/sql/framework/ui/resources/images/rightTrim.png",
079: "Right Trim" },
080: {
081: "5",
082: "String Operators",
083: "org/netbeans/modules/sql/framework/ui/resources/images/stringToHex.png",
084: "String to Hex" },
085: {
086: "6",
087: "String Operators",
088: "org/netbeans/modules/sql/framework/ui/resources/images/substring.gif",
089: "Substring" },
090: {
091: "7",
092: "String Operators",
093: "org/netbeans/modules/sql/framework/ui/resources/images/lowercase.gif",
094: "Lowercase" },
095: {
096: "8",
097: "String Operators",
098: "org/netbeans/modules/sql/framework/ui/resources/images/uppercase.gif",
099: "Uppercase" },
100: {
101: "9",
102: "String Operators",
103: "org/netbeans/modules/sql/framework/ui/resources/images/concat.gif",
104: "Concatenation" },
105:
106: {
107: "10",
108: "Relational Operators",
109: "org/netbeans/modules/sql/framework/ui/resources/images/equal.png",
110: "Equal" },
111: {
112: "11",
113: "Relational Operators",
114: "org/netbeans/modules/sql/framework/ui/resources/images/greater_than.png",
115: "Greater Than" },
116: {
117: "12",
118: "Relational Operators",
119: "org/netbeans/modules/sql/framework/ui/resources/images/greater_equal.png",
120: "Greater Equal" },
121: {
122: "13",
123: "Relational Operators",
124: "org/netbeans/modules/sql/framework/ui/resources/images/lesser_equal.png",
125: "Lesser Equal" },
126: {
127: "14",
128: "Relational Operators",
129: "org/netbeans/modules/sql/framework/ui/resources/images/lesser_than.png",
130: "Lesser Than" },
131: {
132: "15",
133: "Relational Operators",
134: "org/netbeans/modules/sql/framework/ui/resources/images/not_equal.png",
135: "Not Equal" },
136:
137: {
138: "16",
139: "SQL Operators",
140: "org/netbeans/modules/sql/framework/ui/resources/images/Case.png",
141: "Case" },
142: {
143: "17",
144: "SQL Operators",
145: "org/netbeans/modules/sql/framework/ui/resources/images/castAs.png",
146: "Cast As" },
147: {
148: "18",
149: "SQL Operators",
150: "org/netbeans/modules/sql/framework/ui/resources/images/coalesce.png",
151: "Coalesce" },
152: {
153: "19",
154: "SQL Operators",
155: "org/netbeans/modules/sql/framework/ui/resources/images/Count.png",
156: "Count" },
157: {
158: "20",
159: "SQL Operators",
160: "org/netbeans/modules/sql/framework/ui/resources/images/literal.png",
161: "Literal" },
162: {
163: "21",
164: "SQL Operators",
165: "org/netbeans/modules/sql/framework/ui/resources/images/null.png",
166: "Null" },
167: {
168: "22",
169: "SQL Operators",
170: "org/netbeans/modules/sql/framework/ui/resources/images/nullif.png",
171: "Null If" },
172:
173: {
174: "23",
175: "Function Operators",
176: "org/netbeans/modules/sql/framework/ui/resources/images/SUM.png",
177: "Sum" },
178: {
179: "24",
180: "Function Operators",
181: "org/netbeans/modules/sql/framework/ui/resources/images/average.png",
182: "Average" },
183: {
184: "25",
185: "Function Operators",
186: "org/netbeans/modules/sql/framework/ui/resources/images/max.png",
187: "Max" },
188: {
189: "26",
190: "Function Operators",
191: "org/netbeans/modules/sql/framework/ui/resources/images/min.png",
192: "Min" },
193: {
194: "27",
195: "Function Operators",
196: "org/netbeans/modules/sql/framework/ui/resources/images/modulo.png",
197: "Modulo" },
198: {
199: "28",
200: "Function Operators",
201: "org/netbeans/modules/sql/framework/ui/resources/images/multiplication.png",
202: "Multiplication" },
203: {
204: "29",
205: "Function Operators",
206: "org/netbeans/modules/sql/framework/ui/resources/images/sign.png",
207: "Sign" },
208: {
209: "30",
210: "Function Operators",
211: "org/netbeans/modules/sql/framework/ui/resources/images/subtraction.gif",
212: "Subtraction" },
213: {
214: "31",
215: "Function Operators",
216: "org/netbeans/modules/sql/framework/ui/resources/images/division.png",
217: "Division" },
218: {
219: "32",
220: "Function Operators",
221: "org/netbeans/modules/sql/framework/ui/resources/images/addition.gif",
222: "Addition" },
223:
224: {
225: "33",
226: "Date Operators",
227: "org/netbeans/modules/sql/framework/ui/resources/images/datePart.png",
228: "DatePart" },
229: {
230: "34",
231: "Date Operators",
232: "org/netbeans/modules/sql/framework/ui/resources/images/DateToChar.png",
233: "DateToChar" },
234: {
235: "35",
236: "Date Operators",
237: "org/netbeans/modules/sql/framework/ui/resources/images/DateAddition.png",
238: "Date Addition" },
239: {
240: "36",
241: "Date Operators",
242: "org/netbeans/modules/sql/framework/ui/resources/images/DateSubtraction.png",
243: "Date Subtraction" },
244: {
245: "37",
246: "Date Operators",
247: "org/netbeans/modules/sql/framework/ui/resources/images/CharToDate.png",
248: "CharToDate" },
249: {
250: "38",
251: "Date Operators",
252: "org/netbeans/modules/sql/framework/ui/resources/images/NOW2.png",
253: "Now" },
254:
255: {
256: "39",
257: "Cleansing Operators",
258: "org/netbeans/modules/sql/framework/ui/resources/images/normalizePerson.png",
259: "Normalize Name" },
260: {
261: "40",
262: "Cleansing Operators",
263: "org/netbeans/modules/sql/framework/ui/resources/images/parseAddress.png",
264: "Parse Address" },
265: {
266: "41",
267: "Cleansing Operators",
268: "org/netbeans/modules/sql/framework/ui/resources/images/parseBusinessName.png",
269: "Parse Business Name" },
270: {
271: "42",
272: "Cleansing Operators",
273: "org/netbeans/modules/sql/framework/ui/resources/images/Join.png",
274: "Join" },
275:
276: };
277:
278: /**
279: *
280: * @param Category
281: */
282: public OperatorChildren(Category Category) {
283: this .category = Category;
284: }
285:
286: /**
287: *
288: * @return childrenNodes List<Node>
289: */
290: @Override
291: protected java.util.List<Node> initCollection() {
292: List<Node> childrenNodes = new ArrayList<Node>(items.length);
293: for (int i = 0; i < items.length; i++) {
294: if (category.getName().equals(items[i][1])) {
295: Operator item = new Operator();
296: item.setNumber(new Integer(items[i][0]));
297: item.setCategory(items[i][1]);
298: item.setImage(items[i][2]);
299: item.setName(items[i][3]);
300: childrenNodes.add(new OperatorNode(item));
301: }
302: }
303: return childrenNodes;
304: }
305:
306: }
|