Tuesday, August 2, 2011
GWT webAppCreator
GWT has a handy utility called webAppCreator. It can be used to create a GWT project with the necessary artifacts, including Eclipse project file and ant build file. It can even create a maven build file - I need to check this out. Details can be found here. The best way to start a GWT project is to run webAppCreator and import it into Eclipse.
Create a clickable GWT ImageCell
Here is my use case. A search returns a list of Document objects. A GWT CellTable displays the list. One of the table columns shows an icon based on document type, i.e., pdf, word etc. When a user double clicks the icon, it retrieves the content of the document.
GWT ImageCell does the icon part nicely. However, there is no built-in behavior to support clicking. To do that, I had to create a subclass of ImageCell and override a couple of methods. The credit goes to a post on stackoverflow.
The code below is the solution. One thing to note is that the Context object provides access to the actual object (Document, in my case) associated with the column. Here I am merely creating an alert with the document name. There are certainly a lot more exciting stuff you can do with it.
Column<Document, String> iconColumn = new Column<Document, String>(
new ClickableIconCell()) {
@Override
public String getValue(Document object) {
return "images/pdf-16.png";
}
};
private class ClickableIconCell extends ImageCell {
@Override
public Set<String> getConsumedEvents() {
Set<String> consumedEvents = new HashSet<String>();
consumedEvents.add("dblclick");
return consumedEvents;
}
@Override
public void onBrowserEvent(Context context, Element parent,
String value, NativeEvent event,
ValueUpdater<String> valueUpdater) {
switch (DOM.eventGetType((Event) event)) {
case Event.ONDBLCLICK:
Document doc = (Document) context.getKey();
Window.alert(doc.name);
break;
default:
break;
}
}
}
Friday, July 22, 2011
Create an Alfresco JMX Dump
I am working with Alfresco support on an issue and they asked me to provide a JMX dump of my Alfresco system. How in the world can I do that!? Remember that Google is your best friend. It turns out Alfresco has a nice, easy way - just a simple JSP page.
http://localhost:8080/alfresco/faces/jsp/admin/jmx-dumper.jsp
Alfresco WCM 500page Error
I installed Alfresco WCM on an existing 3.4.1 server a couple of days back. Everything worked fine. However, it threw me an "500page" error today. I finally figured out what was going on.
My Alfresco installation is on a VirutalBox VM with dynamic IP assigned every time the VM is started. When it was running last time, I went to the site in Share, Web Quick Start > Document Library > Alfresco Web Quick Start, and changed the hostname in metadata for Quick Start Editorial. I used the IP address at that time. Since the IP has changed, it could not find the hostname+port+page anymore and thus the 500 page error. It is back working after I updated the hostname with the current IP.
I think the assumption is that you should run Alfresco WCM on a fixed IP. Oh well, this is just my sandbox and I can live that inconvenience.
Thursday, July 21, 2011
Revisit my own blog
I am not an avid blogger. I did it occasionally in the past, mostly to keep notes of what I have done. When I revisited my blog today, boy, I already forgot some of the stuff and couldn't believe I wrote it.
Surprisingly, I also found quite a few comments. I am thrilled that some of the readers/followers found it helpful. On the other hand, I think I need to do a better job answering questions. So I turned on the email notification of comments.
Happy blogging...
Thursday, April 28, 2011
Get solaris version
uname doesn't give the OS release number. look at /etc/release.
Published with Blogger-droid v1.6.7
Wednesday, April 20, 2011
hibernate class loading problem in oas
oas will try to load its own antlr.jar from toplink. make sure to uncheck oracle.toplink from class loading during deployment. it will then use the antlr jar bundled from hibernate.
Published with Blogger-droid v1.6.7
Subscribe to:
Posts (Atom)