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