can i use a gwt library in a jsf project - jsf

I want to create a mobile app using PrimeFaces. In it, I also want to use Phonegap, but not directly, rather through its GWT abstraction- phonegap-gwt.
Some of the features provided by PhoneGap, in a phonegap application, require the web page accessing the phone's functionality to be a local page(on the device where phone's functionality is to be accessed)... this can be done using phonegap-gwt in a google web toolkit project also, i.e. dont put server side code in the page that utilises phonegap-gwt code(correct me if I am wrong here, so far?)... On the other hand, the program created by jsf(i.e. primefaces) is a mobile web application.
Hence, what I am confused about is, can I keep GWT code (for Phonegap access through GWT) and JSF code in the same project? I understand that the phonegap gwt code will get compiled into Javascript, but can such programming,i.e. keeping gwt code with jsf code, be implemented? Even if this is possible theoretically, wont there be issues/restrictions that I would have to keep track of? What are those restrictions? Have you tried combining GWT code with JSF code? Did it work?

Related

Android Layout on Worklight

I am beginner with Worklight. I developed an android application using Estimote Android API. Now I want the same application in Worklight. What should I do to get android UI on worklight. I wrote same code on Native folder in Android environment. But I am getting blank display instead of MainActivity layout. How to display android layout on Worklight? Please help me with this issue.
Are you aware of Worklight's client-side abilities? That is, with Worklight you can create either Hybrid apps or Native apps. Make sure to read IBM Worklight's Getting Started training materials.
Hybrid apps are basically a native application shell, containing a web app built using JavaScript, CSS and HTML.
Native apps are just that, fully native Android apps where Worklight provides an API set to work with the Worklight Server and other server-side features.
From your text, it sounds like you have opted to use the Hybrid application model, and in this case it would make perfect sense to me that your native UI code is not displayed out-of-the-box, as that would require altering the default Activity Worklight provides for the Hybrid Android application.
You do not explain what changes you have done
The default activity essentially brings up a Web View into which it loads the client framework as well as display in the index.html that can be found in your Worklight application (your project > your app > common folder > index.html).
So by just adding your code and layout, it does not mean that your app's display will change. This will require you to alter the loading sequence of the application.
You do not explain what changes you have done
In any case, it sounds to me like you need to decide whether to:
Use HTML, CSS and JavaScript to build your application's UI per the Hybrid application model
Create a native app instead, where you will be able to create the UI how you want to, like you say in your question
Learn how to mix & match native and web UI elements together in your Hybrid Worklight application

Add CKEditor add-ons to <pe:ckEditor>

I am using PrimeFaces Extensions <pe:ckEditor> which is basically a server side JSF component which generates the necessary HTML/CSS/JS code output for CKEditor. It works fine, however I have a new requirement which requires me to use either the PBCKCODE or the syntaxhighlighter add-on of CKEditor.
I have successfully created a customized version with those add-ons from their website. However, I have no clue how to integrate those add-ons in <pe:ckEditor>. How can I integrate those add-ons in <pe:ckEditor>?
Is there any reason why you don't want to use the CKEditor directly in stead of using it through pe:ckEditor? At least thats what I did in our project.

Mobile app with Node.js backend - What framework to pick for client-side dev?

I'm planning to build a hybrid mobile app,
I have already progressed pretty well with the server-side using Express 3, and PAssport for authentication.
Now I need to make a decision on what framework or library to use for the clinet-side.
I was wondering if I could get some recommendations and perhaps pros and cons of going with frameworks like
Sencha Touch, JQuery Mobile, Phonegap....
and if there is anyother ones that you think it's worth considering please mention them here,
Thanks for any pointers or advice
JQuery Mobile and Sencha Touch are JavaScript libraries that will let you create an HTML5 application that looks like a native application. Cordova/Phonegap lets you wrap your HTML5 app in native code and provides a common JavaScript API that gives you access to native functionality, like taking a picture with the camera or getting the users Contacts. Another benefit of using Cordova is that it creates native applications for you using the same HTML5 app, so you can publish these files to App stores and increase your distribution. With a JQuery/Sencha Touch only app, you can't distribute on app stores because your hybrid app is simply a website (so, I guess it'd only be a mobile app.)
There are hundreds of blog posts comparing different JavaScript frameworks like Sencha vs jQuery vs Dojo, so you should just go off and do some of that reading. Personally I would suggest Dojo as I think it is the most powerful and enterprise ready framework, but it can have a steep learning curve. One thing I like about Dojo though is the build system, you can pick and choose the modules you want so that you don't have to end up including an enormous .js file like JQuery. I have no idea if jQuery can do this, but a lot of user apps I have seen that use Cordova and JQuery end up including all of jQuery and then jQuery mobile.
If you want to access native device features and/or package the web app as a native app and distribute it on the stores, you should use one of those JavaScript frameworks in combinations with Cordova. (Cordova is the new name for PhoneGap.) Phonegap/Cordova is not really used to build mobile web apps, it's used to extend the capabilities of mobile web apps and allow them to access native device functionality in a completely cross platform way.
Ionic is a new framework available for making hybrid apps that I am liking a lot so far. The framework is built with Sass and AngularJS on top of PhoneGap. Ionic just handles the front end so you still build your app with PhoneGap. I found that since it uses AngularJS your javascript code ends up being a lot cleaner and you will save development time making your app slick compared to what you would have to write with jQuery. It also has some beautiful UI elements. The ionic team has done a lot of speed optimizations with the framework so your app will feel more native than your typical hybrid app built purely with PhoneGap. The framework is still in alpha but I have been impressed with it.

CoffeeScript, Node.js, MongoDB and JasperReports, is it possible?

I just realized a JSF (web JavaScript application) that connect to a MongoDB database and generate a report (PDF) thanks to JasperReports Library (so with a .java file).
Is it possible to do the same thing with a web application in CoffeeScript and Node.js? I am really new to this, so I don't know where to start.
For example: Is it possible to run a .java thanks to Node.js or CoffeeScript?
JSF is actually a JavaServer Faces application, not a JavaScript application. JavaScript (which Node.js, CoffeeScript are based on) is not equivalent to Java despite the similarity in names.
If you already have a JSF-based application then you already should have everything you need to create a web-based application. There is no need for Node.js, CoffeeScript, etc.
Go take a look at JSP, Tomcat, etc. to figure out how to render web pages rather than output to PDF and you should be set.
If you want to rewrite your application in javascript and run it on node.js, you should be able to use PDFKit to build the PDFs.
If you only wish to use your existing application and integrate it with a node.js server, I think you would be wise to run them in parallel (or proxy requests to your JSF application through node, in case that makes sense). It's hard to give a better answer unless you can state more clearly what it is you want to accomplish.
Yes, it's possible. You can start / stop / control another process with Node.js - so You can start .java in another process and use it to generate PDF. But ... it may be not very efficient in terms of resource usage, so it's an open question.
Or, you can write a simple worker that will generate PDF from JSON data and use 0MQ or other inter-process communications between Node.js and this Java worker.
He-he, JSF was one of the worst technologies I ever saw (I believe it's still in the same state now as it was in 2007 when I left Java), even dumb JSP and servlets was better...

JSF and Phonegap

I am a new Java developer and I would like to develop a JSF mobile application. I know I could use JSF 2.0 together with Richfaces, IceFaces or PrimeFaces to develop my app, but I think it would run only on the server and I am not sure if it would have access to offline storage and device’s camera, required by the application.
Question: is it possible to use Phonegap or a similar framework to make my JSF mobile app go native?
I don't think JSF and phonegap can be used together. Phonegap's app is HTML/CSS/javascript app, which doesn't require server. It is client only. JSF app is client-server: application logic mostly located on server and all html generated by server. You can't port it to phone now.
If you need access phone's stuff: offline storage, camera, you can create app in phonegap, sends ajax request to your server. Server can provide some API and you can write it in java. You don't need JSF in this case. Google for REST and Spring for java web services. Or better check this question: https://stackoverflow.com/questions/1710199/which-is-the-best-java-rest-api-restlet-or-jersey
You might want to look at Primeface Mobile. It is a UI toolkit for writing JSF web applications tailored for mobile clients.
http://www.primefaces.org/showcase-labs/mobile/index.jsf

Resources