Use custom CSS template in combination with Primefaces - jsf-2

I have a project which is developed by Primefaces 2.2 and JSF 2.1.
Since I am not satisfied with Primefaces' template neither ThemeRoller that they provide, I found very interesting themes on
http://themeforest.net
and I want to integrate one of those in my project.
Is it possible to integrate Primefaces with templates from Themeforest? Are there any traps that I need to consider?

Primefaces themes are powered by theme rollers, (separate css for structure and skinning). the only way of implementing themes is by using Primefaces's template or ThemeRoller. Or else you can try dynamic themes by defining EL expression as a param value
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{themeSwitcherBean.theme}</param-value>
</context-param>
as mentioned in primefaces document here http://www.primefaces.org/documentation.html

Yes, of course, but it's not a template. It's a theme. You can do that easily with facalet.

I never use the template / skinning provided by Primefaces, but sometimes integrate it in the project because there are some very useful components. Of course you can use a custom template like those you saw on Themeforest. All you have to do is create XHMTL instead of HTML files and correct some syntax (for example input tags need a closing tag in XHTML). The problem is you can't completely disable the styling of components like the p:inputText, you have to use h:inputText and then apply the classes provided by your template in the styleClass attribute.

Related

How to use Component class in JSF2 using JSP

Is there any way to write custom tags using components and renderers in JSF2.0 using JSP?
could you please send the example if it is possible.

ASP.NET MVC4 + Bootstrap 3 How to apply a different theme?

I am trying the new Visual Studio Version, which comes with the built-in Bootstrap Template. Since I wanted to use Bootstrap 3, I upgraded all files according to a helpful thread: ASP.NET MVC 5 and Bootstrap 3
This works fine, but I have trouble to apply a different Theme.
As far as I understand, I can simply replace the bootstrap.css with a different theme and the theme "should" work (I deduced this from http://bootswatch.com/) - but for me the Thema always stays at the ASP.NET default, which I doesn't like.
So: How can I change the damned theme? Ideally, I want to use: http://bootswatch.com/cerulean/
Thank you very much.
Bootstrap's css comes in 2 files: bootstrap.css and bootstrap-theme.css.
I didn't see how it is implemented in mvc5 template, but I'm pretty sure it is done using bundles. So, you got to check the bundles.cs file and replace bootstrap-theme.css there with theme of your choice.

challenges in upgrading Bootstrap Themed ASP MVC site, how to upgrade bootstrap + keep previous CSS / #Helper / Transpiler

I've built an ASP MVC site and used bootstrap, Jquery, knockout and signalR, and inherited a mix of 3rd party MVC code integrated with controls like syncfusion. (I don't have a choice in this matter, company decision)
After coding the HTML helpers in the views,
I manually applied all the bootstrap styles took sometime and got it
to work. Now, with upgrade/changes to bootstrap (RC 3.1) I am finding
myself back to square one, hunting through the code and replacing it manually, lots of
changes. Can you please share a better way to transpile/emit/bind the
bootstrap CSS classes into the helpers (i.e. in an independent way of the
technology helper, whether its ASP HTML MVC helper, Syncfusion HTML
MVC helper, Rad or FluentBootStrap)
Please provide a solution/recommendation to apply bootstrap CSS to ASP MVC pages
That's easy to separate and maintain and CSS upgrade's Programmtically
or globally configurable/settable/applicable
I've been thinking extension classes might be a good option, but not sure how I can achieve this, if you've can show me how to get the custom bootstrap CSS bound so I can programatically apply it or globally,
Is there a transpiler or Razor Declaritve Helper (I know about the nuget package, I tried applying it, and it turned out to be more of a template, than declarative extension binding, and I couldnt use it with other libraries Syncfusion or DevExpress)
or some other way, I would greatly appreciate it.
Here is an example of what I do currently, with the Syncfusion library
#Html.Syncfusion().Menu("myMenu").AutoFormat((Skins)ViewData["Themes"]) - performance hog
or better option 2 below
http://mvc.syncfusion.com/demos/ui/tools/Menu/Appearance
#(Html.Syncfusion().Button("btnNormal")
.Text("Save")
.Width(100)
.Height(50)
.ContentType(ContentTypes.TextAndImage)
.ImageUrl(Url.Content("~/Content/Images/Button/icon_save.png"))
.CustomCSS("CustomCss_Button") )
-> I changed/upgraded manually to BootStrap RC 3.1, I changed this last part to the bootstrap
.CustomCSS("btn-default dropdown-toggle btn-primary"))
Not sure this would be helpful to you, but check out TwitterBootstrapMVC. Right now it supports v2.* of TwitterBootstrap, but the support for v3.* is being built.
Our answer is from the experience we are going through. Here is what we found,
currently, The twitter bootstrap MVC is your best option IMHO, we are moving everything to it and its free! Its probably better the broiler plate option.
The 3.0 upgrade is a big question for us as well, so this is
something Dmitry can clarify.
Also, auto creating type safe bootstrap HTML views/sections for models is another question.
In addition you will face challenges with custom controls, we have a OLAP BI client, which looks / or doesn't not have the same consistent look. Dmitry can you answer how to resolve this with twitterbootmvc
Dmitry, will the twitterbootstrap upgrade, auto upgrade to the 3.0 bootstrap or do we have do anything manually?
I just discovered that in visual studio you can for the precompile of RAZOR into HTML.
Can you add that as an option to fluent

Is PrimceFaces 3.1 Backward Compatible to 2.x version

I'm developing a web app using JSF 2.0 + PrimeFaces 2.2.1
Now I think PrimeFaces 3.x is stable enough. (3.1)
Can I replace the library (PrimeFaces jar file) and continue the development. I know some features have been re-invented in PrimeFaces 3.1.
Will this change make any problem to my app?
You can find the main changes in PrimeFaces 2.2 --> 3.0 in the PrimeFaces wiki. Here's an extract of relevance:
General Changes
Taglib namespaces are changed as;
http://primefaces.prime.com.tr/ui -> http://primefaces.org/ui
http://primefaces.prime.com.tr/mobile -> http://primefaces.org/mobile
Note that this change applies 3.0.M4 and newer.
Component events are now decoupled and implemented as ajax behaviors to improve flexibility. Read more at here. Common *Listener and *Update attributes are now removed, an example is rating component;
2.x;
<p:rating value="#{ratingController.ratingValue}" rateListener="#{ratingController.handleRate}" update="messages"/>
3.x;
<p:rating value="#{ratingController.ratingValue}">
<p:ajax event="rate" listener="#{ratingController.handleRate}" update="messages" />
</p:rating>
User's guide and Taglib docs(IDE completion) will provide all the available events of a component.
RequestContext now allows to execute javascript from backing beans (e.g. deciding to keep a dialog open or hide it), In 2.x this conditional javascript execution on callbacks like oncomplete are achieved via callback params, execute("script here") makes it very easy to implement the same compared to callback params. Note that callback params are still supported and will be in future as they are also used internally in PrimeFaces.
Tag/Attribute docs are available again in facelet taglib to take advantage of quick documentation via IDE code completion.
Aristo replaced Sam as the built-in theme, sam is available at theme gallery as a downloadable theme.
You can find the main changes in PrimeFaces 3.0 --> 3.1 in this PrimeFaces blog. Here's an extract of relevance:
Backward Compatibility
There are two points to note regarding backward compatibility with 3.0;
Component referencing is now aligned with JSF Spec, if PrimeFaces cannot find a component, it will throw an exception. Since PrimeFaces 2.2 we’ve been logging an info message that component cannot be found and falling back to the client id. If you haven’t ignored these messages and fixed your code since 2.2, there won’t be a problem. If not, you need to update your component referencing with respect to findComponent specification.
primefaces.THEME_FORMS setting is removed in favor of plain css, if you need to reset the theme aware styles on input components, add a reset css instead.

Is there a ready-made CSS I can download to style my forms in Symfony?

I just defined some forms in /lib/form/doctrine/ But the form elements currently don't have any CSS formatting.
Is there a default stylesheet that I can quickly copy/paste to style the forms, error messages, etc.?
It's not out of the box for Symfony but Blueprint CSS is a nice CSS framework, and when I used symfony 1.4, it used to color automatically the errors (I don't know if they changed the class names and stuff).
It's a bit heavy, but it ensures a solid structure if you use it for your development.
I just used Symfony's CSS from the admin. It was exactly what I was looking for - good results with minimal effort. Thanks for the suggestion cuhuak.

Resources