* @param body
* @param link
*/
private Control createImageHyperlink(Composite parent, IntroLink link) {
Control control;
Hyperlink linkControl;
boolean showLinkDescription = styleManager.getShowLinkDescription();
Image linkImage = styleManager.getImage(link, "link-icon", //$NON-NLS-1$
ImageUtil.DEFAULT_LINK);
if (showLinkDescription && link.getText() != null) {
Composite container = toolkit.createComposite(parent);
TableWrapLayout layout = new TableWrapLayout();
layout.leftMargin = layout.rightMargin = 0;
layout.topMargin = layout.bottomMargin = 0;
layout.verticalSpacing = 0;
layout.numColumns = 2;
container.setLayout(layout);
//Label ilabel = toolkit.createLabel(container, null);
ImageHyperlink ilabel = toolkit.createImageHyperlink(container, SWT.NULL);
ilabel.setImage(linkImage);
ilabel.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
null));
ilabel.setHref(link.getUrl());
ilabel.addHyperlinkListener(hyperlinkAdapter);
TableWrapData td = new TableWrapData();
td.valign = TableWrapData.TOP;
td.rowspan = 2;
ilabel.setLayoutData(td);
linkControl = toolkit.createHyperlink(container, null, SWT.WRAP);
td = new TableWrapData(TableWrapData.LEFT, TableWrapData.BOTTOM);
td.grabVertical = true;
linkControl.setLayoutData(td);
// Util.highlight(linkControl, SWT.COLOR_RED);
// Util.highlight(container, SWT.COLOR_DARK_YELLOW);
Control desc = createText(container, link.getIntroText());
td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
td.grabHorizontal = true;
td.grabVertical = true;
desc.setLayoutData(td);
control = container;
} else {
ImageHyperlink imageLink = toolkit.createImageHyperlink(parent,
SWT.WRAP | SWT.CENTER);
imageLink.setImage(linkImage);
imageLink.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
null));
TableWrapData td = new TableWrapData();
td.grabHorizontal = true;
imageLink.setLayoutData(td);
linkControl = imageLink;
control = linkControl;
}
linkControl.setText(link.getLabel());
linkControl.setFont(PageStyleManager.getBannerFont());
colorControl(linkControl, link);
linkControl.setHref(link.getUrl());
linkControl.addHyperlinkListener(hyperlinkAdapter);
// Util.highlight(linkControl, SWT.COLOR_DARK_YELLOW);
return control;
}