Categories
Java JBoss

Using multiple PersistenceUnits with same name

To be really flexible in my CMS I decided to use a persistence unit with one name which will be configured in the final webapplication. This means I have a persistence unit “cms” in my business-components in my cms.jar and this unit is configured via persistence.xml in the including web-application, which uses my “cms.jar”. So every webapplication has its own database and I can reuse my businesslogic for the cms (retrieve content, or images and so on).
The problem now is that I have some problems with deploying two applications on JBoss 5.1.0.GA which includes my cms, because there is a bug in this application-server. I hope this will be fixed in the one of the next versions.

Categories
Javascript

CKEditor – events like onComplete

Currently I develop a CMS in Java using Seam and JSF. Target of the CMS is a simple CMS-Structure which can easily be added to a existing Seam-Application and then provide the editable content via simple JSF-Components. Maybe I will later write some more informations about this CMS.

To easily edit text-content I include the Javascript RTE-Texteditor CKEditor. This editor transform a simple Textarea into a full featured RTE-Editor. The simple include-code looks like:

?View Code JAVASCRIPT
1
CKEditor.replace('idoftextarea');

But you can also define some configuration properties. Especially the events are not fully documented yet for version 3.0. A really interesting event is the onComplete-event or other called the instanceReady-event. This event is called if the editor is fully loaded.

A sample definition could be:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
CKEditor.replace('idoftextarea', {
    on: {
        instanceReady: function(ev) { 
            window.alert('I am ready loaded'); 
        }
    }
});

A use case for such an event could be automatic resize of the editor, for example maximize.
You can also define a global event for every CKEDITOR-instance in this way:

?View Code JAVASCRIPT
1
2
3
CKEDITOR.on( 'idoftextarea', function( ev ) {
    window.alert('Im a ready loaded');
});

Idea’s for this blog

Welcome to my new blog. Here I want to post some tips & tricks all around java-development. These tips will be difficult problems I had to solve during my own developing. Currently I develop mostly standalone or web applications using java. For the web I use JBoss-JEE-Stack with Seam and JSF as Viewhandler. I hope you will enjoy my blog and find my tips useful.