org.eclipse.swt.browser.Browser.setText()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(198)

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

Browser.setText介绍

[英]Renders a string containing HTML. The rendering of the content occurs asynchronously. The rendered page will be given trusted permissions; to render the page with untrusted permissions use setText(String html, boolean trusted) instead.

The html parameter is Unicode-encoded since it is a java String. As a result, the HTML meta tag charset should not be set. The charset is implied by the String itself.
[中]呈现包含HTML的字符串。内容的呈现以异步方式进行。呈现的页面将被授予受信任的权限;若要使用不受信任的权限呈现页面,请改用setText(String html, boolean trusted)
html参数是Unicode编码的,因为它是javaString。因此,不应设置HTML元标记字符集。字符集由String本身暗示。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void getData() {
 wBrowser.setText( content );
}

代码示例来源:origin: pentaho/pentaho-kettle

message.setText( report.toString() );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent event ) {
 if ( tree.getSelectionCount() == 1 ) {
  TreeItem item = tree.getSelection()[0];
  if ( item.getParentItem() != null ) { // has a category above it
   String functionName = item.getText();
   FunctionDescription functionDescription = functionLib.getFunctionDescription( functionName );
   if ( functionDescription != null ) {
    String report = functionDescription.getHtmlReport();
    message.setText( report );
   }
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

browser.setUrl( stringUrl );
} else {
 browser.setText( stringUrl );

代码示例来源:origin: eclipse-color-theme/eclipse-color-theme

if (browser != null) {
  browser.setLayoutData(gridData);
  browser.setText("<html><body></body></html>");

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public void
setText(
  String        text )
{
  browser.setText( text );
}

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

public void setText(String text) {
  this.text = text;
  if (browser != null) {
    browser.setText(text);
  }
}

代码示例来源:origin: stackoverflow.com

Browser browser = new Browser( parent, SWT.NONE );
browser.setText( "<html><ol><li>Hello</li><li>welcome</li></ol></html>" );

代码示例来源:origin: org.eclipse.platform/org.eclipse.tips.ui

private void loadContentHtml(IHtmlTip tip) {
  fBrowser.setText(getHTML(tip).trim());
}

代码示例来源:origin: stackoverflow.com

final FormToolkit toolkit = new FormToolkit(display);
final Composite composite = toolkit.createComposite(parent, SWT.BORDER);
composite.setLayoutData(gridData);

final Composite composite2 = toolkit.createComposite(parent, SWT.BORDER);
composite2.setLayoutData(gridData);
final FillLayout layout = new FillLayout();

composite2.setLayout(layout);

final Browser browser = new Browser(composite2, SWT.NONE);
toolkit.adapt(browser);

browser.setText("<html><body>CONTENT</body></html>");

代码示例来源:origin: org.eclipse/org.eclipse.ltk.ui.refactoring

/**
 * {@inheritDoc}
 */
public void refresh() {
  String text= getInputText(fDescriptor);
  if (text != null && text.length() > 0) {
    if ((fBrowser.getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0) {
      final StringBuffer buffer= new StringBuffer(text);
      HTMLPrinter.insertStyles(buffer, new String[] { "direction:rtl", "overflow:hidden"}); //$NON-NLS-1$ //$NON-NLS-2$
      text= buffer.toString();
    }
  }
  fBrowser.setText(text);
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  final Display display = new Display();
  final Shell shell = new Shell(display);
  shell.setLayout(new FillLayout());

  final URL url = ShellSnippet.class.getResource("/icons/full/message_error.gif");
  final Browser browser = new Browser(shell, SWT.MOZILLA);
  final String html = String.format("<html><head/><body>image: <img src=\"%s\"/></body></html>", url);
  browser.setText(html);

  shell.open();
  while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) {
      display.sleep();
    }
  }
  display.dispose();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.tips.ui

/**
 * Sets content in the browser that displays a message after 1500ms if tips
 * could not be loaded.
 */
private void loadWaitingScript() {
  fBrowser.setText(getWaitingScript(1500));
  while (!isDisposed()) {
    if (!getDisplay().readAndDispatch()) {
      break;
    }
  }
}

代码示例来源:origin: org.xworker/xworker_swt

public static void setThing(ActionContext actionContext){
    Thing thing = actionContext.getObject("thing");
    Browser browser = actionContext.getObject("browser");
    
    if(thing != null){
      browser.setUrl(XWorkerUtils.getThingDescUrl(thing));
    }else{
      browser.setText("Thing is null");
    }
  }
}

代码示例来源:origin: org.xworker/xworker_swt

public static void setThing(ActionContext actionContext){
    //World world = World.getInstance();
    Browser browser = (Browser) actionContext.get("browser");
    Thing thing = (Thing) actionContext.get("thing");
    if(thing != null){
      String webUrl = XWorkerUtils.getThingDescUrl(thing);
        browser.setUrl(webUrl);
    }else{
      browser.setText("Thing not exists");
    }
  }
}

代码示例来源:origin: org.apache.uima/ruta-ep-caseditor

private void setHtmlWithEditor() {
 CAS cas = editor.getDocument().getCAS();
 String html = cas.getDocumentText();
 browser.setText(html);
 browser.refresh();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.tips.ui

/**
 * Sets content in the browser that displays a message after 1500ms if the Tip
 * could not load fast enough.
 */
private void loadTimeOutScript() {
  fBrowser.setText(getLoadingScript(500));
  while (!isDisposed()) {
    if (!getDisplay().readAndDispatch()) {
      break;
    }
  }
}

代码示例来源:origin: org.xworker/xworker_swt

public void run(){
    ((Browser) actionContext.get("sysBrowser")).setText("");
    SwtTextUtils.setText(actionContext.get("inputTxt"), "");
    showHtml(XWorkerUtils.getThingDescUrl(getThing()), false);
    
    runChild(child);
  }
});

代码示例来源:origin: org.xworker/xworker_swt

public void run(){
    ((Browser) actionContext.get("sysBrowser")).setText("");
    SwtTextUtils.setText(actionContext.get("inputTxt"), "");
    showHtml(XWorkerUtils.getThingDescUrl(getThing()), false);
    show();
  }
});

代码示例来源:origin: org.xworker/xworker_swt

public void run(){
    ((Browser) actionContext.get("sysBrowser")).setText("");
    SwtTextUtils.setText(actionContext.get("inputTxt"), "");
    showHtml(XWorkerUtils.getThingDescUrl(getThing()), false);
    show();
  }
});

相关文章