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.editor.ext;
043:
044: import java.awt.Dimension;
045: import java.util.ResourceBundle;
046: import javax.swing.JCheckBox;
047: import org.netbeans.editor.SettingsNames;
048: import org.openide.awt.Mnemonics;
049: import org.openide.util.NbBundle;
050:
051: /**
052: *
053: * @author Miloslav Metelka, Petr Nejedly
054: * @version 1.0
055: * @deprecated Without any replacement.
056: */
057: public class FindDialogPanel extends javax.swing.JPanel {
058:
059: static final long serialVersionUID = 5048601763767383114L;
060:
061: private final ResourceBundle bundle = NbBundle
062: .getBundle(org.netbeans.editor.BaseKit.class);
063:
064: /** Initializes the Form */
065: public FindDialogPanel() {
066: initComponents();
067: getAccessibleContext().setAccessibleName(
068: bundle.getString("find-title")); // NOI18N
069: getAccessibleContext().setAccessibleDescription(
070: bundle.getString("ACSD_find")); // NOI18N
071: findWhat.getAccessibleContext().setAccessibleDescription(
072: bundle.getString("ACSD_" + SettingsNames.FIND_WHAT)); // NOI18N
073: replaceWith.getAccessibleContext().setAccessibleDescription(
074: bundle.getString("ACSD_"
075: + SettingsNames.FIND_REPLACE_WITH)); // NOI18N
076:
077: // #71956
078: Dimension findPrefSize = findWhat.getPreferredSize();
079: Dimension replacePrefSize = replaceWith.getPreferredSize();
080: if (findPrefSize != null) {
081: findWhat.setPreferredSize(new Dimension((int) findPrefSize
082: .getWidth(), (int) findPrefSize.getHeight()));
083: }
084: if (replacePrefSize != null) {
085: replaceWith.setPreferredSize(new Dimension(
086: (int) replacePrefSize.getWidth(),
087: (int) replacePrefSize.getHeight()));
088: }
089: }
090:
091: /** This method is called from within the constructor to
092: * initialize the form.
093: * WARNING: Do NOT modify this code. The content of this method is
094: * always regenerated by the FormEditor.
095: */
096: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
097: private void initComponents() {
098: java.awt.GridBagConstraints gridBagConstraints;
099:
100: findWhatPanel = new javax.swing.JPanel();
101: findWhatLabel = new javax.swing.JLabel();
102: findWhat = new javax.swing.JComboBox();
103: replaceWithLabel = new javax.swing.JLabel();
104: replaceWith = new javax.swing.JComboBox();
105: highlightSearch = createCheckBox(SettingsNames.FIND_HIGHLIGHT_SEARCH);
106: incSearch = createCheckBox(SettingsNames.FIND_INC_SEARCH);
107: matchCase = createCheckBox(SettingsNames.FIND_MATCH_CASE);
108: wholeWords = createCheckBox(SettingsNames.FIND_WHOLE_WORDS);
109: bwdSearch = createCheckBox(SettingsNames.FIND_BACKWARD_SEARCH);
110: wrapSearch = createCheckBox(SettingsNames.FIND_WRAP_SEARCH);
111: regExp = createCheckBox(SettingsNames.FIND_REG_EXP);
112: blockSearch = createCheckBox(SettingsNames.FIND_BLOCK_SEARCH);
113:
114: setLayout(new java.awt.GridBagLayout());
115:
116: findWhatPanel.setLayout(new java.awt.GridBagLayout());
117: gridBagConstraints = new java.awt.GridBagConstraints();
118: gridBagConstraints.gridx = 0;
119: gridBagConstraints.gridy = 0;
120: gridBagConstraints.gridwidth = 3;
121: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
122: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
123: gridBagConstraints.weightx = 1.0;
124: gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
125: add(findWhatPanel, gridBagConstraints);
126:
127: findWhatLabel.setLabelFor(findWhat);
128: findWhatLabel
129: .setText(bundle.getString(SettingsNames.FIND_WHAT));
130: findWhatLabel.setDisplayedMnemonic(bundle.getString(
131: SettingsNames.FIND_WHAT + "-mnemonic").charAt(0));
132: gridBagConstraints = new java.awt.GridBagConstraints();
133: gridBagConstraints.gridx = 0;
134: gridBagConstraints.gridy = 1;
135: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
136: gridBagConstraints.insets = new java.awt.Insets(0, 12, 5, 0);
137: add(findWhatLabel, gridBagConstraints);
138:
139: findWhat.setEditable(true);
140: gridBagConstraints = new java.awt.GridBagConstraints();
141: gridBagConstraints.gridx = 1;
142: gridBagConstraints.gridy = 1;
143: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
144: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
145: gridBagConstraints.weightx = 1.0;
146: gridBagConstraints.insets = new java.awt.Insets(0, 11, 9, 10);
147: add(findWhat, gridBagConstraints);
148:
149: replaceWithLabel.setLabelFor(replaceWith);
150: replaceWithLabel.setText(bundle
151: .getString(SettingsNames.FIND_REPLACE_WITH));
152: replaceWithLabel.setDisplayedMnemonic(bundle.getString(
153: SettingsNames.FIND_REPLACE_WITH + "-mnemonic")
154: .charAt(0));
155: gridBagConstraints = new java.awt.GridBagConstraints();
156: gridBagConstraints.gridx = 0;
157: gridBagConstraints.gridy = 2;
158: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
159: gridBagConstraints.insets = new java.awt.Insets(0, 12, 9, 0);
160: add(replaceWithLabel, gridBagConstraints);
161:
162: replaceWith.setEditable(true);
163: gridBagConstraints = new java.awt.GridBagConstraints();
164: gridBagConstraints.gridx = 1;
165: gridBagConstraints.gridy = 2;
166: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
167: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
168: gridBagConstraints.weightx = 1.0;
169: gridBagConstraints.insets = new java.awt.Insets(0, 11, 9, 10);
170: add(replaceWith, gridBagConstraints);
171: gridBagConstraints = new java.awt.GridBagConstraints();
172: gridBagConstraints.gridx = 1;
173: gridBagConstraints.gridy = 6;
174: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
175: gridBagConstraints.weighty = 1.0;
176: gridBagConstraints.insets = new java.awt.Insets(11, 11, 11, 0);
177: add(highlightSearch, gridBagConstraints);
178: gridBagConstraints = new java.awt.GridBagConstraints();
179: gridBagConstraints.gridx = 2;
180: gridBagConstraints.gridy = 6;
181: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
182: gridBagConstraints.insets = new java.awt.Insets(11, 11, 11, 10);
183: add(incSearch, gridBagConstraints);
184: gridBagConstraints = new java.awt.GridBagConstraints();
185: gridBagConstraints.gridx = 1;
186: gridBagConstraints.gridy = 3;
187: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
188: gridBagConstraints.insets = new java.awt.Insets(3, 11, 0, 0);
189: add(matchCase, gridBagConstraints);
190: gridBagConstraints = new java.awt.GridBagConstraints();
191: gridBagConstraints.gridx = 1;
192: gridBagConstraints.gridy = 4;
193: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
194: gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 0);
195: add(wholeWords, gridBagConstraints);
196: gridBagConstraints = new java.awt.GridBagConstraints();
197: gridBagConstraints.gridx = 2;
198: gridBagConstraints.gridy = 5;
199: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
200: gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 10);
201: add(bwdSearch, gridBagConstraints);
202: gridBagConstraints = new java.awt.GridBagConstraints();
203: gridBagConstraints.gridx = 2;
204: gridBagConstraints.gridy = 3;
205: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
206: gridBagConstraints.insets = new java.awt.Insets(3, 11, 0, 10);
207: add(wrapSearch, gridBagConstraints);
208: gridBagConstraints = new java.awt.GridBagConstraints();
209: gridBagConstraints.gridx = 1;
210: gridBagConstraints.gridy = 5;
211: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
212: gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 0);
213: add(regExp, gridBagConstraints);
214: gridBagConstraints = new java.awt.GridBagConstraints();
215: gridBagConstraints.gridx = 2;
216: gridBagConstraints.gridy = 4;
217: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
218: gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 10);
219: add(blockSearch, gridBagConstraints);
220: }// </editor-fold>//GEN-END:initComponents
221:
222: // Variables declaration - do not modify//GEN-BEGIN:variables
223: protected javax.swing.JCheckBox blockSearch;
224: protected javax.swing.JCheckBox bwdSearch;
225: protected javax.swing.JComboBox findWhat;
226: protected javax.swing.JLabel findWhatLabel;
227: protected javax.swing.JPanel findWhatPanel;
228: protected javax.swing.JCheckBox highlightSearch;
229: protected javax.swing.JCheckBox incSearch;
230: protected javax.swing.JCheckBox matchCase;
231: protected javax.swing.JCheckBox regExp;
232: protected javax.swing.JComboBox replaceWith;
233: protected javax.swing.JLabel replaceWithLabel;
234: protected javax.swing.JCheckBox wholeWords;
235: protected javax.swing.JCheckBox wrapSearch;
236:
237: // End of variables declaration//GEN-END:variables
238:
239: private JCheckBox createCheckBox(String key) {
240: JCheckBox box = new JCheckBox();
241: Mnemonics.setLocalizedText(box, bundle.getString(key));
242: box.setToolTipText(bundle.getString(key + "-tooltip"));
243: return box;
244: }
245:
246: }
|