Hello all,
My application displays part of a list of targets. The part displayed can be changed through the model. How do I make sure that the enhanced list view gets updated. App Structure: MODEL: instance vars: completeList filteredList (both are instances of TargetList which is subclass of OrderedCollection) filtering the list is done with a TargetList>>filter: method which returns a new TargetList so: applyFilter: aFilter filteredList := completeList filter: aFilter Thus the filteredList is not edited inplace. PRESENTER: View1 : shell with enhanced list view on filteredList View2 : shell which allows to change and activate filter PROBLEM: Using View2 the filteredList gets updated (as seen in the inspector), but View1 does not get updated. I tried several things like manually sending a #listChanged signal or subclassing ListModel for my TargetList, but that did not work. What is the correct approach. |
"Frank Sonnemans" <[hidden email]> wrote in message
news:[hidden email]... > Hello all, > > My application displays part of a list of targets. The part displayed > can be changed through the model. How do I make sure that the enhanced > list view gets updated. > > I tried several things like manually sending a #listChanged signal or > subclassing ListModel for my TargetList, but that did not work. What > is the correct approach. Let's try my example based on FilteredListModel. I suppose it correct way :) -- Dmitry Zamotkin begin 666 SimpleFilter.pac M?"!P86-K86=E('P-"G!A8VMA9V4@.CT@4&%C:V%G92!N86UE.B G4VEM<&QE M1FEL=&5R)RX-"G!A8VMA9V4@<&%X5F5R<VEO;CH@,#L-"@EB87-I8T-O;6UE M;G0Z("<G+@T*#0IP86-K86=E(&)A<VEC4&%C:V%G959E<G-I;VXZ("<G+@T* M#0HB061D('1H92!P86-K86=E('-C<FEP=',B#0H-"B)!9&0@=&AE(&-L87-S M(&YA;65S+"!L;V]S92!M971H;V0@;F%M97,L(&=L;V)A;"!N86UE<RP@<F5S M;W5R8V4@;F%M97,B#0IP86-K86=E(&-L87-S3F%M97,-"@EA9&0Z("-&:6QT M97)E9$QI<W1-;V1E;#L-"@EA9&0Z("-3:6UP;&5,:7-T36]D96Q3:&5L;#L- M"@EY;W5R<V5L9BX-"@T*<&%C:V%G92!M971H;V1.86UE<PT*"7EO=7)S96QF M+@T*#0IP86-K86=E(&=L;V)A;$YA;65S#0H)>6]U<G-E;&8N#0H-"G!A8VMA M9V4@<F5S;W5R8V5.86UE<PT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<R-C$W.3%",# P,# P,# P,# P,# P,# P,# P M,$,R,# P,# P,#(P,# P,# P,3 P.44P,3 Q,# P,C P-C P,# P,# P,# P M,# P,# P,# P,# P,# P,# P,# P-S R,# P,# P,# P,# P,# P,# P,# P M,# P,# P,# P,# P,# P,#8P-S!#,# T,C9&-S(V-#8U-S(T0S8Q-SDV1C<U M-S0P,# P,# P,# Q,# P,# P,#$P,# P,# P,# P,# P,#5!,# P,# P,# P M,# P,# W03 P,# P,# P,# P,# P03 P,# P,# Y,C P,# P,# X,# P,# P M-30V-3<X-S0T-38T-CDW-$,R,# P,# P,3 P,# P,# P,# P,# P,#8P,# P M,# P0S(P,# P,# P,C P,# P,#,V,# P0S P-$,V,3<R-C<V-30Y-D4W-#8U M-C<V-3<R,#0P,# P,# X,# P,#$T-# Q,#0P,# P,3 P,3 P,# P,# P,# P M,# P,# P,# P,# P,# P,# P-S P,# P,# P,# P,# P,# P,# P,# P,# P M,# P,# P,# P,# P,# P,# P,# V,C Q,# P,# X,# P,# P1C)%.#0T.# P M,# P,# P,# V,#(P1# P-$4W-39#-D,T,S9&-D4W-C8U-S(W-#8U-S(P,# P M,# P,# P,# P,# P,# P,# P,# P-3 P,# P,# V,#$P1C P-$0V-3<S-S,V M,38W-C4U,S8U-S$W-38U-D4V,S8U,# P,# P,# P13 R,3(P,#4S-30T,C0S M-D8V0S9#-C4V,S<T-CDV1C9%-3 W,C9&-S@W.3 P,# P,# P-T$P,# P,# P M,# P,# P,$$P,# P,# P.3(P,# P,# Q,3 P,# P,#1&-S(V-#8U-S(V-38T M-#,V1C9#-D,V-38S-S0V.39&-D5#,C P,# P,# S,# P,# P,#8P,S!",# T M1#8U-S,W,S8Q-C<V-34S-C4V138T,# P,# P,# P13 Q,$4P,#4S-30T,C4S M-SDV1#8R-D8V0S4P-S(V1C<X-SDP,# P,# P,#DR,# P,# P,3 P,# P,# V M,S<R-C4V,3<T-C4T,3<T,T$V-3<X-S0V-39%-S0S04,R,# P,# P,#(P,# P M,# P-C R,#4P,#4P-D8V.39%-S0P,# P,# P,# Q,# P,# P1D(P,3 P,# X M,C R,# P,# P,# P,# P.48P,3 P,# S,S P,# P,#$P,#$P,# P,C(P,C P M,# P,# P,# P,#1!,#(P,# P,# P,# P,# Y,C P,# P,#!&,# P,# P-S,V M-39#-C4V,S<T-CDV1C9%-3(V,39%-C<V-3-!0S(P,# P,# P,3 P,# P,# V M,#,P.# P-#DV13<T-C4W,C<V-C$V0S P,# P,# P,#,P,# P,# P,3 P,# P M,# S,# P,# P,3 P,3 P,# R,C R,# P,# P,# P,# P-$$P,C P,# P,# P M,# P,#DR,# P,# P,$8P,# P,# V.3<S-30V-3<X-S0T1#9&-C0V.38V-CDV M-38T,T%#,C P,# P,# Q,# P,# P,C P,# P,# Q,# Q,# P,# V,#$P1C P M-3<T.31%-#0T1C4W-3 T0S0Q-#,T-31$-#4T134T,# P,# P,# S-C P,#DP M,#0R-SDW-#8U-#$W,C<R-C$W.3)#,# P,# P,D,P,# P,# P,# P,# P,# Q M,# P,# P1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D8P,# P,# P M,$9$,# P,# P0T8P,# P,# Q-C Q,# P,$1!,#$P,# P,# P,# P,#!&,# Q M,# P,$,R,# P,# P,# P,# P,# X,C R,# P,# P,# P,# P0S$P,# P,#!# M,3 P,# P,# P,# P,# P,3,P,# P,# P,# P,# P,# P,# P,# P-4$P,# P M,# P,# P,# P,#=!,# P,# P,# P,# P,#!!,# P,# P,#DR,# P,# P,#<P M,# P,# T0S8Y-S,W-#0R-D8W.$,R,# P,# P,3$P,# P,# P,# P,# P,#8P M,# P,# P0S(P,# P,# P,C P,# P,#8R,#$P,# P,#0P,# P,# P,3 Q,S$T M-# Q,#0P,# P0S P,S P,# T-C S,#DP,# R,# P,# P-$,V.3<S-S0T1#9& M-C0V-39#,# P,# P,#!$03 Q,# P,# P,# P,# P1C P,3 P,#!!,# S,# P M,# P,# P,# P,#8P,#$T,# T.38T-C4V13<T-CDW-#<Y-3,V-38Q-S(V,S8X M-3 V1C9#-CDV,S<Y,# P,# P,# P,# P,# P,# P,# P,# P,#<P,# P,# P M,# P,# P,# P,# P,# P,# P,# P,# P,# P,# P,# P,# P,# P-C(P,3 P M,# P.# P,# P,# X13DT-#@P,# P,# P,# W03 P,# P,# P,# P,# P03 P M,# P,# Y,C P,# P,#$Q,# P,# P-#(V,3<S-CDV,S1#-CDW,S<T-#$V,C<S M-S0W,C8Q-C,W-# Q,# P,# P,C P,# P,#!",C Q,# P,# P,# P,# P1$$P M,3 P,# P,# P,# P,$8P,#$P,# P0S(P,# P,# P,C P,# P,#(R,#(P,# P M,# P,# P,# U,# R,# P,$,R,# P,# P,#(P,# P,# X,C R,# P,# P,# P M,# P,#$P,# P,# P,3 P,# P,#@R,#(P,# P,# P,# P,# Y1C Q,# P,$9" M,#$P,# P0S P,S P,# R,C R,# P,# P,# P,# P-$$P,C P,# P,# P,# P M,#DR,# P,# P,3$P,# P,# V.#9&-S(V.3=!-D8V13<T-C$V0S0U-S@W-#8U M-D4W-#-!0S(P,# P,# P,3 P,# P,# Q,# P,# P0S P,S P,# U,C S,# P M,# P,# P,# P-S(P,S P,# R0S P,# P,#)#,# P,# P,# P,# P,# P,3 P M,# P,$9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&,# P,# P,# P M,# P,# P,$-&,# P,# P1D0P,# P,#!$03 Q,# P,# P,# P,# P1C P,3 P M,#!!,# S,# P,$(P,#,P,# P,# P,# P,# Q,S P,# P,#!%,#(Q03 P-3,U M-#0R-#DV-#8U-D4W-#8Y-S0W.30T-CDV,S<T-CDV1C9%-C$W,C<Y-3 W,C9& M-S@W.3 P,# P,# P-T$P,# P,# P,# P,# P,$$P,# P,# P.3(P,# P,# Q M,C P,# P,#0Y-C0V-39%-S0V.3<T-SDT-#8Y-C,W-#8Y-D8V138Q-S(W.4,R M,# P,# P,#0P,# P,# Q,# Q,# P,#DR,# P,# P,#8P,# P,# V-C8Y-D,W M-#8U-S)#,# S,# P,#DR,# P,# P,#0P,# P,# V0S8Y-S,W-# P,# P,# P M,# P,# P,# P,# P,# P,# P,# P,# P,# P,# P,# P,3 P,# P,# P,# P M,# P,# P,# P,# P,# P,# P,# P,# P,# P,#$P,# P,# P,# P,# P,# P M,# P,# P0C(P,3 P,# P,# P,# P,$1!,#$P,# P,# P,# P,#!&,# Q,# P M,$,R,# P,# P,#,P,# P,# R,C R,# P,# P,# P,# P-3 P,C P,#!#,C P M,# P,# R,# P,# P.#(P,C P,# P,# P,# P,#!",# P,# P,$(P,# P,# X M,C R,# P,# P,# P,# P048P,3 P,# V,S R,# P,#8P,# P,# P,C(P,C P M,# P,# P,# P,#1!,#(P,# P,# P,# P,# Y,C P,# P,# U,# P,# P-S0V M-3<X-S0S04,R,# P,# P,#$P,# P,# Y,C P,# P,#!#,# P,# P-#8V.39# M-S0V-3<R,C V.3<T,D4R13)%-C P,# P,# R,C R,# P,# P,# P,# P-$$P M,C P,# P,# P,# P,#DR,# P,# P,#@P,# P,# V1#8U-D4W-30R-C$W,C-! M0S(P,# P,# P,3 P,# P,# P,# P,# P-C P,# P,# U,C S,# P,# P,# P M,# P-S(P,S P,# R0S P,# P,#)#,# P,# P,# P,# P,# P,# P,# P,$9& M1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&1D9&,#4P,# P,# P-3 P,# P M,$1#,# P,# P,S8P,3 P,#!$03 Q,# P,# P,# P,# P1C P,3 P,#!#,C P M,# P,# R,# P,# P0S P,S P,# Q,# Q,# P,$(P,#,P,# P,# P,# P,# Q M-3 P,# P,#0V,#4P-# P,#,P,# P,# T.38S-D8V13 P,# P,# P,# P,# P M,# Q,# P,# P,#!%,#(Q,3 P-3,U-#0R-3,V.39%-C<V0S8U-S0V1C9%-3 W M,C9&-S@W.3 P,# P,# P-$4P,C!$,# P,3 P,# P,#4S-30T,C0S-D,V,3<S M-S,U,#<R-D8W.#<Y,# P,# P,# S-C P,#8P,#4S-S0W,C8Y-D4V-S W,# P M,# P-#0V1C9#-S V.#8Y-D4Q,C Q,# P,#$X,# P,# P-#DV1#8Q-C<V-34R M-C4V0S8Q-S0V.3<V-C4T-C8Y-D,V-31#-D8V,S8Q-S0V1C<R,$4P,3!%,# U M,S4T-#(U,S<Y-D0V,C9&-D,U,#<R-D8W.#<Y,# P,# P,# Q,C Q,# P,# W M,# P,# P-C,W-3<R-S(V-39%-S0Q,C Q,# P,#!$,# P,# P-3,V.#8U-D,V M0S4V-CDV-3<W,D4V.38S-D8P13 R,48P,#4S-30T,C0U-S@W-#8U-S(V138Q M-D,U,C8U-S,V1C<U-S(V,S8U-$,V.38R-S(V,3<R-SDU,#<R-D8W.#<Y,# P M,# P,# Q,C Q,# P,#$P,# P,# P-C0V1C9#-S V.#8Y-D4V-#<R,S S,#,T 8,D4V-#9#-D,P,# P,# P,"<I*2$-"@T* ` end |
In reply to this post by Frank Sonnemans-2
Frank,
You need to know when the filteredList is changed so make the model's method - applyFilter: aFilter filteredList := completeList filter: aFilter. self trigger: #filteredListChanged If there are any other methods that can change the filtered list then they will have to be altered to either use a common method in your model that triggers the event or trigger the same event themselves. -~-~-~ Short detour One other thing that can catch you out here. The ListPresenter can be a bit sniffy about updating it's view if it doesn't think it needs to. If you change the _contents_ of an collection object rather than changing the object itself, resorting or removing for instance, then the ListPresenter probably won't update. a := #(1 2 3 4 5) asOrderedCollection. lp := ListPresenter show. lp list: a. a remove: 1. lp list: a The Presenter will still show 1,2,3,4,5 as the Model (see ListModel>>list) doesn't think the list has changed *even though it's contents have*. Replace the last line above with "lp list: a copy" and all is OK. The upshot of this is that if your #filter: method doesn't answer a new collection instance (which is unlikely in this case but you never know) then you will have to make the model's accessor do it. filteredList ^filteredList copy [[Looking again at you post makes me wonder if this might not be the cause anyway - it depends on how you are currently doing the update. Before changing anything else try making your model always answer a *copy* of filteredList - you never know]] -~-~-~ You then need to change/add a couple of things in the Presenter - createSchematicWiring [...] self model when: #filteredListChanged send: #onFilteredListChanged to: self onFilteredListChanged self aListPresenter list: self model: filteredList > instance vars: completeList filteredList (both are instances of > TargetList which is subclass of OrderedCollection) Hmmm, I'm not sure about this bit. IMHO subclassing the "Basic" Collection classes is not usually a good idea - aggregation is normally better. > I tried several things like manually sending a #listChanged signal or > subclassing ListModel for my TargetList, but that did not work. What > is the correct approach. There are other ways. The most common would be to use a ListModel in your model to hold the filteredCollection, You can then share that model between the ListPresenter and your model to get automatic updating. This technique can lead to problems though - if the ListPresenter resorts the list for example. You might also be able to subclass ListModel - as Dimitry showed - but you might run into problems again with the tight coupling between Presenter and Model. Ian |
Free forum by Nabble | Edit this page |