Source Code Cross Referenced for JSAlignmentOptionPane.java in  » UML » jrefactory » org » acm » seguin » ide » common » options » 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 » UML » jrefactory » org.acm.seguin.ide.common.options 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  JSAlignmentOptionPane.java - JavaStyle alignment options panel
003:         *  Copyright (C) 2001 Dirk Moebius
004:         *
005:         *  jEdit buffer options:
006:         *  :tabSize=4:indentSize=4:noTabs=false:maxLineLen=0:
007:         *
008:         *  This program is free software; you can redistribute it and/or
009:         *  modify it under the terms of the GNU General Public License
010:         *  as published by the Free Software Foundation; either version 2
011:         *  of the License, or any later version.
012:         *
013:         *  This program is distributed in the hope that it will be useful,
014:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         *  GNU General Public License for more details.
017:         *
018:         *  You should have received a copy of the GNU General Public License
019:         *  along with this program; if not, write to the Free Software
020:         *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
021:         */
022:        package org.acm.seguin.ide.common.options;
023:
024:        import java.awt.event.ActionEvent;
025:        import java.awt.event.ActionListener;
026:        import javax.swing.JCheckBox;
027:        import javax.swing.JTextField;
028:        import org.acm.seguin.ide.common.IDEPlugin;
029:        import org.acm.seguin.ide.common.IDEInterface;
030:
031:        /**
032:         *@author     Mike Atkinson (<a href="mailto:javastyle@ladyshot.demon.co.uk">
033:         *      Mike@ladyshot.demon.co.uk </a> )
034:         *@author     Dirk Moebius (<a href="mailto:dmoebius@gmx.net">dmoebius@gmx.net
035:         *      </a> )
036:         *@created    03 September 2003
037:         *@version    $Version: $
038:         *@since      1.0
039:         */
040:        public class JSAlignmentOptionPane extends JSHelpOptionPane {
041:            private JCheckBox alignPrefixed;
042:            private JTextField dynamicSpacing;
043:            private JTextField fieldNameIndent;
044:            private JMouseComboBox lineUpFields;
045:
046:            private SelectedPanel alignParameters_sp;
047:            private SelectedPanel lineUpFields_sp;
048:            private SelectedPanel alignWithBlock_sp;
049:            private SelectedPanel alignPrefixed_sp;
050:            private SelectedPanel dynamicSpacing_sp;
051:            private SelectedPanel fieldNameIndent_sp;
052:            private SelectedPanel lineUpTags_sp;
053:
054:            private final static String[] lineUpFieldsOptions = {
055:                    getIdeJavaStyleOption("lineUpFields.not"),
056:                    getIdeJavaStyleOption("lineUpFields.tabular"),
057:                    getIdeJavaStyleOption("lineUpFields.atEquals"),
058:                    getIdeJavaStyleOption("lineUpFields.atFixedColumn") };
059:
060:            /**
061:             *  Constructor for the JSAlignmentOptionPane object
062:             *
063:             *@param  project  Description of the Parameter
064:             */
065:            public JSAlignmentOptionPane(String project) {
066:                super ("javastyle.alignment", "pretty", project);
067:            }
068:
069:            /**
070:             *  Description of the Method
071:             */
072:            public void _init() {
073:                ActionHandler ah = new ActionHandler();
074:
075:                String variable_spacing = props.getString("variable.spacing",
076:                        "single");
077:
078:                // "Align parameters if they start on a new line
079:                alignParameters_sp = addComponent("params.lineup",
080:                        "params.lineup", new JCheckBox());
081:
082:                // "Line up field definitions"
083:                lineUpFields = new JMouseComboBox(lineUpFieldsOptions);
084:                lineUpFields.addActionListener(ah);
085:                lineUpFields_sp = addComponent("variable.spacing",
086:                        "lineUpFields", lineUpFields);
087:
088:                // "Align with the block opener '{'"
089:                alignWithBlock_sp = addComponent("variable.align.with.block",
090:                        "lineUpFields.alignWithBlock", new JCheckBox());
091:
092:                // "Align even if prefixed by JavaDoc"
093:                alignPrefixed = new JCheckBox();
094:                alignPrefixed_sp = addComponent("variable.spacing",
095:                        "lineUpFields.alignPrefixed", alignPrefixed);
096:                alignPrefixed.setSelected(variable_spacing.equals("dynamic"));
097:
098:                // "Spacing between columns: nnn"
099:                dynamicSpacing = new JTextField();
100:                dynamicSpacing_sp = addComponent("dynamic.variable.spacing",
101:                        "1", "lineUpFields.dynamicSpacing", dynamicSpacing);
102:
103:                // "Indent field names to column: nnn"
104:                fieldNameIndent = new JTextField();
105:                fieldNameIndent_sp = addComponent("field.name.indent",
106:                        "lineUpFields.fieldNameIndent", fieldNameIndent);
107:                int fni = props.getInteger("field.name.indent", -1);
108:                fieldNameIndent.setText(Integer.toString(fni));
109:
110:                // "Line up names and descriptions in JavaDoc tags"
111:                lineUpTags_sp = addComponent("javadoc.id.lineup", "lineUpTags",
112:                        new JCheckBox());
113:
114:                if (fni >= 0) {
115:                    lineUpFields.setSelectedIndex(3);
116:                } else if (variable_spacing.equals("dynamic")
117:                        || variable_spacing.equals("javadoc.dynamic")) {
118:                    lineUpFields.setSelectedIndex(1);
119:                } else if (variable_spacing.equals("align.equals")) {
120:                    lineUpFields.setSelectedIndex(2);
121:                } else {
122:                    lineUpFields.setSelectedIndex(0);
123:                }
124:
125:                addHelpArea();
126:            }
127:
128:            /**
129:             *  Called when the options dialog's `OK' button is pressed. This should
130:             *  save any properties saved in this option pane.
131:             */
132:            public void _save() {
133:                int sel = lineUpFields.getSelectedIndex();
134:                int fni = -1;
135:                int dvs = 1;
136:                String variable_spacing = "single";
137:
138:                if (sel == 1) {
139:                    if (alignPrefixed.isSelected()) {
140:                        variable_spacing = "dynamic";
141:                    } else {
142:                        variable_spacing = "javadoc.dynamic";
143:                    }
144:                    try {
145:                        dvs = Integer.parseInt(dynamicSpacing.getText());
146:                    } catch (NumberFormatException nfex) {
147:                        IDEPlugin.log(IDEInterface.ERROR, this ,
148:                                "invalid number for dynamic.variable.spacing: "
149:                                        + dynamicSpacing.getText());
150:                    }
151:                } else if (sel == 2) {
152:                    variable_spacing = "align.equals";
153:                } else if (sel == 3) {
154:                    try {
155:                        fni = Integer.parseInt(fieldNameIndent.getText());
156:                    } catch (NumberFormatException nfex) {
157:                        IDEPlugin.log(IDEInterface.ERROR, this ,
158:                                "invalid number for field.name.indent: "
159:                                        + fieldNameIndent.getText());
160:                    }
161:                }
162:
163:                alignParameters_sp.save();
164:                alignWithBlock_sp.save();
165:                alignPrefixed_sp.save(variable_spacing);
166:                dynamicSpacing_sp.save(Integer.toString(dvs));
167:                fieldNameIndent_sp.save(Integer.toString(fni));
168:                lineUpTags_sp.save();
169:            }
170:
171:            /**
172:             *  Description of the Class
173:             *
174:             *@author     Mike Atkinson (Mike)
175:             *@created    03 September 2003
176:             *@version    $Version: $
177:             *@since      1.0
178:             */
179:            private class ActionHandler implements  ActionListener {
180:                /**
181:                 *  Description of the Method
182:                 *
183:                 *@param  evt  Description of Parameter
184:                 */
185:                public void actionPerformed(ActionEvent evt) {
186:                    if (evt.getSource() == lineUpFields) {
187:                        int sel = lineUpFields.getSelectedIndex();
188:
189:                        alignPrefixed.setEnabled(sel == 1);
190:                        dynamicSpacing.setEnabled(sel == 1);
191:                        fieldNameIndent.setEnabled(sel == 3);
192:                    }
193:                }
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.