view - GWT & MVP - Best practices for displaying/editing complex objects? -
all gwt / mvp examples i've learned seem simplistic give clear view best practises regarding displaying , handling more complex model objects.
for example, examples presenter attaches click handler few textboxes on view...if save clicked, presenter's save() called gets updated values, , we're done, mvp style. that's not realistic though.
for example, let's have:
presenterx - gets 'model' object, let's object unknown number of various primitives or whatever
viewx - should show model object in table, and/or allows edited/re-saved
...so sounds very, basic. but, don't know amount of fields in model object need display. might relate dynamic number of rows/columns. no problem table...but how should presenter give view's table? model object view understands, or break down bunch of lists...that view still has understand.
also, fields might editable, of unknown until model object (something in model determines fields editable, say) -- should responsible figuring out editable or not? presenter, how refelct in view, mvp way?
lastly, let's there's 'save' button on view...who's job figure out rows in table changed?
seems me view either needs understand model more, or presenter needs understand view more -- neither of nice mvp :( ... or perhaps there should intermediary object.
i know there nicer/newer helpful ways kind of stuff (editors/requestfactory, etc.), i'm looking suggestions on above scenarious.
as understand it, mvp line m-p-v points. p interacts both, m , v p.
also, 1 of design objectives of mvp have testable p , m, means v must replaceable mock version. so, v should not expose implementation-dependent interfaces (e.g. hasclickhandlers
instead of button
).
now, if v should show generic table, should create generic methods: addcolumn(..)
define columns , addrow(..)
add data. new celltable
pretty flexible , supports adding columns dynamically.
about changes - v should notify, p should act. also, there new editors
, imho not fit nicely mvp, supposed easy use.
Comments
Post a Comment