Using WebEngine + WebView as rich HTML control?

Has anyone tried using WebEngine/WebView to create (static) content which can mix text with images?
What I would want is a reflow capable control where I can put in styled text (different styles, sizes, fonts) and some Images to go along with it and have the text nicely reflow around the images. Since HTML has been capable of doing this for ages, and since I donot think even a new RichText control will be able to mix images and text (and certainly not offer all the other features in HTML, like tables, etc..), I think the WebView could fill this gap.
Getting the HTML page itself inside the control is easy, using the loadContent methods... but what about the Images? I would need some kind of hook to supply Images (directly from a database or from memory, no intermediate URL downloading step) to the WebEngine, but there doesn't seem to be one.
I suppose I could set up a local webserver and point my 'img src' tags to that to get what I want, but perhaps there is an easier way?
Let me know.

Java has so rich capability that you can do anything. To load the images in WebView you need to first must make sure that the image must be in your application package or on other resources.
I think you problem is to load the images in Webview which is just inside your application. Let's assume you app directory is like this
<app name>
+images
     -europa.png
+mypack
     -Main.java
     -Support.java
     -GUI.javaAnd now to load the image "europa.png" with in the Main.java containing WebView we can do like this
     WebView view = new WebView();
     String url = getClass().getResource("../images/europa.png").toExternalForm();
     view.getEngine().loadContent("<html><body>Hello<img src=\""+url+"\" /></body></html>");Thanks
Narayan

Similar Messages

  • Viewing documents stored using archivelink in firefox / custom html control

    Hi All,
    I've have set display settings to call internet browser in transaction OAG4 of archivelink.When any document is opened,it is shown in the internet explorer(default browser).I wish to view the document in firefox  or any other browser .Also is it possible to view the document in  custom html control programmed  in abap.Could give any suggestions.
    Regards
    ram

    I think I figured it out.
    The slashes in the image paths went the wrong direction. \ in stead of /
    Apparently, this is no problem for IE, but chokes Firefox.  Keep an eye out.

  • HTML Controls in ABAP (not ITS)

    Hello...   
    How to build a HTML form and post it by internet inside SAPGUI (ABAP Program)....???  It's possible....???

    Yes, its possiable.   Check out the demo program
    SAPHTML_EVENTS_DEMO.  This uses an "internal" html page which interacts with the ABAP program using HTML control.
    I've never done it, so I can't offer any simpler examples.
    Regards,
    Rich Heilman

  • Display PDF Dokument in HTML control with Adobe Reader X - hide toolbar

    Hello,
    I am reading a document from a content repository via Archive Link Interface. I get the content by the function module SCMS_HTTP_GET. Afterwards the content will be displayed in a html control in the method SHOW_URL  in class
    CL_GUI_HTML_VIEWER by calling the url SAPR3://SAPR3CMS/get/012/XX/0050568700A51EE0BDC6F305DFEDDF57/ with the following code.
    CALL METHOD call_method
       EXPORTING
         method  = 'ShowUrl'
         p_count = 2
         p1      = url
         p2      = frame
       IMPORTING
         RESULT  = m_result.
    If I had a standard url like http//:...test.pdf it would be possible to hide the Adobe Reader X toolbar by the additional command &#toolbar=0
    The SAP url SAPR3://SAPR3CMS/get/012/XX/0050568700A51EE0BDC6F305DFEDDF57/&#toolbar=0 is not working. Can anybody give me a hint how to get the toolbar hidden?
    Thanks and regards
    Joerg

    I don't believe you answered the question. I have the same problem in that when I upgraded to Reader X my Toolbar disappeared and you responded to my post with a fix. Last week I installed updates to both Acrobat 8 and Reader X and in the process lost my toolbar and the floating toolbar. After "repairing" both Reader and Acrobat numerous times I find that at least the floating toolbar is back and F8 will of course deliver the traditional fixed, top of the page toolbar, but only for that specific open document. When I open a new document (from the web) I must F8 to get my traditional toolbar back. Below are the settings I am using to achieve this (I have tried every combination to try and make this work). Any help to get my toolbar back is very much appreciated.

  • ForeColor command is not working in rich editor control after FireFox 14, maybe it's a bug.

    In WYSIHAT HTML Control, the font colour can not be changed when using Firefox 14+, this issue is not existing firefox 13-

    can you reproduce in a new profile
    * [[Use the Profile Manager to create and remove Firefox profiles]]

  • Javascript from Java - calling html control functions

    i have called the attributes of an html control from java using this method
    private JSObject iframeObject;
    iframeObject=(JSObject)win.eval("parent.document.getElementById('"+popupIFrame+"')");
    iframeObject.setMember("src", "../Applet/Popup.html");but how can i call the functions of a control
    for example the focus() function of a textbox or someother controls???

    its ok i got it.
    win.eval() can do it

  • [AIR] Drag Problem (parent & children can receive d&d and HTML Control)

    Hi,
    I have a problem regarding drag and drop in AIR. The d&d involving parent & children that can receive d&d event and the children can contain HTML control. You might want to copy and paste the code below to get a better idea.
    The objectives are:
    1. If you drag the green object and drop it in the black area, it should alert "Parent Drop"
    2. If you drag the green object and drop it in the magenta (purple) color, it should alert "Child Drop"
    3. If you drag the green object and drop it in the white (HTML control) color, it should alert "HTML Drop"
    The problems:
    1. drag green object to black area, to magenta area, and back again to black area. Drop it, the alert is not shown
    2. drag green object to the white area (HTML control). Drop it, the alert is not shown
    Many thanks.
    The Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
         <mx:VBox verticalGap="0" x="50" y="50" width="200" height="200" backgroundColor="#000000" horizontalAlign="center" dragEnter="onParentDragEnter(event)" dragDrop="onParentDrop(event)">
              <mx:Canvas id="canvas1" width="50" height="50" backgroundColor="#00ff00" mouseMove="onMouseMove(event)"/>
              <mx:HTML id="html" width="50" height="50" dragEnter="onHtmlDragEnter(event)" dragDrop="onHtmlDrop(event)"/>
              <mx:Canvas id="canvas2" width="60" height="50" backgroundColor="#ff00ff" dragEnter="onChildDragEnter(event)" dragDrop="onChildDrop(event)"/>
         </mx:VBox>
         <mx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.DragEvent;
                   import mx.managers.DragManager;
                   import mx.core.DragSource;
                   public function init():void
                        html.htmlText = '<div style="font-size:small">HTML Control</div>';
                   public function onMouseMove(event:MouseEvent):void
                        var dragInitiator:Canvas = event.currentTarget as Canvas;
                        var ds:DragSource = new DragSource();
                        ds.addData("item", "item");
                        DragManager.doDrag(dragInitiator, ds, event, dragInitiator);
                   public function onChildDragEnter(event:Event):void
                        trace("onChildDragEnter");
                        DragManager.acceptDragDrop(event.currentTarget as Canvas);
                   public function onParentDragEnter(event:Event):void
                        trace("onParentDragEnter");
                        DragManager.acceptDragDrop(event.currentTarget as VBox);
                   public function onChildDrop(event:DragEvent):void
                        trace("onchilddrop");
                        Alert.show("Child Drop");
                   public function onParentDrop(event:DragEvent):void
                        trace("onparentdrop");
                        Alert.show("Parent Drop");
                   public function onHtmlDragEnter(event:DragEvent):void
                        DragManager.acceptDragDrop(event.currentTarget as HTML);
                   public function onHtmlDrop(event:DragEvent):void
                        Alert.show("HTML Drop");
              ]]>
         </mx:Script>
    </mx:WindowedApplication>

    The parent drop issue is because there can only be one drag acceptor and you don't get another dragEnter event when the mouse leaves the child (since technically, it never left the parent). This isn't as big an issue as it might seem, since generally you wouldn't have both a parent and a child that could take the drop. The ways to fix this are to use the dragOver event in addition to dragEnter or you could handle the dragExit event dispatched by the child and set the drag acceptor back to the parent.
    The HTML control issue is a bit trickier. HTML content has its own drag-and-drop system that operates a bit differently than the ActionScript version. I don't think there is a way to intercept the events before they are handled by the WebKit HTML engine. You can accept a drop in HTML/JavaScript code as described here: http://help.adobe.com/en_US/as3/dev/WS6717AA0A-2B7D-4728-86DC-7D60F919E6B4.html.

  • Use WebEngine to view applet demo of JDK problem

    When I used webEngine to view applet demo of JDK like this:
    WebEngine webEngine = new WebEngine("file:///C:/Program Files/Java/jdk1.6.0_25/demo/applets/BarChart");
    I got message on the page inside JavaFX like this:
    alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!
    So, my question is how can I embed applet in webEngine or can webEngine embed applet?
    Thank you very much!

    There are a few known bugs related to webengine:
    • Issue RT-12439: WebView can not be gc-ed (garbage-collected).
    Description: Memory leak causes the application to crash with an out-of-memory error on web sites that have a lot of content, running scripts, and automatic updates.
    Workaround: To be able to reclaim the WebEngine object, call the webView.setEngine(null) method.
    • Issue RT-12440: WebView is updated even when it is invisible.
    Description: Performance is impacted.
    Workaround: Include a call to the webView.setEngine(null) method in your application.
    For more info take a look at http://download.oracle.com/javafx/2.0/release_notes/jfxpub-release_notes.htm

  • XML-Document from Internet via HTML-Control?

    Hi everybody,
    I would like to access an XML-document from the internet via a HTML-Control and save it in an ABAP XSTRING-Type so i can use the "call Transformation" in order to save it in an ABAP-Table. Is that possible?? or I have to use XI to access such XML-documents.
    Thanks
    Ihssan

    Hello Mr Raja,
    your answer was helpful. There is no problem by accessing XML data from 'http://'-address. But if i try to access the xml data from 'https://'-address it doesn't work. Of course i used a https sheme type.
    Is there problems by getting data from https??
    thanks in advance
    Ihssan
    p.s.: sap_basis release 6.20

  • ESS Time Statements (PZ04) does not display HTML control

    Hi guys,
    I'm implementing ESS Time Statement service (PZ04) with custom templates and ran into the following problem:
    if i just run PZ04 using webgui - everything works fine and i can see the generated smartform report, but when i force ITS to use custom generated template for SAPLESS00_REP screen 100, the custom HTML control that displays the time statement smartform report is not coming up...
    Has anybody came across this issue before?
    The generated HTML template has statement SAP_ControlContainer("HTML_CONTAINER") which is supposed to display the report, but apparently it does not work...
    Thanks a lot in advance, any help is appreciated.
    Serge

    standalone. We are on 4.7 with 6.4 kernel and standalone ITS.
    I'm getting the option subscreen (period specifications), but the custom container which is supposed to display the smartforms reports (displays "Welcome to reports online") is not coming up at all...
    As to the custom templates: i have generated them in SE80 using "Business HTML" style and have not touched after -  here's the default code:
    `include(~service="system", ~language="", ~theme="dm", ~name="TemplateLibraryDHTML.html")`
    `SAP_TopInclude()`
    <html>
      <head>
        `SAP_PageTitle()`
        `SAP_Stylesheet()`
        `SAP_JavaScript()`
      </head>
      <body `SAP_BodyAttributes()` onload="`SAP_OnloadJavaScript()`">
        `SAP_TemplateHeader()`
        `SAP_BodyContentBegin()`
        `SAP_FormBegin()`
          `SAP_DynproLayerBegin(002,002,096,009)`
          `SAP_DynproSubScreen("SEL_OPTIONS")`
          `SAP_DynproLayerEnd()`
          `SAP_DynproLayerBegin(002,012,030,001)`
          `SAP_Button("PB_DISPREP")`
          `SAP_DynproLayerEnd()`
          `SAP_DynproLayerBegin(001,014,002,001)`
          `SAP_Button("PB_MAX")`
          `SAP_DynproLayerEnd()`
          `SAP_DynproControlLayerBegin(001,015,101,022)`
          `SAP_ControlContainer("HTML_CONTAINER")`
          `SAP_DynproControlLayerEnd()`
        `SAP_FormEnd()`
        `SAP_BodyContentEnd()`
      </body>
    </html>
    Thanks Again for any suggestions,
    Serge

  • Unable to fire window.print from HTML control

    Hi,
    I have an AIR application where I use HTML control. I want to fire print command as soon as the page is loaded. I wrote window.print() script on the onLoad event of HTML body tag.
    Somehow this event is not fired. Any thoughts on how to achieve print functionality?
    Thanks,
    Hitesh Patel.

    Hi there
    Perhaps try creating a totally new window definition and configuring the parameters as desired.
    Once in a blue moon we see that the window definition somehow becomes corrupt.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Simulate mouse click on html control

    hello,
    i working on a multitouch application which should load some
    small html files in an html control.
    but i don't have a mouse so I need to simulate the click on a
    link in html etc.
    what i get to work is the down event so the link changes
    color but the it doesn't react on the up event.
    any ideas?
    thanks a lot
    joerg

    Insted of using an "<a href" type of link, and
    highlighting it with CSS you can create a custom <div>
    element, an assign to it javascript events onclick, onmousedown,
    onmouseup, that would do all the wrok.
    You can then fire those events from a diffrent
    function/event.

  • HTML control doesn't allow browser pop-ups from within page

    I've noticed that pop-ups are not allowed from inside of the
    mx:HTML control. Both JavaScript popups and the targeting of a new
    browser window from within both an HTML page or SWF movie doesn't
    seem to work. I would hope that the user's default browser would be
    utilized in this sort of instance.
    For example: if I load www.cnn.com using the HTML control
    into an AIR app - and then click an ad on that site - under normal
    circumstances a new browser window would be launched - in AIR
    nothing happens.
    Is this a limitation or is there some sort of workaround?
    Thanks,
    David

    In order to accomplish this one has to override the createWindow function of the htmlhost class
        override public function createWindow(windowCreateOptions : HTMLWindowCreateOptions) : HTMLLoader {
            //Option1:
            //var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
            //var bounds:Rectangle = new Rectangle(windowCreateOptions.x,windowCreateOptions.y,windowCreateOptions.width,windowCre ateOptions.height);
            //var htmlControl:HTMLLoader = HTMLLoader.createRootWindow(true, initOptions, windowCreateOptions.scrollBarsVisible, bounds);
            //htmlControl.htmlHost = new HTMLHost2();
            //if(windowCreateOptions.fullscreen){
            //htmlControl.stage.displayState =
            //StageDisplayState.FULL_SCREEN_INTERACTIVE;
            //return htmlControl;
            //Option2:
            //var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
            //var window:NativeWindow = new NativeWindow(initOptions);
            //window.visible = true;
            //var htmlLoader2:HTMLLoader = new HTMLLoader();
            //htmlLoader2.width = window.width;
            //htmlLoader2.height = window.height;
            //window.stage.scaleMode = StageScaleMode.NO_SCALE;
            //window.stage.addChild(htmlLoader2);
            //return htmlLoader2;

  • Calling NativeDragManager.acceptDrop when drag over an html control

    Hi,
    I'm using AIR and I want to change the mouse cursor to show an "accept" or copy cursor during a drag operation. I am dragging a file from outside the application over a html control (mx.controls.HTML)
    In the NativeDragEvent.NATIVE_DRAG_OVER event handler I tried to call NativeDragManager.acceptDragDrop(event.target) but the NativeDragEvent.target is a FlexHTMLLoader object.
    This type is incompatible with the expected argument type InterActiveObject.
    I haven't figured out how to get the cursor to change. Any ideas?
    Claire

    HTML uses the Webkit drag-and-drop API. See http://help.adobe.com/en_US/as3/dev/WSC982AEFA-D020-41aa-8C3D-37AAEB7C132C.html.
    Also see this section: http://help.adobe.com/en_US/as3/dev/WSA15C8AF8-3317-46c5-B9B1-EAD3356A2555.html

  • How do I use an apple tv remote to control my mac

    I am having a macbook pro with retina. How do I use an apple tv remote to control my mac?Is there a way. For eg. if I want to control the volume using the remote how do I do?

    No, the iPad has no IR receiver. (I think you mean "Airplay" and not "Airdrop", by the way.)

Maybe you are looking for

  • Error: InfoObject does not contain alpha-conforming value 20030729

    Hi everyone, I got this problem, that i tried to fix yesterday, but all i did was that i got realy frustrated... I created an infoobject which is copy of 0DOC_NUMBER and has alpha coversion routine. Mapping field in DataSource is also type character

  • Insert on basis of select

    Hello, I am trying to find CVs on basis of keywords and then my code is inserting into DB. Its took 4-5 minutes to select and insert 553 records. May I change my following queries or how can I make these statement efficient String query = " select un

  • FRM-41106 You cannot create records without a parent record.

    Hello! Forms 6i. I have a Parent-Detail-Relationship. At the Detail-Block a "When-create-record" sets some default values on the Detail-Block. I got error "FRM-41106 You cannot create records without a parent record" when the Parent-Block executes a

  • Read itab error

    Hello all, i m coding this...... loop at itab2. READ TABLE itab1 with  KEY  X = 'itab2-X'.     if sy-subrc= 0.        process. endif. endloop. But here itab1-X   shows no data in debug but there is data in  itab2-X. so no wrong result. can u tell me

  • Send mail from follow up actions for tasks in service notifications!

    Dear All, I want to send mail to the user from a follow up action in the task assigned to a service notification. In customizing which function module I should select for follow up actions for tasks? Thanks and Regards, Satyajit P