Can not set StiOptions.viewer.toolbar.showAboutButton

Stimulsoft Reports.Flex discussion
Locked
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Chipo »

Hi,
I am trying to set viewer toolbar properties by doing the following:

Code: Select all

protected function init(event:FlexEvent):void {

  StiApiProvider.provider = new StiApiProviderJava(StiApiProvider.AppDesignerFx);
  var initializeProviderEvent: StiApiProviderEvent = new StiApiProviderEvent(StiApiProviderEvent.INITIALIZE_PROVIDER, stiJavaServerUrl, StiProgressMode.Visible);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.INITIALIZE_PROVIDER_RESULT, onInitailizeProviderResult);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.LOAD_DATA_RESULT, checkOptons);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.LOAD_REPORT_RESULT, checkOptons);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.LOAD_CONFIGURATION_RESULT, checkOptons);
  StiApiProvider.provider.dispatchEvent(initializeProviderEvent);
}
			
protected function onInitailizeProviderResult(event:StiApiProviderEvent):void {
  trace("before onInitailizeProviderResult showAboutButton: " + StiOptions.viewer.toolbar.showAboutButton);
  StiViewerFx.initialize(); 
  StiOptions.applicationType = StiApplicationType.Java;
  StiOptions.connection.enableDataLogger = true;
...  
  StiOptions.viewer.toolbar.showAboutButton = false;
  StiOptions.viewer.toolbar.showOpenButton = false;
  StiOptions.viewer.toolbar.showParametersPanel = true;
  StiViewerFx.initialize(); 
  trace("after onInitailizeProviderResult showAboutButton: " + StiOptions.viewer.toolbar.showAboutButton);
}

protected function checkOptons(event:StiApiProviderEvent):void {
  trace("after :" + event.baseType + " showAboutButton:" + StiOptions.viewer.toolbar.showAboutButton);
}
And as a result I have:

Code: Select all

before onInitailizeProviderResult showAboutButton: true
after onInitailizeProviderResult showAboutButton: false
after creationComplete showAboutButton:false
after :loadConfiguration showAboutButton:false
after :loadReport showAboutButton:true
after :loadData showAboutButton:true
after :loadData showAboutButton:true
after :loadData showAboutButton:true
after :loadData showAboutButton:true
after :loadData showAboutButton:true
after :loadData showAboutButton:true
What is wrong in my sequence?

Regards
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Vladimir »

Hello,

This occurs because you are using a Java provider. In this case, the configuration is loaded from the Java server side. You can use 'stimulsoft.properties' file on the server side for configure designer or viewer, or change StiOptions class after loading configuration.

Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Chipo »

Hi,

I supposed I overrode the viewer options after Java provider initialization. I registered it as a StiApiProviderEvent.INITIALIZE_PROVIDER_RESULT function. And in fact I saw correct result until actual report loaded.

Code: Select all

after :loadConfiguration showAboutButton:[b]false[/b]
after :loadReport showAboutButton:[b]true[/b]
I have to override Java server setup on the client. I managed to do so with DemoFx_Flex application (from samples), but it uses

Code: Select all

StiApiProvider.provider = new StiApiProviderFlex(StiApiProvider.AppDesignerFx);
Is there any chance to override setups from the Java server?

Best regards
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Vladimir »

Hello,

You can set options after loading the configuration, for example:

Code: Select all

StiApiProvider.provider.addEventListener(StiApiProviderEvent.LOAD_CONFIGURATION_RESULT, onConfigurationResult);

...

protected function onConfigurationResult(event:StiApiProviderEvent):void {
  StiOptions.viewer.toolbar.showAboutButton = false;
  StiOptions.viewer.toolbar.showOpenButton = false;
  StiOptions.viewer.toolbar.showParametersPanel = true;
}
Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Chipo »

Hi,

thanks a lot for this information. I called my method after StiApiProviderEvent.LOAD_CONFIGURATION_RESULT and got there. But I noticed that after loading of report my overriden parameters gone. So I added my call after StiApiProviderEvent.LOAD_REPORT_RESULT. It started working:

Code: Select all

protected function init(event:FlexEvent):void {
  StiApiProvider.provider = new StiApiProviderJava(StiApiProvider.AppDesignerFx);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.INITIALIZE_PROVIDER_RESULT, onStiInitialiseProiderResult);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.LOAD_CONFIGURATION_RESULT, stiOverrideDesignerOptions);
  StiApiProvider.provider.addEventListener(StiApiProviderEvent.LOAD_REPORT_RESULT, stiOverrideDesignerOptions);
  StiApiProvider.provider.dispatchEvent(new StiApiProviderEvent(StiApiProviderEvent.INITIALIZE_PROVIDER, stiJavaServerUrl, StiProgressMode.Visible));
}

protected function onStiInitialiseProiderResult(event:StiApiProviderEvent):void {
  StiApiProvider.provider.dispatchEvent(new StiApiProviderEvent(StiApiProviderEvent.LOAD_CONFIGURATION));
}
			
protected function stiOverrideDesignerOptions(event:StiApiProviderEvent):void {
  StiOptions.applicationType = StiApplicationType.Java;
  StiOptions.connection.enableDataLogger = true;
...  
  StiThemeManager.theme = StiTheme.silver; 
  StiViewerFx.initialize(); 
}
I can live like that, but do not think report shall contain designer/viewer data. I experimented a little. I had default theme (on the java server) silver and overrode it with black on the flex client. When I opened the viewer with report I saw flickering of the viewer background black (after loading of configuration) -> silver (after loading of report) -> silver again (final call of the stiOverrideDesignerOptions after report loading)

Thank you for your help.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Vladimir »

Hello,

As a solution, please try to clean the 'stimulsoft.properties' file on the server side, in this case the parameters should not be passed.

Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Chipo »

Thank you for your response.

As far as I understood even if I remove "stimulsoft.properties" from web application it will substituted by "defconfigure.properties" from core library. See my post: http://forum.stimulsoft.com/viewtopic.p ... 669#p61531
Please correct me if I am mistaken.

Best regards.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Can not set StiOptions.viewer.toolbar.showAboutButton

Post by Vladimir »

Hello,

We had in mind do not delete the file, but leave it empty - remove all options.

Thank you.
Locked