#1 2019-05-28 09:49:17

Patryx
Member
Registered: 2019-03-25

Icon parameter in AddReportExportFormatProvider

Hi,
How should I use the last parameter of constructor AddReportExportFormatProvider called Icon? I couldn't find such information in your documentation or forum.

I think I found a solution but I am not sure if it is a proper one.
1. At first I created new folder "buttons" in "FileServer Root->resources" folder using Administration page - System Files and I added an icon there as "Icon_map.png". In my case it seemed to be clear BUT I noticed that I had to mark "Share folder for web access" on folder "buttons" (if I loaded icon into "rs", I needed to do the same with "rs" folder).
In other case I didn't have access to it.
2. I modified my script for adding button with my export format (which is fired onlogin) like this:

...
AddReportExportFormatProvider provider = new AddReportExportFormatProvider(new TableReportDtoDec(), "Mapa", "MAP_FORMAT", "/reportserver/reportserver/fileServerAccess?path=/resources/buttons/Icon_map.png")
...

3. I saw my new button:
Mapa-export-screen.jpg

Unfortunately as we can see, the style is not the same one, no margin/padding and it looks different than Excel icon. Is there any way to adjust such an icon? Is my solution of using icon recommended by you or is there another one, better for that?
It would be nice if you describe in documentation how to use icon parameter smile

4. Can I get information which language (locale) is used in such a script for adding button in gui? I want to be able to change my button title "Mapa" in language which is currently used in GUI. Could you tell me how to retrieve such information? I tried to find it out but I have not found a proper solution for that.

Best reagrds,
Patryk

Last edited by Patryx (2019-05-28 09:51:49)

Offline

#2 2019-05-28 13:03:43

Patryx
Member
Registered: 2019-03-25

Re: Icon parameter in AddReportExportFormatProvider

I think I found solution for point 4. - how to get current locale which can be used to translate button name. I paste here my code, maybe somebody will need it in future:

import net.datenwerke.rs.base.client.reportengines.table.dto.decorator.TableReportDtoDec;
import net.datenwerke.rs.scripting.service.scripting.extensions.AddReportExportFormatProvider;
import net.datenwerke.rs.utils.localization.LocalizationServiceImpl;

/* variable */
def final String iconPath = "/reportserver/reportserver/fileServerAccess?path=/resources/buttons/Icon_map.png";
def final String myFormat = "MAP_FORMAT";
def String buttonName = "Mapa";

/* obtain ClientExtensionService */
def ces = GLOBALS.services['clientExtensionService']

/* obtain LocalizationServiceImpl */
def ls = GLOBALS.getInstance(LocalizationServiceImpl.class);

/* check locale and adjust button name */
def currLocale = ls.getLocale()?.toString();

switch(currLocale) {
   case "pl":
      buttonName = "Mapa";
      break;

   case "en":
   default:
      buttonName = "Map";
      break;
}

/* register format */
AddReportExportFormatProvider provider = new AddReportExportFormatProvider(new TableReportDtoDec(), buttonName, myFormat, iconPath);
provider.skipDownload = true;
ces.addReportExportOutputFormat provider;

""

Last edited by Patryx (2019-05-28 13:04:32)

Offline

#3 2019-06-03 07:30:19

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Icon parameter in AddReportExportFormatProvider

Hi Patryx,

thanks for sharing your solution on this.

Regards,
Eduardo

Offline

#4 2019-06-03 08:48:53

Patryx
Member
Registered: 2019-03-25

Re: Icon parameter in AddReportExportFormatProvider

Hi Eduardo,
Could you answer there questions included in my first post:
"... Unfortunately as we can see, the style is not the same one, no margin/padding and it looks different than Excel icon. Is there any way to adjust such an icon? Is my solution of using icon recommended by you or is there another one, better for that? ..."

Offline

#5 2019-06-03 09:07:45

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Icon parameter in AddReportExportFormatProvider

Hi Patryx,

what exactly is different? In the screenshot you posted I see the icon analogous to the excel icon in the second entry.

Regards,
Eduardo

Offline

#6 2019-06-03 13:34:20

Patryx
Member
Registered: 2019-03-25

Re: Icon parameter in AddReportExportFormatProvider

For example a distance between icon and text is different. I think there are more styles for built-in buttons - you have in html special classes for them.

Offline

#7 2019-06-04 14:18:39

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Icon parameter in AddReportExportFormatProvider

Hi Patryx,

the same holds for default icons, please take a look at the screenshot:

FluxBB BBCode-Test

Regards,
Eduardo

Offline

#8 2019-06-05 06:22:46

Patryx
Member
Registered: 2019-03-25

Re: Icon parameter in AddReportExportFormatProvider

Hi Eduardo,
You are right, all the first icons with text look the same if they are as first button. My fault that I didn't check it.
It's like in your screenshot, space is smaller between icon and text.
Thanks!

Offline

Board footer

Powered by FluxBB