View Javadoc

1   /*
2    * Copyright (C) 2004 TiongHiang Lee
3    *
4    * This library is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Lesser General Public
6    * License as published by the Free Software Foundation; either
7    * version 2.1 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this library; if not,  write to the Free Software
16   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   *
18   * Email: thlee@onemindsoft.org
19   */
20  
21  package org.onemind.awtbridge.peer;
22  
23  import java.awt.Dimension;
24  import java.awt.FontMetrics;
25  import java.awt.peer.ChoicePeer;
26  import org.onemind.awtbridge.BridgeContext;
27  /***
28   * A choice peer
29   * @author TiongHiang Lee (thlee@onemindsoft.org)
30   * @version $Id: BridgeChoicePeer.java,v 1.3 2005/03/12 23:03:11 thlee Exp $ $Name: awtbridge-1_0_0 $
31   */
32  public class BridgeChoicePeer extends BridgeComponentPeer implements ChoicePeer
33  {
34  
35      /***
36       * {@inheritDoc}
37       */
38      public BridgeChoicePeer(Object componentObject, BridgeContext context)
39      {
40          super(componentObject, context);
41      }
42  
43      /***
44       * {@inheritDoc}
45       */
46      public final void add(String item, int index)
47      {
48          setUpToDate(false);
49      }
50  
51      /***
52       * {@inheritDoc}
53       */
54      public final void addItem(String item, int index)
55      {
56          setUpToDate(false);
57      }
58  
59      /***
60       * {@inheritDoc}
61       */
62      public final void remove(int index)
63      {
64          setUpToDate(false);
65      }
66  
67      /***
68       * {@inheritDoc}
69       */
70      public final void removeAll()
71      {
72          setUpToDate(false);
73      }
74  
75      /***
76       * {@inheritDoc}
77       */
78      public final void select(int index)
79      {
80          setUpToDate(false);
81      }
82  
83      /***
84       * TODO: To be implemented
85       * {@inheritDoc}
86       */
87      public Dimension preferredSize()
88      {
89          FontMetrics m = getCurrentFontMetrics();
90          return new Dimension(m.charWidth('A') * 20, m.getHeight());
91      }
92  }