Gapp
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Gapp/Form/Context.pm view on Meta::CPAN
$self->meta->throw_error( 'you must supply a value' ) if @_ <= 2;
my ( $name, $attr ) = split /\./, $path;
my $node = $self->get_node( $name );
return if ! $node;
$node->modify( $attr, $value );
# $self->_value_changed( $path, $value ) if ! $self->in_update( $path );
}
sub update {
my ( $self, $stash ) = @_;
for my $path ( $stash->elements ) {
next if $path eq '';
my $value = $stash->fetch( $path );
# $self->set_in_update( $path, 1 );
$self->modify( $path, $value );
# $self->set_in_update( $path, 0 );
}
}
sub update_from_stash {
my $self = shift;
use Carp qw( cluck );
cluck '$cx->update_from_stash( $stash ) deprecated, use $cx->update( $stash )';
$self->update( @_ );
}
1;
lib/Gapp/Form/Stash.pm view on Meta::CPAN
default => 0,
);
# if the context has updated the stash
after 'store' => sub { $_[0]->set_modified(1) };
after 'delete' => sub { $_[0]->set_modified(1) };
sub update {
my ( $self, $cx ) = @_;
for my $field ( $self->elements ) {
try {
my $value = $cx->lookup( $field );
$self->store( $field, $value );
}
}
$self->set_modified( 0 );
}
sub update_from_context {
my $self = shift;
use Carp qw( cluck );
cluck '$stash->update_from_context( $cx ) deprecated, use $stash->update( $cx ) instead';
$self->update( @_ );
}
1;
lib/Gapp/Meta/Widget/Native/Role/FormField.pm view on Meta::CPAN
$self->on_change->( $self ) if $self->on_change;
}
}
before _apply_signals => sub {
my ( $self ) = @_;
$self->_connect_changed_handler if $self->can('_connect_changed_handler');
};
sub update {
my ( $self ) = @_;
$self->set_is_updating( 1 );
$self->stash_to_widget( $self->form->stash ) if $self->field;
$self->set_is_updating( 0 );
}
sub enable {
my ( $self ) = @_;
$self->gobject->set_sensitive( 1 );
lib/Gapp/Meta/Widget/Native/Trait/Form.pm view on Meta::CPAN
my $stash = $self->stash;
for my $w ( $self->find_fields ) {
$stash->store( $w->field, undef ) if ! $stash->contains( $w->field );
}
$stash->set_modified( 0 );
}
# update the values in the form
sub update {
my ( $self ) = ( @_ );
# update the stash if we have a context
$self->stash->update( $self->context ) if $self->context;
# update the widgets from the stash
$self->update_from_stash;
}
# update the values in the form (don't update the stash first)
sub update_from_stash {
my ( $self ) = @_;
# update the values in the form
for my $w ( $self->find_fields ) {
$w->set_is_updating( 1 );
$w->stash_to_widget( $self->stash ) if $w->field;
$w->set_is_updating( 0 );
}
}
sub update_stash {
my ( $self ) = shift;
warn '$form->update_stash deprecated, use $form->sync_stash';
$self->sync_stash( @_ );
}
sub sync_stash {
my ( $self ) = @_;
my $stash = $self->stash;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.701 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )