Gapp

 view release on metacpan or  search on metacpan

lib/Gapp/Form/Context.pm  view on Meta::CPAN

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
    $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

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    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

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
        $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

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
    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;
    



( run in 0.600 second using v1.01-cache-2.11-cpan-49f99fa48dc )