Program Editor

The Program Editor view provides the ability to view and edit Program components.

Figure 1. Program Editor


To view, right-click a Program and select Program Editor. It shows Edit, Slots, Imports, and Source tabs.

Tab Description
Edit Edits the onExecute, onStart, onStop and freeForm methods. An example from the demo Database follows:
BStatusNumeric inA = getInA();
BStatusNumeric inB = getInB();
BStatusNumeric out = getOut();

out.setValue( inA.getValue() + inB.getValue() );
Slots Shows and changes the slots of the program component. It includes Slot, #, Name, Display Name, Definition, Flags, Type and, Facets for each slot.
Imports Shows the modules that have been imported. It also allows the following:
  • Import Type—imports a new type.

  • Import Package—imports a new package.

  • Remove—Removes added Import Type and Import Package.

Source Edits the source of the program component. The editor supports special Color coding for Java Files. An example from the demo Database follows:
/* Auto-generated ProgramImpl Code */
import java.util.*;              /* java Predefined*/
import javax.baja.sys.*;         /* baja Predefined*/
import javax.baja.status.*;      /* baja Predefined*/
import javax.baja.util.*;        /* baja Predefined*/
import com.tridium.program.*;    /* program Predefined*/

public class ProgramImpl
    extends com.tridium.program.ProgramBase
{

////////////////////////////////////////////////////////////////
// Getters
////////////////////////////////////////////////////////////////

public BStatusNumeric getOut() { return (BStatusNumeric)get("out"); }
public BStatusNumeric getInA() { return (BStatusNumeric)get("inA"); }
public BStatusNumeric getInB() { return (BStatusNumeric)get("inB"); }

////////////////////////////////////////////////////////////////
// Setters
////////////////////////////////////////////////////////////////

public void setOut(javax.baja.status.BStatusNumeric v) { set("out", v); }
public void setInA(javax.baja.status.BStatusNumeric v) { set("inA", v); }
public void setInB(javax.baja.status.BStatusNumeric v) { set("inB", v); }

////////////////////////////////////////////////////////////////
// onExecute
////////////////////////////////////////////////////////////////

public void onExecute()
   throws Throwable


{
    BStatusNumeric inA = getInA();
    BStatusNumeric inB = getInB();
    BStatusNumeric out = getOut();

    out.setValue( inA.getValue() + inB.getValue() );
  }
}

Program Editor Menus

The Workbench main menu functions are available. When the Program Editor is visible, the following Program Editor menu function is also available:

  • Import Type ()

  • Import Package ()

  • Remove ()

  • Add Slot (Ctrl + A)

  • Delete (Ctrl + Delete)

  • Rename Slot (Ctrl + R)

  • Compile and (F9) () - Compiles and saves the source of the program component

  • Compile (Ctrl + F9) () - Compiles athe source of the program component.

Program Editor Toolbar

The Workbench toolbar contains navigation and editing buttons. When the Program Editor is visible, additional toolbar buttons include:

  • Find ()

  • Replace ()

  • Compile and Save ()

  • Compile ()

  • Console Prev

  • Console Next