KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > plaf > CompiereComboPopup


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.plaf;
15
16 import javax.swing.JComboBox JavaDoc;
17 import javax.swing.plaf.basic.BasicComboPopup JavaDoc;
18
19 import org.compiere.swing.CComboBox;
20 import org.compiere.swing.CField;
21
22 /**
23  * Compiere Combo Popup - allows to prevent the display of the popup
24  *
25  * @author Jorg Janke
26  * @version $Id: CompiereComboPopup.java,v 1.5 2003/09/27 11:08:53 jjanke Exp $
27  */

28 public class CompiereComboPopup extends BasicComboPopup JavaDoc
29 {
30     /**
31      * Constructor
32      * @param combo
33      */

34     public CompiereComboPopup(JComboBox JavaDoc combo)
35     {
36         super(combo);
37     } // CompiereComboPopup
38

39     /**
40      * Conditionally show the Popup.
41      * If the combo is a CComboBox/CField, the return value of the
42      * method displayPopup determines if the popup is actually displayed
43      * @see CComboBox#displayPopup()
44      * @see CField#displayPopup()
45      */

46     public void show()
47     {
48         // Check ComboBox if popup should be displayed
49
if (comboBox instanceof CComboBox && !((CComboBox)comboBox).displayPopup())
50             return;
51         // Check Field if popup should be displayed
52
if (comboBox instanceof CField && !((CField)comboBox).displayPopup())
53             return;
54         super.show();
55     } // show
56

57
58     /**
59      * Inform CComboBox and CField that Popup was hidden
60      * @see CComboBox.hidingPopup
61      * @see CField.hidingPopup
62      *
63     public void hide()
64     {
65         super.hide();
66         // Inform ComboBox that popup was hidden
67         if (comboBox instanceof CComboBox)
68             (CComboBox)comboBox).hidingPopup();
69         else if (comboBox instanceof CComboBox)
70             (CComboBox)comboBox).hidingPopup();
71     } // hided
72     /**/

73 } // CompiereComboPopup
74
Popular Tags