Posts Tagged ‘Direct2CP’

Motorola Mobility’s Ninja HTML5 framework, that was unveiled mid-2012, however without new references since many months, was replaced by Google Web Designer, an Adobe Edge/Apple iAd Producer like HTML5 ads builder, then with limited scope (no more a rich internet applications builder). The Montage HTML5 framework (that was the basis for Ninja HTML5) is still available (open source).

We can find more details in this greatly written article, that underlines that there isn’t any HTML5 web applications solution (framework and builder) available (GWT is old, not HTML5 focused and no more driven by Google), only basic tools and low level frameworks (jQuery, angularJS, BackboneJS, Twitter Bootstrap).

We can however still use Cappuccino and Apple’s XCode/Interface Builder to build applications such as or (using Direct2CP’s solution mda approach allowed building these easily even without IB).

In fact all single page/anonymous div based frameworks can easily use HTML5 features when required, by extending existing components. That is adding/generating new doms elements (and/or new css values) to components. Cappuccino still uses CSS3 for Popover and other areas, while Direct2CP components wrap HTML5 audio and video tags (also use CSS3 animations) and new upload features.

Then a whole new HTML5 framework would not provide more (as many features aren’t HTML5 specific), at least a true HTML5 framework would be replacing all anonymous divs by WebGL elements (that is wrapping these in components) for rendering (HTML5 also provides features that aren’t display related, like storage).

A 1.1 update to Direct2CP is available :

– fixed state problem in EMZenView (was in canplay state when switching song – should be buffering state) that prevented play.

– added deferred mode in DCMasterDetailView (createDeferredForEndpoint) : if true numberOfRows returns 0 immediately( without calling the synch remote method). It is reset to false when calling setCriteria, setSortDescriptorsStr or reset.

Emotuned application (free music platform for composers, see here) now uses press (350 KB for the application .sj) and the new deffered mode for the master detail views (that is only one request is sent initially, for the main store tab – no requests for empty table views from other tabs). Performance is now related to the hosting provider.

Direct2CP available

Posted: April 20, 2012 in IT/Dev
Tags: , , , , , ,


Direct2CP is available.

This new version of CP2JavaWS brings the following features and enhancements :

– Added support for php on the server side (not yet full php objects encoding/decoding, only CPDictionary and CPArray encoding/decoding to anonymous php objects), including digest authentication.
– Added easy forms creation by code, including validation management (local and remote validation methods) with automatic error messages display.
– full support for exceptions and errors.
– support for complex nested master detail views (forms views can be used as detail views, and even composite detail view is allowed, for example a detail view that contains both a form view and another master detail view).
– enhancements and fixes in master view : technical id column can now be hidden, columns labels and sizes can be set, master/detail layout split can be horizontal besides vertical, fixed in transient wrong values when sorting in Firefox (now asynch read), fixed additional triggered selection after master view element selection (now asynch read).
– endpoint’s url can now be relative.
– support mix of java and php endpoints (separate tracking of java sessionid and php sessionid)
– generic dao service for php and connection factory
– fix in decoder for null dictionary or array properties
– fix in request parameters (now urlencoded – required for special chars like + or = used in encrypted values, criterias or text content)
– support aes encryption for form fields
– window controller for password reset
– fixed log errors for xhr’s non allowed (and not useful) request headers (content-length, connection) or unsafe ones (set-cookie)
– added paged grid collection view
– added drop upload controller (compatible with Safari 4, Safari 5.1, Firefox)
– added css3 based Zen html5 audio player (including fixes for Firefox)

The RC2 of Ext JS 3.0, unveiled last June, 3 (that was just one day after the 0.7 version of CP2JavaWS, that brought management for automatic asynchronous and buffered remote access for TableView) provides a CRUD mode that is close to CP2JavaWS’s Direct2CP one (presented last July, 14, and completed August, 2 – I wasn’t aware of Ext JS new features at that time).

Using Ext JS we create a Reader object (manages deserializing/JSON to fields mapping), Writer (for serializing/fields to JSON mapping) and Store object (url of remote programs that manage read, create, update and delete). We can see examples here and there (RESTFull store), and simpler examples wihout server backend (Dynamic Form and binding from a local xml file). On the Proxy object we can also specify an index range (autoLoad), that allows buffered access (Buffer Grid).

The Ext JS architecture ensures a good separation and provides advanced customization of rendering and behaviours for master and detail views. However CP2JavaWS provides these specific features :

  • only one line of code needed to create a fully working CRUD master/detail view (see here the required code when using Ext JS), automatic asynchronous and buffered access, sorting, form (detail view) controls that depends from their property type (as with Ext JS’s Dynamic Form). We just have to specify the CP business class name. All of the Ext Js features are accessible from a unique component, that allows same level of customization : columns displayed in the table view, custom detail view if needed, custom remote service if needed (instead of the provided generic DAO service).
  • provides a generic DAO service that doesn’t require any coding or setting on the server side, works on the object level and manages full database access cycle (through Hibernate) – Ext JS’s RESTful Store demo just simulates a database using session. Then CP2JavaWS’s Direct2CP is probably the most suited for a Java backend (instant work without any coding nor config).
  • allows to call directly an existing Java application/business services layer (based on Spring or another container) as it works at object level, and without additional configuration.
  • manages complex objects (objects graphs with nested, heterogeneous collections and references) both on client and server side : it then allows to display/edit any nested property, using paths, and the generic detail view creates an editing field for all of these nested objects attributes. Next version of CP2JavaWS will allow to specify (restrict) the editables properties in detail view (as we still can for the table view) – for now we can either edit all the object’s graph properties, or pass a custom detail view (has then to manage controls creation).
  • provides management for technical or business (and multiple) key(s), without additional configuration. Hidding of id field(s) depending on the mode and editing step is automatic, as new id affectation.
  • manages retreiving of value/label pairs for combo lists and radio buttons groups (through a remote service or local data).
  • choose automatically proper control from combo lists and radio buttons.
  • completely free (a 329$ license per developper is required for Ext JS).

Moreover CP2JavaWS provides full Digest authentication (Basic only with Ext JS), automatic switch to JSONP if required, and full jsession id tracking per endpoint.

Note : support for in-table editing (instead of using a detail view), still available in Ext JS, will be added soon into Cappuccino’s CPTableView. In fact it is an historical feature of Next/Cocoa’s NSTableView (the proper delegate method is still listed – commented – in CPTableView). In the same way columns reordering is planned.

Ext GWT 2.0 (available since July, 9, and priced the same as Ext JS 3.0) includes the new buffered Grid View, Row Editor, and still allowed (thanks to its generation step) to easily add Java CRUD management on the server side. However we still have to write a lot of code (see the source code of GXT Grid Store Data Binding example – also not faster to load than a CP application) and we are then stick with GWT limitations compared with Cappuccino :

  • requires a generations step (not elegant and less smooth development cycle), whose generator isn’t open source,
  • generated javascript very hard to deep debug,
  • based on the old Swing components model (very limited compared with Cocoa concepts),
  • does not allow integrating with Cappuccino (we then lack high level features like evolved graphics engine, undo/redo, drag&drop, advanced and automatic layout management, delegation chain and powerful runtime, etc.).

By using Ext JS 3.0 (pure javascript), integration with Cappuccino is more likely, however it is of very limited interest from the previous statements (and CP2JavaWS’s Direct2CP mode still is built on top of standard/expected Cocoa delegate methods).

CP2JavaWS_direct2CPA new version of CP2JavaWS is available. It completes the master/detail view(Direct2CP) :

– added automatic support for creation/insert (add button) and delete in generic detail view, with full state management.

– added management for business key(s) in master and detail views, besides technical one. Moreover the business key can be multiple (composite). The detail view allows to set these key elements at creation time (once). If using a technical key, it is set by the database (sequence, identity, etc.) and retrieved/displayed back in the detail view after creation.

– added support for combo lists and radio buttons : through codes/labels descriptors we can associate codes/labels pairs with an attribute (its detail view field). That collection can be setted in the client side or retrieved using a specified remote service (useful for long lists read from a database, and for localization).

– added the innovative DatePicker component from Randall Luecke (RCL concepts) as date field editing (requires some provided images resources).

– master and detail views can use the generic DAO service (typically for services backed by a relational database) or custom ones (read elements, read one element, update, insert, delete) if using a specific datastore or connector.
The master/detail view provides then 4 modes : generic detail view with generic DAO service or custom service, or custom detail view with generic DAO service or custom service.

– the HTTP requests sender now behaves as expected when using synchronous requests : the result is returned (does not use anymore a delegate and handlers).

masterDetailViewA new version of CP2JavaWS is available. Besides enhancements for CPTableViewDelegate and bug fixes, it brings a Direct2CP mode (Direct2Java like for CP client), that allows to display a Master/Detail view, by simply providing the CP elements class name (and additional selection criteria for the master table if needed) :

– 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).