Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » ScoutInfoForm(change logo and/or text)
ScoutInfoForm [message #718609] Wed, 24 August 2011 20:18 Go to next message
Adrian MoserFriend
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 #718710 is a reply to message #718609] Thu, 25 August 2011 06:24 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 124
Registered: November 2010
Senior Member
I am not sure you can change this form.

But you can control which form is opened with the AboutMenu in the Desktop class of your application (<your_application>.client.ui.desktop.Desktop).

@Order(10.0)
public class AboutMenu extends AbstractMenu{

  @Override
  public String getConfiguredText(){
    return Texts.get("AboutMenu");
  }

  @Override
  public void execAction() throws ProcessingException{
    ScoutInfoForm form=new ScoutInfoForm();
    form.startModify();
  }
}


If you change execAction you can open the form you want.
Re: ScoutInfoForm [message #718713 is a reply to message #718710] Thu, 25 August 2011 06:37 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht VogtFriend
Messages: 104
Registered: July 2015
Senior Member
Since the displayed text and logo is html you could extend ScoutInfoForm and overwrite the method createHtmlBody or just getLogoImage.

import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.rt.client.ui.form.ScoutInfoForm;
import org.eclipse.scout.rt.shared.services.common.file.RemoteFile;

public class InfoForm extends ScoutInfoForm {

  public InfoForm() throws ProcessingException {
    super();
  }

  @Override
  public RemoteFile getLogoImage() {
    RemoteFile yourLogo = null;
    return yourLogo;
  }

  @Override
  protected void createHtmlBody(StringBuffer buf) {
    /* your body */
  }
}


Re: ScoutInfoForm [message #718739 is a reply to message #718713] Thu, 25 August 2011 08:35 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
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 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
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:
index.php/fa/12695/0/

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 651 times)
Re: ScoutInfoForm [message #990758 is a reply to message #990587] Fri, 14 December 2012 06:50 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
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
Re: ScoutInfoForm [message #991047 is a reply to message #990758] Mon, 17 December 2012 07:58 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Hi Beat

Thanks for confirming. I have since tried this and am now able to have my own HTML field displaying several different pictures.
Previous Topic:JAX-WS and type substitution
Next Topic:Splash Screen Client Swing
Goto Forum:
  


Current Time: Tue Apr 16 17:50:56 GMT 2024

Powered by FUDForum. Page generated in 0.78142 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top