application object one transient instance created for each process used as a kind of transient root...
TRANSCRIPT
Application Object
• One transient instance created for each process• Used as a kind of transient root object to store
often used references• System supplied variable called app
– app.myBank– app.myBranch
Application
myBankmyBranch
Transient
Process Starts – Initialise app
2702.1
Branch
name Central City
2702.2
Branch
name Down Town
2601.1
Bank
name JADE Bank
Processapp
ApplicationmyBank 2601.1
myBranch2702.1
Transient
User working with Central City branch
myBank 2601.1
myBranch
app
Transient
Background taske.g. Print Server
Process
Processapp
ApplicationmyBank 2601.1
myBranch2702.2
Transient
User working with Down Town branch
app.myBank
app.myBranch
app.myBranch
app.myBank
app.myBank
# 1
# 2
# 3
Application
Node
Persistent Cache Transient Cache
TransientDatabase
Background Process
Process
Process
process, node, system
More System Variables
• currentSession• currentSchema• exception• method• rootSchema• self
Class Constants
• Different from Global Constants and Local Constants• Viewed in Class Browser
Class Class
• Used to store class information
• Useful properties– instances
• Useful methods– getProperties– firstInstance
Subschema Visibility
XRaySchemaXRaySchema OncologySchemaOncologySchema
XRayPatientXRayPatient OncologyPatientOncologyPatient
PatientPatient PatientPatient
allPatients XRayPatients
OncologyPatients
allPatients XRayPatients
OncologyPatients
Subschema Copy Class
Root Class
TreatmentCentreSchemaTreatmentCentreSchema
PatientPatient
TreatmentCentreTreatmentCentre
Root Class
Challenge #22• Paint a CustomerList form
• Code load method of form
• Code table_displayRow method
name mnuCustomerList
caption &List
• Add a menu item to MainMenu
caption Customer List columns 3
fixedColumns 0
name btnEdit
caption Edit
name table
Challenge #23
Customer class
• Add a setPropertiesOnUpdate method
CustomerDetails form
• Add myCustomer reference
• Code load method – if myCustomer not null, prefill text boxes
• Add an updateCustomer method
• Modify btnOK_click method – if myCustomer not null, call updateCustomer
CustomerList form
• Code btnEdit_click method
To enable a customer from CustomerList form to be edited:
List Objects in a Table
table_displayRow(table : Table input; theSheet : Integer; obj : Object; theRow : Integer; bcontinue: Boolean io) : String updating;vars cust : Customer;begin cust := obj.Customer; return cust.firstNames & Tab & cust.lastName & Tab & cust.address;end;
table_displayRow(table : Table input; theSheet : Integer; obj : Object; theRow : Integer; bcontinue: Boolean io) : String updating;vars cust : Customer;begin cust := obj.Customer; return cust.firstNames & Tab & cust.lastName & Tab & cust.address;end;
• Display a row of text for each object in collection
table.setCellText (1, // row1, // column'First Names' & Tab & 'Last Name' & Tab & 'Address'); // text
table.setCellText (1, // row1, // column'First Names' & Tab & 'Last Name' & Tab & 'Address'); // text
• Set headings
table.displayCollection (app.myBank.allCustomers, // collectiontrue, // automatically updated?Table.DisplayCollection_Forward, // forwards or backwardsnull); // start object within collection
table.displayCollection (app.myBank.allCustomers, // collectiontrue, // automatically updated?Table.DisplayCollection_Forward, // forwards or backwardsnull); // start object within collection
• Associate a collection with a table
Select from a Table
cust := table.accessRow(table.row).itemObject.Customer;cust := table.accessRow(table.row).itemObject.Customer;
accessedColumn
itemObject
accessedCell accessedRow accessedSheet
table
• Access the item object• Type cast as a Customer
Conditional Update
setPropertiesOnUpdate(pAddress : String; pFirstNames : String; pLastName : String) updating;
begin self.address := pAddress; self.firstNames := pFirstNames; if self.lastName <> pLastName then self.lastName := pLastName; endif;end;
setPropertiesOnUpdate(pAddress : String; pFirstNames : String; pLastName : String) updating;
begin self.address := pAddress; self.firstNames := pFirstNames; if self.lastName <> pLastName then self.lastName := pLastName; endif;end;
What is the purpose of the if statement?