}
@Override
@SuppressWarnings("unchecked")
public int getBaseline(int width, int height) {
ListView listView = (ListView)getComponent();
int baseline = -1;
int clientWidth = width;
if (listView.getCheckmarksEnabled()) {
clientWidth = Math.max(clientWidth - (CHECKBOX.getWidth() + (checkboxPadding.left
+ checkboxPadding.right)), 0);
}
ListView.ItemRenderer itemRenderer = listView.getItemRenderer();
List<Object> listData = (List<Object>)listView.getListData();
if (variableItemHeight && listData.getLength() > 0) {
itemRenderer.render(listData.get(0), 0, listView, false, false, false, false);
int itemHeight = itemRenderer.getPreferredHeight(clientWidth);
if (listView.getCheckmarksEnabled()) {
itemHeight = Math.max(CHECKBOX.getHeight() + (checkboxPadding.top
+ checkboxPadding.bottom), itemHeight);
}
baseline = itemRenderer.getBaseline(clientWidth, itemHeight);
} else {
itemRenderer.render(null, -1, listView, false, false, false, false);
int fixedItemHeight = itemRenderer.getPreferredHeight(-1);
if (listView.getCheckmarksEnabled()) {
fixedItemHeight = Math.max(CHECKBOX.getHeight() + (checkboxPadding.top
+ checkboxPadding.bottom), fixedItemHeight);
}
baseline = itemRenderer.getBaseline(clientWidth, fixedItemHeight);