public static void handleOnPrepare(AutoTextHandle autoTextHandle, ExecutionContext context) {
   try {
     IAutoText cell = new AutoText(autoTextHandle);
     IAutoTextEventHandler eh = getEventHandler(autoTextHandle, context);
     if (eh != null) eh.onPrepare(cell, context.getReportContext());
   } catch (Exception e) {
     addException(context, e);
   }
 }
 public static void handleInitialize(ModuleHandle design, ExecutionContext context) {
   try {
     String scriptText = design.getInitialize();
     Expression.Script scriptExpr = null;
     if (null != scriptText) {
       String id =
           ModuleUtil.getScriptUID(design.getPropertyHandle(IModuleModel.INITIALIZE_METHOD));
       scriptExpr = Expression.newScript(scriptText);
       scriptExpr.setFileName(id);
     }
     if (handleScript(null, scriptExpr, context).didRun()) return;
     IReportEventHandler eh = (IReportEventHandler) getInstance(design, context);
     if (eh != null) eh.initialize(context.getReportContext());
   } catch (Exception e) {
     addException(context, e, design);
   }
 }
 public static void handleOnPrepare(ReportDesignHandle report, ExecutionContext context) {
   try {
     String scriptText = report.getOnPrepare();
     Expression.Script scriptExpr = null;
     if (null != scriptText) {
       String id =
           ModuleUtil.getScriptUID(report.getPropertyHandle(IReportDesignModel.ON_PREPARE_METHOD));
       scriptExpr = Expression.newScript(scriptText);
       scriptExpr.setFileName(id);
     }
     if (handleScript(null, scriptExpr, context).didRun()) return;
     IReportEventHandler eh = (IReportEventHandler) getInstance(report, context);
     if (eh != null) eh.onPrepare(context.getReportContext());
   } catch (Exception e) {
     addException(context, e, report);
   }
 }
 public static void handleOnPageBreak(IAutoTextContent content, ExecutionContext context) {
   Object generateBy = content.getGenerateBy();
   if (generateBy == null) {
     return;
   }
   ReportItemDesign autoTextDesign = (ReportItemDesign) generateBy;
   try {
     if (!needOnPageBreak(autoTextDesign)) {
       return;
     }
     // fromGrid doesn't matter here since row data is null
     IAutoTextInstance autoText = new AutoTextInstance(content, context, RunningState.PAGEBREAK);
     if (handleScript(autoText, autoTextDesign.getOnPageBreak(), context).didRun()) return;
     IAutoTextEventHandler eh = getEventHandler(autoTextDesign, context);
     if (eh != null) eh.onPageBreak(autoText, context.getReportContext());
   } catch (Exception e) {
     addException(context, e, autoTextDesign.getHandle());
   }
 }
  public static void handleOnCreate(IAutoTextContent content, ExecutionContext context) {
    Object generateBy = content.getGenerateBy();
    if (generateBy == null) {
      return;
    }
    ReportItemDesign autoTextItemDesign = (ReportItemDesign) generateBy;
    try {
      if (!needOnCreate(autoTextItemDesign)) {
        return;
      }
      IAutoTextInstance autoText = new AutoTextInstance(content, context, RunningState.CREATE);
      if (handleScript(autoText, autoTextItemDesign.getOnCreate(), context).didRun()) return;
      IAutoTextEventHandler eh = getEventHandler(autoTextItemDesign, context);
      if (eh != null) eh.onCreate(autoText, context.getReportContext());

    } catch (Exception e) {
      addException(context, e, autoTextItemDesign.getHandle());
    }
  }
 public static void handleBeforeFactory(ReportDesignHandle report, ExecutionContext context) {
   try {
     IDesignElement element = SimpleElementFactory.getInstance().getElement(report);
     IReportDesign reportDesign = new ReportDesign(report);
     String scriptText = report.getBeforeFactory();
     Expression.Script scriptExpr = null;
     if (null != scriptText) {
       String id =
           ModuleUtil.getScriptUID(
               report.getPropertyHandle(IReportDesignModel.BEFORE_FACTORY_METHOD));
       scriptExpr = Expression.newScript(scriptText);
       scriptExpr.setFileName(id);
     }
     if (handleScript(element, scriptExpr, context).didRun()) return;
     IReportEventHandler eh = (IReportEventHandler) getInstance(report, context);
     if (eh != null) eh.beforeFactory(reportDesign, context.getReportContext());
   } catch (Exception e) {
     addException(context, e, report);
   }
 }