Jtable header multi-line-wrap-alignment

One of my user asked if he could have the header settings such that the multi-line header text do not wrap. Also he wanted an easy way to align the columns. Needless to mention, these abilities are not yet present in InfoCaptor but since they were already in the feature pipeline, I picked those during this weekend.

Currently, the jtable, which is the rendering component for tabular information on the dashboards, displays the headers automatically in multi-line and it centers each line of the header.

There is lot of transformations applied to the actual column name before it appears on the jtable header.

for e.g. lets say the actual column name is “EMP_SUPERVISOR_NAME”

First it removes the underscore “_” and replaces it with a white space(blank character) ” ” and then it capitalizes the first character of every word, so the final outcome is

“Emp Supervisor Name”

Next, to achieve the multiline effect, it places the entire text within the html tags and each space is replaced with a html new line, so the actual string looks like

<html>Emp<br>Supervisor<br>Name</html>
Emp Supervisor Name

Now with the new feature, you can align the header text anyway you want, right, left,center or default.

What is default alignment?

If you notice any application, by default, numbers are aligned to the right and everything else is aligned to the left.

So if you pick, the default alignment (which is the current behavior of column data in InfoCaptor), the numbers are to the right and everything else is left.

The header is aligned the same way the column data is aligned.

Technical changes

With the new features, the old method of placing them within the center tags didn’t scale out for the left and right alignment. So a new technique is being deployed using the paragraph tag.

Now the header text is placed as below

<html><p align="left">Emp<br>Supervisor<br>Name</p></html>
Emp
Supervisor
name

For the no-wrap feature, the <br<
tags are not placed within the header text

Emp Supervisor name

This version should be out pretty soon 🙂