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

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

本文整理了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

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

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

  1. public void run() {
  2. JavaScript.eval(
  3. "if (window.parent && window.parent."
  4. + CmsLegacyApp.VAR_IS_LEGACY_APP
  5. + ") window.parent.location.reload();");
  6. }
  7. });

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

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

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

  1. /**
  2. * <p>
  3. * Executes the given JavaScript code to manipulate the chart.
  4. * Use the JavaScript variable <code>chart</code> to access the chart.
  5. * </p>
  6. * <p>Example:</p>
  7. * <pre> chart.manipulateChart("chart.addSeries({name: 'new', data: [1, 2]});");</pre>
  8. *
  9. * @param js JavaScript code to be executed
  10. */
  11. public void manipulateChart(String js) {
  12. JavaScript.eval(
  13. "var chart = $('#" + getDomId() + "').highcharts();\n" +
  14. js
  15. );
  16. }
  17. }

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

  1. /**
  2. * Sets the window title.<p>
  3. *
  4. * @param title the new window title
  5. */
  6. public void setTitle(String title) {
  7. /* HACK: Using a Label destroys the layout for some reason, so we resort to setting the caption directly in the
  8. element via an explicit JavaScript call. */
  9. JavaScript.eval(
  10. "document.querySelector('#"
  11. + getId()
  12. + " .fakewindowheader').innerHTML = '"
  13. + StringEscapeUtils.escapeJavaScript(title)
  14. + "'");
  15. }
  16. }

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

  1. /**
  2. * Sets the window title.<p>
  3. *
  4. * @param title the new window title
  5. */
  6. public void setWindowTitle(String title) {
  7. /* HACK: Using a Label destroys the layout for some reason, so we resort to setting the caption directly in the
  8. element via an explicit JavaScript call. */
  9. m_windowTitle = title;
  10. JavaScript.eval(
  11. "document.querySelector('#"
  12. + getId()
  13. + " .fakewindowheader').innerHTML = '"
  14. + StringEscapeUtils.escapeJavaScript(title)
  15. + "'");
  16. }

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

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

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

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

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

  1. /**
  2. * Initializes the tree with the given resource as a root.<p>
  3. *
  4. * @param rootRes the new tree root resource
  5. * @throws CmsException if something goes wrong
  6. */
  7. protected void initTree(CmsResource rootRes) throws CmsException {
  8. m_currentRoot = rootRes;
  9. m_treeContainer.removeAllComponents();
  10. showHeader();
  11. CmsSitemapTreeController controller = new CmsSitemapTreeController(
  12. A_CmsUI.getCmsObject(),
  13. rootRes,
  14. this,
  15. m_treeContainer);
  16. // no need to escape a structure id
  17. JavaScript.eval(CmsGwtConstants.VAR_LOCALE_ROOT + "='" + rootRes.getStructureId() + "'");
  18. CmsSitemapUI ui = (CmsSitemapUI)(A_CmsUI.get());
  19. ui.getSitemapExtension().setSitemapTreeController(controller);
  20. CmsSitemapTreeNode root1 = controller.createRootNode();
  21. controller.initEventHandlers(root1);
  22. m_treeContainer.addComponent(root1);
  23. controller.onClickOpen(root1);
  24. }

相关文章