Import dijit/dojo widgets into worklight palette - dojo

I've been working with IBM Worklight for the last month and I discovered that even if I imported the Dojo toolkit when I created my hybrid app, I can't see dijit components in my palette, and some dojo/dojox components cause errors.
Here is my config :
Windows XP
Eclipse SDK Version: 3.7.2
IBM Worklight 5.0.5
Dojo version 1.8.1-20121024
Therefore I got errors when launching my app :
Failed to load resource: the server responded with a status of 404 (Not Found)
URL/ipad/1.0/default/dojox/dgauges/components/green/HorizontalLinearGauge.js
(I wanted to display a slider and only found this gauge)
But I do have the dojo folder in my project (with dijit/dojo/dojox folders inside).
Anyone knows how to fix this ?
Cheers

I have used the Worklight Studio 5.0.5.1 wizard to create a project and application that includes Dojo and added the iPad environment.
Next, looking at the Dojo Palette, I see a slider widget. I drag it to my HTML:
Run As > Build All and Deploy and previewing the environment in the MBS shows the slider:
I do not have Xcode on this machine so this is the best I can do right now.
Are you sure you do not see a slider widget?

If you were looking for the dijit form Horizontal Slider, you can right click in the palette's contents and click Customize... In the Customize Palette dialog, select the Dojo Form Widgets category, and uncheck Hide. When you expand Dojo Form Widgets, you can select Horizontal Slider and uncheck Hide. Click OK, and these items should show up in the palette.
But for a slider on a mobile page, Idan's suggestion of using a Dojo Mobile Slider is probably better than the dijit slider.

To improve build performance, applications with Dojo dictate which files to include in the build using the build-dojo.xml file. By default, it is optimized for mobile development. If you'd like to include the HorizontalSlider, the easiest way is to uncomment <include name="dojo/dijit-layer.js.compressed.js"/>, but leave the <include> elements after that commented out. That will give you a patternset of "dojo/dojo.js.compressed.js", "dojo/core-web-layer.js.compressed.js", and "dojo/dijit-layer.js.compressed.js".
If you've used the Palette to drag and drop the HorizontalSlider, it should have added references to dijit.css and claro.css in the application's markup. So these resources will need to be added to your application to style the widget. You could do this manually by copying the dijit/themes/claro/ directory and dijit/themes/dijit.css file into your application. But as we saw, the build-dojo.xml file automates adding these things to the build. In your build-dojo.xml file, find the patternset dojo.resources.loose-modules. And add the following includes:
<include name="dijit/themes/claro/**"/>
<include name="dijit/themes/dijit.css"/>
Save the build-dojo.xml file.
Now you need to update your application's JS file. In wlCommonInit, the layer files are required. There is an array the includes what you would need for mobile development. You will need to add another layer to the array: "dojo/dijit-layer". So it should look something like:
require([ "dojo/core-web-layer", "dojo/mobile-ui-layer", "dojo/mobile-compat-layer", "dojo/dijit-layer" ], dojoInit);
Save your application's JS file and preview your application as you normally would. This should fix the 404 problems and render the HorizontalSlider widget.

Related

Eclipse RCP Application doesn't show UI-Elements of external plugins

I'm currently adapting an eclipse-plugin for an eclipse-rcp application.
The framework version wasn't changed in this progress. It's still based on eclipse 3.8. So no framework update. But somehow I'm not able to show my ui-elements in the new version.
I tried the basic sample-plugin of eclipse. It works perfectly in the old one but not in the new one.
The plugin is loaded and will be executed. The UI-Elements are loaded from the plugin.xml but somehow they are not displayed. I put the same sample file into the old one and it works perfectly. See Old Version and New Version
Does eclipse rcp provide any methods to disable the ui-elements of external plugins with something like a white- or blacklist?
I'm thankful for every input.
With some help with the support of the application I was able to resolve the problem. They implemented in the new version a permission management. I had to add an suffix to all my ids of menus, views and buttons otherwise this elements will be filtered.

Unable to set up jquery mobile project with worklight 6.1

I am unable to set-up a IBM Worklight project involving jquery-mobile. Here are my environment details:
eclipse Version: Juno Service Release 2 (32-bit version since I am using jre1.6.0_41)
Worklight version: 6.1.0.01
jquery-mobile: 1.3.1
I can create a new worklight project (called MyLab1) and associate jquery-mobile CSS and JS files to it. However the problems are:
The default .html file gets created as index.html (under 'apps->MyLab1->common') while my expectation is it should be MyLab1.html (as per the training material I have from IBM Worklight)
The 'Mobile Navigation' pane is completely blank while my expectation (again as per training material) is I will see a 'page(default)' control there
Whenever I try to create a new control (under 'Mobile Navigation' pane) I get the error 'Mobile Navigation controls cannot be added to the current page. This feature is only enabled for projects which have jQuery Mobile or Dojo mobile available'
I do not see any option (under eclipse menu) to start or stop Worklight sever (that comes with Developer studio version)
I am fairly new to Mobile application development space (just started with IBM worklight set up this week) and given the above issues I believe I may be doing something fundamentally wrong.
Starting Worklight 6.1, it is very much expected for a new application filenames' to be main.js, main.css and index.html.
Additionally, while you can do the adding of jQuery Mobile by yourself, you should instead use the wizard Worklight Studio provides for you.
This way not only will the files you choose be added properly to your project, but the HTML file will be updated accordingly as well (HEAD references, initial jQuery Mobile template in the body element).
The Palette view should then also list the relevant jQuery Mobile widgets you can use in your app.
Please follow the Worklight 6.1 training modules if you intend on using Worklight 6.1.
My impression is that you are reading the Worklight 5.0.x training modules.
To start or stop the Worklight Server, you need to open the Servers view and click either the play or stop buttons.
Use the keyboard shortcut Ctrl+3 and write "server".
Everything works: http://i.stack.imgur.com/K1G8O.png
I found the solution after trying out a few things. It turned out that WL-6.1.x doesn't work well with JRE 6 (32 bit) and eclipse Juno (32 bit) combination. Once I switched to JRE7/Juno-64 bit; things apparently started to work (for now at least).
Thanks Idan for your helpful comments

IBM Worklight 6.1 - What symbol is this?

I'm using IBM worklight 6.1 and eclipse Juno for my mobile app project. This is a first time I got this kind of symbol on my eclipse. Can I know what symbol is this?
Thanks a lot in advance.
The markings overlayed on the folder and file icons are called decorators. The ones depicted in your screen shot are not coming from Worklight.
The decorator overlayed on the folder icon is called staged or partially-staged.
http://wiki.eclipse.org/EGit/User_Guide/State#Label_Decorations
staged - The resource has changes which are added to the index. Not
that adding to the index is possible at the moment only on the commit
dialog on the context menu of a resource.
partially-staged - The resource has changes which are added to the index and additionally changes in the working tree that are neither in the index nor in the
repository.
The decorator overlayed on the files icon is called added.
http://www.rorycullen.com/blog/2009/07/guide-to-subclipse-decorator-icons/
The “plus” sign indicates that this is a new file that did not exist
before.
You may have enabled some source control plug-in in your Eclipse installation.
In any case, not related to Worklight.

IBM Worklight 6.0 - Controlling Dojo Layers

The question concerns how to use the Dojo tooling in Worklight Studio 6.
I am using Worklight Studio 6.0.0.20130926-1933 as a a plugin for my Juno Eclipse on a macbook.
I want to use Dojo, and to use a few more Dojo components than are delivered in the standard layers. So, when creating my project I selected the option to add Dojo Toolkit and took the New Dojo Library option, in the dialogue that appears I stayed with the "provided" dojo, and expanded the "select Dojo components to be included" section - this shows all the optional Dojo modules, including ones I want to use (for example dojox/form/Manager).
Having finished that selection I see some layer files have been created in my new DojoProject and they are copied to the www directory of my Worklight project, however so far as I can see the extra Dojo modules are not present in the layers - a search for dojox/form finds nothing, and my app's attempt to require "dojox/form/Manager" fails.
I can work round this by manually building layers and loading them, but I assume that I'm not using the tool correctly.
What is the correct way to use the Worklight tools to control the layer contents?
Transpires that the selected Dojo components are available for use but do not get included in any layers. The dojo components are available for serving via the Dojo Libarary Requests capability.
Seems that at present if we need to get those extra files into layers then we are required to use the Dojo layer building scripts by hand and copy the results in the Worklight project's wwww directory.

How to create firefox3 sidebar?

Hi I want to create sidebar in Firefox 3 but have no clue how to do this.
I find tutorial on MDC (https://developer.mozilla.org/en/Creating_a_Firefox_sidebar) but after installation extension do not work with "not compatible with Firefox 3.0.3" error.
Does anybody have any tip or link to some resource about how to make sidebar?
Well, a Firefox extension, be it a sidebar, toolbar or whatever other type of extension is basically a mix of XUL and Javascript, all packaged nice and tidy into an installer package called an XPI.
For an excelent XUL tutorial see http://xulplanet.mozdev.org/tutorials/xultu/.
For information about building extensions and the package format see https://developer.mozilla.org/en/Building_an_Extension.
For a sidebar you basically have to override the browser's sidebar area by using an overlay. For good overlay information check out MDC and the excerpt at http://www.oreillynet.com/pub/a/mozilla/excerpt/FirefoxHacks_chap01/.
All you need except the links above is knowledge of XML, some Javascript and a creative mind.
To fix the problem you faced above, you have to specify the correct version of Firefox in the install.rdf file. For Firefox 3 set maxVersion to:
<em:maxVersion>3.*</em:maxVersion>