IBM Worklight 6.0 - Controlling Dojo Layers - ibm-mobilefirst

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.

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

Import dijit/dojo widgets into worklight palette

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.

where can I get a XD version dojo source

WHere can I get a XD version of dojo source like the one hosted on google? What I want to do is to host dojo source from my local CDN, and my custom dojo module in my web application. Is this a good practice? or I might as well just include the dojo source in my web app, and run the custom build?
Thanks,
You can build an xd version of dojo from the source code
Here are instructions on how to do it:
http://dojotoolkit.org/reference-guide/1.7/quickstart/custom-builds.html
See the section on "doing xdomain builds"
In our organization (a large one), we do have a CDN version of dojo deployed on internal CDN mainly since some of our webapps are not allowed to access extranet (firewall issues).
For performance, though, a custom build gives biggest boost since it is customized to the modules you need/use - once the custom build is done, you only need to ship a single compressed js output file and a small number of supporting files
When doing your custom build, you can use the xdDojoPath and loader=xdomain if you wish to use cross domain dojo to load your optimized js - see http://osdir.com/ml/cometd-users/2011-08/msg00050.html for some notes on this
Also see related SO question: Dojo on a CDN vs own install
The good news is that with Dojo 1.7+ and the new loader, you don't have to do anything special for a cross domain build (good answer above from #Vijay Agrawal, but I think that reference guide link may need some updating for 1.7) Just write your code to the new AMD format, use asynch:true, run the build tools to create layers, and deploy them on any server. AMD makes use of callbacks and many of the tricks the old Dojo xd builder used to employ, but in a much simpler way.
To support older code, there is a legacy cross domain mode mentioned in the loader docs.

Adding Dojo 1.6+ in Lotus Notes database v8.5.3

Lotus Notes 8.5.3 uses dojo 1.5.1. However I want to use dojo 1.6/1.7 library in my NSF database. How can I do it? I tried to use the technique suggested by Keith Strickland in his blog but no luck.
I need to include the dojo library in NSF database and not on server.
The reason I want to do this so as to use the advanced Dojo Mobile libraries (from dojo 1.6/1.7) in my XPages.
UPDATE: I even posted this question on XPages forum some time back but no replies.
The Domino 8.5.3 server uses Dojo 1.6.1 for XPages. You should see this if you view the HTML source of a test application.
As an example, I see this in one of my applications:
"/xsp/.ibmxspres/dojoroot-1.6.1/dojo/dojo.js"
If you are going to create apps using Dojo Mobile then take a look at the Extension Library and the latest Upgrade Pack 1 for Domino 8.5.3. Both includes XPages Mobile controls.
Per's correct that the Dojo plugin that is loaded by default is 1.6.1 (the ".1" is because it includes IBM-specific code and this means it differentiates it from anything a developer has added in).
The files in the js folder on the server / client are 1.5.1 and this is needed for iNotes.
You can change the Dojo version in the xsp.properties by setting xsp.client.script.dojo.version in Package Explorer. Incidentally UP1 offers a nice visual editor for the xsp.properties file.
However, currently if you change this setting you need to uncheck "Use runtime optimized javaScript and CSS resources" or it will still use the plugin. I noticed this too late for anything to be done before the Gold release.
If you add 1.7 files to the server and include the IBM folder from 1.5.1 it may work. AFAIK there's no way to get the IBM folder from the plugin code.
See my blog post for more details: http://www.intec.co.uk/domino-8-5-3-greater-power-over-dojo-thanks-ibm-for-your-work/