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-2006 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.java.ui;
043:
044: import org.netbeans.api.java.source.CodeStyle.WrapStyle;
045: import static org.netbeans.modules.java.ui.FmtOptions.*;
046: import static org.netbeans.modules.java.ui.FmtOptions.CategorySupport.OPTION_ID;
047: import org.netbeans.modules.java.ui.FmtOptions.CategorySupport;
048: import org.openide.util.NbBundle;
049:
050: /**
051: *
052: * @author phrebejk
053: */
054: public class FmtTabsIndents extends javax.swing.JPanel {
055:
056: /** Creates new form FmtTabsIndents */
057: public FmtTabsIndents() {
058: initComponents();
059:
060: continuationIndentSizeField.putClientProperty(OPTION_ID,
061: continuationIndentSize);
062: labelIndentField.putClientProperty(OPTION_ID, labelIndent);
063: absoluteLabelIndentCheckBox.putClientProperty(OPTION_ID,
064: absoluteLabelIndent);
065: indentTopLevelClassMembersCheckBox.putClientProperty(OPTION_ID,
066: indentTopLevelClassMembers);
067: indentCasesFromSwitchCheckBox.putClientProperty(OPTION_ID,
068: indentCasesFromSwitch);
069: }
070:
071: public static FormatingOptionsPanel.Category getController() {
072: return new CategorySupport(
073: "LBL_TabsAndIndents",
074: new FmtTabsIndents(), // NOI18N
075: NbBundle.getMessage(FmtTabsIndents.class,
076: "SAMPLE_TabsIndents"), // NOI18N
077: new String[] { FmtOptions.rightMargin, "30" },
078: new String[] { FmtOptions.wrapAnnotations,
079: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
080: FmtOptions.wrapArrayInit,
081: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
082: FmtOptions.wrapAssert,
083: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
084: FmtOptions.wrapAssignOps,
085: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
086: FmtOptions.wrapBinaryOps,
087: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
088: FmtOptions.wrapChainedMethodCalls,
089: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
090: FmtOptions.wrapDoWhileStatement,
091: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
092: FmtOptions.wrapEnumConstants,
093: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
094: FmtOptions.wrapExtendsImplementsKeyword,
095: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
096: FmtOptions.wrapExtendsImplementsList,
097: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
098: FmtOptions.wrapFor,
099: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
100: FmtOptions.wrapForStatement,
101: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
102: FmtOptions.wrapIfStatement,
103: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
104: FmtOptions.wrapMethodCallArgs,
105: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
106: FmtOptions.wrapMethodParams,
107: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
108: FmtOptions.wrapTernaryOps,
109: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
110: FmtOptions.wrapThrowsKeyword,
111: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
112: FmtOptions.wrapThrowsList,
113: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
114: FmtOptions.wrapWhileStatement,
115: WrapStyle.WRAP_ALWAYS.name() }, new String[] {
116: FmtOptions.alignMultilineArrayInit,
117: Boolean.FALSE.toString() }, new String[] {
118: FmtOptions.alignMultilineAssignment,
119: Boolean.FALSE.toString() }, new String[] {
120: FmtOptions.alignMultilineBinaryOp,
121: Boolean.FALSE.toString() }, new String[] {
122: FmtOptions.alignMultilineCallArgs,
123: Boolean.FALSE.toString() }, new String[] {
124: FmtOptions.alignMultilineFor,
125: Boolean.FALSE.toString() }, new String[] {
126: FmtOptions.alignMultilineImplements,
127: Boolean.FALSE.toString() }, new String[] {
128: FmtOptions.alignMultilineMethodParams,
129: Boolean.FALSE.toString() }, new String[] {
130: FmtOptions.alignMultilineParenthesized,
131: Boolean.FALSE.toString() }, new String[] {
132: FmtOptions.alignMultilineTernaryOp,
133: Boolean.FALSE.toString() }, new String[] {
134: FmtOptions.alignMultilineThrows,
135: Boolean.FALSE.toString() }); // NOI18N
136: }
137:
138: /** This method is called from within the constructor to
139: * initialize the form.
140: * WARNING: Do NOT modify this code. The content of this method is
141: * always regenerated by the Form Editor.
142: */
143: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
144: private void initComponents() {
145:
146: jTextField3 = new javax.swing.JTextField();
147: jCheckBox3 = new javax.swing.JCheckBox();
148: continuationIndentSizeLabel = new javax.swing.JLabel();
149: continuationIndentSizeField = new javax.swing.JTextField();
150: labelIndentLabel = new javax.swing.JLabel();
151: labelIndentField = new javax.swing.JTextField();
152: absoluteLabelIndentCheckBox = new javax.swing.JCheckBox();
153: indentTopLevelClassMembersCheckBox = new javax.swing.JCheckBox();
154: indentCasesFromSwitchCheckBox = new javax.swing.JCheckBox();
155:
156: jTextField3.setText("jTextField3");
157:
158: org.openide.awt.Mnemonics.setLocalizedText(jCheckBox3,
159: "jCheckBox3");
160: jCheckBox3.setBorder(javax.swing.BorderFactory
161: .createEmptyBorder(0, 0, 0, 0));
162: jCheckBox3.setMargin(new java.awt.Insets(0, 0, 0, 0));
163:
164: setOpaque(false);
165:
166: continuationIndentSizeLabel
167: .setLabelFor(continuationIndentSizeField);
168: org.openide.awt.Mnemonics.setLocalizedText(
169: continuationIndentSizeLabel, org.openide.util.NbBundle
170: .getMessage(FmtTabsIndents.class,
171: "LBL_ContinuationIndentSize")); // NOI18N
172:
173: labelIndentLabel.setLabelFor(labelIndentField);
174: org.openide.awt.Mnemonics.setLocalizedText(labelIndentLabel,
175: org.openide.util.NbBundle.getMessage(
176: FmtTabsIndents.class, "LBL_LabelIndent")); // NOI18N
177:
178: org.openide.awt.Mnemonics.setLocalizedText(
179: absoluteLabelIndentCheckBox, org.openide.util.NbBundle
180: .getMessage(FmtTabsIndents.class,
181: "LBL_AbsoluteLabelIndent")); // NOI18N
182: absoluteLabelIndentCheckBox.setBorder(javax.swing.BorderFactory
183: .createEmptyBorder(0, 0, 0, 0));
184: absoluteLabelIndentCheckBox.setMargin(new java.awt.Insets(0, 0,
185: 0, 0));
186: absoluteLabelIndentCheckBox.setOpaque(false);
187:
188: org.openide.awt.Mnemonics.setLocalizedText(
189: indentTopLevelClassMembersCheckBox,
190: org.openide.util.NbBundle.getMessage(
191: FmtTabsIndents.class,
192: "LBL_IndentTopLevelClassMemberts")); // NOI18N
193: indentTopLevelClassMembersCheckBox
194: .setBorder(javax.swing.BorderFactory.createEmptyBorder(
195: 0, 0, 0, 0));
196: indentTopLevelClassMembersCheckBox
197: .setMargin(new java.awt.Insets(0, 0, 0, 0));
198: indentTopLevelClassMembersCheckBox.setOpaque(false);
199:
200: org.openide.awt.Mnemonics.setLocalizedText(
201: indentCasesFromSwitchCheckBox,
202: org.openide.util.NbBundle.getMessage(
203: FmtTabsIndents.class,
204: "LBL_IndentCasesFromSwitch")); // NOI18N
205: indentCasesFromSwitchCheckBox
206: .setBorder(javax.swing.BorderFactory.createEmptyBorder(
207: 0, 0, 0, 0));
208: indentCasesFromSwitchCheckBox.setMargin(new java.awt.Insets(0,
209: 0, 0, 0));
210: indentCasesFromSwitchCheckBox.setOpaque(false);
211:
212: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
213: this );
214: this .setLayout(layout);
215: layout
216: .setHorizontalGroup(layout
217: .createParallelGroup(
218: org.jdesktop.layout.GroupLayout.LEADING)
219: .add(
220: layout
221: .createSequentialGroup()
222: .add(
223: layout
224: .createParallelGroup(
225: org.jdesktop.layout.GroupLayout.LEADING)
226: .add(
227: layout
228: .createSequentialGroup()
229: .add(
230: layout
231: .createParallelGroup(
232: org.jdesktop.layout.GroupLayout.LEADING)
233: .add(
234: labelIndentLabel)
235: .add(
236: continuationIndentSizeLabel))
237: .addPreferredGap(
238: org.jdesktop.layout.LayoutStyle.RELATED,
239: 19,
240: Short.MAX_VALUE)
241: .add(
242: layout
243: .createParallelGroup(
244: org.jdesktop.layout.GroupLayout.LEADING)
245: .add(
246: continuationIndentSizeField,
247: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
248: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
249: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
250: .add(
251: org.jdesktop.layout.GroupLayout.TRAILING,
252: labelIndentField,
253: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
254: 36,
255: Short.MAX_VALUE)))
256: .add(
257: layout
258: .createSequentialGroup()
259: .add(
260: layout
261: .createParallelGroup(
262: org.jdesktop.layout.GroupLayout.LEADING)
263: .add(
264: absoluteLabelIndentCheckBox)
265: .add(
266: indentTopLevelClassMembersCheckBox)
267: .add(
268: indentCasesFromSwitchCheckBox))
269: .addPreferredGap(
270: org.jdesktop.layout.LayoutStyle.RELATED,
271: 12,
272: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
273: .add(261, 261, 261)));
274:
275: layout.linkSize(new java.awt.Component[] {
276: continuationIndentSizeField, labelIndentField },
277: org.jdesktop.layout.GroupLayout.HORIZONTAL);
278:
279: layout
280: .setVerticalGroup(layout
281: .createParallelGroup(
282: org.jdesktop.layout.GroupLayout.LEADING)
283: .add(
284: layout
285: .createSequentialGroup()
286: .add(
287: layout
288: .createParallelGroup(
289: org.jdesktop.layout.GroupLayout.BASELINE)
290: .add(
291: continuationIndentSizeLabel)
292: .add(
293: continuationIndentSizeField,
294: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
295: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
296: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
297: .addPreferredGap(
298: org.jdesktop.layout.LayoutStyle.RELATED)
299: .add(
300: layout
301: .createParallelGroup(
302: org.jdesktop.layout.GroupLayout.BASELINE)
303: .add(
304: labelIndentLabel)
305: .add(
306: labelIndentField,
307: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
308: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
309: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
310: .addPreferredGap(
311: org.jdesktop.layout.LayoutStyle.RELATED)
312: .add(
313: absoluteLabelIndentCheckBox)
314: .addPreferredGap(
315: org.jdesktop.layout.LayoutStyle.RELATED)
316: .add(
317: indentTopLevelClassMembersCheckBox)
318: .addPreferredGap(
319: org.jdesktop.layout.LayoutStyle.RELATED)
320: .add(
321: indentCasesFromSwitchCheckBox)
322: .addContainerGap(222,
323: Short.MAX_VALUE)));
324: }// </editor-fold>//GEN-END:initComponents
325:
326: // Variables declaration - do not modify//GEN-BEGIN:variables
327: private javax.swing.JCheckBox absoluteLabelIndentCheckBox;
328: private javax.swing.JTextField continuationIndentSizeField;
329: private javax.swing.JLabel continuationIndentSizeLabel;
330: private javax.swing.JCheckBox indentCasesFromSwitchCheckBox;
331: private javax.swing.JCheckBox indentTopLevelClassMembersCheckBox;
332: private javax.swing.JCheckBox jCheckBox3;
333: private javax.swing.JTextField jTextField3;
334: private javax.swing.JTextField labelIndentField;
335: private javax.swing.JLabel labelIndentLabel;
336: // End of variables declaration//GEN-END:variables
337:
338: }
|