Page 1 of 1

Can not set StiOptions.viewer.toolbar.showAboutButton

Posted: Mon Sep 17, 2012 5:16 am
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

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

Posted: Mon Sep 17, 2012 1:56 pm
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.

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

Posted: Mon Sep 17, 2012 11:35 pm
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

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

Posted: Tue Sep 18, 2012 12:23 pm
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.

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

Posted: Wed Sep 19, 2012 2:27 am
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.

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

Posted: Wed Sep 19, 2012 12:55 pm
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.

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

Posted: Thu Sep 20, 2012 6:16 am
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.

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

Posted: Fri Sep 21, 2012 1:08 pm
by Vladimir
Hello,

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

Thank you.