com.vaadin.ui.JavaScript.eval()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 JavaScript  
字(3.4k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中com.vaadin.ui.JavaScript.eval()方法的一些代码示例,展示了JavaScript.eval()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaScript.eval()方法的具体详情如下:
包路径:com.vaadin.ui.JavaScript
类名称:JavaScript
方法名:eval

JavaScript.eval介绍

[英]Executes the given JavaScript code in the browser.
[中]在浏览器中执行给定的JavaScript代码。

代码示例

代码示例来源:origin: org.opencms/opencms-core

public void attach(AttachEvent event) {
    JavaScript.eval(VAR_IS_LEGACY_APP + " = true;");
  }
});

代码示例来源:origin: org.opencms/opencms-core

public void run() {
    JavaScript.eval(
      "if (window.parent && window.parent."
        + CmsLegacyApp.VAR_IS_LEGACY_APP
        + ") window.parent.location.reload();");
  }
});

代码示例来源:origin: org.opencms/opencms-core

public void detach(DetachEvent event) {
    JavaScript.eval(VAR_IS_LEGACY_APP + " = false;");
  }
});

代码示例来源:origin: com.github.markash/statistics-card

/**
   * <p>
   * Executes the given JavaScript code to manipulate the chart.
   * Use the JavaScript variable <code>chart</code> to access the chart.
   * </p>
   * <p>Example:</p>
   * <pre>  chart.manipulateChart("chart.addSeries({name: 'new', data: [1, 2]});");</pre>
   *
   * @param js JavaScript code to be executed
   */
  public void manipulateChart(String js) {
    JavaScript.eval(
        "var chart = $('#" + getDomId() + "').highcharts();\n" +
            js
    );
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
   * Sets the window title.<p>
   *
   * @param title the new window title
   */
  public void setTitle(String title) {

    /* HACK: Using a Label destroys the layout for some reason, so we resort to setting the caption directly in the
     element via an explicit JavaScript call. */
    JavaScript.eval(
      "document.querySelector('#"
        + getId()
        + " .fakewindowheader').innerHTML = '"
        + StringEscapeUtils.escapeJavaScript(title)
        + "'");
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Sets the window title.<p>
 *
 * @param title the new window title
 */
public void setWindowTitle(String title) {
  /* HACK: Using a Label destroys the layout for some reason, so we resort to setting the caption directly in the
   element via an explicit JavaScript call. */
  m_windowTitle = title;
  JavaScript.eval(
    "document.querySelector('#"
      + getId()
      + " .fakewindowheader').innerHTML = '"
      + StringEscapeUtils.escapeJavaScript(title)
      + "'");
}

代码示例来源:origin: org.opencms/opencms-core

@SuppressWarnings("synthetic-access")
  public void buttonClick(ClickEvent event) {
    List<I_CmsDataViewItem> result = panel.getSelection();
    String script = params.prepareCallbackScript(result);
    JavaScript.eval(script);
    m_context.finish(null);
  }
});

代码示例来源:origin: org.opencms/opencms-core

JavaScript.eval(
  "setTimeout(function(){ "
    + "var el= document.getElementById('"

代码示例来源:origin: org.opencms/opencms-core

/**
 * Initializes the tree with the given resource as a root.<p>
 *
 * @param rootRes the new tree root resource
 * @throws CmsException if something goes wrong
 */
protected void initTree(CmsResource rootRes) throws CmsException {
  m_currentRoot = rootRes;
  m_treeContainer.removeAllComponents();
  showHeader();
  CmsSitemapTreeController controller = new CmsSitemapTreeController(
    A_CmsUI.getCmsObject(),
    rootRes,
    this,
    m_treeContainer);
  // no need to escape a structure id
  JavaScript.eval(CmsGwtConstants.VAR_LOCALE_ROOT + "='" + rootRes.getStructureId() + "'");
  CmsSitemapUI ui = (CmsSitemapUI)(A_CmsUI.get());
  ui.getSitemapExtension().setSitemapTreeController(controller);
  CmsSitemapTreeNode root1 = controller.createRootNode();
  controller.initEventHandlers(root1);
  m_treeContainer.addComponent(root1);
  controller.onClickOpen(root1);
}

相关文章