diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-12 13:14:18 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-19 14:57:16 +0200 |
commit | 1e6f0b2d8b35f856637eedf91729e522fcc633e8 (patch) | |
tree | bfaadde20db0d26b8e30a3751aca4708a9e73886 /wizards | |
parent | java: remove unused methods (diff) | |
download | core-1e6f0b2d8b35f856637eedf91729e522fcc633e8.tar.gz core-1e6f0b2d8b35f856637eedf91729e522fcc633e8.zip |
simplify CallFormWizard
Change-Id: I0dfdc1acb0b550c1eeed16498f3e791e0123c4eb
Diffstat (limited to 'wizards')
5 files changed, 115 insertions, 137 deletions
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java index fc3177c26268..94a141a6072a 100644 --- a/wizards/com/sun/star/wizards/form/CallFormWizard.java +++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java @@ -22,7 +22,7 @@ import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.PropertyNames; -/** This class capsulates the class, that implements the minimal component, a +/** This class encapsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). */ public class CallFormWizard @@ -150,23 +150,18 @@ public class CallFormWizard @Override public Type[] getTypes() { - Type[] typeReturn = - { - }; - - try - { - typeReturn = new Type[] + Type[] typeReturn = new Type[] { - new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.beans.XPropertySet.class), new Type(com.sun.star.beans.XFastPropertySet.class), new Type(com.sun.star.beans.XMultiPropertySet.class), new Type(com.sun.star.lang.XInitialization.class) + new Type(com.sun.star.task.XJobExecutor.class), + new Type(com.sun.star.lang.XTypeProvider.class), + new Type(com.sun.star.lang.XServiceInfo.class), + new Type(com.sun.star.beans.XPropertySet.class), + new Type(com.sun.star.beans.XFastPropertySet.class), + new Type(com.sun.star.beans.XMultiPropertySet.class), + new Type(com.sun.star.lang.XInitialization.class) }; - } - catch (Exception exception) - { - System.err.println(exception); - } - return (typeReturn); + return typeReturn; } } } diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java index 1fd4dbd38487..853e23801a81 100644 --- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java +++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java @@ -24,7 +24,7 @@ import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.PropertyNames; -/** This class capsulates the class, that implements the minimal component, a +/** This class encapsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). */ public class CallQueryWizard diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index 7141da9e6ffd..d6d531fd1a9a 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -27,159 +27,142 @@ import com.sun.star.wizards.common.PropertyNames; import java.util.logging.Level; import java.util.logging.Logger; -/** This class capsulates the class, that implements the minimal component, a - * factory for creating the service (<CODE>__getServiceFactory</CODE>). +/** This class implements the component. At least the interfaces XServiceInfo, + * XTypeProvider, and XInitialization should be provided by the service. */ public class CallReportWizard + extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor { - private static boolean bWizardstartedalready; + private static boolean bWizardStartedAlready; + /** The service name, that must be used to get an instance of this service. + */ + private static final String __serviceName = "com.sun.star.wizards.report.CallReportWizard"; + private PropertyValue[] m_wizardContext; - /** This class implements the component. At least the interfaces XServiceInfo, - * XTypeProvider, and XInitialization should be provided by the service. + /** The constructor of the inner class has a XMultiServiceFactory parameter. + * @param xmultiservicefactoryInitialization A special service factory + * could be introduced while initializing. */ - private static class ReportWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor + public CallReportWizard(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) { + super(); + xmultiservicefactory = xmultiservicefactoryInitialization; + } - private PropertyValue[] m_wizardContext; - - /** The constructor of the inner class has a XMultiServiceFactory parameter. - * @param xmultiservicefactoryInitialization A special service factory - * could be introduced while initializing. - */ - public ReportWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) - { - super(); - xmultiservicefactory = xmultiservicefactoryInitialization; - } - - public void trigger(String sEvent) + public void trigger(String sEvent) + { + try { - try + if (sEvent.equals(PropertyNames.START)) { - if (sEvent.equals(PropertyNames.START)) + if (!bWizardStartedAlready) { - if (!bWizardstartedalready) - { - ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext ); - CurReportWizard.startReportWizard(); - } - bWizardstartedalready = false; + ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext ); + CurReportWizard.startReportWizard(); } - else if (sEvent.equals("fill")) + bWizardStartedAlready = false; + } + else if (sEvent.equals("fill")) + { + Dataimport CurDataimport = new Dataimport(xmultiservicefactory); + if (m_wizardContext != null) { - Dataimport CurDataimport = new Dataimport(xmultiservicefactory); - if (m_wizardContext != null) + NamedValueCollection context = new NamedValueCollection( m_wizardContext ); + XTextDocument textDocument = context.queryOrDefault( "TextDocument", null, XTextDocument.class ); + XDatabaseDocumentUI documentUI = context.queryOrDefault( "DocumentUI", null, XDatabaseDocumentUI.class ); + if ( textDocument != null ) { - NamedValueCollection context = new NamedValueCollection( m_wizardContext ); - XTextDocument textDocument = context.queryOrDefault( "TextDocument", null, XTextDocument.class ); - XDatabaseDocumentUI documentUI = context.queryOrDefault( "DocumentUI", null, XDatabaseDocumentUI.class ); - if ( textDocument != null ) - { - CurDataimport.createReport(xmultiservicefactory, documentUI, textDocument, m_wizardContext); - } + CurDataimport.createReport(xmultiservicefactory, documentUI, textDocument, m_wizardContext); } } } - catch (Exception e) - { - Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); - } - System.gc(); } - /** The service name, that must be used to get an instance of this service. - */ - private static final String __serviceName = "com.sun.star.wizards.report.CallReportWizard"; - /** The service manager, that gives access to all registered services. - */ - private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory; - - /** This method is a member of the interface for initializing an object - * directly after its creation. - * @param object This array of arbitrary objects will be passed to the - * component after its creation. - * @throws com.sun.star.uno.Exception Every exception will not be handled, but will be - * passed to the caller. - */ - public void initialize(Object[] object) throws com.sun.star.uno.Exception + catch (Exception e) { - this.m_wizardContext = Properties.convertToPropertyValueArray(object); - + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } + System.gc(); + } - /** This method returns an array of all supported service names. - * @return Array of supported service names. - */ - public java.lang.String[] getSupportedServiceNames() - { - String[] stringSupportedServiceNames = new String[1]; + /** The service manager, that gives access to all registered services. + */ + private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory; + + /** This method is a member of the interface for initializing an object + * directly after its creation. + * @param object This array of arbitrary objects will be passed to the + * component after its creation. + * @throws com.sun.star.uno.Exception Every exception will not be handled, but will be + * passed to the caller. + */ + public void initialize(Object[] object) throws com.sun.star.uno.Exception + { + this.m_wizardContext = Properties.convertToPropertyValueArray(object); - stringSupportedServiceNames[ 0] = __serviceName; + } - return (stringSupportedServiceNames); - } + /** This method returns an array of all supported service names. + * @return Array of supported service names. + */ + public java.lang.String[] getSupportedServiceNames() + { + String[] stringSupportedServiceNames = new String[1]; - /** This method returns true, if the given service will be - * supported by the component. - * @param stringService Service name. - * @return True, if the given service name will be supported. - */ - public boolean supportsService(String stringService) - { - boolean booleanSupportsService = false; + stringSupportedServiceNames[ 0] = __serviceName; - if (stringService.equals(__serviceName)) - { - booleanSupportsService = true; - } - return (booleanSupportsService); - } + return (stringSupportedServiceNames); + } - @Override - public byte[] getImplementationId() - { - return new byte[0]; - } + /** This method returns true, if the given service will be + * supported by the component. + * @param stringService Service name. + * @return True, if the given service name will be supported. + */ + public boolean supportsService(String stringService) + { + boolean booleanSupportsService = false; - /** Return the class name of the component. - * @return Class name of the component. - */ - public java.lang.String getImplementationName() + if (stringService.equals(__serviceName)) { - return (ReportWizardImplementation.class.getName()); + booleanSupportsService = true; } + return (booleanSupportsService); + } - /** Provides a sequence of all types (usually interface types) - * provided by the object. - * @return Sequence of all types (usually interface types) provided by the - * service. - */ - @Override - public Type[] getTypes() - { - Type[] typeReturn = - { - }; + @Override + public byte[] getImplementationId() + { + return new byte[0]; + } - try - { - typeReturn = new Type[] - { - new Type(com.sun.star.task.XJobExecutor.class), - new Type(com.sun.star.lang.XTypeProvider.class), - new Type(com.sun.star.lang.XServiceInfo.class), - new Type(com.sun.star.lang.XInitialization.class) - }; - } - catch (Exception e) - { - Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); - } + /** Return the class name of the component. + * @return Class name of the component. + */ + public java.lang.String getImplementationName() + { + return CallReportWizard.class.getName(); + } - return (typeReturn); - } + /** Provides a sequence of all types (usually interface types) + * provided by the object. + * @return Sequence of all types (usually interface types) provided by the + * service. + */ + @Override + public Type[] getTypes() + { + Type[] typeReturn = new Type[] + { + new Type(com.sun.star.task.XJobExecutor.class), + new Type(com.sun.star.lang.XTypeProvider.class), + new Type(com.sun.star.lang.XServiceInfo.class), + new Type(com.sun.star.lang.XInitialization.class) + }; + + return typeReturn; } } diff --git a/wizards/com/sun/star/wizards/report/report.component b/wizards/com/sun/star/wizards/report/report.component index 68c8ce94021e..050871fd587b 100644 --- a/wizards/com/sun/star/wizards/report/report.component +++ b/wizards/com/sun/star/wizards/report/report.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.Java2" xmlns="http://openoffice.org/2010/uno-components"> <implementation name= - "com.sun.star.wizards.report.CallReportWizard$ReportWizardImplementation"> + "com.sun.star.wizards.report.CallReportWizard"> <service name="com.sun.star.wizards.report.CallReportWizard"/> </implementation> </component> diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java index c0214cffe334..32a367fc0d63 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -23,7 +23,7 @@ import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.PropertyNames; -/** This class capsulates the class, that implements the minimal component, a +/** This class encapsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). */ public class CallTableWizard |