ScoutInfoForm [message #718609] |
Wed, 24 August 2011 20:18 |
Adrian Moser Messages: 67 Registered: March 2011 |
Member |
|
|
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 #718739 is a reply to message #718713] |
Thu, 25 August 2011 08:35 |
|
Hi Adrian
In fact there is an easier way to exchange the logo. The default implementation of getLogoImage returns an empty RemoteFile, so createHtmlAttachments does not use that file instead it uses an image called application_logo_large.png. To exchange that logo you can simply put an image with the same name in the folder resources/icons of your client plugin. Thats it!
Regards
Claudio
|
|
|
Re: ScoutInfoForm [message #990587 is a reply to message #718739] |
Thu, 13 December 2012 10:14 |
Urs Beeli Messages: 573 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
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 652 times)
|
|
|
Re: ScoutInfoForm [message #990758 is a reply to message #990587] |
Fri, 14 December 2012 06:50 |
|
Hi Urs
Yes, your assumption is correct. Attachments to an HTML field are stored in a temporary directory. Paths in the HTML code are looked up relatively to that directory - expect when you specify the full URL (as you noticed correctly).
So yes, if you want to use "my_special_filename.png" as src in an <img> tag, you have to add an attachment with that name.
Beat
|
|
|
|
Powered by
FUDForum. Page generated in 0.03144 seconds