001/* 002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved. 003 * 004 * http://www.izforge.com/izpack/ 005 * http://developer.berlios.de/projects/izpack/ 006 * 007 * Copyright 2003 Elmar Grom 008 * 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 */ 021 022package com.izforge.izpack.sample; 023 024import com.izforge.izpack.panels.ProcessingClient; 025import com.izforge.izpack.panels.Processor; 026 027/*---------------------------------------------------------------------------*/ 028/** 029 * This class provides a demonstration for using an encryption service in 030 * connection with a <code>RuleInputField</code>, as used in a 031 * <code>UserInputPanel</code>. 032 * 033 * @version 0.0.1 / 02/19/03 034 * @author Elmar Grom 035 */ 036/*---------------------------------------------------------------------------*/ 037public class Scrambler implements Processor 038{ 039 /*--------------------------------------------------------------------------*/ 040 /** 041 * Rearranges the input fields and concatenates the result, separating 042 * individual fields with a '*'. 043 * 044 * @param client the client object using the services of this encryptor. 045 * 046 * @return the encryption result. 047 */ 048 /*--------------------------------------------------------------------------*/ 049 public String process (ProcessingClient client) 050 { 051 StringBuffer buffer = new StringBuffer (); 052 053 for (int i = client.getNumFields () - 1; i > -1; i--) 054 { 055 buffer.append (client.getFieldContents (i)); 056 if (i > 0) 057 { 058 buffer.append ('*'); 059 } 060 } 061 062 return (buffer.toString ()); 063 } 064} 065/*---------------------------------------------------------------------------*/