if (width <= 0) {
width = Settings.propColumnWidth.getInt();
}
TextAreaIcon icon = new TextAreaIcon(HTMLTextHelper.convertHtmlToText(item.getDescription()), new JLabel().getFont(), width, 2);
JLabel iconLabel = new JLabel("");
iconLabel.setIcon(icon);
pb.add(iconLabel, cc.xyw(2,4,3));
JLabel label3 = new JLabel();
if (item.isAlreadyInstalled()) {
Version installedVersion = item.getInstalledVersion();
if ((installedVersion != null) && (installedVersion.compareTo(item.getVersion()) < 0)) {
label.setIcon(NEW_VERSION_ICON);
label3.setText("(" + mLocalizer.msg("installed","Installed version: ") + installedVersion.toString()+")");
label3.setFont(label3.getFont().deriveFont(label3.getFont().getSize2D()+2));
pb.add(label3, cc.xy(4,2));
}
}
if (isSelected && isEnabled) {
label.setForeground(list.getSelectionForeground());
String author = item.getProperty("author");
String website = item.getWebsite();
FormLayout authorAndWebsiteLayout = new FormLayout("default,5dlu,default","default");
JPanel authorAndWebsite = new JPanel(authorAndWebsiteLayout);
authorAndWebsite.setOpaque(false);
if (author != null) {
lay.appendRow(RowSpec.decode("2dlu"));
lay.appendRow(RowSpec.decode("default"));
lay.appendRow(RowSpec.decode("2dlu"));
pb.add(authorAndWebsite, cc.xyw(2,7,3));
JLabel authorLabel = new JLabel(mLocalizer.msg("author", "Author"));
authorLabel.setFont(authorLabel.getFont().deriveFont(Font.BOLD));
authorLabel.setForeground(list.getSelectionForeground());
authorLabel.setHorizontalAlignment(SwingConstants.RIGHT);
JLabel authorName = new JLabel(HTMLTextHelper.convertHtmlToText(author));
authorName.setForeground(list.getSelectionForeground());
authorAndWebsite.add(authorLabel, cc.xy(1,1));
authorAndWebsite.add(authorName, cc.xy(3,1));
}
if (website != null) {
if(author == null) {
lay.appendRow(RowSpec.decode("2dlu"));
lay.appendRow(RowSpec.decode("default"));
lay.appendRow(RowSpec.decode("2dlu"));
pb.add(authorAndWebsite, cc.xyw(2,7,3));
}
else {
authorAndWebsiteLayout.appendRow(RowSpec.decode("1dlu"));
authorAndWebsiteLayout.appendRow(RowSpec.decode("default"));
}
JLabel webLabel = new JLabel(mLocalizer.msg("website", "Website"));
webLabel.setFont(webLabel.getFont().deriveFont(Font.BOLD));
webLabel.setForeground(list.getSelectionForeground());
webLabel.setHorizontalAlignment(SwingConstants.RIGHT);
LinkButton webLink = new LinkButton(HTMLTextHelper.convertHtmlToText(website));
webLink.setForeground(list.getSelectionForeground());
authorAndWebsite.add(webLabel, cc.xy(1,author == null ? 1 : 3));
authorAndWebsite.add(webLink, cc.xy(3,author == null ? 1 : 3));
}
icon.setMaximumLineCount(-1);
iconLabel.setForeground(list.getSelectionForeground());
label3.setForeground(list.getSelectionForeground());
} else {
if(!item.isStable()) {
label.setForeground(new Color(200, 0, 0));
}
else {
label.setForeground(list.getForeground());
}
icon.setMaximumLineCount(1);
iconLabel.setForeground(list.getSelectionForeground());
iconLabel.setForeground(list.getForeground());
label3.setForeground(Color.gray);
}