ScoutInfoForm [message #718609] |
Wed, 24 August 2011 16:18  |
Eclipse User |
|
|
|
Does anyone know how to change the built-in ScoutInfoForm?
I would like to add my own application logo, and add some application-specific text.
|
|
|
|
|
|
Re: ScoutInfoForm [message #990587 is a reply to message #718739] |
Thu, 13 December 2012 05:14   |
Eclipse User |
|
|
|
I have been looking at branding our info form. I tried the approach of extending ScoutInfoForm and displaying my own form as described in the posts by Jeremie and Stephan. I have succesfully been able to replace the text section of the info form (by overriding createHtmlBody) but any attempt at using a different image by overriding getLogoImage() have failed. It seems, that no matter what image name you supply to an <img src=""> element in the info form, it always uses application_logo_large.png from the client/resource/icons folder unless using a fully qualified file:// URL.
To demonstrate this, I have created three images (all called Info.png) in the resource/icons folders of the client, ui.swing and ui.swt (they have different background colours, so I can tell which one is used). I also created three images (all called application_logo_large.png) in those three folders (again using different background colours).
Then I modified Desktop.AboutMenu.execAction as follows:
public void execAction() throws ProcessingException {
//ScoutInfoForm form = new ScoutInfoForm();
InfoForm form = new InfoForm();
form.startModify();
}
and added the following class:
public class InfoForm extends ScoutInfoForm {
public InfoForm() throws ProcessingException {
super();
}
@Override
public RemoteFile getLogoImage() {
return new RemoteFile("Info.png", 0);
}
@Override
protected void createHtmlBody(StringBuffer buf) {
buf.append("<h1>InfoForm</h1>");
buf.append("<p>The struggle with the icons</p>");
RemoteFile f = getLogoImage();
if (f != null) {
buf.append("<p>Using getLogoImage()<br>");
buf.append("<img src=\"" + f.getPath() + "\"><br>");
buf.append("<i>img src=\"" + f.getPath() + "\"</i></p>");
}
else {
buf.append("<p>Using getLogoImage()<br>");
buf.append("getLogoImage returned null</p>");
}
buf.append("<p>Hard coding it<br>"); buf.append("<img src=\"" + "Info.png" + "\"><br>");
buf.append("<i>img src=\"" + "Info.png" + "\"</i></p>");
buf.append("<p>Using a fully qualified URL<br>");
buf.append("<img src=\"file://///D:/devsbb/workspaces/scout-tutorial/org.eclipse.minicrm.client/resources/icons/Info.png\"><br>");
buf.append("<i>img src=\"" + "file://///D:/devsbb/workspaces/scout-tutorial/org.eclipse.minicrm.client/resources/icons/Info.png" + "\"</i></p>");
buf.append("<p>Life, the universe and everything</p>");
}
}
This results in the following output:

As you can see, I pass "Info.png" to <img src> in the first two attempts (once using getLogoImage and once hard coded) which is the picture with the red circle. However, in both cases the picture with the blue circle (application_logo_large.png) is shown.
Only by using an explicit file:// URL to my hard drive can I manage to show the picture I really want.
Looking at ScoutInfoForm.createHtmlAttachements I see that the RemoteFile I return from getLogoImage is only used to name the file but that the content is always read from AbstractIcons.ApplicationLogo. Is this intended behaviour or a bug? In any case, apart from my problem, it seems to render the ScoutInfoForm.setLogoImage() method pretty useless.
If I understand this right, if I wanted to use a different image (or several images), I would also need to overwrite createHtmlAttachments() method. Is this assumption correct?
Attachment: InfoForm.png
(Size: 19.66KB, Downloaded 747 times)
|
|
|
|
Re: ScoutInfoForm [message #991047 is a reply to message #990758] |
Mon, 17 December 2012 02:58  |
Eclipse User |
|
|
|
Hi Beat
Thanks for confirming. I have since tried this and am now able to have my own HTML field displaying several different pictures.
|
|
|
Powered by
FUDForum. Page generated in 0.29473 seconds