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 org.onemind.awtbridge.BridgeContext;
24  import org.onemind.awtbridge.input.BridgeInputContext;
25  import org.onemind.awtbridge.render.BridgeRenderContext;
26  import org.onemind.awtbridge.util.ComponentEventListeners;
27  /***
28   * A default PeerBridge abstract implementation that handle the registration and id generation.
29   * @author TiongHiang Lee (thlee@onemindsoft.org)
30   * @version $Id: AbstractBridgePeer.java,v 1.4 2005/04/26 17:38:55 thlee Exp $ $Name: awtbridge-1_0_0 $
31   */
32  public abstract class AbstractBridgePeer extends BridgePeer
33  {
34  
35      /*** whether the peer is up-to-date (for implementing caching) */
36      private boolean _upToDate = false;
37  
38      /*** whether the dimension has changed since last render */
39      private boolean _isDimensionChanged = true;
40  
41      /***
42       * {@inheritDoc}
43       */
44      public AbstractBridgePeer(Object componentObject, BridgeContext context)
45      {
46          super(componentObject, context);
47      }
48  
49      /***
50       * whether this peer is up-to-date (the component does not any changes since the peer is last painted.) *
51       * @return true if component has no display changes since the peer is last painted.
52       */
53      public final boolean isUpToDate()
54      {
55          return _upToDate;
56      }
57  
58      /***
59       * Set the peer up-to-date status to b
60       * @param b new up-to-date status
61       */
62      public final void setUpToDate(boolean b)
63      {
64          _upToDate = b;
65      }
66  
67      /***
68       * Whether the dimension has changed since last render
69       * @return true if changed
70       */
71      public final boolean isDimensionChanged()
72      {
73          return _isDimensionChanged;
74      }
75  
76      /***
77       * Set whether the dimension has changed since last render
78       * @param b whether the dimension changed
79       */
80      public final void setDimensionChanged(boolean b)
81      {
82          _isDimensionChanged = b;
83      }
84  
85      /***
86       * {@inheritDoc}
87       */
88      protected void selfProcessInput(BridgeInputContext context,
89              Object inputObject)
90      {
91          throw new UnsupportedOperationException("selfProcessInput is not supported");
92      }
93  
94      /***
95       * {@inheritDoc}
96       */
97      protected void selfRender(BridgeRenderContext context, Object renderObject)
98      {
99          throw new UnsupportedOperationException("selfProcessInput is not supported");
100     }
101     
102 }