Main Menu
Lecture 1
Lecture 3
Lecture 4
Lecture 5
Lecture 6
Lecture 7
 

 

 

Key Classes

WOComponent

Represents a page or part of a page

Defines the look and feel

Controller class for a web page

Your components are subclasses of WOComponent (an abstract class)

They inherit all WOComponents methods and behaviours (including main)

By Default, WO creates a component called Main on startup and displays it

User linking to the top level URL will get the Main Component returned and displayed as the main page

 

Java awake method

A component does not exist in a vacuum

Is is a member of the graph of objects that cooperate to handle user requests

A component is sent messages from the framework during the request-response cycle

awake() is sent to a component instance each time it is about to participate in the request-response cycle

awake() is different to the components constructor (which is only called once) because a single instance can participate in multiple request-response cycles

sleep() is called at the end of a component's participation in the request response cycle

Therefore the component is only active during a request response cycle

There are two ways the framework interacts with your code

  1. awake() should contain initialisation code for this request
  2. sleep() should release any resources

both are defined for the WOComponent class and can be specialised using inheritance

Therefore we can overide awake() and sleep() to customise the framework

DO NOT call super inside awake(), in fact you can't.