Thursday, April 17, 2014

Possible ways to hide/show Portlet border in Liferay

There are several ways to hide/show portlet border in Liferay.
1. Configure in every portlet.
To show/hide portlet border in every individual portlet, detailed steps shown in previous post.

2. Configure in theme;
All portlets within the configured theme will be show/hide border by default.
add the following line into liferay-look-and-feel.xml
the value is either true or false.
<theme id="myTheme" name="myTheme" >
    <settings>
        <setting key="portlet-setup-show-borders-default" value="true|false" />
    </settings>
     .............................................
     .............................................
</theme>

3. Configure in portal-ext.properties;
All portlets will be show/hide border by default
add the following line into portal-ext.properties
the value is either true or false.

theme.portlet.decorate.default=true|false



Done!!

Sunday, April 13, 2014

Adding second, minute, hour, day to java.util.date


long secondInMilis  = 1000;
long minuteInMilis  = secondInMilis * 60;
long hourInMilis  = minuteInMilis * 60;
long dayInMilis  = hourInMilis * 24;

Date add1Second = new Date(new Date().getTime() + secondInMilis);
Date add10Second = new Date(new Date().getTime() + (10 * secondInMilis));

Date add1Minute = new Date(new Date().getTime() + minuteInMilis);
Date add10Minute = new Date(new Date().getTime() + (10 * minuteInMilis));

Date add1Hour = new Date(new Date().getTime() + hourInMilis);
Date add10Hour = new Date(new Date().getTime() + (10 * hourInMilis));

Date add1Day = new Date(new Date().getTime() + dayInMilis);
Date add10Day = new Date(new Date().getTime() + (10 * dayInMilis));


Done!!

How to increase memory and heap size in Eclipse

The default configuration in Eclipse is maximum memory 512mb, and heap size 256mb.
But that is normally not enough especially running server plugin in Eclipse, eg, Tomcat, JBoss

To run the server plugin smoothly, we need to increase the memory and heap size as below.

1. Open eclipse.ini in <Eclipse_installation_dir>

2. edit the memory and heap size to expected settings


Done!!

Saturday, March 29, 2014

How to change fonts in Eclipse

1. Open Preferences dialog
    Window > Preferences

2. Go to Colors and Fonts
    General > Appearance > Colors and Fonts

3. Choose Java > Java Editor Text Font

4. Edit

5. Choose preferred font, size, color

6. OK > OK


Done!!

Wednesday, March 26, 2014

How to generate styled PDF in Liferay PrimeFaces Portlet with iText

In the previous post,
How to generate PDF in Liferay PrimeFaces Portlet with iText shows how to generate a PDF document, unfortunately, the generated PDF is not able to handle style class.

eg,
<!DOCTYPE HTML><html><body>Generate <strong>PDF</strong> Test</body></html>
can be generated without any problem. 

but, 
<!DOCTYPE HTML><html><body>Generate <span style='color: red;'>PDF</span> Test</body></html>
is unable to generate the text with red color.

LinkWithin

Related Posts Plugin for WordPress, Blogger...