function configureButtons(this)
% CONFIGUREBUTTONS 

% Author(s): Bora Eryilmaz
% Revised:
% Copyright 1986-2004 The MathWorks, Inc.
% $Revision: 1.1.6.4 $ $Date: 2004/11/18 23:44:24 $

% Get the dialog handle
Dialog = this.Dialog;

% Configure buttons
L = [ handle.listener( handle(Dialog.getHelpButton), ...
                       'ActionPerformed', @LocalHelpButton ); ...
      handle.listener( handle(Dialog.getOkButton), ...
                       'ActionPerformed', @LocalOKButton ); ...
      handle.listener( handle(Dialog.getApplyButton), ...
                       'ActionPerformed', @LocalApplyButton ); ...
      handle.listener( handle(Dialog.getCancelButton), ...
                       'ActionPerformed', @LocalCancelButton ) ];

set(L, 'CallbackTarget', this);
this.Listeners = [this.Listeners; L];

% ----------------------------------------------------------------------------- %
function LocalHelpButton(this, hData)
% Launch the help browser
if isa(this.OptimOptionForm, 'srogui.OptimOptionForm')
  if this.Dialog.getOptimOptionPanel.isVisible
    helpview([docroot '/toolbox/sloptim/sloptim.map'], 'options_opt')
  else
    helpview([docroot '/toolbox/sloptim/sloptim.map'], 'options_sim')
  end;
elseif isa(this.OptimOptionForm, 'speforms.OptimOptionForm')
  if this.Dialog.getOptimOptionPanel.isVisible
    helpview([docroot '/toolbox/slestim/slestim.map'], 'options_opt')
  else
    helpview([docroot '/toolbox/slestim/slestim.map'], 'options_sim')
  end;
end;

% ----------------------------------------------------------------------------- %
function LocalOKButton(this, hData)
% Call the apply callback
isOK = LocalApplyButton(this);

% Call the cancel callback if data update is succesfull
if isOK
  LocalCancelButton(this);
end

% ----------------------------------------------------------------------------- %
function LocalCancelButton(this, hData)
% Close the dialog
awtinvoke(this.Dialog, 'setVisible', false);

% ----------------------------------------------------------------------------- %
function isOK = LocalApplyButton(this, hData)
isOK = setModelData(this);
