/**
* Hides the layer, if it exists.
*/
function netscape_samples_simple_LayerController_hideLayer() {
if(this.myLayer != "undefined") {
this.myLayer.visibility = "hide";
}
this.sysout("hide");
}
/**
* Shows the layer.
*
* If the layer doesn't exist, this function first creates
* the layer.
*/
function netscape_samples_simple_LayerController_showLayer() {
this.sysout("in showLayer");
// Check to see if the layer exists.
// If not, create the layer
if(this.myLayer == "undefined") {
this.sysout("mylayer == "+this.myLayer);
this.createLayer();
this.sysout("after creation, mylayer == "+this.myLayer);
}
this.myLayer.visibility = "show";
}
/**
* A private function (hence the underscore)
* used to create the layer.
*/
function _netscape_samples_simple_LayerController_createLayer() {
this.sysout("in createLayer");
myLayer = new Layer(350);
myLayer.height = 200;
myLayer.clip.height = 200;
myLayer.clip.width = 350;
myLayer.pageX = 100;
myLayer.pageY = 100;
myLayer.bgColor = "#ffddee";
myLayer.src = this.layerSource;
this.sysout("createLayer::this.layerSource = " + this.layerSource);
this.myLayer = myLayer;
}
/**
* This is another private function. By default, this
* component's source is in "non-debug" mode, which
* means that debugging messages won't appear in the
* the Java Console. By uncommenting the call
* to "java.lang.System.out.println(Str);" -- which
* is calling the java class "System.out.println" directly
* from JavaScript -- printing debug messages to the Java Console
* is re-enabled.
*/
function _netscape_samples_simple_LayerController_sysout(Str) {
// Commented out to avoid extra overhead of printing
// debugging messages
// java.lang.System.out.println(Str);
}
/**
* Constructs a new LayerController Object, each layerController
* has one source property.
*/
function netscape_samples_simple_LayerController(params) {
this.hideLayer = netscape_samples_simple_LayerController_hideLayer; // hides
this.showLayer = netscape_samples_simple_LayerController_showLayer; // shows
// Doesn't need to be declared in SGML because
// it is a private method, but does need to be
// assigned to this (all methods do, unless they are static,
// like sysout, which we assign anyway for namespace reasons).
this.createLayer = _netscape_samples_simple_LayerController_createLayer;
this.layerSource = params.layerSource; // the pagelet
this.sysout = _netscape_samples_simple_LayerController_sysout; // a private function
this.sysout("LayerController::this.layerSource = " + this.layerSource);
}