HTML-GUI
view release on metacpan or search on metacpan
lib/HTML/GUI/screen.pm view on Meta::CPAN
return $self;
}
$DB::single = 1;
if ($self->getProp('nextScreenType') eq 'closeDialog'){
$newScreen = HTML::GUI::widget->instantiateFromYAML( $self->getProp('parentScreenDesc'));
$self->executeCallBackHandler($newScreen,'dialogCallBackFunc',$self->getProp('nextScreenParams'));
}else{
$newScreen = HTML::GUI::widget->instantiateFromFile($nextScreenPath);
$self->executeCallBackHandler($newScreen,'openCallBackFunc',$self->getProp('nextScreenParams'));
}
if (!$newScreen){
$self->error("Sorry, a technical problem occured : impossible to load the next screen. Please report this issue to the support.");
return $self;
}
$newScreen->setProp({counter => $self->getProp('counter')});
if ($nextScreenValues){
$newScreen->setValue($nextScreenValues);
}
if ($self->getProp('nextScreenType') eq 'openDialog'){
$newScreen->setProp({parentScreenDesc=>$self->serializeToYAML()});
}
return $newScreen;
}
=pod
=head3 setNextScreen
Parameters :
- $path : the path of the next screen
- $params : hash ref containing the optional params to call the next screen (for example imagine the next screen is customer_info and the param is {customer_id => 254412}
- $values : you can specify all the values you want to feed your screen (in the way you get the values from getValueHash() )
Description :
- determine what is the next screen to display to the user and populate it with the messages and user data
Returns :
- the screen to display to the user ; it can be a new one if needed
=cut
sub setNextScreen{
my($self,$path,$params,$values,$screenType) = @_;
$screenType ||= 'screen';
$self->setProp({nextScreen => $path,
nextScreenType => $screenType,
nextScreenParams => $params || {},
nextScreenValues => $values || {},
loadNextScreen => 1,
});
}
=pod
=head3 openDialog
Description :
- define the next dialog to show to the end user. The difference between a dialog and a screen is that a dialog can be closed (like a popup window).
Parameters :
- $path : the path of the next screen
- $params : hash ref containing the optional params to call the next screen (for example imagine the next screen is customer_info and the param is {customer_id => 254412}
- $values : you can specify all the values you want to feed your screen (in the way you get the values from getValueHash() )
=cut
sub openDialog(){
my($self,$path,$params,$values) = @_;
$self->setNextScreen($path,$params,$values,'openDialog');
}
=pod
=head3 closeDialog
Description :
- close the current dialog. MUST only be called on an dialog screen.
Parameters :
- $params : hash ref containing the optional params that will be used as parameters for the dialogCallBack function.
=cut
sub closeDialog(){
my($self,$params) = @_;
$self->setNextScreen(undef,$params,undef,'closeDialog');
}
=pod
=head3 error
Description :
- Specialization of the error function for all generic messages for the end user
parameters :
- $message : the message to display to the end user
Returns :
- nothing
=cut
sub error($){
my ($self,$message) = @_;
$self->SUPER::error({
visibility => 'pub',
'error-type' => 'business',
'message' => $message,
});
}
#array of properties that must be serialized
my @GHW_publicPropList = qw/parentScreenDesc dialogCallBack/;
=pod
=head3 getDefinitionData
( run in 1.468 second using v1.01-cache-2.11-cpan-364913b4093 )