Addapt bootstrap theme for web application - java

So I was trying to make web app. And because I'm not very good with frontend I decided to buy bootstrap theme. When I inspected it, I realised it's just static theme. I can't use it for my web app with Java backend and REST end points. It's like I just bought good wireframes. I need REST functions implemented. Now first thing that came to my mind is to learn Angular and create those pages by myself, but that is time consuming. What is the fastest way to make those pages usable.

I will try to be the clearest I can be.
The theme you purchaised is just plain html with css (Bootstrap)
What you have to do now is:
define a new frontend project with AngularJS, maybe using some Yeoman generator
add Bootstrap as Bower dependency
define all your AngularJS views (or templates, or partials)
copy the theme html fragments into your views
customized it using an additional css file (i.e. custom.css) that overrides the theme original ones
use all the theme components to design your specific UI.
Also keep in mind that purchaising an html/css theme does not mean to buy a frontend skeleton application. It's just a way to accelerate the UX/UI design and development of a complete new frontend application from scratch and you must have some kind of web design/web development basic skills in order to use it properly.
Hope this could help you

Related

Swing and Android Apps with shared code base and resources

In my company we would like to develop a swing and a android application. Both should basically have the same functions. So we thought to create a normal java project with the core code, a java project for XML communication with the endpoint (both apps use the same endpoint) and a java project for shared resources like bundles, images and so on.
Now the drawback: After having a first look at android we noticed that android handles resources very much different from any other system. Everything has to be in XML files and logos/images have to be in different folders with different resolutions. From my understanding this would mean to discard the idea of a shared resource project and to maintain the resources two times: one time for swing in the form of bundles and the like and another time for android.
Our architecture is layer based: the business logic layer defines functions that are the core functionalities of the app. The presentation layer should grab the functions and build the layout dynamically based on the role of the logged in user. Here too, I'm not sure how to archive this with android.
Questions:
Is it possible to have the applications use the same resources?
Do someone know another way how to handle this? (I'm a noob with android)
All comments, ideas and alternatives are welcome!
You can have string resources in xml for android, so it will parse them by itself, so all you need in your desktop app is to write parser to grab this resources and use them. I believe it's better then duplicating. In case if you have too much resources you can put them in few xml files, that will be the same: android will grab them automatically but you will just change file name.

How to create UI dynamically, server-side, with GWT 2.4

I'm trying to create a user interface using Google Web Toolkit v2.4. For a variety of reasons, I need to specify the contents of the interface on the server, at run-time. I don't just mean the the buttons need dynamic labels etc, but rather the whole UI needs to be created at run-time.
Much of my UI can be specified as straight-forward HTML. But I also want widgets like Scrollpane. Of course I need to somehow attach actions to things like buttons.
I tried creating the UI server-side by creating instances of com.google.gwt.user.client.ui.Button, and returning them to the client via RPC call. However the Button class is not serializable. (Also the package name is telling me this is an object which should live on the client only.)
I considered generating a UiBinder template on the fly. However it seems UI binder templates need to be compiled.
I'm now looking at sending HTML to the client with placeholder XML elements where the GWT widgets should go. On the client, I would use DOM methods to find and replace them with GWT widgets. But it feels I've gone far astray, at this point.
It feels like there should be a straight-forward way to do this, but it is eluding me.
Suggestions?
GWT has no built-in support for stuff like this (since it is totally missing the point of gwt).
So you have two choices,
build your own framework, so you will be able to send from server to client some layout page data, client will parse it and will create ui
or
you can use some other framework, for example Vaadin which basically does what you want, or a combination of some JavaScript UI Framework + Node.js where you can easily share the code between client and server.
You should look at Vaadin. Server-side control generating client side GWT.
I think you are looking for XForms. There are several implementations of XForms (http://www.w3.org/MarkUp/Forms/wiki/XForms_Implementations) and some of them work on the server side and some of them work in browser. Some of the second type may work as a browser plugin, flash or java script, but my favouite is EMC Formula XForms Engine (https://community.emc.com/docs/DOC-4345) that was developed to work with GWT.
If you need some example, here it is: http://svn.yuppy.pl/projects/trunk/sample-gwt-xforms/.
You can refer link http://code.google.com/p/acris/wiki/DynamicUiBinder for dynamicUiBinder

Can you add a GWT screen to an already existing screen in a webapp?

Is it possible to add GWT as a component in an already existing webpage?
I don't know what exactly do you mean by component, but GWT can be integrated in any web page,since GWT output is (mostly) javascript. JavaScript can be used in any page. It doesn't matter if the page is existing or you are just planning to create it. If you can include js on that page, you can use GWT.
Perhaps this is what you are looking for ?
Running a GWT application (including Applets) inside an IFRAME from an ASP.NET 3.5 app?
I think the answer on that question is relevant.
Yes, GWT can be added to any existing webpage.
GWT's RootPanel will be the div you place on that webpage.
Hope this helps.
You need to understand the constraints of browser technology. Perhaps, you already do.
To, answer your question, you have to return back to ground zero - javascript.
Are you able to write a simple javascript object that runs as a "component" of your current app, such that there could exists a duplex communication between your simple javascript object and the canvas of your current app? Can your simple javascript object invoke and be invoked by features of your current app?
Knowing that GWT ultimately gets compiled to javascript, and if even a simple javacript object cannot function componentially with your current app, would you think there is any hope to componentize a GWT app with your current app?
Setting up a communication channel
Componentization would require ability to communicate.
Let us say, you need to write your combo app using both jquery and GWT. Your jquery side should be able to dedicate a HTML element into which it could write. Like a simple DIV, ensuring that the element has an ID. You could have several elements for such a purpose.
On the GWT side, your GWT code would be able to grab these elements thro getElementById. Voila! There are your communication channels.
GWT is a dominating possessive creature, for one reason - it refuses to create widgets thro which you could name with an ID (except for ensuredebugId). For that reason, it does not fare very well running as a component.
More likely, your GWT app is the master and your non-GWT apps are the component.
It is a very "well-practiced field" of having non-GWT apps running as components to a GWT app. We have charting, chat, clocks, widgets, etc components written in jquery, javascript and even server-side services. And then we write GWT wrappers around their elements and use JSNI to communicate with them.
All these non-GWT avenues of creating DOM elements and javascript objects have the common ability to generate elements that can have an Id, which makes them more susceptible to be componentized under GWT than the other way around.
Good examples are the Javascript APIs for Google Maps, Google Location API. e.g. HighCharts http://www.highcharts.com/.
All you need to do is to create a div in your existing web-page and give it an Id.
Then use the following to insert your component into that div.
RootPanel.get("PUT THE DIV ID HERE").setWidget(superCoolGwtComponent);
Simple :D

adding vaadin ui to existing java web app

I am working to create a UI using Vaadin, now I want to add this to an existing java web app.
Do I simply need to add the Vaadin jar file, and the java files of vaadin to that web app?
Or is there some procedure to follow, when doing this?
You also need to ensure that the Vaadin ApplicationServlet is being called, and is being sent the right requests. The VAADIN directory has theme information; you need to ensure it is being served as well, or is being served from the code base directly.
See the Book of Vaadin for details on how to configure your web.xml to ensure the right things happen.
Just add the vaadin.jar file to your WEB-INF/lib directory and you're good to go.
edit: see Ross Judson's answer.

Achieving multipage GWT website

I have a question on managing a multipage GWT website. For now I only have one html page in which I embed lots of divs to store the widgets that I use. Then, according to the user's actions I add or remove the necessary divs using GWTs DOM class. Therefore, I use only one html page to simulate multiple pages. Is there a better way to do this?
Thanks.
I disagree with cletus. In my experience, gwt is just as good at enhancing multipage apps as it is at one-page applications like gmail. It just depends on what you're requirements are for your web app.
I'd agree that writing one-page applications is definitely the place to start, but once you get the concept of gwt modules, they can easily be used to add custom javascript to multiple pages.
To answer your question; I think your design of using one page and swapping out widgets is perfectly acceptable.
These talks might help to give you ideas about when multi page apps might make sense:
Effective GWT: Developing a complex,
high-performance app with Google Web
Toolkit
Progressively Enhance AJAX
Applications with Google Web Toolkit
and GQuery
GWT is designed primarily for one-page applications. There is good reason for this. You take a hit every time you do a page transition with so much Javascript. The page load times are so noticeable. Think of goign to GMail. You have a period of 1-5 seconds where it loads. Now how would your user experience be if that happened whenever the user went to a new page and that happened a lot?
Neither do you need to put every widget on the page. You can dynamically create and add (or remove) widgets as you see fit. It's a somewhat different approach to how you'd normally do a traditional multi-page HTML-centric Website.
Something I have found useful is using the GWT DeckPanel. A deck panel is like a deck of cards where each "card" is a GWT Panel. You can treat these "card" panels like pages and initialise and populate them with widgets at startup. You can then respond to user navigation actions by bringing a "card" panel to the front of the deck so that the user can see it.
The sort of approach works best as part of either the MVC (model-view-controller) or MVP (model-view-presenter) design pattern.
In order to achieve such a thing, you should have history management - like Gmail, which can use back/forward. It is achieved by anchors, and this class
In addition to the good DeckPanel and History suggestions, I'd also add that you can get GWT to split your app into multiple JS files that are dynamically loaded as needed with runAsync. This let's you have a very fast initial page load and load the new "pages" as the user needs them.
LazyPanel.createWidget() is a convenient place to stick a runAsync call that can be combined with DeckPanel or TabPanel to dynamically load content and UI code. A controller/presenter for navigation is even better (though a little more work on the programmer sometimes).

Categories