Monday, May 26, 2014

How to invoke javascript from Managed Bean in PrimeFaces

In PrimeFaces, we can invoke a javascript function from managed bean.
One of the good example is to keep dialog open when validation exception.

Besides, other javascript function can be called.
code in xhtml

<p:commandButton value="Call JS from MB" action="#{myBean.callJsFromMB}" />

code in managed bean

public void callJsFromMB() {
    // other business logic or validation
    RequestContext.getCurrentInstance().execute("alert('test')");
}


Done!!

Sunday, May 25, 2014

Adding Footer and Header into PDF with iText

iText version - 2.1.7

Header/Footer only
Document document = new Document();
HeaderFooter header = new HeaderFooter(new Phrase("This is header"), false);
HeaderFooter footer = new HeaderFooter(new Phrase("This is footer"), false);
document.setHeader(header);
document.setFooter(footer);


Header/Footer with page number
Document document = new Document();
HeaderFooter header = new HeaderFooter(new Phrase("This is header"), true);
HeaderFooter footer = new HeaderFooter(new Phrase("This is footer"), true);
document.setHeader(header);
document.setFooter(footer);


Header/Footer with font
Document document = new Document();
Font font = new Font(Font.TIMES_ROMAN, 11);  // font family, font size
HeaderFooter header = new HeaderFooter(new Phrase("This is header", font), true);
HeaderFooter footer =new HeaderFooter(new Phrase("This is footer", font), false);
document.setHeader(header);
document.setFooter(footer);


Done!!

Saturday, May 17, 2014

How to integrate SlidesJS into JSF2

SlidesJS is an image slider that is nice and easy to implement.
To implement SlidesJS into JSF2.x application, just need to download the required files and follow the steps below.

1. copy all the required files into resources folder.

Wednesday, May 14, 2014

How to change Liferay Portlet title with jQuery

In some cases, we might want to change the Portlet title, So that the title is more meaningful the the Portlet content.
eg. screen navigates from search page to maintenance page.


$('#idOfDeployedPortlet').find('.portlet-title-text').html('new title');


idOfDeployedPortlet - portlet id deployed in Liferay, if you do not know how to get the deployed portlet id, please refer this post.
new title - Title to be passed in for the target page.

Sunday, May 11, 2014

Synchronization between data model and data dictionary in Oracle SQL Developer Data Modeler

This post is regarding how to synchronize data model and the connected data dictionary in Oracle SQL Developer Data Modeler.

Besides reverse engineering, Oracle SQL Developer Data Modeler is able to synchronize the existing data model with the connected or defined Data Dictionary.
Meaning it's able to update the data model when there are new updates in the schema or vice versa.

Steps to synchronize new updates from schema to data model.

1. Click on Synchronize Model with Data Dictionary

LinkWithin

Related Posts Plugin for WordPress, Blogger...