Source Code Cross Referenced for TSEOrthogonalTabExt.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 java.awt.Dimension;
052:        import java.util.Iterator;
053:        import java.util.List;
054:        import javax.swing.BorderFactory;
055:        import javax.swing.JComponent;
056:        import javax.swing.JLabel;
057:        import javax.swing.JPanel;
058:        import javax.swing.border.TitledBorder;
059:
060:        public class TSEOrthogonalTabExt extends TSEOrthogonalTab {
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 TSEOrthogonalTabExt(TSEGraph graph,
077:                    TSServiceInputData inputData, JDialog dialog) {
078:                super (graph, inputData, dialog);
079:                setA11yFeatures();
080:            }
081:
082:            /**
083:             * This method creates the Horizontal Spacing panel of this tab.
084:             */
085:            protected JPanel makeHorizontalSpacingPanel() {
086:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
087:
088:                // create the subpanels
089:                JPanel leftPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
090:                JPanel rightPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
091:
092:                // Create the components
093:                this .horizontalSpacingBetweenNodesField = this 
094:                        .createDoubleField(4, 0, 9999);
095:                this .horizontalSpacingBetweenEdgesField = this 
096:                        .createDoubleField(4, 0, 9999);
097:
098:                JLabel spacingBetweenNodesLabel = this .createLabel(
099:                        "Spacing_Between_Nodes",
100:                        "Horizontal_Spacing_Between_Nodes",
101:                        horizontalSpacingBetweenNodesField);
102:
103:                JLabel spacingBetweenEdgesLabel = this .createLabel(
104:                        "Spacing_Between_Edges", null,
105:                        horizontalSpacingBetweenEdgesField);
106:
107:                // add the components to the subpanele
108:                leftPanel.add(spacingBetweenNodesLabel);
109:                leftPanel.add(this .createVerticalRigidArea(9));
110:                leftPanel.add(spacingBetweenEdgesLabel);
111:
112:                rightPanel.add(this .horizontalSpacingBetweenNodesField);
113:                rightPanel.add(this .createVerticalRigidArea(5));
114:                rightPanel.add(this .horizontalSpacingBetweenEdgesField);
115:
116:                // add the subpanels to the panel
117:                panel.add(leftPanel);
118:                panel.add(this .createHorizontalRigidArea(20));
119:                panel.add(rightPanel);
120:
121:                // Create a border
122:                this .createCompoundBorder(panel, "Horizontal_Spacing", 0, 6, 5,
123:                        6);
124:
125:                return panel;
126:            }
127:
128:            /**
129:             * This method creates the Vertical Spacing panel of this tab.
130:             */
131:            protected JPanel makeVerticalSpacingPanel() {
132:                JPanel panel = this .createBoxLayoutPanel(BoxLayout.X_AXIS);
133:
134:                // create the subpanels
135:                JPanel leftPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
136:                JPanel rightPanel = this .createBoxLayoutPanel(BoxLayout.Y_AXIS);
137:
138:                // Create the components
139:                this .verticalSpacingBetweenNodesField = this .createDoubleField(
140:                        4, 0, 9999);
141:                this .verticalSpacingBetweenEdgesField = this .createDoubleField(
142:                        4, 0, 9999);
143:
144:                JLabel spacingBetweenNodesLabel = this .createLabel(
145:                        "Spacing_Between_Nodes",
146:                        "Vertical_Spacing_Between_Nodes",
147:                        verticalSpacingBetweenNodesField);
148:
149:                JLabel spacingBetweenEdgesLabel = this .createLabel(
150:                        "Spacing_Between_Edges", null,
151:                        verticalSpacingBetweenEdgesField);
152:
153:                // add the components to the subpanele
154:
155:                leftPanel.add(spacingBetweenNodesLabel);
156:                leftPanel.add(this .createVerticalRigidArea(9));
157:                leftPanel.add(spacingBetweenEdgesLabel);
158:
159:                rightPanel.add(this .verticalSpacingBetweenNodesField);
160:                rightPanel.add(this .createVerticalRigidArea(5));
161:                rightPanel.add(this .verticalSpacingBetweenEdgesField);
162:
163:                // add the subpanels to the panel
164:
165:                panel.add(leftPanel);
166:                panel.add(this .createHorizontalRigidArea(20));
167:                panel.add(rightPanel);
168:
169:                // Create a border
170:                this 
171:                        .createCompoundBorder(panel, "Vertical_Spacing", 0, 6,
172:                                5, 6);
173:
174:                return panel;
175:            }
176:
177:            /**
178:             * This method creates a new JPanel and sets its layout manager to
179:             * a BoxLayout with the input layout style.
180:             */
181:            protected JPanel createBoxLayoutPanel(int layout) {
182:                JPanel panel = new JPanel();
183:                panel.setLayout(new BoxLayout(panel, layout));
184:                panel.setAlignmentX(LEFT_ALIGNMENT);
185:                panel.setAlignmentY(TOP_ALIGNMENT);
186:                return panel;
187:            }
188:
189:            /**
190:             * This method creates a new <code>JLabel</code> with the given text
191:             * @param labelKey the key for which the label text will be obtained from the resource bundle
192:             * @param mnemonicKey the for which the mnemonic will be obtained from the resource bundle
193:             * set it to null if you don't want to set mnemonic for this label.
194:             * @param labelForComp the component for which the label is set
195:             */
196:            protected JLabel createLabel(String labelKey, String mnemonicKey,
197:                    Component labelForComp) {
198:                JLabel label = new JLabel(tsBundle.getStringSafely(labelKey)
199:                        + ":");
200:                label.setForeground(labelColor);
201:                label.setAlignmentX(LEFT_ALIGNMENT);
202:                label.setAlignmentY(TOP_ALIGNMENT);
203:                //A11y
204:                label.setLabelFor(labelForComp);
205:                if (mnemonicKey != null) {
206:                    label.setDisplayedMnemonic(AccessiblityUtils
207:                            .getMnemonic(mnemonicKey));
208:                }
209:                return (label);
210:            }
211:
212:            public void createCompoundBorder(JPanel panel, String labelKey,
213:                    int top, int left, int bottom, int right) {
214:                String label = this .tsBundle.getStringSafely(labelKey);
215:                TitledBorder titledBorder = BorderFactory
216:                        .createTitledBorder(label);
217:                titledBorder.setTitleColor(labelColor);
218:                panel.setBorder(BorderFactory.createCompoundBorder(
219:                        titledBorder, BorderFactory.createEmptyBorder(top,
220:                                left, bottom, right)));
221:            }
222:
223:            // Override the super method to fix the component display issue with different fontsizes
224:            // The method loops through all the components in the component list to get the largest width.
225:            // Then for each component that has smaller width, set its maximum size with the new width.
226:            // Note 1:  the code does not set the maximun size for the component that has the same width
227:            // as the maximum width.  
228:            // Note 2: the 2 boolean paramters are not used in this method.
229:            protected int normalizeComponentDimensions(List components,
230:                    boolean xDim, boolean yDim) {
231:                int width = -1;
232:                if (components != null && components.size() > 0) {
233:                    // get the max width or max height of the components
234:                    Iterator compIterator = components.iterator();
235:                    while (compIterator.hasNext()) {
236:                        JComponent cmp = (JComponent) compIterator.next();
237:                        if (cmp instanceof  JPanel) {
238:                            JPanel comp = (JPanel) cmp;
239:                            width = (int) Math.max(comp.getPreferredSize()
240:                                    .getWidth(), width);
241:                        }
242:                    }
243:
244:                    // set the preferred size of all the components to that of the largest component
245:                    Dimension compDimension = null;
246:
247:                    compIterator = components.iterator();
248:
249:                    while (compIterator.hasNext()) {
250:                        JComponent cmp = (JComponent) compIterator.next();
251:                        if (cmp instanceof  JPanel) {
252:                            JPanel comp = (JPanel) cmp;
253:
254:                            if (comp.getPreferredSize().width != width) {
255:                                compDimension = new Dimension(width, (int) comp
256:                                        .getPreferredSize().getHeight());
257:                                //comp.setPreferredSize(compDimension);
258:                                //comp.setMinimumSize(compDimension);
259:                                comp.setMaximumSize(compDimension);
260:                            }
261:
262:                            //                    System.out.println("pref size="+comp.getPreferredSize().toString() +
263:                            //                        " mim Size="+ comp.getMinimumSize().toString() +
264:                            //                        " max size="+ comp.getMaximumSize().toString());
265:                        }
266:                    }
267:                }
268:                return width;
269:            }
270:
271:            public void setA11yFeatures() {
272:                Font defaultFont = this .getFont();
273:                // set nmemonics (just one per group box)
274:                qualityDraftRadioButton.setMnemonic(AccessiblityUtils
275:                        .getMnemonic("Draft"));
276:                aspectRatioAutomaticRadioButton.setMnemonic(AccessiblityUtils
277:                        .getMnemonic("Automatic"));
278:                fixNodeSizesCheckBox.setMnemonic(AccessiblityUtils
279:                        .getMnemonic("Fix_Node_Sizes"));
280:
281:                // set font to use the default font
282:                qualityDraftRadioButton.setFont(defaultFont);
283:                qualityDefaultRadioButton.setFont(defaultFont);
284:                qualityProofRadioButton.setFont(defaultFont);
285:
286:                aspectRatioAutomaticRadioButton.setFont(defaultFont);
287:                aspectRatioCustomRadioButton.setFont(defaultFont);
288:                aspectRatioDisabledRadioButton.setFont(defaultFont);
289:
290:                fixNodeSizesCheckBox.setFont(defaultFont);
291:
292:                // set accessibility name and descritpion
293:                AccessiblityUtils.setAccessibleProperties(
294:                        horizontalSpacingBetweenNodesField, null,
295:                        "Horizontal_Spacing_Between_Nodes");
296:                AccessiblityUtils.setAccessibleProperties(
297:                        verticalSpacingBetweenNodesField, null,
298:                        "Vertical_Spacing_Between_Nodes");
299:                AccessiblityUtils.setAccessibleProperties(
300:                        horizontalSpacingBetweenEdgesField, null,
301:                        "Horizontal_Spacing_Between_Edges");
302:                AccessiblityUtils.setAccessibleProperties(
303:                        verticalSpacingBetweenEdgesField, null,
304:                        "Vertical_Spacing_Between_Edges");
305:
306:                AccessiblityUtils.setAccessibleProperties(
307:                        qualityDraftRadioButton, null, "Draft");
308:                AccessiblityUtils.setAccessibleProperties(
309:                        qualityDefaultRadioButton, null, "Default");
310:                AccessiblityUtils.setAccessibleProperties(
311:                        qualityProofRadioButton, null, "Proof");
312:
313:                AccessiblityUtils.setAccessibleProperties(
314:                        aspectRatioAutomaticRadioButton, null, "Automatic");
315:                AccessiblityUtils.setAccessibleProperties(
316:                        aspectRatioCustomRadioButton, null,
317:                        "Aspect_Ratio_Custom");
318:                AccessiblityUtils.setAccessibleProperties(
319:                        aspectRatioCustomField, "Aspect_Ratio_Custom",
320:                        "Aspect_Ratio_Custom");
321:                AccessiblityUtils.setAccessibleProperties(
322:                        aspectRatioDisabledRadioButton, null, "Disabled");
323:
324:                AccessiblityUtils.setAccessibleProperties(fixNodeSizesCheckBox,
325:                        null, "Fix_Node_Sizes");
326:
327:                this.getAccessibleContext().setAccessibleDescription(
328:                        this.getAccessibleContext().getAccessibleName());
329:            }
330:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.