Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1003 / install / IzPack / sample / src / Scrambler.java @ 41653

History | View | Annotate | Download (2.22 KB)

1
/*
2
 * $Id: Scrambler.java 5819 2006-06-14 07:29:09Z cesar $
3
 * Copyright (C) 2003 Elmar Grom
4
 *
5
 * File :               Scramble.java
6
 * Description :        Example code for an encryption service
7
 * Author's email :     elmar@grom.net
8
 * Author's Website :   http://www.izforge.com
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
 */
24

    
25
package   com.izforge.izpack.sample;
26

    
27
import    com.izforge.izpack.panels.*;
28

    
29
/*---------------------------------------------------------------------------*/
30
/**
31
 * This class provides a demonstration for using an encryption service in
32
 * connection with a <code>RuleInputField</code>, as used in a
33
 * <code>UserInputPanel</code>.
34
 *
35
 * @version  0.0.1 / 02/19/03
36
 * @author   Elmar Grom
37
 */
38
/*---------------------------------------------------------------------------*/
39
public class Scrambler implements Processor
40
{
41
 /*--------------------------------------------------------------------------*/
42
 /**
43
  * Rearranges the input fields and concatenates the result, separating
44
  * individual fields with a '*'.
45
  *
46
  * @param     client   the client object using the services of this encryptor.
47
  *
48
  * @return    the encryption result.
49
  */
50
 /*--------------------------------------------------------------------------*/
51
  public String process (ProcessingClient client)
52
  {
53
    StringBuffer buffer = new StringBuffer ();
54
    
55
    for (int i = client.getNumFields () - 1; i > -1; i--)
56
    {
57
      buffer.append (client.getFieldContents (i));
58
      if (i > 0)
59
      {
60
        buffer.append ('*');
61
      }
62
    }
63
    
64
    return (buffer.toString ());
65
  }
66
}
67
/*---------------------------------------------------------------------------*/