Tuesday, July 20, 2010

Calling super class method in javascript

In order to call super class's method, do this:
ClassName.prototype.method.call(this);
where "this" is the child object.

Refresh a ADF component programmatically

In order to refresh an ADF component in bean, do the following:
  • Bind that component to some property of bean
  • get reference of AdfFacesContext by AdfFacesContext.getInstance()
  • add that component as a partial target like adfFacesContext.addPartialTarget(comp_binding)

Wednesday, July 14, 2010

Open-jACOB Draw2D selecting a figure

Open-jACOB Draw2D is an excellent javascript drawing api. One of the method of workflow (main canvas in api) is not documented and that is "setCurrentSelection". After using this method, you can use "showResizedHandles" method to show handles like given below:

g_workflow.setCurrentSelection(figure);
g_workflow.showResizeHandles(figure);

Tuesday, July 13, 2010

Use minimal version of javascript to speedup downloading

whenever you develop some javascript code, always convert it to minimal version before deployment. Minimal version removes extra spaces, comments and other stuffs, thus greatly increasing downloading speed by decreasing the javascript file size. One tool is JSMin

Saturday, July 10, 2010

IE CSS Compatibility Model

IE by default does not follow the CSS Standard specification e.g. it includes border and padding in width and height of element but standard threats them separately. In order to use standard definition add following doctype in the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">