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:
042: package org.netbeans.modules.visualweb.designer.jsf;
043:
044: import javax.swing.ComboBoxModel;
045: import javax.swing.event.ListDataListener;
046:
047: /**
048: *
049: * @author pbuzek
050: */
051: public class JsfDesignerAdvancedOptionsPanel extends javax.swing.JPanel {
052: private ResolutionModel resolutionModel = new ResolutionModel();
053:
054: /** Creates new form JsfDesignerAdvancedOptionsPanel */
055: public JsfDesignerAdvancedOptionsPanel() {
056: initComponents();
057: resolutionModel.setValue(0);
058: resolution.setModel(resolutionModel);
059: }
060:
061: int getResolution() {
062: return resolutionModel.getValue();
063: }
064:
065: void setResolution(int res) {
066: resolutionModel.setValue(res);
067: }
068:
069: int getDefaultFontSize() {
070: return ((Integer) defaultFontSize.getValue()).intValue();
071: }
072:
073: void setDefaultFontSize(int i) {
074: defaultFontSize.setValue(Integer.valueOf(i));
075: }
076:
077: int getGridHeight() {
078: return ((Integer) gridHeight.getValue()).intValue();
079: }
080:
081: void setGridHeight(int i) {
082: gridHeight.setValue(Integer.valueOf(i));
083: }
084:
085: int getGridWidth() {
086: return ((Integer) gridWidth.getValue()).intValue();
087: }
088:
089: void setGridWidth(int i) {
090: gridWidth.setValue(Integer.valueOf(i));
091: }
092:
093: boolean isShowGrid() {
094: return showGrid.isSelected();
095: }
096:
097: void setShowGrid(boolean b) {
098: showGrid.setSelected(b);
099: }
100:
101: boolean isSnapToGrid() {
102: return snapToGrid.isSelected();
103: }
104:
105: void setSnapToGrid(boolean b) {
106: snapToGrid.setSelected(b);
107: }
108:
109: String getDataProviderSuffix() {
110: return dataProviderSuffix.getText();
111: }
112:
113: void setDataProviderSuffix(String suffix) {
114: dataProviderSuffix.setText(suffix);
115: }
116:
117: String getRowsetSuffix() {
118: return rowsetSuffix.getText();
119: }
120:
121: void setRowsetSuffix(String suffix) {
122: rowsetSuffix.setText(suffix);
123: }
124:
125: boolean isRowsetInSession() {
126: return rowsetInSession.isSelected();
127: }
128:
129: void setRowsetInSession(boolean b) {
130: rowsetInSession.setSelected(b);
131: }
132:
133: boolean isRowsetDuplicate() {
134: return checkRowsetDuplicate.isSelected();
135: }
136:
137: void setRowsetDuplicate(boolean b) {
138: checkRowsetDuplicate.setSelected(b);
139: }
140:
141: boolean isPromptForName() {
142: return promptForName.isSelected();
143: }
144:
145: void setPromptForName(boolean b) {
146: promptForName.setSelected(b);
147: }
148:
149: /** This method is called from within the constructor to
150: * initialize the form.
151: * WARNING: Do NOT modify this code. The content of this method is
152: * always regenerated by the Form Editor.
153: */
154: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
155: private void initComponents() {
156:
157: defaultFontSize = new javax.swing.JSpinner();
158: jLabel1 = new javax.swing.JLabel();
159: jLabel2 = new javax.swing.JLabel();
160: jLabel3 = new javax.swing.JLabel();
161: gridHeight = new javax.swing.JSpinner();
162: gridWidth = new javax.swing.JSpinner();
163: jLabel4 = new javax.swing.JLabel();
164: resolution = new javax.swing.JComboBox();
165: showGrid = new javax.swing.JCheckBox();
166: snapToGrid = new javax.swing.JCheckBox();
167: jLabel6 = new javax.swing.JLabel();
168: rowsetSuffix = new javax.swing.JTextField();
169: rowsetInSession = new javax.swing.JCheckBox();
170: checkRowsetDuplicate = new javax.swing.JCheckBox();
171: jLabel5 = new javax.swing.JLabel();
172: dataProviderSuffix = new javax.swing.JTextField();
173: promptForName = new javax.swing.JCheckBox();
174:
175: jLabel1.setLabelFor(defaultFontSize);
176: org.openide.awt.Mnemonics
177: .setLocalizedText(
178: jLabel1,
179: org.openide.util.NbBundle
180: .getMessage(
181: JsfDesignerAdvancedOptionsPanel.class,
182: "JsfDesignerAdvancedOptionsPanel.jLabel1.text")); // NOI18N
183:
184: jLabel2.setLabelFor(gridHeight);
185: org.openide.awt.Mnemonics
186: .setLocalizedText(
187: jLabel2,
188: org.openide.util.NbBundle
189: .getMessage(
190: JsfDesignerAdvancedOptionsPanel.class,
191: "JsfDesignerAdvancedOptionsPanel.jLabel2.text")); // NOI18N
192:
193: jLabel3.setLabelFor(gridWidth);
194: org.openide.awt.Mnemonics
195: .setLocalizedText(
196: jLabel3,
197: org.openide.util.NbBundle
198: .getMessage(
199: JsfDesignerAdvancedOptionsPanel.class,
200: "JsfDesignerAdvancedOptionsPanel.jLabel3.text")); // NOI18N
201:
202: jLabel4.setLabelFor(resolution);
203: org.openide.awt.Mnemonics
204: .setLocalizedText(
205: jLabel4,
206: org.openide.util.NbBundle
207: .getMessage(
208: JsfDesignerAdvancedOptionsPanel.class,
209: "JsfDesignerAdvancedOptionsPanel.jLabel4.text")); // NOI18N
210:
211: resolution
212: .setModel(new javax.swing.DefaultComboBoxModel(
213: new String[] { "Item 1", "Item 2", "Item 3",
214: "Item 4" }));
215:
216: org.openide.awt.Mnemonics
217: .setLocalizedText(
218: showGrid,
219: org.openide.util.NbBundle
220: .getMessage(
221: JsfDesignerAdvancedOptionsPanel.class,
222: "JsfDesignerAdvancedOptionsPanel.showGrid.text")); // NOI18N
223: showGrid.setMargin(new java.awt.Insets(0, 0, 0, 0));
224:
225: org.openide.awt.Mnemonics
226: .setLocalizedText(
227: snapToGrid,
228: org.openide.util.NbBundle
229: .getMessage(
230: JsfDesignerAdvancedOptionsPanel.class,
231: "JsfDesignerAdvancedOptionsPanel.snapToGrid.text")); // NOI18N
232: snapToGrid.setMargin(new java.awt.Insets(0, 0, 0, 0));
233:
234: jLabel6.setLabelFor(rowsetSuffix);
235: org.openide.awt.Mnemonics
236: .setLocalizedText(
237: jLabel6,
238: org.openide.util.NbBundle
239: .getMessage(
240: JsfDesignerAdvancedOptionsPanel.class,
241: "JsfDesignerAdvancedOptionsPanel.jLabel6.text")); // NOI18N
242:
243: rowsetSuffix.setText(org.openide.util.NbBundle.getMessage(
244: JsfDesignerAdvancedOptionsPanel.class,
245: "JsfDesignerAdvancedOptionsPanel.rowsetSuffix.text")); // NOI18N
246:
247: org.openide.awt.Mnemonics
248: .setLocalizedText(
249: rowsetInSession,
250: org.openide.util.NbBundle
251: .getMessage(
252: JsfDesignerAdvancedOptionsPanel.class,
253: "JsfDesignerAdvancedOptionsPanel.rowsetInSession.text")); // NOI18N
254: rowsetInSession.setMargin(new java.awt.Insets(0, 0, 0, 0));
255:
256: org.openide.awt.Mnemonics
257: .setLocalizedText(
258: checkRowsetDuplicate,
259: org.openide.util.NbBundle
260: .getMessage(
261: JsfDesignerAdvancedOptionsPanel.class,
262: "JsfDesignerAdvancedOptionsPanel.checkRowsetDuplicate.text")); // NOI18N
263: checkRowsetDuplicate.setMargin(new java.awt.Insets(0, 0, 0, 0));
264:
265: jLabel5.setLabelFor(dataProviderSuffix);
266: org.openide.awt.Mnemonics
267: .setLocalizedText(
268: jLabel5,
269: org.openide.util.NbBundle
270: .getMessage(
271: JsfDesignerAdvancedOptionsPanel.class,
272: "JsfDesignerAdvancedOptionsPanel.jLabel5.text")); // NOI18N
273:
274: dataProviderSuffix
275: .setText(org.openide.util.NbBundle
276: .getMessage(
277: JsfDesignerAdvancedOptionsPanel.class,
278: "JsfDesignerAdvancedOptionsPanel.dataProviderSuffix.text")); // NOI18N
279:
280: org.openide.awt.Mnemonics
281: .setLocalizedText(
282: promptForName,
283: org.openide.util.NbBundle
284: .getMessage(
285: JsfDesignerAdvancedOptionsPanel.class,
286: "JsfDesignerAdvancedOptionsPanel.promptForName.text")); // NOI18N
287: promptForName.setMargin(new java.awt.Insets(0, 0, 0, 0));
288:
289: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
290: this );
291: this .setLayout(layout);
292: layout
293: .setHorizontalGroup(layout
294: .createParallelGroup(
295: org.jdesktop.layout.GroupLayout.LEADING)
296: .add(
297: layout
298: .createSequentialGroup()
299: .add(
300: layout
301: .createParallelGroup(
302: org.jdesktop.layout.GroupLayout.LEADING)
303: .add(
304: org.jdesktop.layout.GroupLayout.TRAILING,
305: layout
306: .createSequentialGroup()
307: .add(
308: jLabel4,
309: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
310: 160,
311: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
312: .add(
313: 18,
314: 18,
315: 18))
316: .add(
317: layout
318: .createSequentialGroup()
319: .add(
320: jLabel1,
321: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
322: 131,
323: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
324: .add(
325: 47,
326: 47,
327: 47))
328: .add(
329: layout
330: .createSequentialGroup()
331: .add(
332: jLabel2,
333: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
334: 96,
335: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
336: .add(
337: 82,
338: 82,
339: 82))
340: .add(
341: layout
342: .createSequentialGroup()
343: .add(
344: jLabel3,
345: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
346: 90,
347: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
348: .add(
349: 88,
350: 88,
351: 88))
352: .add(
353: jLabel5,
354: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
355: 178,
356: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
357: .add(
358: layout
359: .createSequentialGroup()
360: .add(
361: jLabel6,
362: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
363: 139,
364: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
365: .add(
366: 39,
367: 39,
368: 39)))
369: .addPreferredGap(
370: org.jdesktop.layout.LayoutStyle.RELATED)
371: .add(
372: layout
373: .createParallelGroup(
374: org.jdesktop.layout.GroupLayout.LEADING)
375: .add(
376: layout
377: .createSequentialGroup()
378: .add(
379: promptForName)
380: .addContainerGap())
381: .add(
382: layout
383: .createParallelGroup(
384: org.jdesktop.layout.GroupLayout.LEADING)
385: .add(
386: layout
387: .createSequentialGroup()
388: .add(
389: checkRowsetDuplicate)
390: .addContainerGap())
391: .add(
392: layout
393: .createParallelGroup(
394: org.jdesktop.layout.GroupLayout.LEADING)
395: .add(
396: layout
397: .createSequentialGroup()
398: .add(
399: rowsetInSession)
400: .addContainerGap())
401: .add(
402: layout
403: .createParallelGroup(
404: org.jdesktop.layout.GroupLayout.LEADING)
405: .add(
406: layout
407: .createSequentialGroup()
408: .add(
409: snapToGrid)
410: .addContainerGap())
411: .add(
412: layout
413: .createSequentialGroup()
414: .add(
415: showGrid)
416: .addContainerGap())
417: .add(
418: org.jdesktop.layout.GroupLayout.TRAILING,
419: layout
420: .createSequentialGroup()
421: .add(
422: layout
423: .createParallelGroup(
424: org.jdesktop.layout.GroupLayout.TRAILING)
425: .add(
426: org.jdesktop.layout.GroupLayout.LEADING,
427: rowsetSuffix,
428: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
429: 210,
430: Short.MAX_VALUE)
431: .add(
432: resolution,
433: 0,
434: 210,
435: Short.MAX_VALUE)
436: .add(
437: org.jdesktop.layout.GroupLayout.LEADING,
438: dataProviderSuffix,
439: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
440: 210,
441: Short.MAX_VALUE))
442: .add(
443: 14,
444: 14,
445: 14))
446: .add(
447: layout
448: .createSequentialGroup()
449: .add(
450: layout
451: .createParallelGroup(
452: org.jdesktop.layout.GroupLayout.TRAILING,
453: false)
454: .add(
455: org.jdesktop.layout.GroupLayout.LEADING,
456: gridWidth)
457: .add(
458: org.jdesktop.layout.GroupLayout.LEADING,
459: gridHeight)
460: .add(
461: org.jdesktop.layout.GroupLayout.LEADING,
462: defaultFontSize,
463: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
464: 44,
465: Short.MAX_VALUE))
466: .addContainerGap(
467: 180,
468: Short.MAX_VALUE))))))));
469: layout
470: .setVerticalGroup(layout
471: .createParallelGroup(
472: org.jdesktop.layout.GroupLayout.LEADING)
473: .add(
474: layout
475: .createSequentialGroup()
476: .addContainerGap()
477: .add(
478: layout
479: .createParallelGroup(
480: org.jdesktop.layout.GroupLayout.BASELINE)
481: .add(
482: resolution,
483: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
484: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
485: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
486: .add(jLabel4))
487: .addPreferredGap(
488: org.jdesktop.layout.LayoutStyle.RELATED)
489: .add(
490: layout
491: .createParallelGroup(
492: org.jdesktop.layout.GroupLayout.BASELINE)
493: .add(
494: defaultFontSize,
495: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
496: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
497: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
498: .add(jLabel1))
499: .addPreferredGap(
500: org.jdesktop.layout.LayoutStyle.RELATED)
501: .add(
502: layout
503: .createParallelGroup(
504: org.jdesktop.layout.GroupLayout.BASELINE)
505: .add(
506: gridHeight,
507: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
508: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
509: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
510: .add(jLabel2))
511: .addPreferredGap(
512: org.jdesktop.layout.LayoutStyle.RELATED)
513: .add(
514: layout
515: .createParallelGroup(
516: org.jdesktop.layout.GroupLayout.BASELINE)
517: .add(
518: gridWidth,
519: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
520: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
521: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
522: .add(jLabel3))
523: .addPreferredGap(
524: org.jdesktop.layout.LayoutStyle.RELATED)
525: .add(showGrid)
526: .addPreferredGap(
527: org.jdesktop.layout.LayoutStyle.RELATED)
528: .add(snapToGrid)
529: .addPreferredGap(
530: org.jdesktop.layout.LayoutStyle.RELATED)
531: .add(
532: layout
533: .createParallelGroup(
534: org.jdesktop.layout.GroupLayout.BASELINE)
535: .add(jLabel5)
536: .add(
537: dataProviderSuffix,
538: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
539: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
540: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
541: .addPreferredGap(
542: org.jdesktop.layout.LayoutStyle.RELATED)
543: .add(
544: layout
545: .createParallelGroup(
546: org.jdesktop.layout.GroupLayout.BASELINE)
547: .add(
548: rowsetSuffix,
549: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
550: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
551: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
552: .add(jLabel6))
553: .addPreferredGap(
554: org.jdesktop.layout.LayoutStyle.RELATED)
555: .add(rowsetInSession)
556: .addPreferredGap(
557: org.jdesktop.layout.LayoutStyle.RELATED)
558: .add(checkRowsetDuplicate)
559: .addPreferredGap(
560: org.jdesktop.layout.LayoutStyle.RELATED)
561: .add(promptForName)
562: .addContainerGap()));
563:
564: showGrid
565: .getAccessibleContext()
566: .setAccessibleDescription(
567: org.openide.util.NbBundle
568: .getMessage(
569: JsfDesignerAdvancedOptionsPanel.class,
570: "JsfDesignerAdvancedOptionsPanel.showGrid.desc")); // NOI18N
571: snapToGrid
572: .getAccessibleContext()
573: .setAccessibleDescription(
574: org.openide.util.NbBundle
575: .getMessage(
576: JsfDesignerAdvancedOptionsPanel.class,
577: "JsfDesignerAdvancedOptionsPanel.snapToGrid.desc")); // NOI18N
578: rowsetInSession
579: .getAccessibleContext()
580: .setAccessibleDescription(
581: org.openide.util.NbBundle
582: .getMessage(
583: JsfDesignerAdvancedOptionsPanel.class,
584: "JsfDesignerAdvancedOptionsPanel.rowsetInSession.desc")); // NOI18N
585: checkRowsetDuplicate
586: .getAccessibleContext()
587: .setAccessibleDescription(
588: org.openide.util.NbBundle
589: .getMessage(
590: JsfDesignerAdvancedOptionsPanel.class,
591: "JsfDesignerAdvancedOptionsPanel.checkRowsetDuplicate.desc")); // NOI18N
592: promptForName
593: .getAccessibleContext()
594: .setAccessibleDescription(
595: org.openide.util.NbBundle
596: .getMessage(
597: JsfDesignerAdvancedOptionsPanel.class,
598: "JsfDesignerAdvancedOptionsPanel.promptForName.desc")); // NOI18N
599: }// </editor-fold>//GEN-END:initComponents
600:
601: // Variables declaration - do not modify//GEN-BEGIN:variables
602: private javax.swing.JCheckBox checkRowsetDuplicate;
603: private javax.swing.JTextField dataProviderSuffix;
604: private javax.swing.JSpinner defaultFontSize;
605: private javax.swing.JSpinner gridHeight;
606: private javax.swing.JSpinner gridWidth;
607: private javax.swing.JLabel jLabel1;
608: private javax.swing.JLabel jLabel2;
609: private javax.swing.JLabel jLabel3;
610: private javax.swing.JLabel jLabel4;
611: private javax.swing.JLabel jLabel5;
612: private javax.swing.JLabel jLabel6;
613: private javax.swing.JCheckBox promptForName;
614: private javax.swing.JComboBox resolution;
615: private javax.swing.JCheckBox rowsetInSession;
616: private javax.swing.JTextField rowsetSuffix;
617: private javax.swing.JCheckBox showGrid;
618: private javax.swing.JCheckBox snapToGrid;
619:
620: // End of variables declaration//GEN-END:variables
621:
622: private class ResolutionModel implements ComboBoxModel {
623: ResolutionEditor editor = new ResolutionEditor();
624:
625: public int getValue() {
626: return ((Integer) editor.getValue()).intValue();
627: }
628:
629: public void setValue(int value) {
630: editor.setValue(Integer.valueOf(value));
631: }
632:
633: public void setSelectedItem(Object anItem) {
634: editor.setAsText((String) anItem);
635: }
636:
637: public Object getSelectedItem() {
638: return editor.getAsText();
639: }
640:
641: public int getSize() {
642: return editor.getTags().length;
643: }
644:
645: public Object getElementAt(int index) {
646: return editor.getTags()[index];
647: }
648:
649: public void addListDataListener(ListDataListener l) {
650: }
651:
652: public void removeListDataListener(ListDataListener l) {
653: }
654:
655: }
656: }
|