JCVSConfirmation.java :  » Source-Control » jcvsweb » com » ice » jcvsweb » bean » Java Open Source

Java Open Source » Source Control » jcvsweb 
jcvsweb » com » ice » jcvsweb » bean » JCVSConfirmation.java

package com.ice.jcvsweb.bean;

import java.util.ArrayList;
import java.util.List;



/**
 * This class is used as a bean for handing options to the "confirmation page".
 *
 * Like this:
 *
 * +-------------------------------------------------------
 * | Do you want to delete the view 'name'?
 * +-------------------------------------------------------
 * |
 * | [icon]  Deleting the view entails removing all
 * |         of the files in the working directory.
 * |
 * + - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 * |
 * |    [icon]  Yes, I want to delete all of the files in
 * |     YES    this view's checked out working directory.
 * |
 * + - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * |
 * |    [icon]  No, I want to keep all of the files in
 * |     NO     this view's checked out working directory.
 * |
 * |
 * |
 * 
 * This is accomodated by creating a list of string arrays
 * each representing an option to select. The string arrays
 * are defined as follows:
 *
 *    [0] The option's large name (e.g., YES)           [required]
 *    [1] The option's action/url                       [required]
 *    [2] The option's icon                             [or null]
 *    [3] The option's inline message                   [or null]
 *
 * The options are ordered as they are added.
 *
 * @author Tim Endres, <a href="mailto:time@jcvs.org">time@jcvs.org</a>
 * @see com.ice.cvsc
 */

public
class    JCVSConfirmation
  {
  private String      prompt = null;
  private String      message = null;
  private String      icon = null;
  private List      options = null;


  public
  JCVSConfirmation()
    {
    this.options = new ArrayList();
    }

  public
  JCVSConfirmation( String prompt, String iconPath, String message )
    {
    this.prompt = prompt;
    this.message = message;
    this.icon = icon;
    this.options = new ArrayList();
    }

  public void
  addOption( String name, String action, String icon, String msg )
    {
    String[] sa = new String[ 4 ];
    sa[0] = name;
    sa[1] = action;
    sa[2] = icon;
    sa[3] = msg;
    this.options.add( sa );
    }

  public String
  getPrompt()
    {
    return this.prompt;
    }

  public void
  setPrompt( String prompt )
    {
    this.prompt = prompt;
    }

  public String
  getIcon()
    {
    return this.icon;
    }

  public void
  setIcon( String icon )
    {
    this.icon = icon;
    }

  public String
  getMessage()
    {
    return this.message;
    }

  public void
  setMessage( String message )
    {
    this.message = message;
    }

  public List
  getOptions()
    {
    return this.options;
    }

  public void
  setOptions( List options )
    {
    this.options = options;
    }

  public String
  toString()
    {
    StringBuffer buf = new StringBuffer();

    buf.append( "[ " );
    buf.append( "prompt='" ).append( this.prompt ).append( "', " );
    buf.append( "#options='" ).append( this.options.size() ).append( "', " );
    buf.append( "icon='" ).append( this.icon ).append( "'" );
    buf.append( "message='" ).append( this.message ).append( "'" );
    buf.append( " ]" );

    return buf.toString();
    }


  }

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.