Source Code Cross Referenced for TSEGeneralTabExt.java in  » IDE-Netbeans » uml » com » tomsawyer » editor » service » layout » jlayout » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » uml » com.tomsawyer.editor.service.layout.jlayout 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 com.tomsawyer.editor.service.layout.jlayout;
043:
044:        import com.tomsawyer.editor.TSEResourceBundleWrapper;
045:        import java.awt.Component;
046:        import java.awt.Font;
047:        import javax.swing.BoxLayout;
048:        import javax.swing.JDialog;
049:        import com.tomsawyer.service.TSServiceInputData;
050:        import com.tomsawyer.editor.TSEGraph;
051:        import javax.swing.BorderFactory;
052:        import javax.swing.ButtonGroup;
053:        import javax.swing.JLabel;
054:        import javax.swing.JPanel;
055:        import javax.swing.border.TitledBorder;
056:
057:        public class TSEGeneralTabExt extends TSEGeneralTab {
058:            public static TSEResourceBundleWrapper tsBundle = TSEResourceBundleWrapper
059:                    .getSystemLabelBundle();
060:
061:            /**
062:             * This constructor creates a new Symmetric tab.
063:             * @param
064:             * 		graph the <code>TSEGraph</code> whose layout
065:             * 		properties are being edited.
066:             * @param
067:             * 		inputData the service input data object where the
068:             * 		layout options are stored
069:             * @param
070:             * 		dialog the Layout Properties dialog that this
071:             * 		tab belongs to.
072:             */
073:            public TSEGeneralTabExt(TSEGraph graph,
074:                    TSServiceInputData inputData, JDialog dialog) {
075:                super (graph, inputData, dialog);
076:                setA11yFeatures();
077:            }
078:
079:            /**
080:             * This method creates the Margin Spacing panel of this tab.
081:             */
082:            protected JPanel makeMarginSpacingPanel() {
083:                JPanel marginSpacing = new JPanel();
084:
085:                // Create the radio buttons
086:
087:                this .proportionalMarginSpacing = this .createRadioButton(
088:                        "Proportional_Spacing", PROPORTIONAL_MARGIN_SPACING);
089:                this .constantMarginSpacing = this .createRadioButton(
090:                        "Constant_Spacing", CONSTANT_MARGIN_SPACING);
091:
092:                // Add the radio buttons to a group
093:
094:                ButtonGroup spacingGroup = new ButtonGroup();
095:                spacingGroup.add(this .proportionalMarginSpacing);
096:                spacingGroup.add(this .constantMarginSpacing);
097:
098:                // Layout the Margin Spacing panel.
099:
100:                marginSpacing.setLayout(new BoxLayout(marginSpacing,
101:                        BoxLayout.Y_AXIS));
102:
103:                this .proportionalMarginSpacing.setAlignmentX(LEFT_ALIGNMENT);
104:                this .constantMarginSpacing.setAlignmentX(LEFT_ALIGNMENT);
105:
106:                // Create the spacing panel and its components
107:
108:                JPanel spacing = new JPanel();
109:
110:                this .leftMarginSpacingField = this 
111:                        .createDoubleField(4, 0, 9999);
112:                this .topMarginSpacingField = this .createDoubleField(4, 0, 9999);
113:                this .rightMarginSpacingField = this .createDoubleField(4, 0,
114:                        9999);
115:                this .bottomMarginSpacingField = this .createDoubleField(4, 0,
116:                        9999);
117:
118:                JLabel leftLabel = this .createLabel("Left", null,
119:                        leftMarginSpacingField);
120:                JLabel topLabel = this .createLabel("Top", null,
121:                        topMarginSpacingField);
122:                JLabel rightLabel = this .createLabel("Right", null,
123:                        rightMarginSpacingField);
124:                JLabel bottomLabel = this .createLabel("Bottom", null,
125:                        bottomMarginSpacingField);
126:
127:                spacing.setLayout(new BoxLayout(spacing, BoxLayout.X_AXIS));
128:                JPanel leftPanel = new JPanel();
129:                JPanel rightPanel = new JPanel();
130:
131:                // Layout the components of the spacing panel
132:
133:                leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
134:                rightPanel
135:                        .setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
136:
137:                leftPanel.add(leftLabel);
138:                leftPanel.add(this .createVerticalRigidArea(9));
139:                leftPanel.add(topLabel);
140:                leftPanel.add(this .createVerticalRigidArea(9));
141:                leftPanel.add(rightLabel);
142:                leftPanel.add(this .createVerticalRigidArea(9));
143:                leftPanel.add(bottomLabel);
144:
145:                rightPanel.add(this .leftMarginSpacingField);
146:                rightPanel.add(this .createVerticalRigidArea(5));
147:                rightPanel.add(this .topMarginSpacingField);
148:                rightPanel.add(this .createVerticalRigidArea(5));
149:                rightPanel.add(this .rightMarginSpacingField);
150:                rightPanel.add(this .createVerticalRigidArea(5));
151:                rightPanel.add(this .bottomMarginSpacingField);
152:
153:                spacing.add(leftPanel);
154:                spacing.add(this .createHorizontalRigidArea(40));
155:                spacing.add(rightPanel);
156:                this .createCompoundBorder(spacing, "", 6, 6, 5, 5);
157:
158:                leftPanel.setAlignmentY(TOP_ALIGNMENT);
159:                rightPanel.setAlignmentY(TOP_ALIGNMENT);
160:                spacing.setAlignmentX(LEFT_ALIGNMENT);
161:
162:                marginSpacing.add(this .constantMarginSpacing);
163:                marginSpacing.add(this .createVerticalRigidArea(5));
164:                marginSpacing.add(this .proportionalMarginSpacing);
165:                marginSpacing.add(this .createVerticalRigidArea(5));
166:                marginSpacing.add(spacing);
167:
168:                // Add the titled borders
169:
170:                this .createCompoundBorder(marginSpacing, "Margin_Spacing", 0,
171:                        6, 6, 6);
172:
173:                return (marginSpacing);
174:            }
175:
176:            /**
177:             * This method creates the Nested View Spacing panel of this tab.
178:             */
179:            protected JPanel makeNestedViewSpacingPanel() {
180:                JPanel nestedViewSpacing = new JPanel();
181:
182:                // Create the radio buttons
183:
184:                this .proportionalNestedViewSpacing = this .createRadioButton(
185:                        "Proportional_Spacing",
186:                        PROPORTIONAL_NESTED_VIEW_SPACING);
187:                this .constantNestedViewSpacing = this .createRadioButton(
188:                        "Constant_Spacing", CONSTANT_NESTED_VIEW_SPACING);
189:
190:                // Add the radio buttons to a group
191:
192:                ButtonGroup spacingGroup = new ButtonGroup();
193:                spacingGroup.add(this .proportionalNestedViewSpacing);
194:                spacingGroup.add(this .constantNestedViewSpacing);
195:
196:                // Layout the Nested View Spacing panel.
197:
198:                nestedViewSpacing.setLayout(new BoxLayout(nestedViewSpacing,
199:                        BoxLayout.Y_AXIS));
200:
201:                this .proportionalNestedViewSpacing
202:                        .setAlignmentX(LEFT_ALIGNMENT);
203:                this .constantNestedViewSpacing.setAlignmentX(LEFT_ALIGNMENT);
204:
205:                // Create spacing Panel and its components
206:                JPanel spacing = new JPanel();
207:
208:                this .leftNestedViewSpacingField = this .createDoubleField(4, 0,
209:                        9999);
210:                this .topNestedViewSpacingField = this .createDoubleField(4, 0,
211:                        9999);
212:                this .rightNestedViewSpacingField = this .createDoubleField(4, 0,
213:                        9999);
214:                this .bottomNestedViewSpacingField = this .createDoubleField(4,
215:                        0, 9999);
216:
217:                JLabel leftLabel = this .createLabel("Left", null,
218:                        leftNestedViewSpacingField);
219:                JLabel topLabel = this .createLabel("Top", null,
220:                        topNestedViewSpacingField);
221:                JLabel rightLabel = this .createLabel("Right", null,
222:                        rightNestedViewSpacingField);
223:                JLabel bottomLabel = this .createLabel("Bottom", null,
224:                        bottomNestedViewSpacingField);
225:
226:                spacing.setLayout(new BoxLayout(spacing, BoxLayout.X_AXIS));
227:                JPanel leftPanel = new JPanel();
228:                JPanel rightPanel = new JPanel();
229:
230:                // Layout the components of the spacing panel
231:
232:                leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
233:                rightPanel
234:                        .setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
235:
236:                leftPanel.add(leftLabel);
237:                leftPanel.add(this .createVerticalRigidArea(9));
238:                leftPanel.add(topLabel);
239:                leftPanel.add(this .createVerticalRigidArea(9));
240:                leftPanel.add(rightLabel);
241:                leftPanel.add(this .createVerticalRigidArea(9));
242:                leftPanel.add(bottomLabel);
243:
244:                rightPanel.add(this .leftNestedViewSpacingField);
245:                rightPanel.add(this .createVerticalRigidArea(5));
246:                rightPanel.add(this .topNestedViewSpacingField);
247:                rightPanel.add(this .createVerticalRigidArea(5));
248:                rightPanel.add(this .rightNestedViewSpacingField);
249:                rightPanel.add(this .createVerticalRigidArea(5));
250:                rightPanel.add(this .bottomNestedViewSpacingField);
251:
252:                spacing.add(leftPanel);
253:                spacing.add(this .createHorizontalRigidArea(40));
254:                spacing.add(rightPanel);
255:                this .createCompoundBorder(spacing, "", 6, 6, 5, 5);
256:
257:                leftPanel.setAlignmentY(TOP_ALIGNMENT);
258:                rightPanel.setAlignmentY(TOP_ALIGNMENT);
259:                spacing.setAlignmentX(LEFT_ALIGNMENT);
260:
261:                nestedViewSpacing.add(this .constantNestedViewSpacing);
262:                nestedViewSpacing.add(this .createVerticalRigidArea(5));
263:                nestedViewSpacing.add(this .proportionalNestedViewSpacing);
264:                nestedViewSpacing.add(this .createVerticalRigidArea(5));
265:                nestedViewSpacing.add(spacing);
266:
267:                // Add the titled borders
268:
269:                this .createCompoundBorder(nestedViewSpacing,
270:                        "Nested_View_Spacing", 0, 6, 6, 6);
271:
272:                return (nestedViewSpacing);
273:            }
274:
275:            /**
276:             * This method creates the Intergraph Edge Spacing panel of this tab.
277:             */
278:            protected JPanel makeIntergraphEdgeSpacingPanel() {
279:                // create the panel
280:
281:                JPanel intergraphEdgeSpacing = new JPanel();
282:
283:                intergraphEdgeSpacing.setLayout(new BoxLayout(
284:                        intergraphEdgeSpacing, BoxLayout.X_AXIS));
285:                intergraphEdgeSpacing.setAlignmentX(LEFT_ALIGNMENT);
286:
287:                // create the subpanels of the panel
288:
289:                JPanel leftPanel = new JPanel();
290:                JPanel rightPanel = new JPanel();
291:
292:                leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
293:                rightPanel
294:                        .setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
295:
296:                leftPanel.setAlignmentY(TOP_ALIGNMENT);
297:                rightPanel.setAlignmentY(TOP_ALIGNMENT);
298:
299:                // create the components of the panel
300:
301:                this .intergraphEdgeHorizontalSpacingField = this 
302:                        .createDoubleField(4, 0, 9999);
303:                this .intergraphEdgeVerticalSpacingField = this 
304:                        .createDoubleField(4, 0, 9999);
305:
306:                JLabel horizontalSpacing = this .createLabel(
307:                        "Horizontal_Spacing", "Horizontal_Spacing",
308:                        intergraphEdgeHorizontalSpacingField);
309:                JLabel verticalSpacing = this .createLabel("Vertical_Spacing",
310:                        null, intergraphEdgeVerticalSpacingField);
311:
312:                // add the components to the subpanels
313:                leftPanel.add(horizontalSpacing);
314:                leftPanel.add(this .createVerticalRigidArea(9));
315:                leftPanel.add(verticalSpacing);
316:
317:                rightPanel.add(this .intergraphEdgeHorizontalSpacingField);
318:                rightPanel.add(this .createVerticalRigidArea(5));
319:                rightPanel.add(this .intergraphEdgeVerticalSpacingField);
320:
321:                // add the subpanels to the panel
322:
323:                intergraphEdgeSpacing.add(leftPanel);
324:                intergraphEdgeSpacing.add(this .createHorizontalRigidArea(20));
325:                intergraphEdgeSpacing.add(rightPanel);
326:
327:                this .createCompoundBorder(intergraphEdgeSpacing,
328:                        "Intergraph_Edge_Spacing", 0, 6, 5, 5);
329:
330:                return intergraphEdgeSpacing;
331:            }
332:
333:            /**
334:             * This method creates a new JPanel and sets its layout manager to
335:             * a BoxLayout with the input layout style.
336:             */
337:            protected JPanel createBoxLayoutPanel(int layout) {
338:                JPanel panel = new JPanel();
339:                panel.setLayout(new BoxLayout(panel, layout));
340:                panel.setAlignmentX(LEFT_ALIGNMENT);
341:                panel.setAlignmentY(TOP_ALIGNMENT);
342:                return panel;
343:            }
344:
345:            /**
346:             * This method creates a new <code>JLabel</code> with the given text
347:             * @param labelKey the key for which the label text will be obtained from the resource bundle
348:             * @param mnemonicKey the for which the mnemonic will be obtained from the resource bundle
349:             * set it to null if you don't want to set mnemonic for this label.
350:             * @param labelForComp the component for which the label is set
351:             */
352:            protected JLabel createLabel(String labelKey, String mnemonicKey,
353:                    Component labelForComp) {
354:                JLabel label = new JLabel(tsBundle.getStringSafely(labelKey)
355:                        + ":");
356:                label.setForeground(labelColor);
357:                label.setAlignmentX(LEFT_ALIGNMENT);
358:                label.setAlignmentY(TOP_ALIGNMENT);
359:                //A11y
360:                label.setLabelFor(labelForComp);
361:                if (mnemonicKey != null) {
362:                    label.setDisplayedMnemonic(AccessiblityUtils
363:                            .getMnemonic(mnemonicKey));
364:                }
365:                return (label);
366:            }
367:
368:            public void createCompoundBorder(JPanel panel, String labelKey,
369:                    int top, int left, int bottom, int right) {
370:                String label = "";
371:                if (labelKey != null && labelKey.trim().length() > 0) {
372:                    label = this .tsBundle.getStringSafely(labelKey);
373:                }
374:                TitledBorder titledBorder = BorderFactory
375:                        .createTitledBorder(label);
376:                titledBorder.setTitleColor(labelColor);
377:                panel.setBorder(BorderFactory.createCompoundBorder(
378:                        titledBorder, BorderFactory.createEmptyBorder(top,
379:                                left, bottom, right)));
380:            }
381:
382:            public void setA11yFeatures() {
383:                Font defaultFont = this .getFont();
384:
385:                // set nmemonics for radio buttons (only 1st one in a component group)
386:                proportionalMarginSpacing.setMnemonic(AccessiblityUtils
387:                        .getMnemonic("Proportional_Spacing"));
388:                proportionalNestedViewSpacing.setMnemonic(AccessiblityUtils
389:                        .getMnemonic("Proportional_Spacing_2"));
390:
391:                // set font to use the default font
392:                constantMarginSpacing.setFont(defaultFont);
393:                constantNestedViewSpacing.setFont(defaultFont);
394:                proportionalMarginSpacing.setFont(defaultFont);
395:                proportionalNestedViewSpacing.setFont(defaultFont);
396:
397:                // set accessibility name and descritpion
398:                AccessiblityUtils.setAccessibleProperties(
399:                        constantMarginSpacing, null, "Constant_Spacing");
400:                AccessiblityUtils
401:                        .setAccessibleProperties(proportionalMarginSpacing,
402:                                null, "Proportional_Spacing");
403:                AccessiblityUtils.setAccessibleProperties(
404:                        constantNestedViewSpacing, null, "Constant_Spacing");
405:                AccessiblityUtils.setAccessibleProperties(
406:                        proportionalNestedViewSpacing, null,
407:                        "Proportional_Spacing");
408:
409:                AccessiblityUtils.setAccessibleProperties(
410:                        leftMarginSpacingField, null, "Left");
411:                AccessiblityUtils.setAccessibleProperties(
412:                        topMarginSpacingField, null, "Top");
413:                AccessiblityUtils.setAccessibleProperties(
414:                        rightMarginSpacingField, null, "Right");
415:                AccessiblityUtils.setAccessibleProperties(
416:                        bottomMarginSpacingField, null, "Bottom");
417:
418:                AccessiblityUtils.setAccessibleProperties(
419:                        leftNestedViewSpacingField, null, "Left");
420:                AccessiblityUtils.setAccessibleProperties(
421:                        topNestedViewSpacingField, null, "Top");
422:                AccessiblityUtils.setAccessibleProperties(
423:                        rightNestedViewSpacingField, null, "Right");
424:                AccessiblityUtils.setAccessibleProperties(
425:                        bottomNestedViewSpacingField, null, "Bottom");
426:
427:                AccessiblityUtils.setAccessibleProperties(
428:                        intergraphEdgeHorizontalSpacingField, null,
429:                        "Horizontal_Spacing");
430:                AccessiblityUtils.setAccessibleProperties(
431:                        intergraphEdgeVerticalSpacingField, null,
432:                        "Vertical_Spacing");
433:
434:                this.getAccessibleContext().setAccessibleDescription(
435:                        this.getAccessibleContext().getAccessibleName());
436:            }
437:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.