Professional Documents
Culture Documents
2009
About This Document - The section you are looking at now, which includes a brief introduction, release notes, and copyright notifications. Introducing the Samsung Mobile Widget SDK - Describes how to install, update, and launch the SDK. The Widget Perspective - Describes the user interface of the Samsung Mobile Widget SDK and describes how to customize it. Creating a Widget Project - A simple guide to creating a project that you can use to quickly produce widgets for Samsung TouchWiz devices. Supporting Multiple Devices with Overrides - Using one widget project to support many different devices by putting customized files in override directories. Tutorial Sample - A simple widget that uses JavaScript, CSS, and images. Debugging Widget Projects - How to use publicly available debugging tools to find errors in your projects. Widget-Development Tips - Techniques and suggestions that will help you get the most out of the SDK. SDK Menu Items - A reference to the menu items that are specific to the Samsung Mobile Widget SDK.
Automatic Update Site: A new update site has been created for the Samsung Mobile Widget SDK. It is: http://widget.samsungmobile.com/
sdk/. Current users just need to perform an update using their current update sites. Choose Help > Check for Updates. As part of installing the 1.0.1
update, the list of update sites in Preferences > Install/Update > Available Software Sites will automatically be updated to point to the new Samsung Mobile Widget SDK update site at widget.samsungmobile.com. Future updates will then come from the new site. Use of the update site at
Device List: The GT-M8910 Pixon12 device has been added to the device list.
Java5 JRE To download Java, visit: http://java.com/. (Reference platform is Sun Java 2 Standard Edition 5.0 Update 11) For more information see: http://www.eclipse.org/downloads/moreinfo/jre.php Eclipse 3.5 for JavaEE (Galileo Release). To download Eclipse, visit: http://www.eclipse.org/downloads/
You must have the Eclipse SDK for Java EE to run the Samsung Mobile Widget SDK.
The generic XML file, configinfo.xml, is now named project.xml. You will need to copy settings from your old XML file into the project.
The overrides directories were named by the screen resolution of the device, but now the names are a combination of the resolution and browser name. You will need to copy files from any older overrides directory into the appropriate overrides directory in your new project.
Workspace Setup
Please verify that your workspace is set up to use UTF-8 as a default text encoding. 1. Select Window > Preferences > General > Workspace 2. Click the Other radio button in the Text file encoding section and select UTF-8 from the drop-down list.
JavaScript Support
Preferences are in Window > Preferences > Web > JavaScript Do not manually add or remove libraries from your project. Libraries will be better supported in a future release. Until further notice, do not select "Enable JavaScript semantic validation" (see Window > Preferences > Web > JavaScript > Validator > Errors/ Warnings). Selecting this option currently produces some spurious errors and warnings. If you prefer not to be warned about missing semicolons, do the following: 1. Select Window > Preferences 2. Expand Web > JavaScript > Validator 3. Select Errors/Warnings 4. Check "Enable JavaScript semantic validation" 5. Expand "Potential programming problems" 6. Change "Optional Semi-Colon" to Ignore" 7. Turn off "Enable JavaScript semantic validation" 8. Click the OK button. Select Yes when asked about a full rebuild.
Run As Widget
If you see a Windows error dialog box when you use the Run As > Widget command, you might be missing some VisualStudio runtime libraries. Download and install them here.
In the Widget perspective, choose Help > Help Contents. Use the Contents view to navigate to Samsung Mobile Widget Development Guide.
Samsung Electronics
This material is copyrighted by Samsung Electronics. Any unauthorized reproductions, use or disclosure of this material, or any part thereof, is strictly prohibited and is a violation under the Copyright Law. Samsung Electronics reserves the right to make changes in specifications at any time and without notice. The information furnished by Samsung Electronics in this material is believed to be accurate and reliable, but is not warranted true in all cases. "SAMSUNG", "SAMSUNG.com" and "SAMSUNG DIGITall Everyone's invited" are trademarks of SAMSUNG in the United States or other countries. Unauthorized use or duplication of these marks is strictly prohibited by law. The Samsung Logo is the trademark of Samsung Electronics.
Firefox
Firefox Copyright 1998-2009 Contributors. All rights reserved. Firefox and the Firefox logos are trademarks of the Mozilla Foundation. All rights reserved.
Microsoft Corporation
Windows is a registered trademark of Microsoft Corporation in the United States and other countries.
NetFront
Copyright 2009, ACCESS CO., LTD. ACCESS and NetFront are trademarks or registered trademarks of ACCESS Co., Ltd. in Japan and other countries.
Opera
Copyright 1995-2009 Opera Software ASA. All rights reserved.
Safari
Copyright 2007-2009 Apple Inc. All rights reserved.
The Samsung Mobile Widget SDK is a widget-development environment based on the Eclipse open development platform. Samsung Mobile Widget SDK helps you develop widgets for Samsung mobile devices running the TouchWiz user interface. This guide shows you how to create a widget project, launch the widget on the device emulator, and package it for release. In addition, you will find a stepby-step description of creating a sample widget that answers many common questions about widget development. Samsungs TouchWiz user interface includes 3D-effects, haptic feedback, and gesture and voice controls. The TouchWiz widget dock makes it easy for customers to manage and download widgets that customize and personalize their devices. Samsung Mobile Widget SDK simplifies the task of developing widgets in a number of ways:
It uses templates to create projects you can use as a starting point. It provides an emulator that makes it easy to visualize the final product on multiple devices, browsers, and platforms. It simplifies the customization of widgets for different sizes of device screens. It provides IDE features like autocomplete, context menus, and error tracking. It imports existing widgets, enabling you to examine and modify them. It packages and exports widgets for distribution.
This guide assumes that you have some familiarity with Eclipse and that you are familiar with HTML, CSS, and JavaScript.
Click the Add button to add the Samsung Mobile Widget SDK distribution site to your list of available software sites. The Add Site dialog box appears:
Give the update site an identifiable name in the Name field - something like "Samsung Mobile Widget SDK update site" - and specify the URL in the
Location field. The URL for the Samsung Mobile Widget SDK update site is http://widget.samsungmobile.com/sdk/. Click the OK button when
you are finished. From the Work with: combo box, select the update site that you just added.
The Install dialog box should now display "Samsung Mobile Widget SDK" in the list of available software:
Select the checkbox next to "Samsung Mobile Widget SDK" and then click the Next button. A progress bar across the bottom of the window shows you that Eclipse is "Calculating requirements and dependencies." An Install Details screen appears, listing the items to be installed:
Select the "Samsung Mobile Widget SDK" item and click the Next button. Review and accept the license, and click the Finish button. When the "Operation in progress" progress bar tells you that the installation is finished, a Software Updates dialog box "strongly recommends" that you restart Eclipse. Click Yes to follow this suggestion.
You should see "Samsung Mobile Widget SDK Widget Development" in the list on the Installed Software tab. To uninstall the Samsung Mobile Widget SDK, you would select "Samsung widget development core" in the list and click the Uninstall button.
Choose "Widget" from the list in the Open Perspective dialog box and click the OK button. The Widget perspective opens, revealing the views and editors you will use to help build widgets for the TouchWiz interface.
Project Explorer view shows you the names and structures of your current projects. Note that widget projects are decorated with an open folder containing an "S". Source Editor views display the editable files in your project and provide tools for editing them. Outline view gives you an easy way to see the organization of the file that is currently open in the editor and allows you to jump quickly to given point in the file. Device view displays the devices that are emulated when you preview your widget. Enables widget developers to add new devices to their projects by dragging them into the project's Device List. Instance Management views give you information you can use to add devices to your project, diagnose problems, and browse search results.
To return a perspective to its default appearance, choose Window > Reset perspective. If you find that you usually modify the default perspective, you can save your preferred configuration by choosing Window > Save Perspective as and giving your configuration a unique name. This new perspective now appears among the choices in the Open Perspective dialog box. You can add views to your perspective, if you like. To see a list of views you can add, choose Window > Show View. If you choose Other... in the menu that appears, you will be presented with a Show View dialog box that gives you access to a large number of possibilities. Another common customization is to use filters to choose which features to hide and show. For example, you might want to hide any closed projects in the Project Explorer view. To close a project, right-click the name of the project in Project Explorer and choose Close Project from the context menu. The icon decorating the project name changes from an open folder to a closed folder.
To hide closed projects, click the View Menu icon in Project Explorer (a small inverted triangle) and choose the Customize View option.
In the Available Customizations dialog box that appears, select the "Closed projects" filter in the Filters tab and click the OK button.
The configuration information defines several important things about your widget.
Widget ID: A unique identifier for your widget. You should provide the namespace of your company or organization where <yourdomain> is suggested and a further refinement of your company's namespace where <yourdomain> is suggested. For more information, see Unique Widget Identifiers. Description: A brief description of your widget. Version: A version number that identifies your widget. Unlike the Widget ID, this version number may be exposed to the user. Width and Height: The size, in pixels, of the widget when it appears on the target device. Access Network: Designates whether the widget accesses the network. The default setting is TRUE. You should uncheck this box if your widget does not the network, as shown in the preceding screen shot.
You can edit these settings later, if necessary, by opening the project.xml file in the root of your widget project. The project.xml file is a generic configuration file that the Samsung Mobile Widget SDK uses to generate the config.xml file that is required by the finished widget. Different versions of the config.xml file are required for different platforms. The Samsung Mobile Widget SDK generates the correct form of config.xml whenever you export a project, based on your project's project.xml file and the platform of the target device. When you have finished with this Create a Widget Project screen, click the Next button.
You can select more than one device by using the usual Ctrl+Click and Shift+Click key combinations, as shown in the preceding screen shot.
You can add new devices to a project at any time by dragging them from the Device view to your project's Device List node.
When you have finished with this Select Devices screen, click the Next button.
The "RSS Reader" widget implements many good ideas in cross-platform widget design. For more information, see Best Practices for Widget Development. Click the Finish button to create your Widget project.
Most of the files in a new project are starting points for your code; as you would expect, the "Hello World" template creates a very simple widget.
Device List Lists the target devices for your widget. You can add to this list after you have created the project by dragging devices here from the Device view. css > style.css Lists the CSS files defining the appearance of your HTML file(s). The default file, style.css, is linked to at the top of the default
HTML file; you can supply more CSS files in this directory, if necessary, and link to them from the HTML file.
images Lists the PNG images used by your widget. PNG is the preferred file format, because PNG files support transparency and have ample color depth. project.xml Supplies configuration information, including the information you specified when you created the project. If you needed to change a widgets width and height, for instance, you would need to edit this file. overrides - Lists groups that define the screen resolutions and browsers supported by your project's devices. You can use these groups to customize your widget for particular browsers and resolutions. In this case, the 240x400 NetFront group is for the Pixon device, and the 240x400 Opera group is for the Omnia device. icon.png An icon that is displayed in the devices widget tray to identify your widget. The size of the icon varies with the screen size of the target device:
r r r r
QVGA (240 x 320) the maximum width of the tray is 56 pixels. A square icon should be no wider than 44 pixels. WQVGA (240 x 400) the maximum width of the tray is 60 pixels. A square icon should be no wider than 50 pixels. QHD (360 x 640) the maximum width of the tray is 81 pixels. A square icon should be no wider than 65 pixels. WVGA (480 x 800) the maximum width of the tray is 126 pixels. A square icon should be no wider than 102 pixels.
index.html Provides the HTML code that implements the appearance of your widget. Most widgets use only one HTML file. You might use more than one HTML file if your widget were implemented in multiple languages; the index.html file would allow users to choose a language, and each language would be implemented in its own HTML file. JavaScript Resources - A read-only list of the libraries that are available to your widget. As you add devices to your project, libraries available on that device are automatically added to this directory. You can browse through the libraries to look for functions or documentation on functions in the supported libraries.
js > main.js Lists the JavaScript files that supply the functionality of your widget. The default file, main.js, is specified at the top of the default
HTML file.
Your icon file must be named icon.png and your root-level HTML file must be named index.html.
The SDK's second emulator is based on the Opera browser. This emulator is used for Windows Mobile devices. For example, a preview of the "RSS Reader" widget on the Omnia (Opera) device looks like this when the emulator appears:
The RSS Reader widget retrieves headlines from Yahoo! News. The Opera browser runs behind the emulated widget, as shown above. When you choose one of the stories in the list, the widget displays story details:
The back arrow above the story returns the reader to the list of stories. The plus button launches a browser that displays the full story on the Yahoo! News site. You can use the Run button as a shortcut after you have run several widget previews. When you click the small arrow to the right of the Run button ( ), a list of recent launches appears. Choose the project you want to preview from this list.
Right-click a device in your Device List and choose Export from the context menu that appears. Select any file in your project and press the CONTROL+SHIFT+X key combination. Select the root of the "Choose_a_Button" project and choose File > Export. In the Export dialog box that appears, expand the Samsung node, select
An exported widget is given a name in the form Project_Name.Device_Name.WGT. In this case, the widget is named Choose_a_Button.Pixon.
WGT. A .WGT file is really a standard compressed file with a .WGT filename extension; to view its contents, you can rename the file by adding a .ZIP
extension and then open it with any compression utility.
5.2 - Overrides
You might choose to lay out your widget differently for different screen sizes, or to use special-case code for different browsers. You can do this by putting modified files into the overrides directory for a specified group. The files at the root of your project are used by default whenever you run or export a widget; if you put a modified file into one of the overrides directories, that file will override the default file. You could use a single widget project to support both a QVGA (240 x 320) device and a WVGA (480 x 800) device, for example. Let's say that the HTML and JavaScript files were the same for both of these devices; the HTML is simple, and the JavaScript contains any required special-case code for window resizing. In this case, you might need to support the different screen resolutions with customized icon files, separate images, different CSS files for positioning objects, and separate project.xml files containing the size of the widgets. A schematic view of the project might look something like this:
In this case, whenever you previewed or exported your widget for Device One, the IDE would pick up the default files: the styles, images, icon, HTML, XML, and JavaScript. When you previewed or exported the widget for Device Two, the IDE would build a widget using the default HTML and JavaScript, but would override the other files with the contents of the 240x320 BrowserA directory. Similarly, when you previewed or exported the widget for Device Three, the IDE would build a widget using the default HTML and JavaScript, but would use the contents of the 480x800 BrowserB directory.
html file into the overrides > 240x320 Dolfin directory (or CTRL + Drag), edit the text in the HTML file, and preview the result on the Tocco
and the other devices. The changes you make to the files in the overrides > 240x320 Dolfin appear only when you preview on the Tocco - the widgets for the other devices have not changed. Note that you do not need to copy any JavaScript or CSS files in this case - the only file you need to put in the 240x320 Dolfin directory is the file that is changing for this override. To preview your widget on a particular device, select the device in the Device List, click the small triangle next to the Run icon, and choose Run As > Widget.
Alternatively, you can right-click on the desired device and choose Run As > Widget.
Yet another way of doing this is by using the Run menu: Run > Run As > Widget. The output on the Tocco emulator looks like this:
The new copy of index.html in the 240x320 Dolfin directory is picked up automatically when you preview the Tocco. Notice that the size of the text in this example has been changed with an inline style to prevent line-wrap problems.
Tutorial Sample
This section of the Samsung Mobile Widget Development Guide leads you through the process of creating a simple widget. This widget uses simple CSS and JavaScript to animate buttons and change the visibility of paragraphs - it is only slightly more complicated than the "Hello World" template
To ensure that the project was set up successfully, right-click the root of the "Choose_a_Button" project in Project Explorer and select Run As > Widget. A white box should appear in the emulator.
In the sample code, these buttons are named yes.png, yes_inverted.png, no.png, and no_inverted.png. After you have created the buttons, you can drag them from a window in the file system to the images directory in Project Explorer to import them into your project.
/*================================================================= * The start() function is called when the onload() event occurs. * It ensures that the responses to button presses are initially * hidden. ================================================================*/ function start() { document.getElementById("yesreaction").style.visibility="hidden";
document.getElementById("noreaction").style.visibility="hidden"; } /*================================================================= * The mouseClick() function is called when the onclick() event * occurs. It animates the buttons and changes the visibility * of the paragraphs that display responses to the click. * * button parameter - string identifying the button that was clicked ================================================================*/ function mouseClick(button) { if (button=="yesbutton") { // change the button image for 300 milliseconds document.yesbutton.src ="images/yes_inverted.png"; setTimeout("document.yesbutton.src ='images/yes.png'", 300); // ensure other button is in unselected state document.nobutton.src ="images/no.png"; // change visibility of button responses document.getElementById("yesreaction").style.visibility="visible"; document.getElementById("noreaction").style.visibility="hidden"; } else if (button=="nobutton") { document.nobutton.src ="images/no_inverted.png"; setTimeout("document.nobutton.src ='images/no.png'", 300); document.yesbutton.src ="images/yes.png"; document.getElementById("yesreaction").style.visibility="hidden"; document.getElementById("noreaction").style.visibility="visible"; } else { document.write("Something went wrong."); } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/main.js"></script> </head> <body onload="start()"> <p>Would you care to <br />press a button?</p> <img src="images/yes.png" name="yesbutton" onclick="mouseClick('yesbutton')"></img> <img src="images/no.png" name="nobutton" onclick="mouseClick('nobutton')"></img> <p id="yesreaction" style="position:absolute;top:100px"> Thank you for your input.</p> <p id="noreaction" style="position:absolute;top:100px"> You are trying <br />to confuse me.</p> </body> </html>
Use your mouse to verify that the buttons animate correctly and that they handle the mouse clicks.
This section of the documentation will help you choose a good debugger for your widget project.
NetFront (ACCESS), for some Samsung Handset Platform (SHP) devices Opera, for Windows Mobile devices Dolfin (WebKit), for some SHP devices
You can preview your widget on any web browser you have installed by setting up a new run configuration for your project. For more information, see Previewing on a Browser. Most users of the Samsung Mobile Widget SDK attempt to develop widgets that will reach as many TouchWiz devices as possible. The most successful widgets will run on any platform and on any browser. Building widgets like this requires careful attention to interoperability issues, as outlined in Best Practices for Widget Development.
HTML editor
CSS metrics JavaScript debugging, with breakpoints, stepping through code, expression watching, stack tracing, and more. DOM exploration
The following screen shot shows Firebug displaying information about the "Hello World" code, while the output is displayed at the top of the screen. The Layout view is a graphical representation of the current styles.
Firefox does not allow you to use XMLHttpRequest from a local file. If your widget uses XMLHttpRequest and you want to debug it in Firebug, add the following (temporarily) to your code. This will present a dialog box when the request is made:
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) { // There should be no errors. This try/catch construction should allow // you to run this code in any browser. }
For more information about working with XMLHttpRequest, see XMLHttpRequest Issues. You can learn more about Firebug and download it here: http://getfirebug.com/
You can use the Scripts tab to examine your project's JavaScript files and the Elements tab to examine your HTML and CSS files. The name of the current JavaScript file is next to a drop-down list that enables you to switch between files:
When you first run Dragonfly, you will see a drop-down window in the Scripts tab labeled "Select a window." Click the down arrow and choose "Widget Emulator" to start your debugging session.
If the "Select a window" drop-down window is empty, please close other instances of Opera that you have running.
You can use the Dragonfly views to see the HTML and script files for both the emulator and your widget. You should be sure to work with the widget files when you are debugging, not the emulator files. To do this, click the DOM tab above the Dragonfly work area and then the Documents tab at the bottom of the window, and choose the path that ends with ...DeviceName/widgets/ProjectName/index.html, not ...opera_emulator/
DeviceName/index.html.
The Scripts view also shows the script for both the emulator itself and for your widget. Normally, your source files will be under the second index.html tree control. Information about Dragonfly can be found at http://www.opera.com/dragonfly. A discussion of using Dragonfly to debug widgets is here: http://dev.opera.
com/articles/view/debugging-widgets-using-opera-dragonfly/.
Widget-Development Tips
This part of the Samsung Mobile Widget Development Guide discusses advanced topics for widget development.
Both the comments in this code and the implementation details can help you develop your widgets. Many of these API elements work in different ways on different platforms; you should implement cross-browser strategies in your code to accommodate these differences. For information, see Best Practices for Widget Development and Samsung Mobile Widget Specification V0.93.
There are tabs along the bottom of this view. In the preceding screen shot we are looking at the Design tab. For a better preview of the HTML file you can click the Preview tab. The mouse cursor in the preceding screen shot is near a small left arrow that you can click to reveal a palette of visual items you can drag into the editor. For example, in the following illustration, the Line Break item has been dragged from the HTML 4.0 menu and dropped between "Hello" and "World":
Ensure that the Widget node is selected in the Run Configurations dialog box that appears. Give this new run configuration a descriptive name. The
Project and Device entry fields are filled in with values taken from the project that was selected when you opened this dialog box. Select "Web Browser"
in the Run with section. The dialog box should look something like this:
Click the Web Browser Preference... button to choose the web browser on which you would like to test your widget:
Ensure that the "Use external Web browser" radio button is selected, as shown above. To add a new browser to this list, click the New... button and navigate to the browser's location on your hard drive.
Browsers handle security with XMLHttpRequest in different ways. For example, the Dolfin browser used by many Samsung devices (based on the WebKit browser used in the Samsung Mobile Widget SDK) allows XMLHttpRequest access to remote sites, but other browsers may not. For more information, see Working with Multiple Browser Platforms.
5. Click the Finish button. 6. Drag a device into the Device List for the new project. The following screen shot shows a list of available widget files that could be displayed when a user clicks the Browse button.
When you import an existing widget, the Samsung Mobile Widget SDK reads the widget's config.xml file and transfers the values to the new project's generic project.xml file. Different versions of a widget's config.xml file are required for different platforms. When you export a project, the Samsung Mobile Widget SDK generates the correct form of config.xml, based on the project's project.xml file and the platform of the target device. For information about exporting a project, see Exporting a Widget. Note for earlier widgets developed using the Opera Widget Emulator: Widgets written to work with the Opera Widget Emulator may have the following line of code in the head of index.html to allow them work with the Opera Widget Emulator:
<script type="text/javascript">if(parent.emulator)parent.emulator.begin(window);</script>
You should remove this line from your index.html file. The Samsung Mobile Widget SDK automatically works with the Opera Widget Emulator. Calling
emulator.begin again overwrites the Samsung Mobile Widget API widget object, causing incorrect emulation behavior for setScroll and resizeWindow.
If you follow the suggestions given in the angle brackets and allow the IDE to add the name of your project at the end of the string, your widget project is certain to have a unique identifier. Your identifier might look like this:
Company URL - The namespace of your company or organization. For example, com.samsung Group ID - A further refinement of the company namespace. For example, sprc.dev.widgets Project name - The name of your widget project.
The IDE combines these values with an identifier for the target device to produce the final unique widget identifier. A link in the Create a Widget Project dialog box makes it easy for you to set a preference that saves your identifier prefix, freeing you from having to enter
it every time you create a new widget project. Click Set Widget ID default prefix to display the Preferences dialog box:
You can also save your widget identifier's prefix by choosing Window > Preferences and clicking the Widget node.
Window Resizing
A common cross-browser issue is window resizing. SHP devices support the resizeWindow API, but Windows Mobile devices may support only the
resizeTo API. You can solve this problem with a try/catch construction like this:
Event Handling
function doSomething(e) { if (!e) { var e = window.event; // e gives access to the event in all browsers } }
If you use this idiom with inline event handling, you must pass the event to the handler manually. Restrict event handling to the W3C DOM Level 2 Event specification: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/ For additional information, use resources such as http://www.quirksmode.org/js/introevents.html and http://www.quirksmode.org/js/events_access.html.
XMLHttpRequest Issues
Various browsers have different security restrictions when using XMLHttpRequest from a local file.
IE - allowed with warning dialog Safari - allowed Opera - disallowed - test as widget instead Firefox - disallowed - add the following (temporarily) to your code. This will present a dialog box when the request is made:
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) { // There should be no errors. This try/catch construction should allow // you to run this code in any browser. }
The responseXML from a XMLHttpRequest can be null if the request header has not been initialized correctly. The results can vary on different browsers. To correctly get the desired response, set the content header before making the request. For example:
request.setRequestHeader("Content-type", "text/xml");
The XMLHttpRequest API is not currently supported by Internet Explorer. Your code should create a cross-browser XMLHttpRequest object by creating a new ActiveXObject, when necessary, as in the following sample from the RSS Reader template's network.js file:
function getXMLHttpRequest() { var xmlHttp = null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } return xmlHttp; }
http_proxy
This must be in lowercase letters, as shown. 6. Specify the variable value in this form:
http://proxy_server_name:port_number
A variable value might look like this:
http://ourproxy.widget.com:8081
7. Reboot your computer. The next time you run the emulator, it will use the proxy as specified.
Configuring Opera
You can find the proxy settings in Opera like this: 1. Tools > Preferences 2. Advanced tab 3. Network node 4. Proxy Servers button Use the information given above, in Setting the System's Environment Variable, to set up the proxy server.
Configuring Safari
You can find the proxy settings in Safari like this: 1. Edit > Preferences 2. Select Advanced 3. Proxies: Change Settings button 4. LAN Settings button 5. Select the checkbox for "Use a proxy server for your LAN" Use the information given above, in Setting the System's Environment Variable, to set up the proxy server.
Configuring Firefox
You can find the proxy settings in Firefox like this: 1. Tools > Options 2. Advanced tab 3. Network tab 4. Settings button in the "Connection: Configure how Firefox connects to the Internet" section. 5. Select the "Manual proxy configuration" radio button. Use the information given above, in Setting the System's Environment Variable, to set up the proxy server.
This section of the Samsung Mobile Widget Development Guide is a reference to the menu items that are specific to the Samsung Mobile Widget SDK. Not every menu item is listed here. Menu items are discussed only when they are new or extended for the Samsung Mobile Widget SDK, when their use could be confusing without some explanation, or when they are used so commonly in widget development that omitting them would appear to be an oversight. For information about the Eclipse user interface, use the following links into the IDE's integrated help system. These links work only when you are viewing this document inside the IDE, by choosing Help > Help Contents and expanding the Samsung Mobile Widget Development Guide node. To return to this page, click the yellow left arrow ( Eclipse menu items:
File menu Edit menu Navigate menu Project menu Window menu Help menu
Project Explorer icons Editor area marker bar Tasks view Toolbar buttons
You can find a great deal of useful information about Eclipse in the help file, under Workbench User Guide. The preceding links take you to pages in Workbench User Guide > Reference > User interface information.
File Menu
New > Widget Project creates a new widget project. For a description of using this menu item, see Creating a New Project. Import imports an existing widget, creating a new project for it. For a description of using this menu item, see Importing an Existing Widget. Export packages a widget for release, creating a .WGT file in the destination you specify. For a description of using this menu item, see Exporting a Widget Properties gives you information about the selected project. You should select a project name before choosing this menu item. Information that may be useful to widget developers includes:
r
Resource node identifies the workspace for the project. Run/Debug Settings enables you to work with launch configurations for your project. For information about launch configurations, see
Previewing on a Browser.
Validation > HTML Syntax enables you to configure project-specific HTML validation settings and provides a link to a dialog box where you
can configure settings for your entire workspace.
Run Menu
Run As > Widget enables you to test your widget in the device emulator. There are several other ways to do this - you can also use the context menu in Project Explorer view or the Run button in the menu bar ( ). For a description of using this menu item, see Testing a Widget Project.
Run Configurations enables you to create selectable launch environments for your widget project; for instance, you could create a configuration that allowed you to choose to run the widget in Internet Explorer. In the Run Configurations dialog box, choose Widget > New_configuration to reveal the Widget Preview Mode settings. You can use the same alternative ways of doing this as you could for Run As > Widget above. For information about launch configurations, see Previewing on a Browser.
Window Menu
Open Perspective > Other reveals a dialog box that allows you to choose the Widget perspective. You can also use the Open Perspective icon to do this. For a description, see Launching the Samsung Mobile Widget SDK. Show View enables you to show any views that may be hidden and to choose any views that are not part of the default Widget perspective. If you select Show View > Other you will be able to choose from many different views that are supplied by the Eclipse IDE. Save Perspective As enables you to save a customized version of the Widget perspective. For more information, see Customizing a Perspective. Reset Perspective resets the Widget perspective to its default settings. Preferences reveals a dialog box where you can change a wide array of different settings for Eclipse.
r
Install/Update > Available Software Sites lists the URLs of web sites that might contain Eclipse updates. One of these sites is the Samsung widget update site. You can use this page to modify or test your connection to this site. Web reveals a large number of preferences that are interesting to widget developers, including CSS Files, HTML Files, and JavaScript. Widget enables you to specify the default domain name for your projects. For more information, see Unique Widget Identifiers.
r r
Help Menu
Help Contents opens the Eclipse integrated help system. One of the items in the Contents pane is Samsung Mobile Widget Development Guide - this documentation. You may sometimes find it useful to restrict the scope of your searches to this document; to do this, click the Search scope link to the right of the Search entry field and define a search scope that is restricted to this guide.
Check for Updates causes Eclipse to check a list of web sites for updates to any of its plug-ins. Any updates to the Samsung Mobile Widget SDK will be downloaded and installed with you choose this menu item. Install New Software enables you to specify a site from which you would like to download new Eclipse plug-ins. For more information, see Installing the Samsung Mobile Widget SDK. About Eclipse reveals a dialog box with Build identifiers and buttons that display features of individual Eclipse components. One of these buttons is decorated with the widget icon; this will take you to information about the Samsung Mobile Widget SDK. Clicking the Installation Details button at the bottom of the About Eclipse dialog box brings up an Eclipse Installation Details dialog box, which contains a wealth of information about the plug-ins that comprise the IDE.
).
Customize View enables you to specify items you want to hide or reveal in the Project Explorer view. For more information, see Customizing a Perspective. Link with Editor is a persistent setting that causes the name of the file you are working on in the Source Editor view to be highlighted in Project Explorer.
New > Project opens a New Project dialog box, which you can use to create a new widget project. Inside this dialog box, you can expand the Samsung node, select Widget Project, click the Next button, and complete the creation process as described in Creating a New Project. Import opens an Import dialog box. For information about importing an existing widget into the IDE, see Importing an Existing Widget. Export opens an Export dialog box. For information about exporting a widget, see Exporting a Widget Run As > Widget enables you to test your widget in the device emulator. There are several other ways to do this - you can also use the Run > Run As menu item in the menu bar or the Run button ( ). For a description of using this menu item, see Testing a Widget Project. Properties gives you information about the selected project. For more about this menu item, see File Menu, above. Open With > Web Page Editor - available only when you have selected an HTML file. This source editor may help visualize your work as you produce a widget. It includes a visual preview, a palette of user-interface elements that you can drag into your project, and Design and Preview modes.
Available Software Sites, Preferences > Install/Update See Window Menu, Preferences. Check for Updates See Help Menu. Configurations, Run See Run Menu, Run Configurations. Customize View See Project Explorer View Menu. Eclipse, About See Help Menu, About Eclipse. Eclipse, Installation Details See Help Menu, About Eclipse. Editor, Link with See Project Explorer View Menu, Link with Editor. Export See File Menu and Project Explorer Context Menu. Help Contents See Help Menu. HTML Syntax, Validation See File Menu, Properties. Import See File Menu and Project Explorer Context Menu. Install/Update > Available Software Sites, Preferences See Window Menu, Preferences. Install New Software See Help Menu. Link with Editor See Project Explorer View Menu. New > Project See Project Explorer Context Menu. New > Widget Project See File Menu. Open Perspective > Other See Window Menu. Open With > Web Page Editor See Project Explorer Context Menu Perspective, Open > Other See Window Menu. Perspective, Reset See Window Menu, Reset Perspective. Perspective, Save As See Window Menu, Save Perspective As. Preferences See Window Menu. Project, New See Project Explorer Context Menu, New Project. Project, New Widget See File Menu. Properties See File Menu. and Project Explorer Context Menu Reset Perspective See Window Menu. Run/Debug Settings See File Menu, Properties. Run As > Widget See Run Menu. and Project Explorer Context Menu Run Configurations See Run Menu. Save Perspective As See Window Menu. Show View See Window Menu. Software, Install New See Help Menu, Install New Software. Updates, Check for See Help Menu, Check for Updates. Validation See File Menu, Properties. View, Customize See Project Explorer View Menu, Customize View. View, Show See Window Menu, Show View. Web, Preferences See Window Menu, Preferences. Widget, Run As See Run Menu, Run As. and Project Explorer Context Menu Widget Project, New See File Menu.