@Override
  public void getCodeInserters(
      WbdGenerator generator, WbdWidget instance, UimData ud, CodeInserterList codeInserterList)
      throws WbdException {
    // TODO: Uncomment this as required
    GenerationMode mode = generator.getMode();
    if (mode == GenerationMode.DESIGN) {
      // Add code inserters for design mode
      CodeInserter[] arr = {

        // Include a CSS snippet
        new StylesheetCodeInserter(generator, instance, "phoneList_cssHeader.css"),
      };
      codeInserterList.add(arr);
    } else if (mode == GenerationMode.PREVIEW) {
      // Add code inserters for preview mode
      CodeInserter[] arr = {
        //				// Link to an external Javascript file
        //				new JavascriptLinkInserter(jsUrl),

        //				// Link to an external stylesheet
        //				new StylesheetLinkInserter(cssUrl),

        // Include a javascript snippet
        new JavascriptCodeInserter(generator, instance, "phoneList_jsHeader.js"),

        // Include a CSS snippet
        new StylesheetCodeInserter(generator, instance, "phoneList_cssHeader.css"),
      };
      codeInserterList.add(arr);
    } else if (mode == GenerationMode.PRODUCTION
        || generator.getMode() == GenerationMode.CONTROLLER) {
      // Add code inserters for production mode
      CodeInserter[] arr = {
        //				// Link to an external Javascript file
        //				new JavascriptLinkInserter(jsUrl),

        //				// Link to an external stylesheet
        //				new StylesheetLinkInserter(cssUrl),

        // Include a javascript snippet
        new JavascriptCodeInserter(generator, instance, "phoneList_jsHeader.js"),

        // Include a CSS snippet
        new StylesheetCodeInserter(generator, instance, "phoneList_cssHeader.css"),

        //				// Add import statements to the JSP
        //				new PageImportCodeInserter(XData.class.getName()),
      };
      codeInserterList.add(arr);

      if (USE_PRODUCTION_HELPER) {
        SnippetParam[] productionHelperParams = getSnippetParams(generator, instance, ud);
        codeInserterList.add(
            WbdProductionHelper.codeInserter(
                instance, PhoneListProductionHelper.class.getName(), productionHelperParams));
        codeInserterList.add(new PageImportCodeInserter(PhoneListProductionHelper.class.getName()));
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void getCodeInserters(
      WbdGenerator generator, WbdWidget instance, UimData ud, CodeInserterList codeInserterList)
      throws WbdException {
    // TODO: Uncomment this as required
    GenerationMode mode = generator.getMode();
    if (mode == GenerationMode.DESIGN) {
      // Add code inserters for design mode
      CodeInserter[] arr = {

        //				// Include a CSS snippet
        //				new StylesheetCodeInserter(instance.miscellaneousFilePath(generator,
        // "googleApi_cssHeader.css")),
      };
      codeInserterList.add(arr);
    } else if (mode == GenerationMode.PREVIEW) {
      // Add code inserters for preview mode
      CodeInserter[] arr = {
        //				// Link to an external Javascript file
        // new
        // JavascriptLinkInserter("http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"),

        //				// Link to an external stylesheet
        //				new StylesheetLinkInserter(cssUrl),

        //				// Include a javascript snippet
        //				new JavascriptCodeInserter(instance.miscellaneousFilePath(generator,
        // "googleApi_jsHeader.js")),

        //				// Include a CSS snippet
        //				new StylesheetCodeInserter(instance.miscellaneousFilePath(generator,
        // "googleApi_cssHeader.css")),
      };
      codeInserterList.add(arr);
    } else if (mode == GenerationMode.PRODUCTION
        || generator.getMode() == GenerationMode.CONTROLLER) {
      // Add code inserters for production mode
      CodeInserter[] arr = {
        //				// Link to an external Javascript file
        //				new JavascriptLinkInserter(jsUrl),

        //				// Link to an external stylesheet
        //				new StylesheetLinkInserter(cssUrl),

        //				// Include a javascript snippet
        //				new JavascriptCodeInserter(instance.miscellaneousFilePath(generator,
        // "googleApi_jsHeader.js")),

        //				// Include a CSS snippet
        //				new StylesheetCodeInserter(instance.miscellaneousFilePath(generator,
        // "googleApi_cssHeader.css")),

        //				// Add import statements to the JSP
        //				new PageImportCodeInserter(XData.class.getName()),
      };
      codeInserterList.add(arr);

      if (USE_PRODUCTION_HELPER) {
        SnippetParam[] productionHelperParams = null;
        //				codeInserterList.add(WbdProductionHelper.codeInserter(instance,
        // GoogleApiProductionHelper.class.getName(), productionHelperParams));
        //				codeInserterList.add(new
        // PageImportCodeInserter(GoogleApiProductionHelper.class.getName()));
      }
    }
  }