gui.dialog
Class CaptchaContentPane

java.lang.Object
  extended by gui.dialog.DialogContentPane
      extended by gui.dialog.CaptchaContentPane
All Implemented Interfaces:
IPaymentListener, DialogContentPane.IWizardSuitable, IDialogOptions, JAPHelpContext.IHelpContext, java.util.EventListener

public class CaptchaContentPane
extends DialogContentPane
implements DialogContentPane.IWizardSuitable, IPaymentListener

This class displays a dialog for solving a captcha.

Author:
Tobias Bayer

Nested Class Summary
private  class CaptchaContentPane.MyDocument
           
 
Nested classes/interfaces inherited from class gui.dialog.DialogContentPane
DialogContentPane.CheckError, DialogContentPane.IWizardSuitable, DialogContentPane.IWizardSuitableNoWizardButtons, DialogContentPane.Layout
 
Field Summary
private  java.lang.String m_beginsWith
           
private  IImageEncodedCaptcha m_captcha
           
private  ICaptchaSender m_captchaSource
           
private  javax.swing.JLabel m_imageLabel
           
private  byte[] m_solution
           
private  java.lang.Object m_syncObject
           
private  javax.swing.JTextField m_tfSolution
           
private static java.lang.String MSG_CAPTCHAERROR
           
private static java.lang.String MSG_SOLVE
           
private static java.lang.String MSG_TITLE
          Messages
private static java.lang.String MSG_WRONGCHARNUM
           
 
Fields inherited from class gui.dialog.DialogContentPane
BUTTON_OPERATION_WIZARD, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_EMPTY, DEFAULT_BUTTON_HELP, DEFAULT_BUTTON_KEEP, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_OK, DEFAULT_BUTTON_YES, MSG_CANCEL, MSG_FINISH, MSG_NEXT, MSG_NO, MSG_OK, MSG_OPERATION_FAILED, MSG_PREVIOUS, MSG_SEE_FULL_MESSAGE, MSG_YES, ON_CANCEL_DISPOSE_DIALOG, ON_CANCEL_HIDE_DIALOG, ON_CANCEL_SHOW_NEXT_CONTENT, ON_CANCEL_SHOW_PREVIOUS_CONTENT, ON_CLICK_DISPOSE_DIALOG, ON_CLICK_DO_NOTHING, ON_CLICK_HIDE_DIALOG, ON_CLICK_SHOW_NEXT_CONTENT, ON_CLICK_SHOW_PREVIOUS_CONTENT, ON_NO_DISPOSE_DIALOG, ON_NO_HIDE_DIALOG, ON_NO_SHOW_NEXT_CONTENT, ON_NO_SHOW_PREVIOUS_CONTENT, ON_YESOK_DISPOSE_DIALOG, ON_YESOK_HIDE_DIALOG, ON_YESOK_SHOW_NEXT_CONTENT, ON_YESOK_SHOW_PREVIOUS_CONTENT
 
Fields inherited from interface gui.dialog.IDialogOptions
MESSAGE_TYPE_ERROR, MESSAGE_TYPE_INFORMATION, MESSAGE_TYPE_PLAIN, MESSAGE_TYPE_QUESTION, MESSAGE_TYPE_WARNING, OPTION_TYPE_CANCEL, OPTION_TYPE_DEFAULT, OPTION_TYPE_EMPTY, OPTION_TYPE_OK_CANCEL, OPTION_TYPE_YES_NO, OPTION_TYPE_YES_NO_CANCEL, RETURN_VALUE_CANCEL, RETURN_VALUE_CLOSED, RETURN_VALUE_NO, RETURN_VALUE_OK, RETURN_VALUE_UNINITIALIZED, RETURN_VALUE_YES
 
Constructor Summary
CaptchaContentPane(JAPDialog a_parentDialog, DialogContentPane a_previousContentPane)
           
 
Method Summary
 void accountActivated(PayAccount acc)
          The active account changed.
 void accountAdded(PayAccount acc)
          An account was added
 int accountCertRequested(MixCascade a_connectedCascade)
          The AI has signaled that the current cascade has to be payed for.
 void accountError(XMLErrorMessage msg, boolean a_bIgnore)
          The AI has signaled an error.
 void accountRemoved(PayAccount acc)
          An account was removed
 DialogContentPane.CheckError[] checkCancel()
          Is called when the "Cancel" button is clicked.
 DialogContentPane.CheckError[] checkNo()
          Is called when the "No" or "Previous" button is clicked.
 DialogContentPane.CheckError[] checkYesOK()
          Is called when the "Yes", "OK" or "Next" button is clicked.
 void creditChanged(PayAccount acc)
          The credit changed for the given account.
 byte[] getSolution()
           
 void gotCaptcha(ICaptchaSender a_source, IImageEncodedCaptcha a_captcha)
          Captcha retrieved
 boolean isSkippedAsNextContentPane()
          If the previous content pane of this one calls moveToNextContentPane(), this content pane may tell him to skip it and move forward to the next one.
 boolean isSkippedAsPreviousContentPane()
          If the next content pane of this one calls moveToPreviousContentPane(), this content pane may tell him to skip it and move forward to the next one.
private  void setCaptcha(IImageEncodedCaptcha a_captcha, java.lang.String a_beginsWith)
           
 
Methods inherited from class gui.dialog.DialogContentPane
addComponentListener, addDialogComponentListener, addDialogWindowListener, checkUpdate, clearStatusMessage, clearStatusMessage, closeDialog, dispose, getButtonCancel, getButtonHelp, getButtonNo, getButtonValue, getButtonYesOK, getContentPane, getDefaultButton, getDefaultButtonOperation, getDialog, getHelpContext, getHelpExtractionDisplayContext, getMessageIcon, getNextContentPane, getPreviousContentPane, getText, getValue, hasNextContentPane, hasPreviousContentPane, hasValidValue, hasWizardLayout, isActive, isAutomaticFocusSettingEnabled, isDialogVisible, isDisposed, isMoveBackAllowed, isMoveForwardAllowed, isVisible, moveToNextContentPane, moveToPreviousContentPane, printErrorStatusMessage, printErrorStatusMessage, printErrorStatusMessage, printStatusMessage, printStatusMessage, removeComponentListener, removeDialogComponentListener, removeDialogWindowListener, setButtonValue, setContentPane, setDefaultButton, setDefaultButtonOperation, setMouseListener, setText, showDialog, updateDialog, updateDialogOptimalSized, updateDialogOptimalSized, validateDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_TITLE

private static final java.lang.String MSG_TITLE
Messages


MSG_SOLVE

private static final java.lang.String MSG_SOLVE

MSG_WRONGCHARNUM

private static final java.lang.String MSG_WRONGCHARNUM

MSG_CAPTCHAERROR

private static final java.lang.String MSG_CAPTCHAERROR

m_tfSolution

private javax.swing.JTextField m_tfSolution

m_solution

private byte[] m_solution

m_captcha

private IImageEncodedCaptcha m_captcha

m_beginsWith

private java.lang.String m_beginsWith

m_imageLabel

private javax.swing.JLabel m_imageLabel

m_syncObject

private java.lang.Object m_syncObject

m_captchaSource

private ICaptchaSender m_captchaSource
Constructor Detail

CaptchaContentPane

public CaptchaContentPane(JAPDialog a_parentDialog,
                          DialogContentPane a_previousContentPane)
Method Detail

checkNo

public DialogContentPane.CheckError[] checkNo()
Description copied from class: DialogContentPane
Is called when the "No" or "Previous" button is clicked. If one or more error occured, they should be returned as CheckErrors to inform the user. In this case, the automatic reaction on the button click is prohibited and getValue() will not change. Overwrite this method to set your own check; it returns null by default. This method should never be called directly and is only used internally.

Overrides:
checkNo in class DialogContentPane
Returns:
errors that prohibit the operation or null or an empty array if the operation is allowed

checkYesOK

public DialogContentPane.CheckError[] checkYesOK()
Description copied from class: DialogContentPane
Is called when the "Yes", "OK" or "Next" button is clicked. If one or more error occured, they should be returned as CheckErrors to inform the user. In this case, the automatic reaction on the button click is prohibited and getValue() will not change. Overwrite this method to set your own check; it returns null by default. This method should never be called directly and is only used internally.

Overrides:
checkYesOK in class DialogContentPane
Returns:
errors that prohibit the operation or null or an empty array if the operation is allowed

checkCancel

public DialogContentPane.CheckError[] checkCancel()
Description copied from class: DialogContentPane
Is called when the "Cancel" button is clicked. If one or more error occured, they should be returned as CheckErrors to inform the user. In this case, the automatic reaction on the button click is prohibited and getValue() will not change. Overwrite this method to set your own check; it returns null by default. This method should never be called directly and is only used internally.

Overrides:
checkCancel in class DialogContentPane
Returns:
errors that prohibit the operation or null or an empty array if the operation is allowed

setCaptcha

private void setCaptcha(IImageEncodedCaptcha a_captcha,
                        java.lang.String a_beginsWith)

getSolution

public byte[] getSolution()

gotCaptcha

public void gotCaptcha(ICaptchaSender a_source,
                       IImageEncodedCaptcha a_captcha)
Description copied from interface: IPaymentListener
Captcha retrieved

Specified by:
gotCaptcha in interface IPaymentListener

isSkippedAsNextContentPane

public boolean isSkippedAsNextContentPane()
Description copied from class: DialogContentPane
If the previous content pane of this one calls moveToNextContentPane(), this content pane may tell him to skip it and move forward to the next one. Returns false by default but may be overwritten by subclasses.

Overrides:
isSkippedAsNextContentPane in class DialogContentPane
Returns:
true if this content pane would like to be skipped as next content pane; false otherwise

isSkippedAsPreviousContentPane

public boolean isSkippedAsPreviousContentPane()
Description copied from class: DialogContentPane
If the next content pane of this one calls moveToPreviousContentPane(), this content pane may tell him to skip it and move forward to the next one. Returns false by default but may be overwritten by subclasses.

Overrides:
isSkippedAsPreviousContentPane in class DialogContentPane
Returns:
true if this content pane would like to be skipped as previous content pane; false otherwise

accountCertRequested

public int accountCertRequested(MixCascade a_connectedCascade)
Description copied from interface: IPaymentListener
The AI has signaled that the current cascade has to be payed for.

Specified by:
accountCertRequested in interface IPaymentListener

accountError

public void accountError(XMLErrorMessage msg,
                         boolean a_bIgnore)
Description copied from interface: IPaymentListener
The AI has signaled an error.

Specified by:
accountError in interface IPaymentListener
a_bIgnore - do not force a user reaction

accountActivated

public void accountActivated(PayAccount acc)
Description copied from interface: IPaymentListener
The active account changed.

Specified by:
accountActivated in interface IPaymentListener
Parameters:
acc - PayAccount the account which is becoming active

accountRemoved

public void accountRemoved(PayAccount acc)
Description copied from interface: IPaymentListener
An account was removed

Specified by:
accountRemoved in interface IPaymentListener
Parameters:
acc - PayAccount the account which was removed

accountAdded

public void accountAdded(PayAccount acc)
Description copied from interface: IPaymentListener
An account was added

Specified by:
accountAdded in interface IPaymentListener
Parameters:
acc - PayAccount the new Account

creditChanged

public void creditChanged(PayAccount acc)
Description copied from interface: IPaymentListener
The credit changed for the given account.

Specified by:
creditChanged in interface IPaymentListener
Parameters:
acc - PayAccount