Source Code Cross Referenced for TSEHierarchicalTabExt.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 java.util.List;
048:        import javax.swing.Box;
049:        import javax.swing.BoxLayout;
050:        import javax.swing.ButtonGroup;
051:        import javax.swing.JDialog;
052:        import com.tomsawyer.service.TSServiceInputData;
053:        import com.tomsawyer.editor.TSEGraph;
054:        import java.awt.Dimension;
055:        import javax.swing.BorderFactory;
056:        import javax.swing.JLabel;
057:        import javax.swing.JPanel;
058:        import javax.swing.border.TitledBorder;
059:
060:        public class TSEHierarchicalTabExt extends TSEHierarchicalTab {
061:            public static TSEResourceBundleWrapper tsBundle = TSEResourceBundleWrapper
062:                    .getSystemLabelBundle();
063:
064:            /**
065:             * This constructor creates a new Symmetric tab.
066:             * @param
067:             * 		graph the <code>TSEGraph</code> whose layout
068:             * 		properties are being edited.
069:             * @param
070:             * 		inputData the service input data object where the
071:             * 		layout options are stored
072:             * @param
073:             * 		dialog the Layout Properties dialog that this
074:             * 		tab belongs to.
075:             */
076:            public TSEHierarchicalTabExt(TSEGraph graph,
077:                    TSServiceInputData inputData, JDialog dialog) {
078:                super (graph, inputData, dialog);
079:                setA11yFeatures();
080:            }
081:
082:            /**
083:             * This method creates the Orientation panel of this tab.
084:             */
085:            protected JPanel makeOrientationPanel() {
086:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
087:
088:                // create the subpanels
089:                JPanel orientation = this 
090:                        .createBoxLayoutPanel(BoxLayout.Y_AXIS);
091:
092:                // Create the components
093:                this .orientationTopToBottom = this .createRadioButton(
094:                        "Top_To_Bottom", ORIENTATION_TOP_TO_BOTTOM);
095:                this .orientationLeftToRight = this .createRadioButton(
096:                        "Left_To_Right", ORIENTATION_LEFT_TO_RIGHT);
097:                this .orientationBottomToTop = this .createRadioButton(
098:                        "Bottom_To_Top", ORIENTATION_BOTTOM_TO_TOP);
099:                this .orientationRightToLeft = this .createRadioButton(
100:                        "Right_To_Left", ORIENTATION_RIGHT_TO_LEFT);
101:
102:                // Add the buttons to a group
103:
104:                ButtonGroup orientationGroup = new ButtonGroup();
105:                orientationGroup.add(this .orientationTopToBottom);
106:                orientationGroup.add(this .orientationLeftToRight);
107:                orientationGroup.add(this .orientationBottomToTop);
108:                orientationGroup.add(this .orientationRightToLeft);
109:
110:                // Layout the components
111:                orientation.add(this .orientationTopToBottom);
112:                orientation.add(this .createVerticalRigidArea(5));
113:                orientation.add(this .orientationLeftToRight);
114:                orientation.add(this .createVerticalRigidArea(5));
115:                orientation.add(this .orientationBottomToTop);
116:                orientation.add(this .createVerticalRigidArea(5));
117:                orientation.add(this .orientationRightToLeft);
118:
119:                panel.add(orientation);
120:                panel.add(Box.createRigidArea(new Dimension(5, 0)));
121:
122:                // Create a border
123:                this .createCompoundBorder(panel, "Orientation", 0, 5, 5, 5);
124:
125:                //        System.out.println("orientation panel pref size="+panel.getPreferredSize().toString() +
126:                //            " mim Size="+ panel.getMinimumSize().toString() +
127:                //            " max size="+ panel.getMaximumSize().toString());
128:
129:                return panel;
130:            }
131:
132:            /**
133:             * This method creates the Level Alignment panel of this tab.
134:             */
135:            protected JPanel makeLevelAlignmentPanel() {
136:
137:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
138:                JPanel levelAlignment = this 
139:                        .createBoxLayoutPanel(BoxLayout.Y_AXIS);
140:
141:                // Create the components
142:
143:                this .alignmentTop = this .createRadioButton("Top");
144:                this .alignmentCenter = this .createRadioButton("Center");
145:                this .alignmentBottom = this .createRadioButton("Bottom");
146:
147:                ButtonGroup levelAlignmentGroup = new ButtonGroup();
148:                levelAlignmentGroup.add(this .alignmentTop);
149:                levelAlignmentGroup.add(this .alignmentCenter);
150:                levelAlignmentGroup.add(this .alignmentBottom);
151:
152:                // Layout the components
153:                levelAlignment.add(this .alignmentTop);
154:                levelAlignment.add(Box.createRigidArea(new Dimension(0, 5)));
155:                levelAlignment.add(this .alignmentCenter);
156:                levelAlignment.add(Box.createRigidArea(new Dimension(0, 5)));
157:                levelAlignment.add(this .alignmentBottom);
158:                levelAlignment.add(Box.createRigidArea(new Dimension(0, 5)));
159:
160:                panel.add(levelAlignment);
161:                panel.add(Box.createRigidArea(new Dimension(5, 0)));
162:
163:                // Create a border
164:                this .createCompoundBorder(panel, "Level_Alignment", 0, 5, 5, 5);
165:
166:                return (panel);
167:            }
168:
169:            /**
170:             * This method creates the Horizontal Spacing panel of this tab.
171:             */
172:            protected JPanel makeHorizontalSpacingPanel() {
173:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
174:
175:                // create the subpanels
176:
177:                JPanel leftPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
178:                JPanel rightPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
179:
180:                // Create the components
181:
182:                this .horizontalSpacingBetweenNodesField = this 
183:                        .createDoubleField(4, 0, 9999);
184:                this .horizontalSpacingBetweenEdgesField = this 
185:                        .createDoubleField(4, 0, 9999);
186:
187:                JLabel spacingBetweenNodesLabel = this .createLabel(
188:                        "Spacing_Between_Nodes",
189:                        "Horizontal_Spacing_Between_Nodes_1",
190:                        horizontalSpacingBetweenNodesField);
191:
192:                JLabel spacingBetweenEdgesLabel = this .createLabel(
193:                        "Spacing_Between_Edges", null,
194:                        horizontalSpacingBetweenEdgesField);
195:
196:                // add the components to the subpanel
197:                leftPanel.add(spacingBetweenNodesLabel);
198:                leftPanel.add(this .createVerticalRigidArea(9));
199:                leftPanel.add(spacingBetweenEdgesLabel);
200:
201:                rightPanel.add(this .horizontalSpacingBetweenNodesField);
202:                rightPanel.add(this .createVerticalRigidArea(5));
203:                rightPanel.add(this .horizontalSpacingBetweenEdgesField);
204:
205:                // add the subpanels to the panel
206:
207:                panel.add(leftPanel);
208:                panel.add(this .createHorizontalRigidArea(15));
209:                panel.add(rightPanel);
210:
211:                // Create a border
212:                this .createCompoundBorder(panel, "Horizontal_Spacing", 0, 5, 5,
213:                        5);
214:
215:                return panel;
216:            }
217:
218:            /**
219:             * This method creates the Vertical Spacing panel of this tab.
220:             */
221:            protected JPanel makeVerticalSpacingPanel() {
222:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
223:
224:                // create the subpanels
225:
226:                JPanel leftPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
227:                JPanel rightPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
228:
229:                // Create the components
230:                this .verticalSpacingBetweenNodesField = this .createDoubleField(
231:                        4, 0, 9999);
232:                this .verticalSpacingBetweenEdgesField = this .createDoubleField(
233:                        4, 0, 9999);
234:
235:                JLabel spacingBetweenNodesLabel = this .createLabel(
236:                        "Spacing_Between_Nodes",
237:                        "Vertical_Spacing_Between_Nodes_2",
238:                        verticalSpacingBetweenNodesField);
239:                JLabel spacingBetweenEdgesLabel = this .createLabel(
240:                        "Spacing_Between_Edges", null,
241:                        verticalSpacingBetweenEdgesField);
242:
243:                // add the components to the subpanel
244:                leftPanel.add(spacingBetweenNodesLabel);
245:                leftPanel.add(this .createVerticalRigidArea(9));
246:                leftPanel.add(spacingBetweenEdgesLabel);
247:
248:                rightPanel.add(this .verticalSpacingBetweenNodesField);
249:                rightPanel.add(this .createVerticalRigidArea(5));
250:                rightPanel.add(this .verticalSpacingBetweenEdgesField);
251:
252:                // add the subpanels to the panel
253:
254:                panel.add(leftPanel);
255:                panel.add(this .createHorizontalRigidArea(15));
256:                panel.add(rightPanel);
257:
258:                // Create a border
259:                this 
260:                        .createCompoundBorder(panel, "Vertical_Spacing", 0, 5,
261:                                5, 5);
262:
263:                return panel;
264:            }
265:
266:            /**
267:             * This method creates the Polyline Routing panel of this tab.
268:             */
269:            protected JPanel makePolylineRoutingPanel() {
270:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
271:
272:                this .spacingBetweenBendsField = this .createDoubleField(4, 0,
273:                        9999);
274:                spacingBetweenBendsField.setAlignmentY(TOP_ALIGNMENT);
275:                JLabel spacingBetweenBendsLabel = this .createLabel(
276:                        "Spacing_Between_Bends", "Spacing_Between_Bends",
277:                        spacingBetweenBendsField);
278:
279:                panel.add(spacingBetweenBendsLabel);
280:                panel.add(createHorizontalRigidArea(15));
281:                panel.add(spacingBetweenBendsField);
282:
283:                this 
284:                        .createCompoundBorder(panel, "Polyline_Routing", 0, 5,
285:                                5, 5);
286:
287:                return panel;
288:            }
289:
290:            /**
291:             * This method creates a new JPanel and sets its layout manager to
292:             * a BoxLayout with the input layout style.
293:             */
294:            protected JPanel createBoxLayoutPanel(int layout) {
295:                JPanel panel = new JPanel();
296:                panel.setLayout(new BoxLayout(panel, layout));
297:                panel.setAlignmentX(LEFT_ALIGNMENT);
298:                panel.setAlignmentY(TOP_ALIGNMENT);
299:
300:                return panel;
301:            }
302:
303:            /**
304:             * This method creates a new <code>JLabel</code> with the given text
305:             * @param labelKey the key for which the label text will be obtained from the resource bundle
306:             * @param mnemonicKey the for which the mnemonic will be obtained from the resource bundle
307:             * set it to null if you don't want to set mnemonic for this label.
308:             * @param labelForComp the component for which the label is set
309:             */
310:            protected JLabel createLabel(String labelKey, String mnemonicKey,
311:                    Component labelForComp) {
312:                JLabel label = new JLabel(tsBundle.getStringSafely(labelKey)
313:                        + ":");
314:                label.setForeground(labelColor);
315:                label.setAlignmentX(LEFT_ALIGNMENT);
316:                label.setAlignmentY(TOP_ALIGNMENT);
317:                //A11y
318:                label.setLabelFor(labelForComp);
319:                if (mnemonicKey != null) {
320:                    label.setDisplayedMnemonic(AccessiblityUtils
321:                            .getMnemonic(mnemonicKey));
322:                }
323:                return (label);
324:            }
325:
326:            public void createCompoundBorder(JPanel panel, String labelKey,
327:                    int top, int left, int bottom, int right) {
328:                String label = this .tsBundle.getStringSafely(labelKey);
329:                TitledBorder titledBorder = BorderFactory
330:                        .createTitledBorder(label);
331:                titledBorder.setTitleColor(labelColor);
332:                panel.setBorder(BorderFactory.createCompoundBorder(
333:                        titledBorder, BorderFactory.createEmptyBorder(top,
334:                                left, bottom, right)));
335:            }
336:
337:            // Override the super method to fix the component display issue with different fontsizes
338:            // Fixed issue #84056
339:            protected int normalizeComponentDimensions(List components,
340:                    boolean xDim, boolean yDim) {
341:                int width = -1;
342:                return width;
343:            }
344:
345:            public void setA11yFeatures() {
346:                Font defaultFont = this .getFont();
347:                // set nmemonics checkboxes
348:                orientationBottomToTop.setMnemonic(AccessiblityUtils
349:                        .getMnemonic("Bottom_To_Top"));
350:                alignmentTop.setMnemonic(AccessiblityUtils.getMnemonic("Top"));
351:                qualityDraftRadioButton.setMnemonic(AccessiblityUtils
352:                        .getMnemonic("Draft"));
353:                routingOrthogonalRadioButton.setMnemonic(AccessiblityUtils
354:                        .getMnemonic("Orthogonal"));
355:                variableLevelSpacing.setMnemonic(AccessiblityUtils
356:                        .getMnemonic("Variable_Level_Spacing"));
357:
358:                // set font to use the default font
359:                orientationLeftToRight.setFont(defaultFont);
360:                orientationBottomToTop.setFont(defaultFont);
361:                orientationRightToLeft.setFont(defaultFont);
362:                orientationTopToBottom.setFont(defaultFont);
363:
364:                alignmentTop.setFont(defaultFont);
365:                alignmentCenter.setFont(defaultFont);
366:                alignmentBottom.setFont(defaultFont);
367:
368:                qualityDraftRadioButton.setFont(defaultFont);
369:                qualityDefaultRadioButton.setFont(defaultFont);
370:                qualityProofRadioButton.setFont(defaultFont);
371:
372:                routingOrthogonalRadioButton.setFont(defaultFont);
373:                routingPolylineRadioButton.setFont(defaultFont);
374:
375:                fixNodeSizesCheckBox.setFont(defaultFont);
376:                variableLevelSpacing.setFont(defaultFont);
377:                undirected.setFont(defaultFont);
378:
379:                // set accessibility name and descritpion
380:                AccessiblityUtils.setAccessibleProperties(
381:                        orientationLeftToRight, null, "Left_To_Right");
382:                AccessiblityUtils.setAccessibleProperties(
383:                        orientationBottomToTop, null, "Bottom_To_Top");
384:                AccessiblityUtils.setAccessibleProperties(
385:                        orientationRightToLeft, null, "Right_To_Left");
386:                AccessiblityUtils.setAccessibleProperties(
387:                        orientationTopToBottom, null, "Top_To_Bottom");
388:
389:                AccessiblityUtils.setAccessibleProperties(alignmentTop, null,
390:                        "Top");
391:                AccessiblityUtils.setAccessibleProperties(alignmentCenter,
392:                        null, "Center");
393:                AccessiblityUtils.setAccessibleProperties(alignmentBottom,
394:                        null, "Bottom");
395:
396:                AccessiblityUtils.setAccessibleProperties(
397:                        qualityDraftRadioButton, null, "Draft");
398:                AccessiblityUtils.setAccessibleProperties(
399:                        qualityDefaultRadioButton, null, "Default");
400:                AccessiblityUtils.setAccessibleProperties(
401:                        qualityProofRadioButton, null, "Proof");
402:
403:                AccessiblityUtils.setAccessibleProperties(
404:                        routingOrthogonalRadioButton, null, "Orthogonal");
405:                AccessiblityUtils.setAccessibleProperties(
406:                        routingPolylineRadioButton, null, "Polyline");
407:
408:                AccessiblityUtils.setAccessibleProperties(fixNodeSizesCheckBox,
409:                        null, "Fix_Node_Sizes");
410:                AccessiblityUtils.setAccessibleProperties(variableLevelSpacing,
411:                        null, "Variable_Level_Spacing");
412:                AccessiblityUtils.setAccessibleProperties(undirected, null,
413:                        "Undirected_Layout");
414:
415:                AccessiblityUtils.setAccessibleProperties(
416:                        horizontalSpacingBetweenEdgesField, null,
417:                        "Horizontal_Spacing_Between_Edges");
418:                AccessiblityUtils.setAccessibleProperties(
419:                        horizontalSpacingBetweenNodesField, null,
420:                        "Horizontal_Spacing_Between_Nodes");
421:                AccessiblityUtils.setAccessibleProperties(
422:                        verticalSpacingBetweenEdgesField, null,
423:                        "Vertical_Spacing_Between_Edges");
424:                AccessiblityUtils.setAccessibleProperties(
425:                        verticalSpacingBetweenNodesField, null,
426:                        "Vertical_Spacing_Between_Nodes");
427:                AccessiblityUtils
428:                        .setAccessibleProperties(spacingBetweenBendsField,
429:                                null, "Spacing_Between_Bends");
430:
431:                this.getAccessibleContext().setAccessibleDescription(
432:                        this.getAccessibleContext().getAccessibleName());
433:            }
434:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.