001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019:
020: package org.openharmonise.him.displaycomponents.search;
021:
022: import java.awt.*;
023: import java.awt.event.*;
024: import java.net.MalformedURLException;
025: import java.net.URI;
026: import java.net.URL;
027: import java.rmi.RemoteException;
028: import java.text.*;
029: import java.util.*;
030: import java.util.List;
031:
032: import javax.swing.*;
033: import javax.xml.rpc.ServiceException;
034:
035: import org.openharmonise.commons.xml.namespace.*;
036: import org.openharmonise.him.*;
037: import org.openharmonise.him.configuration.*;
038: import org.openharmonise.him.displaycomponents.*;
039: import org.openharmonise.him.editors.report.swing.*;
040: import org.openharmonise.him.harmonise.*;
041: import org.openharmonise.him.window.messages.MessageHandler;
042: import org.openharmonise.him.window.swing.ResourcePathCellRenderer;
043: import org.openharmonise.swing.FontManager;
044: import org.openharmonise.swing.datefield.*;
045: import org.openharmonise.vfs.context.*;
046: import org.openharmonise.vfs.gui.*;
047: import org.openharmonise.vfs.search.*;
048: import org.openharmonise.vfs.servers.*;
049: import org.openharmonise.webdav.client.webservice.SearchDetailsService;
050:
051: /**
052: * The search form panel.
053: *
054: * @author Matthew Large
055: * @version $Revision: 1.5 $
056: *
057: */
058: public class SearchTabPanel extends JPanel implements ActionListener,
059: LayoutManager, KeyListener, ContextListener {
060:
061: /**
062: * Search display component.
063: */
064: private SearchDisplayComponent m_display = null;
065:
066: /**
067: * Selected highlight colour.
068: */
069: private Color m_selectedColor = new Color(173, 169, 143);
070:
071: /**
072: * Label for free-text search field.
073: */
074: private JLabel m_textLabel = null;
075:
076: /**
077: * Free-text search field.
078: */
079: private JTextField m_textTextField = null;
080:
081: /**
082: * Free-text search type selector.
083: */
084: private JComboBox m_textComboBox = null;
085:
086: /**
087: * Label for search in selector.
088: */
089: private JLabel m_inLabel = null;
090:
091: /**
092: * Search in selector.
093: */
094: private JComboBox m_inCombo = null;
095:
096: /**
097: * Search button.
098: */
099: private JButton m_searchButton = null;
100:
101: /**
102: * Label for options.
103: */
104: private JLabel m_optionsLabel = null;
105:
106: /**
107: * Checkbox for publication date.
108: */
109: private JCheckBox m_publicationDateCheck = null;
110:
111: /**
112: * Publication date text field.
113: */
114: private JDateField m_publicationDateField = null;
115:
116: /**
117: * Publication date operator selector.
118: */
119: private JComboBox m_publicationDateCombo = null;
120:
121: /**
122: * Check box for author name.
123: */
124: private JCheckBox m_authorCheck = null;
125:
126: /**
127: * Author name text field.
128: */
129: private JTextField m_authorTextField = null;
130: private JComboTree m_authorTree = null;
131:
132: /**
133: * Identifier for title option.
134: */
135: private static String TEXT_OPTION_TITLE = "Title";
136:
137: /**
138: * Identifier for contents option.
139: */
140: private static String TEXT_OPTION_CONTENTS = "Contents";
141:
142: private List m_aStopWords = null;
143:
144: /**
145: * Constructs a new search tab panel.
146: *
147: * @param display Search display component
148: */
149: public SearchTabPanel(SearchDisplayComponent display) {
150: super ();
151: this .m_display = display;
152: this .setup();
153: }
154:
155: /**
156: * Configures the search form.
157: *
158: */
159: private void setup() {
160: ContextHandler.getInstance().addListener(
161: ContextType.CONTEXT_SYSTEM_PROP_CHANGED, this );
162:
163: this .setLayout(this );
164:
165: // String fontName = "Dialog";
166: // int fontSize = 11;
167: // Font font = new Font(fontName, Font.PLAIN, fontSize);
168: // Font fontBold = new Font(fontName, Font.BOLD, fontSize);
169:
170: m_textLabel = new JLabel("Containing the text:");
171: m_textLabel.setFont(FontManager.getInstance().getFont(
172: FontManager.FONT_STANDARD));
173: this .add(m_textLabel);
174:
175: m_textTextField = new JTextField();
176: m_textTextField.setFont(FontManager.getInstance().getFont(
177: FontManager.FONT_STANDARD));
178: m_textTextField.addKeyListener(this );
179: this .add(m_textTextField);
180:
181: String[] aTextOptions = new String[] { "Title", "Contents" };
182: this .m_textComboBox = new JComboBox(aTextOptions);
183: this .m_textComboBox.setActionCommand("TEXT_OPTIONS");
184: this .add(m_textComboBox);
185:
186: m_inLabel = new JLabel("Search in...");
187: m_inLabel.setFont(FontManager.getInstance().getFont(
188: FontManager.FONT_STANDARD));
189: this .add(m_inLabel);
190:
191: Object[] sPaths = this .getComboData();
192: m_inCombo = new JComboBox(sPaths);
193: m_inCombo.addActionListener(this );
194: m_inCombo.setActionCommand("COMBO");
195: m_inCombo.setRenderer(new ResourcePathCellRenderer(ServerList
196: .getInstance().getHarmoniseServer().getVFS()));
197: m_inCombo.setFont(FontManager.getInstance().getFont(
198: FontManager.FONT_RESOURCE_TITLE));
199: this .add(m_inCombo);
200:
201: m_searchButton = new JButton("Search");
202: m_searchButton.setActionCommand("SEARCH");
203: m_searchButton.setFont(FontManager.getInstance().getFont(
204: FontManager.FONT_STANDARD));
205: m_searchButton.setIcon(IconManager.getInstance().getIcon(
206: "16-command-search.gif"));
207: m_searchButton.addActionListener(this );
208: this .add(m_searchButton);
209:
210: this .m_optionsLabel = new JLabel(" Options");
211: this .m_optionsLabel.setFont(FontManager.getInstance().getFont(
212: FontManager.FONT_STANDARD_BOLD));
213: this .add(this .m_optionsLabel);
214:
215: this .m_publicationDateCheck = new JCheckBox("Publication date");
216: this .m_publicationDateCheck.setActionCommand("PUBDATE");
217: this .m_publicationDateCheck.setFont(FontManager.getInstance()
218: .getFont(FontManager.FONT_STANDARD));
219: this .m_publicationDateCheck.addActionListener(this );
220: this .add(this .m_publicationDateCheck);
221:
222: Date dt = new Date();
223: this .m_publicationDateField = new JDateField("yyyy-MM-dd");
224: this .m_publicationDateField.setBorder(BorderFactory
225: .createLineBorder(Color.BLACK));
226: this .m_publicationDateField.setFont(FontManager.getInstance()
227: .getFont(FontManager.FONT_STANDARD));
228: this .m_publicationDateField.setVisible(false);
229: this .add(this .m_publicationDateField);
230:
231: String[] pubDateOperators = new String[] { "=", ">", "<" };
232: this .m_publicationDateCombo = new JComboBox(pubDateOperators);
233: this .m_publicationDateCombo.setFont(FontManager.getInstance()
234: .getFont(FontManager.FONT_STANDARD_BOLD));
235: this .m_publicationDateCombo.setVisible(false);
236: this .add(this .m_publicationDateCombo);
237:
238: this .m_authorCheck = new JCheckBox("Author");
239: this .m_authorCheck.setActionCommand("CREAT");
240: this .m_authorCheck.setFont(FontManager.getInstance().getFont(
241: FontManager.FONT_STANDARD));
242: this .m_authorCheck.addActionListener(this );
243: this .add(this .m_authorCheck);
244:
245: this .m_authorTree = new JComboTree();
246: this .m_authorTree.addCollectionPath(HarmonisePaths.PATH_VALUES
247: + "/admin/content_workers/authors");
248: this .m_authorTree.setVisible(false);
249: this .add(this .m_authorTree);
250:
251: }
252:
253: /* (non-Javadoc)
254: * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
255: */
256: public void layoutContainer(Container arg0) {
257: int nHeight = 5;
258:
259: this .m_textComboBox.setSize(this .getParent().getWidth() - 20,
260: 20);
261: this .m_textComboBox.setLocation(10, nHeight);
262: nHeight = nHeight + this .m_textComboBox.getSize().height + 5;
263:
264: this .m_textLabel.setSize(this .getParent().getWidth() - 20, 20);
265: this .m_textLabel.setLocation(10, nHeight);
266: nHeight = nHeight + this .m_textLabel.getSize().height + 5;
267:
268: this .m_textTextField.setSize(this .getParent().getWidth() - 20,
269: 20);
270: this .m_textTextField.setLocation(10, nHeight);
271: nHeight = nHeight + this .m_textTextField.getSize().height + 5;
272:
273: this .m_inLabel.setSize(this .getParent().getWidth() - 20, 20);
274: this .m_inLabel.setLocation(10, nHeight);
275: nHeight = nHeight + this .m_inLabel.getSize().height + 5;
276:
277: this .m_inCombo.setSize(this .getParent().getWidth() - 20, 20);
278: this .m_inCombo.setLocation(10, nHeight);
279: nHeight = nHeight + this .m_inCombo.getSize().height + 5;
280:
281: this .m_optionsLabel.setSize(this .getParent().getWidth() - 20,
282: 20);
283: this .m_optionsLabel.setLocation(10, nHeight);
284: nHeight = nHeight + this .m_optionsLabel.getSize().height + 5;
285:
286: this .m_publicationDateCheck.setSize(
287: this .getParent().getWidth() - 20, 20);
288: this .m_publicationDateCheck.setLocation(10, nHeight);
289: nHeight = nHeight
290: + this .m_publicationDateCheck.getSize().height + 5;
291:
292: if (this .m_publicationDateCheck.isSelected()) {
293: this .m_publicationDateField.setSize(this .getParent()
294: .getWidth() - 70, 20);
295: this .m_publicationDateField.setLocation(10, nHeight);
296:
297: this .m_publicationDateCombo.setSize(40, 20);
298: this .m_publicationDateCombo.setLocation(this .getParent()
299: .getWidth() - 50, nHeight);
300: nHeight = nHeight
301: + this .m_publicationDateField.getSize().height + 5;
302: }
303:
304: this .m_authorCheck
305: .setSize(this .getParent().getWidth() - 20, 20);
306: this .m_authorCheck.setLocation(10, nHeight);
307: nHeight = nHeight + this .m_authorCheck.getSize().height + 5;
308:
309: if (this .m_authorCheck.isSelected()) {
310: this .m_authorTree.setSize(this .getParent().getWidth() - 20,
311: 20);
312:
313: this .m_authorTree.setLocation(10, nHeight);
314: nHeight = nHeight + this .m_authorTree.getSize().height + 5;
315: }
316:
317: nHeight = nHeight + 5;
318: this .m_searchButton.setSize(90, 25);
319: this .m_searchButton.setLocation(this .getParent().getWidth()
320: - this .m_searchButton.getSize().width - 10, nHeight);
321: nHeight = nHeight + this .m_searchButton.getSize().height + 5;
322: }
323:
324: /* (non-Javadoc)
325: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
326: */
327: public void actionPerformed(ActionEvent ae) {
328: if (ae.getActionCommand().equals("SEARCH")) {
329: this .doSearch();
330: } else if (ae.getActionCommand().equals("COMBO")
331: && this .m_inCombo.getSelectedItem() instanceof OtherPathCell) {
332: this .m_inCombo.hidePopup();
333: this .m_inCombo.setSelectedIndex(this .m_inCombo.getModel()
334: .getSize() - 2);
335:
336: JFrame frame = new JFrame();
337: frame.setIconImage(((ImageIcon) IconManager.getInstance()
338: .getIcon("32-sim-logo.gif")).getImage());
339:
340: ConfigDialog dialog = new ConfigDialog(frame, "Customise");
341: dialog.setSelectedTab("Search in");
342: dialog.show();
343:
344: String fontName = "Dialog";
345: int fontSize = 11;
346: Font font = new Font(fontName, Font.PLAIN, fontSize);
347:
348: this .remove(this .m_inCombo);
349: Object[] sPaths = this .getComboData();
350: this .m_inCombo = new JComboBox(sPaths);
351: this .m_inCombo.addActionListener(this );
352: this .m_inCombo.setActionCommand("COMBO");
353: this .m_inCombo.setRenderer(new ResourcePathCellRenderer(
354: ServerList.getInstance().getHarmoniseServer()
355: .getVFS()));
356: this .m_inCombo.setFont(font);
357: this .add(this .m_inCombo);
358:
359: this .m_inCombo.setSelectedIndex(this .m_inCombo.getModel()
360: .getSize() - 2);
361:
362: this .revalidate();
363: } else if (ae.getActionCommand().equals("PUBDATE")) {
364: this .m_publicationDateField
365: .setVisible(this .m_publicationDateCheck
366: .isSelected());
367: this .m_publicationDateCombo
368: .setVisible(this .m_publicationDateCheck
369: .isSelected());
370: this .revalidate();
371: } else if (ae.getActionCommand().equals("CREAT")) {
372: this .m_authorTree.setVisible(this .m_authorCheck
373: .isSelected());
374: this .revalidate();
375: }
376: }
377:
378: /* (non-Javadoc)
379: * @see com.simulacramedia.contentmanager.context.ContextListener#contextMessage(com.simulacramedia.contentmanager.context.ContextEvent)
380: */
381: public void contextMessage(ContextEvent ce) {
382: if (ce.getMessage().trim().equals("SEARCHPATHS")
383: && this .m_inCombo != null) {
384: String fontName = "Dialog";
385: int fontSize = 11;
386: Font font = new Font(fontName, Font.PLAIN, fontSize);
387:
388: this .remove(this .m_inCombo);
389: Object[] sPaths = this .getComboData();
390: this .m_inCombo = new JComboBox(sPaths);
391: this .m_inCombo.addActionListener(this );
392: this .m_inCombo.setActionCommand("COMBO");
393: this .m_inCombo.setRenderer(new ResourcePathCellRenderer(
394: ServerList.getInstance().getHarmoniseServer()
395: .getVFS()));
396: this .m_inCombo.setFont(font);
397: this .add(this .m_inCombo);
398:
399: this .m_inCombo.setSelectedIndex(this .m_inCombo.getModel()
400: .getSize() - 2);
401:
402: this .revalidate();
403: }
404: }
405:
406: private void populateStopWords() {
407: try {
408: Server server = null;
409: server = ServerList.getInstance().getHarmoniseServer();
410: URI uri = server.getURI();
411:
412: String sURI = uri.getScheme() + "://" + uri.getHost() + ":"
413: + uri.getPort() + "/webdav/services/DAVService";
414: URL url = null;
415: try {
416: url = new URL(sURI);
417: } catch (MalformedURLException e2) {
418: e2.printStackTrace();
419: }
420:
421: this .m_aStopWords = SearchDetailsService.getStopWords(url);
422: } catch (RemoteException e) {
423: e.printStackTrace();
424: } catch (ServiceException e) {
425: e.printStackTrace();
426: }
427: }
428:
429: private boolean checkStopWords(String sFreeText) {
430: boolean bStopWordError = false;
431:
432: StringTokenizer sTok = new StringTokenizer(sFreeText, " ");
433: int nTokenCount = sTok.countTokens();
434: List aStopWordsFound = new ArrayList();
435:
436: while (sTok.hasMoreTokens()) {
437: String sToken = sTok.nextToken();
438: if (this .m_aStopWords.contains(sToken.toLowerCase())) {
439: aStopWordsFound.add(sToken);
440:
441: }
442: }
443:
444: if (aStopWordsFound.size() > 0
445: && aStopWordsFound.size() < nTokenCount) {
446: StringBuffer sBuff = new StringBuffer(
447: "Your search contained the following stop words [");
448: Iterator itor = aStopWordsFound.iterator();
449: while (itor.hasNext()) {
450: String sStopWord = (String) itor.next();
451: sBuff.append(sStopWord);
452: if (itor.hasNext()) {
453: sBuff.append(", ");
454: }
455: }
456: sBuff
457: .append("]. These words are very common and will not be used in the search.");
458: MessageHandler.getInstance().fireMessageEvent(
459: sBuff.toString(), MessageHandler.TYPE_INFORMATION);
460: } else if (aStopWordsFound.size() > 0
461: && aStopWordsFound.size() >= nTokenCount) {
462: MessageHandler
463: .getInstance()
464: .fireMessageEvent(
465: "Your search contained only stop words. These words are very common and are not used by the search. Please try other word(s).",
466: MessageHandler.TYPE_ERROR);
467: bStopWordError = true;
468: }
469:
470: return bStopWordError;
471: }
472:
473: /**
474: * Performs the search.
475: *
476: */
477: private void doSearch() {
478:
479: if (this .m_aStopWords == null) {
480: this .populateStopWords();
481: }
482:
483: if (this .m_textTextField.getText().trim().equals("")
484: || !this .checkStopWords(this .m_textTextField.getText()
485: .trim())) {
486: Query query = new Query();
487:
488: Select select = new Select(NamespaceType.DAV.getURI(),
489: "resourcetype");
490: query.addSelectProperty(select);
491:
492: Scope scope = new Scope((String) this .m_inCombo
493: .getSelectedItem(), true);
494: query.addScope(scope);
495:
496: ConditionGroup andGroup = new ConditionGroup(
497: ConditionGroup.AND);
498:
499: ArrayList aConditions = new ArrayList();
500:
501: if (!this .m_textTextField.getText().trim().equals("")) {
502: if (((String) this .m_textComboBox.getSelectedItem())
503: .equals(TEXT_OPTION_TITLE)) {
504: PropertyCondition propCond = new PropertyCondition(
505: NamespaceType.OHRM.getURI(), "title",
506: "contains");
507: propCond.setValue(this .m_textTextField.getText());
508: aConditions.add(propCond);
509: } else if (((String) this .m_textComboBox
510: .getSelectedItem())
511: .equals(TEXT_OPTION_CONTENTS)) {
512: ContentCondition contentCond = new ContentCondition(
513: "contains");
514: contentCond
515: .setValue(this .m_textTextField.getText());
516: aConditions.add(contentCond);
517: }
518:
519: }
520:
521: if (this .m_publicationDateCheck.isSelected()
522: && this .m_publicationDateField.getDate() != null) {
523: if ((((String) this .m_publicationDateCombo
524: .getSelectedItem())).equalsIgnoreCase("=")) {
525: PropertyCondition pubDateCond = new PropertyCondition(
526: NamespaceType.OHRM.getURI(), "START", ">=");
527:
528: PropertyCondition pubDateCond2 = new PropertyCondition(
529: NamespaceType.OHRM.getURI(), "START", "<");
530:
531: Date initialDate = this .m_publicationDateField
532: .getDate();
533: Calendar cal2 = Calendar.getInstance();
534: cal2.setTime(initialDate);
535: cal2.add(Calendar.DAY_OF_MONTH, 1);
536:
537: SimpleDateFormat dateFormat = new SimpleDateFormat(
538: "yyyy-MM-dd");
539: String sDateValue = dateFormat.format(initialDate);
540: pubDateCond.setValue(sDateValue);
541:
542: sDateValue = dateFormat.format(cal2.getTime());
543: pubDateCond2.setValue(sDateValue);
544:
545: ConditionGroup andGrp = new ConditionGroup(
546: ConditionGroup.AND);
547: andGrp.addPropertyCondition(pubDateCond);
548: andGrp.addPropertyCondition(pubDateCond2);
549:
550: aConditions.add(andGrp);
551: } else if ((((String) this .m_publicationDateCombo
552: .getSelectedItem())).equalsIgnoreCase(">")) {
553: PropertyCondition pubDateCond = new PropertyCondition(
554: NamespaceType.OHRM.getURI(), "START", ">");
555:
556: Date initialDate = this .m_publicationDateField
557: .getDate();
558: Calendar cal2 = Calendar.getInstance();
559: cal2.setTime(initialDate);
560: cal2.add(Calendar.DAY_OF_MONTH, 1);
561:
562: SimpleDateFormat dateFormat = new SimpleDateFormat(
563: "yyyy-MM-dd");
564: String sDateValue = dateFormat.format(cal2
565: .getTime());
566: pubDateCond.setValue(sDateValue);
567: aConditions.add(pubDateCond);
568: } else if ((((String) this .m_publicationDateCombo
569: .getSelectedItem())).equalsIgnoreCase("<")) {
570: PropertyCondition pubDateCond = new PropertyCondition(
571: NamespaceType.OHRM.getURI(), "START", "<");
572:
573: SimpleDateFormat dateFormat = new SimpleDateFormat(
574: "yyyy-MM-dd");
575: String sDateValue = dateFormat
576: .format(this .m_publicationDateField
577: .getDate());
578: pubDateCond.setValue(sDateValue);
579: aConditions.add(pubDateCond);
580: }
581:
582: }
583:
584: if (this .m_authorCheck.isSelected()) {
585: PropertyCondition authorNameCond = new PropertyCondition(
586: NamespaceType.OHRM.getURI(), "AUTHOR", "=");
587: authorNameCond.setValue(this .m_authorTree.getPath());
588: aConditions.add(authorNameCond);
589: }
590:
591: if (aConditions.size() == 1) {
592: Object condition = aConditions.get(0);
593: if (condition instanceof ConditionGroup) {
594: query.addConditionGroup((ConditionGroup) condition);
595: } else if (condition instanceof PropertyCondition) {
596: andGroup
597: .addPropertyCondition((PropertyCondition) condition);
598: query.addConditionGroup(andGroup);
599: } else if (condition instanceof ContentCondition) {
600: andGroup
601: .addContentCondition((ContentCondition) condition);
602: query.addConditionGroup(andGroup);
603: }
604: this .m_display.doSearch(query);
605: } else if (aConditions.size() > 1) {
606: Iterator itor = aConditions.iterator();
607: while (itor.hasNext()) {
608: Object condition = (Object) itor.next();
609: if (condition instanceof ConditionGroup) {
610: andGroup
611: .addConditionGroup((ConditionGroup) condition);
612: } else if (condition instanceof PropertyCondition) {
613: andGroup
614: .addPropertyCondition((PropertyCondition) condition);
615: } else if (condition instanceof ContentCondition) {
616: andGroup
617: .addContentCondition((ContentCondition) condition);
618: }
619: }
620: query.addConditionGroup(andGroup);
621: this .m_display.doSearch(query);
622: }
623: }
624:
625: }
626:
627: /* (non-Javadoc)
628: * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
629: */
630: public void keyReleased(KeyEvent ke) {
631:
632: }
633:
634: /**
635: * Returns the data to populate the search in combo box.
636: *
637: * @return List of collection paths
638: */
639: private Object[] getComboData() {
640: ArrayList aData = new ArrayList();
641:
642: aData.add("/webdav/Content/Documents");
643:
644: List aValues = ConfigStore.getInstance().getPropertyVals(
645: "SEARCHPATHS");
646:
647: if (aValues != null) {
648:
649: aValues.remove("/webdav/Content/Documents");
650: Server server = ServerList.getInstance()
651: .getHarmoniseServer();
652:
653: ArrayList aRemovePaths = new ArrayList();
654:
655: Iterator itor = aValues.iterator();
656: while (itor.hasNext()) {
657: String sTempPath = (String) itor.next();
658: if (server.getVFS().getVirtualFile(sTempPath) == null) {
659: aRemovePaths.add(sTempPath);
660: }
661: }
662: if (aRemovePaths.size() > 0) {
663: aValues.removeAll(aRemovePaths);
664: ConfigStore.getInstance().setProperty("SEARCHPATHS",
665: (ArrayList) aValues);
666: }
667:
668: aData.addAll(aValues);
669: }
670:
671: aData.add(new OtherPathCell());
672:
673: return aData.toArray();
674: }
675:
676: /**
677: * @param arg0
678: */
679: private SearchTabPanel(boolean arg0) {
680: super (arg0);
681: }
682:
683: /**
684: * @param arg0
685: */
686: private SearchTabPanel(LayoutManager arg0) {
687: super (arg0);
688: }
689:
690: /**
691: * @param arg0
692: * @param arg1
693: */
694: private SearchTabPanel(LayoutManager arg0, boolean arg1) {
695: super (arg0, arg1);
696: }
697:
698: /* (non-Javadoc)
699: * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
700: */
701: public void removeLayoutComponent(Component arg0) {
702: }
703:
704: /* (non-Javadoc)
705: * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
706: */
707: public void addLayoutComponent(String arg0, Component arg1) {
708: }
709:
710: /* (non-Javadoc)
711: * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
712: */
713: public Dimension minimumLayoutSize(Container arg0) {
714: return this .getParent().getPreferredSize();
715: }
716:
717: /* (non-Javadoc)
718: * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
719: */
720: public Dimension preferredLayoutSize(Container arg0) {
721: return new Dimension(100, 100);
722: }
723:
724: /* (non-Javadoc)
725: * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
726: */
727: public void keyPressed(KeyEvent ke) {
728: if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
729: this .m_searchButton.doClick();
730: }
731: }
732:
733: /* (non-Javadoc)
734: * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
735: */
736: public void keyTyped(KeyEvent arg0) {
737: }
738:
739: }
|