12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data Model Classes}Set ..%data(n,"Cars") = $RANDOM(100) * scaleSet ..%data(n,"Trucks") = $RANDOM(100) * scaleSet ..%data(n,"Trains") = $RANDOM(100) * scaleSet ..%data(n,"Airplanes") = $RANDOM(100) * scaleSet ..%data(n,"Ships") = $RANDOM(100) * scale}Quit $$$OK}When your data model has multiple series, if you bind the data model to a chart, the chart automatically picks up the variousseries, although you need to be careful with a pie chart. Series work similarly for a grid. A form can only display one seriesat a time, so you need to rely on the data controller attribute defaultSeries to determine which series is currently in view.6.9.9 Custom Data Model Classes%ZEN.DataModel.ObjectDataModel or %ZEN.DataModel.Adaptor are sufficient for most needs. However, sometimes adeveloper might want to create a special category of data model, for example to represent a global. In that case the developermust subclass %ZEN.DataModel.DataModel and implement the details of this subclass.The following table lists methods that applications can call in order to work with a data model object. The behavior of thesemethods is up to the specific %ZEN.DataModel.DataModel subclass that implements them.Table 6–5: Custom Data Model Class MethodsMethod%DeleteModel%OpenModel%SaveModelDescriptionDelete an instance of a data model object given an identifier value. This takes the givenidentifier value and uses it to delete an instance of a source object (if applicable). (If thedata model object serves as both interface and data source, then the data model objectitself is deleted).Open an instance of a data model object given an identifier value. This takes the givenidentifier value and uses it to find an instance of a source object (if applicable) and thencopies the appropriate values of the source object into the properties of the data modelobject. (If the data model object serves as both interface and data source, then thiscopying is not carried out).Save an instance of a data model object. This copies the properties of the data modelobject back to the appropriate source object (if applicable) and then asks the sourceobject to save itself. (If the data model object serves as both interface and data source,then the data model itself is saved.).<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 187

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!