ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/conient/uk/org/iscream/cms/conient/datacomponents/StringDataComponent.java
(Generate patch)

Comparing projects/cms/source/conient/uk/org/iscream/cms/conient/datacomponents/StringDataComponent.java (file contents):
Revision 1.14 by ajm, Thu Mar 15 01:05:46 2001 UTC vs.
Revision 1.19 by tdb, Tue May 21 16:47:10 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * http://www.i-scream.org.uk
4 + * Copyright (C) 2000-2002 i-scream
5 + *
6 + * This program is free software; you can redistribute it and/or
7 + * modify it under the terms of the GNU General Public License
8 + * as published by the Free Software Foundation; either version 2
9 + * of the License, or (at your option) any later version.
10 + *
11 + * This program is distributed in the hope that it will be useful,
12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 + * GNU General Public License for more details.
15 + *
16 + * You should have received a copy of the GNU General Public License
17 + * along with this program; if not, write to the Free Software
18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + */
20 +
21   //---PACKAGE DECLARATION---
22 < package uk.org.iscream.conient.datacomponents;
22 > package uk.org.iscream.cms.conient.datacomponents;
23  
24   //---IMPORTS---
25   import javax.swing.JLabel;
26   import javax.swing.JTextField;
27   import java.awt.GridLayout;
28   import javax.swing.SwingUtilities;
29 + import uk.org.iscream.cms.server.util.XMLPacket;
30  
31   /**
32   * This is the most basic of DataComponents.
# Line 52 | Line 73 | public class StringDataComponent extends VisibleDataCo
73          _item.setText("-uninitialised-");
74          add(_label);
75          add(_item);
76 +        setVisible(false);
77      }
78  
79   //---PUBLIC METHODS---
# Line 63 | Line 85 | public class StringDataComponent extends VisibleDataCo
85       * run this method.
86       */
87      public void run() {
88 <        _item.setText(_cache);
88 >        if(!isVisible()) {
89 >            setVisible(true);
90 >        }
91 >        _item.setText(_cache);
92      }
93      
94      /**
# Line 81 | Line 106 | public class StringDataComponent extends VisibleDataCo
106   //---ACCESSOR/MUTATOR METHODS---
107  
108      /**
109 <     * This takes the String value of the parameter that this component
85 <     * is monitoring direct from the packet, it then performs all
109 >     * This takes the packet to obtain the value from, it then performs all
110       * approriate conversions and adds this class to the Swing Event
111       * Dispatching queue.
112       *
113 <     * @param value the value for this data component
113 >     * @param packet the XMLPacket to get the data from
114       * @throws DataFormatException if there was a problem converting the data for display
115       */
116 <    public void setValue(String value) throws DataFormatException {
116 >    public void setValue(XMLPacket packet) throws DataFormatException {
117 >        String value = packet.getParam(_attribute);
118          try {
119              if(!_cache.equals(value)) {
120                  _cache = value;
# Line 138 | Line 163 | public class StringDataComponent extends VisibleDataCo
163      protected JLabel _label;
164      
165      /**
166 <     * Remebers what the last value was, so we
166 >     * Remembers what the last value was, so we
167       * only update if we have to.
168       */    
169 <    String _cache = "";
169 >    protected String _cache = "";
170      
171      /**
172       * The length of the JTextField

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines