In order to extend the scenario user interface, as described in Step 10 in the Adding Custom Alert Messages to Gears section above, you must create and add two files to your gear’s classes.jar file.

expression-grammar.xml

You need only one expression-grammar.xml file per gear, but it must contain a custom expression for each event. The following code sample shows the contents of an expression-grammar.xml file for a document exchange gear with an expression for a DocumentCreated event.

<?xml version="1.0" encoding="utf-8"?>

<!-- ==================================================================== -->
<!-- Scenario UI grammar extension for the Alert gear.                    -->
<!-- ==================================================================== -->

<?xcl-stylesheet resource="atg/ui/expreditor/xcl/grammar.xsl"?>

<context serializable="true">

  <!-- Include scenario construct definitions -->

  <include template="atg.portal.scenario.expression.expression-grammar"/>

  <!-- ==================================================================== -->
  <!-- Custom expression for the DocumentCreated event.                     -->
  <!-- ==================================================================== -->

  <sequence id="event-message-atg.portal.gear.docexch.DocumentCreatedMessage">
    <attribute name="icon">
       <icon path="atg/ui/scenario/images/generic-event.gif"/>
    </attribute>
    <attribute name="eventType"
               value="atg.portal.gear.docexch.DocumentCreatedMessage"/>
    <attribute name="eventContext" value="request"/>

    <xml-template>
      <event-name>atg.portal.gear.docexch.DocumentCreatedMessage</event-name>
    </xml-template>

    <token><description>Document Created</description></token>
    <rule name="portal-event-filter"/>
  </sequence>

  <sequence id="condition-message-atg.portal.gear.docexch.DocumentCreatedMessage">
    <expression-class>
        atg.ui.scenario.expression.EventConditionExpression
    </expression-class>
    <attribute name="icon">
       <icon path="atg/ui/scenario/images/generic-condition.gif"/></attribute>
    <attribute name="checkedEventName"
               value="atg.portal.gear.docexch.DocumentCreatedMessage"/>

    <token><description>Document event</description></token>
    <rule name="portal-condition-filter"/>
  </sequence>

</context>
GrammarExtension.java

You need only one GrammarExtension.java file per gear; this file contains nothing that is message-specific. The following code sample shows the contents of a GrammarExtension.java file for a document exchange gear.

package atg.portal.gear.docexch;
import atg.ui.scenario.*;
import atg.ui.scenario.expression.*;
import atg.xcl.*;

/** Scenario UI grammar extension for a custom action / grammar extension example.
*/

public class DocexchGrammarExtension extends DefaultGrammarExtension {

  //----------------------------------------
  // Constructors
  //----------------------------------------

  public DocexchGrammarExtension() {

    // Load the XML file that specifies the grammar extension.
    super("atg.portal.gear.docexch.docexch-expression-grammar");
  }
}

Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices