JDIC Integration

Purpose

The ulc-jdic project aims to integrate the JDesktop Integration Components (JDIC) into the UltraLightCLient (ULC) framework, allowing the usage of these components in the context of a ULC application.

JDIC provides Java applications with access to functionalities and facilities provided by the native desktop. It consists of a collection of Java packages and tools. JDIC supports a variety of features such as embedding the native browser, launching the desktop applications, creating tray icons on the desktop, registering file type associations, creating JNLP installer packages, etc.

Supported Components

So far, the following components have been integrated into ULC:

ULC Component Name JDIC Component
ULCBrowser WebBrowser Example

More components are subject to be supported in the future. Please come back and check for other JDIC components integrated into ULC.

Examples

ULCBrowser

The following example shows how to use the ULCBrowser.

            ULCBrowser browser = new ULCBrowser("http://www.canoo.com");
            refreshButton = new ULCButton("Refresh");
            forwardButton = new ULCButton("Forward");
            backButton = new ULCButton("Backward");
            executeScriptButton = new ULCButton("Execute Script");
            //add the listeners to the buttons
            refreshButton.addActionListener(new IActionListener() {
            public void actionPerformed(ActionEvent inEvent) {
            browser.refresh();
            }
            });
            forwardButton.addActionListener(new IActionListener() {
            public void actionPerformed(ActionEvent inEvent) {
            browser.forward();
            }
            });
            backButton.addActionListener(new IActionListener() {
            public void actionPerformed(ActionEvent inEvent) {
            browser.back();
            }
            });
            //use a script handler to react on script results
            executeScriptButton.addActionListener(new IActionListener() {
            public void actionPerformed(ActionEvent inEvent) {
            IJavaScriptHandler myHandler = new IJavaScriptHandler() {
            public void scriptCompleted(int ScriptID, String result) {
            System.out.println("Script ID: " + ScriptID
            + " result: " + result);
            }
            };
            browser.executeScript("alert('Using Script')", myHandler);
            }
            });
            //add a listener for the Browser events
            browser.addWebBrowserListener(new WebBrowserAdapter() {
            public void downloadCompleted(WebBrowserEvent event) {
            fAddressTextField.setText(fWebBrowser.getUrl());
            fBackButton.setEnabled(fWebBrowser.isBackEnabled());
            fForwardButton.setEnabled(fWebBrowser.isForwaredEnabled());
            updateStatusInfo("Document loading completed.");
            }
            public void downloadError(WebBrowserEvent event) {
            updateStatusInfo("Loading error.");
            }
            public void titleChange(WebBrowserEvent event) {
            if (fMainPane instanceof ULCFrame){
            ((ULCFrame)fMainPane).setTitle(event.getEventData());
            updateStatusInfo("Title of the browser window changed.");
            }
            }
            });
         

Resources