Portlet Factory, Version 6.1.2


 

Implementation of generation behavior

Implement the builder generation behavior by implementing the following interface:

com.bowstreet.builders.webapp.foundation.WebAppBuilder

In your generation class, implement the following method:

public void doBuilderCall(GenContext genContext, WebApp webApp, BuilderCall builderCall, BuilderInputs builderInputs, PageLocation pageLocation) { ... }

The parameters to the doBuilderCall() method provide you with the ability to interact with the WebApp object and to place a builder call on a page. The other objects to which you have access in your builder generation class are:

genContext

A system object that is passed to all the GenHandlers and builders. It is used to create builderInputs objects and to invoke other builders. This object has the lifetime of a generation.

webApp

The main executable object in the WebEngine, with collections of pages, methods, variables, and links to other models. You can call methods on the webApp object to add elements to the web application.

builderCall

Represents a call to a builder. One of these is created for each entry in the builder call list, and one is created whenever a builder calls another builder.

builderInputs

Holds a set of builder inputs.

pageLocation

Holds the page location syntax.

The following code sample shows the generation class for a Hello World builder:

package com.bowstreet.examples.builders.webapp; import com.bowstreet.builders.webapp.foundation.WebAppControlBuilder; import com.bowstreet.generation.GenContext; import com.bowstreet.webapp.WebApp; import com.bowstreet.generation.BuilderCall; import com.bowstreet.generation.BuilderInputs; import com.bowstreet.builders.webapp.pagelocation.PageLocation; import com.bowstreet.builders.webapp.api.Text;

public class HelloWorldBuilder implements WebAppControlBuilder {
 public HelloWorldBuilder() {
 }
 public void doBuilderCall(GenContext genContext, WebApp webApp,
 BuilderCall builderCall, BuilderInputs builderInputs,
 PageLocation pageLocation) {
 //Create a Text builder call using the builder API
 Text helloText = new Text(builderCall, genContext);
 helloText.setName("HelloWorldText");

 //Place this builder on the page(s) determined by the PageLocation in the
 //Builder Call Editor
 helloText.setPageLocation(pageLocation);

 //Display input from DisplayText input in Builder Call Editor
 //Use "Hello, world", if no value is specified.
 helloText.setText(builderInputs.getString("DisplayText", "Hello, world"));

//Invoke the builder call
 helloText.invokeBuilder();
 }
}

Parent topic: Using other builders in the generation class Parent topic: Overview of builder architecture Related concepts

About creating builder definitions

About model-based builder creation

About implementing a coordinator

Builder input widgets


Library | Support |