french english

RSS 1.0 
 
 Login 
 Password 
 Créer un compte 
 
14-07-09 / 23:09 : CP2JavaWS 0.8 : Direct2CP MasterDetail View (cjed)
Une nouvelle version de CP2JavaWS est disponible. En plus d'améliorations du CPTableViewDelegate et de corrections, elle apporte un mode Direct2CP (inspiré de Direct2Java), qui permet d'afficher une vue de type Master/Detail, en passant simplement la classe des éléments (et les critères de recherche additionnels pour la master table) :

- refactored the request management (mode switch, CPURLConnection/CPJSONP creation, delegate and auth. delegate creation, encoding and decoding) in a new class, CP2JavaWSHttpSender, as it is used by both CPRemoteService and CP2JavaWSTableViewDelegate.

- the CP2JavaWSHttpSender allows to specify if call arguments have to be encoded (CP to js conversion before js to JSON), and if result has to be decoded (js to CP after JSON to js).

- For remote service methods that have generic argument types (Object), we can now pass to the CP2JavaWSHttpSender an array of generic parameters indexes (required as on the Java server side we then cannot discover the generic Object type from the passed parameter value).

- reponses with error code didn't trigger anymore the failHandler since CPURConnection doesn't check anymore for error codes (in order to allow to perform action depending on the error code).

- fixed a problem in Decoder, where empty Date on JS object was setted as undefined on the CP object instead of null, and where JS boolean fields with false value where treated as unset.

- CP2JavaWSTableViewDelegate can now be used in two modes : in the first mode the full CP objects are returned for each requested row (slower but we then still have the full object if we select it for editing in the detail view - then no need for additional read request).

In the second mode the return (for a row) is a tab of values (each value is the final attribute corresponding to the specified attribute path - setted as the column's id), that is faster (attributes paths are passed to the select HQL request - faster than a select *, and no decoding occurs on the client side - result encoding to JSON on the server side is also faster) but requires an additional read for editing. In both cases the displayed values correspond to the columns' ids, and can be nested attributes paths.

- a new object, CP2JavaWSMasterDetailView allows to display and manage automatically a Master/Detail view for a specified CP business class (sort of a Direct2CP, that uses CP2JavaWSTableViewDelegate). We can specify specific attributes paths to display in the master view (tableView), as we may want to display only a few of those (and the whole attributes values in the detail view). If not precised, the master view will display a column for each attribute (the elements CP class ivars are introspected recursively - so we get a column for each nested CP object's attributes).

endPoint1 = [CP2JavaWSEndPoint createForURL:"http://host/appName/endpointName"];
var masterDetailView = [CP2JavaWSMasterDetailView createForEndPoint:endPoint1 elementsClassName:"MyCustomClass" idAttName:"customerId" masterAttributes:["customerId", "name", "age"] criterias:nil rect:CGRectMake(x, y, w, h)];

Depending on the attribute type (string/integer, boolean, date) the detail view adds a CPTextField, CPCheckBox, etc. To use combo lists for some attributes values editing, a next update will allow to specify RemoteValuesListDescriptors, that will store the endpoint (if different) and remote services (if many) that return the corresponding combo lists values.
By clicking on a row in the master view (tableView), the detail view fields are automatically filled. The detail view contains a Modify button, that automatically calls the generic RemoteDAOService to update the object.
We can pass a custom detail view if needed (that will have to implement some delegate methods to fill the editing fields, and use the provided DetailViewDelegate for changes submission).

Note : the Objective-J/preprocess.js (or Frameworks/Objective-J/Objective-J.js) has to be modified using the provided file changes in order to manage ivar types (required for the new MasterDetail view).
Commentaires
Poster un commentaire 
  
    
  image de securisation du formulaire


  
      (sera ajouté après validation)