diff options
8 files changed, 92 insertions, 6 deletions
diff --git a/forms/qa/integration/forms/CellBinding.java b/forms/qa/integration/forms/CellBinding.java index a32220d11ddd..3bf171d82465 100644 --- a/forms/qa/integration/forms/CellBinding.java +++ b/forms/qa/integration/forms/CellBinding.java @@ -87,7 +87,7 @@ public class CellBinding extends complexlib.ComplexTestCase /* ------------------------------------------------------------------ */ public void after() throws com.sun.star.uno.Exception, java.lang.Exception { - //closeDocument(); + closeDocument(); } /* ------------------------------------------------------------------ */ diff --git a/forms/qa/integration/forms/XMLFormSettings.java b/forms/qa/integration/forms/XMLFormSettings.java index edb4fb07c45d..f36bcb38cca4 100644 --- a/forms/qa/integration/forms/XMLFormSettings.java +++ b/forms/qa/integration/forms/XMLFormSettings.java @@ -125,7 +125,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase /* ------------------------------------------------------------------ */ public void after() throws com.sun.star.uno.Exception, java.lang.Exception { - //impl_closeDocument(); + impl_closeDocument(); } /* ------------------------------------------------------------------ */ diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index 59b79b2c2496..ef8a63146e4e 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -44,7 +44,9 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi { // extends ReportWizard // ReportTextDocument CurReportDocument; - IReportDocument CurReportDocument;// PropertyValue[] CurProperties; + IReportDocument CurReportDocument; + +// PropertyValue[] CurProperties; static boolean bStopProcess; static String sProgressDBConnection; static String sProgressDataImport; diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java index b4e7ac32e9c1..af8476f5c3e9 100644 --- a/wizards/com/sun/star/wizards/report/IReportDocument.java +++ b/wizards/com/sun/star/wizards/report/IReportDocument.java @@ -257,4 +257,10 @@ public interface IReportDocument public void setCommandType(int CommandType); public void setCommand(String Command); + + /** + * check internal invariants + * @throws a + */ + public void checkInvariants() throws java.lang.Exception; } diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java index 27e88e287585..b7e7d2c4f47a 100644 --- a/wizards/com/sun/star/wizards/report/ReportLayouter.java +++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java @@ -61,7 +61,8 @@ public class ReportLayouter public String[][] LayoutFiles; public String[][] ContentFiles; // private Desktop.OfficePathRetriever curofficepath; - Object aOrientationImage; // boolean m_bLandscape = true; + Object aOrientationImage; + // boolean m_bLandscape = true; private XMultiServiceFactory m_xMSF; public ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog) diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index d7f38eb37b9c..fb45ad376107 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -612,7 +612,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme public void setGrouping(String[] aGroupFieldNames) { getRecordParser().prependSortFieldNames(aGroupFieldNames); - }// TODO: we have to change to String List!!!! + } + +// TODO: we have to change to String List!!!! private ArrayList m_aReportPath = null; public ArrayList getReportPath() @@ -728,4 +730,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme getRecordParser().Command = _sCommand; // throw new UnsupportedOperationException("Not supported yet."); } + + public void checkInvariants() throws java.lang.Exception + { + } } diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 7d9db8c76488..65ec553f6183 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -35,6 +35,7 @@ package com.sun.star.wizards.report; // import com.sun.star.wizards.reportbuilder.ReportBuilderImplementation; import com.sun.star.awt.Size; import com.sun.star.awt.TextEvent; +import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XControl; import com.sun.star.awt.XControlModel; import com.sun.star.awt.XFixedText; @@ -49,6 +50,8 @@ import com.sun.star.deployment.XPackageInformationProvider; import com.sun.star.lang.EventObject; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; +import com.sun.star.logging.XLogger; +import com.sun.star.logging.XLoggerPool; import com.sun.star.sdb.CommandType; import com.sun.star.uno.AnyConverter; @@ -92,7 +95,9 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple public static final int SOGROUPPAGE = 3; public static final int SOSORTPAGE = 4; public static final int SOTEMPLATEPAGE = 5; - public static final int SOSTOREPAGE = 6; // ReportTextDocument CurReportDocument; + public static final int SOSTOREPAGE = 6; + + // ReportTextDocument CurReportDocument; // ReportTextImplementation CurReportDocument; IReportDocument CurReportDocument; static String sMsgWizardName; @@ -564,6 +569,26 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple return sLocation; } +private static XLogger m_xLogger; + +private static void initializeLogger(XMultiServiceFactory _xMSF) +{ + XComponentContext xContext = Helper.getComponentContext(_xMSF); + + Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool"); + if (aLoggerPool == null) + { + System.out.println("Can't get singleton from logging"); + } + final XLoggerPool xLoggerPool = (XLoggerPool)UnoRuntime.queryInterface(XLoggerPool.class, aLoggerPool); + m_xLogger = xLoggerPool.getNamedLogger("com.sun.star.wizards.ReportBuilder"); +} + +public static XLogger getLogger() +{ + return m_xLogger; +} + public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue) { return startReportWizard(_xMSF, CurPropertyValue, false); @@ -571,9 +596,13 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue, boolean _bDebug) { + initializeLogger(_xMSF); + getLogger().log(com.sun.star.logging.LogLevel.SEVERE, "Start Report Wizard"); + XComponent[] ret = null; this.xMSF = _xMSF; DBGPROPERTYVALUE = CurPropertyValue; + // CurReportDocument = new ReportTextDocument(xMSF, ReportPath + "/stl-default.ott", m_oResource ); // if (isReportBuilderInstalled()) // { @@ -655,11 +684,15 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple // CurDBMetaData = CurReportDocument.getRecordParser(); // tests(); + if (CurReportDocument.getRecordParser().getConnection(CurPropertyValue)) { // CurReportDocument.getDoc().xProgressBar.setValue(20); CurReportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(CurReportDocument.getRecordParser()); buildSteps(); + + CurReportDocument.checkInvariants(); + this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValue, false); createWindowPeer(CurReportDocument.getWizardParent()); @@ -671,6 +704,19 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } CurReportDocument.getRecordParser().dispose(); } + catch (java.io.IOException e) + { + String sMessage = e.getMessage(); + if (sMessage.equals("default.otr")) + { + sMessage = m_oResource.getResText(UIConsts.RID_REPORT + 92); + } + else + { + } + // show a dialog with the error message + SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMessage); + } catch (java.lang.Exception jexception) { jexception.printStackTrace(System.out); diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 184bd7cd9fea..515d0c635ed0 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -60,6 +60,7 @@ import com.sun.star.util.XURLTransformer; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.FieldColumn; // import java.io.File; +import java.io.File; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Iterator; @@ -201,6 +202,8 @@ public class ReportBuilderImplementation extends ReportImplementationHelper } catch (com.sun.star.uno.Exception e) { + ReportWizard.getLogger().log(com.sun.star.logging.LogLevel.SEVERE, "Problems with initialize the ReportDefinition" + e.getMessage()); + } m_xReportDefinition = xReportDefinition; @@ -876,6 +879,28 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { getReportDefinition().setCommandType(_nCommand); } + + + public void checkInvariants() throws java.lang.Exception + { + final String sDefaultHeaderLayoutPath = getDefaultHeaderLayout(); + if (sDefaultHeaderLayoutPath == null) + { + throw new java.io.IOException("default.otr"); + } + + final String sName = FileAccess.getFilename(sDefaultHeaderLayoutPath); + // if (sName.toLowerCase().equals("default.otr_") || + // LayoutTemplatePath.equals("DefaultLayoutOfHeaders")) + // File aFile = new File(sDefaultHeaderLayoutPath); + // File aFile = new File(sName); + FileAccess aAccess = new FileAccess(getGlobalMSF()); + if (! aAccess.exists(sDefaultHeaderLayoutPath, true)) + { + throw new java.io.IOException("default.otr"); + } + } + } |