diff options
author | Behrend Cornelius <bc@openoffice.org> | 2002-09-13 06:52:26 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2002-09-13 06:52:26 +0000 |
commit | 9ef164ae76edc1f2e3b57555b721c2493399974b (patch) | |
tree | 6a946556e79786b09a29b22131c9c0ccd06d1b5c /wizards/com/sun/star/wizards | |
parent | 9cb49f052a7c607d3490cec226715bcf12c27982 (diff) |
#100395# now thread for Datainsertion set up
Diffstat (limited to 'wizards/com/sun/star/wizards')
-rw-r--r-- | wizards/com/sun/star/wizards/report/Dataimport.java | 42 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/report/ReportWizard.java | 43 |
2 files changed, 52 insertions, 33 deletions
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index 9f5f9331ca8d..0b25ee63f2bb 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -2,9 +2,9 @@ * * $RCSfile: Dataimport.java,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: bc $ $Date: 2002-09-11 13:16:39 $ + * last change: $Author: bc $ $Date: 2002-09-13 07:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -226,8 +226,9 @@ public class Dataimport extends ReportWizard{ new Object[] {new Integer(14), "HID:34321", new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop}); CurUNOProgressDialog.calculateDialogPosition(xMSF, CurReportDocument.Frame.getComponentWindow().getPosSize(), CurReportDocument.xWindowPeer); + CurUNOProgressDialog.xWindow.setVisible(true); -// setDialogVisible(CurUNOProgressDialog); + return CurUNOProgressDialog; } @@ -242,22 +243,29 @@ public class Dataimport extends ReportWizard{ }} - - public void setDialogVisible(final UNODialogs CurUNOProgressDialog){ - + public void importReportData(final XMultiServiceFactory xMSF, final ReportDocument CurReportDocument, final UNODialogs CurUNOProgressDialog){ +/* Thread ProgressThread = new Thread(new Runnable(CurUNOProgressDialog) { + private UNODialogs dialog; + public Runnable( UNODialogs x ) + { + dialog = x; + }*/ Thread ProgressThread = new Thread(new Runnable() { + public void run(){ try{ - System.out.println("bin im Thread"); - boolean bexists = (CurUNOProgressDialog.xWindow != null); - System.out.print("Dialog vorhanden: "); - System.out.println(bexists); - CurUNOProgressDialog.xWindow.setVisible(true); - System.out.println("bin immer noch im thread"); + if (reconnectToDatabase(xMSF, CurReportDocument)){ + CurReportDocument.getGroupFieldFortmats(xMSF, CurReportDocument.CurDBMetaData, sMsgTableNotExisting); + CurUNOProgressDialog.modifyFontWeight("lblProgressDBConnection", com.sun.star.awt.FontWeight.NORMAL); + CurUNOProgressDialog.modifyFontWeight("lblProgressDataImport", com.sun.star.awt.FontWeight.BOLD); + insertDatabaseDatatoReportDocument(xMSF, CurReportDocument, CurUNOProgressDialog); + } } catch (ThreadDeath td){ System.out.println("could not stop thread"); - }} + } + CurUNOProgressDialog.xComponent.dispose(); + } }); ProgressThread.start(); // try { @@ -275,13 +283,7 @@ public class Dataimport extends ReportWizard{ CurReportDocument = new ReportDocument(xMSF, false, true); int iWidth = CurReportDocument.Frame.getComponentWindow().getPosSize().Width; CurUNOProgressDialog = showProgressDisplay(xMSF, CurReportDocument, true); - if (reconnectToDatabase(xMSF, CurReportDocument)){ - CurReportDocument.getGroupFieldFortmats(xMSF, CurReportDocument.CurDBMetaData, sMsgTableNotExisting); - CurUNOProgressDialog.modifyFontWeight("lblProgressDBConnection", com.sun.star.awt.FontWeight.NORMAL); - CurUNOProgressDialog.modifyFontWeight("lblProgressDataImport", com.sun.star.awt.FontWeight.BOLD); - insertDatabaseDatatoReportDocument(xMSF, CurReportDocument, CurUNOProgressDialog); - } - CurUNOProgressDialog.xComponent.dispose(); + importReportData(xMSF, CurReportDocument, CurUNOProgressDialog); } catch(java.lang.Exception jexception ){ jexception.printStackTrace(System.out); diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 40016ce73896..6645a3829439 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -2,9 +2,9 @@ * * $RCSfile: ReportWizard.java,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: bc $ $Date: 2002-09-11 15:47:51 $ + * last change: $Author: bc $ $Date: 2002-09-13 07:52:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -657,7 +657,7 @@ public class ReportWizard { tools.attachEventCall(CurReportDocument.ReportTextDocument, "OnNew", "macro:///Tools.Debug.FillDocument()"); //"service:com.sun.star.wizards.report.CallReportWizard?fill" buseTemplate = ((Short) CurUNODialog.getPropertyOfDialogControl("optUseTemplate", "State")).shortValue() == (short) 1; CurReportDocument.breakLinkofTextSections(); - bDocisStored = tools.storeDocument(xMSF, CurReportDocument.Component , StorePath, "swriter: writer_StarOffice_XML_Writer_Template", + bDocisStored = tools.storeDocument(xMSF, CurReportDocument.Component , StorePath, "writer_StarOffice_XML_Writer_Template", buseTemplate, sMsgSavingImpossible + (char)13 + sMsgLinkCreationImpossible); if (bDocisStored == true) CurReportDocument.CurDBMetaData.createDBLink(CurReportDocument.CurDBMetaData.DataSource, StorePath); @@ -1378,16 +1378,7 @@ public class ReportWizard { bdisposeDialog = false; Dataimport CurDataimport = new Dataimport(); CurUNOProgressDialog = CurDataimport.showProgressDisplay(xMSF, CurReportDocument, false); // CurReportDocument.Frame.getComponentWindow().getPosSize().Width); - if (CurReportDocument.CurDBMetaData.executeCommand(sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot)){ - CurDataimport.insertDatabaseDatatoReportDocument(xMSF, CurReportDocument, CurUNOProgressDialog); - } - CurUNOProgressDialog.xComponent.dispose(); - } - if (bcreateTemplate == false){ - boolean bDocisStored = tools.storeDocument(xMSF, CurReportDocument.Component, StorePath, "swriter: StarOffice XML (Writer)", - false, sMsgSavingImpossible + (char)13 + sMsgLinkCreationImpossible); - if (bcreateLink && bDocisStored) - CurReportDocument.CurDBMetaData.createDBLink(CurReportDocument.CurDBMetaData.DataSource, StorePath); + importReportData(xMSF, CurReportDocument, CurUNOProgressDialog, CurDataimport); } } break; @@ -1407,6 +1398,32 @@ public class ReportWizard { }} + public void importReportData(final XMultiServiceFactory xMSF, final ReportDocument CurReportDocument, final UNODialogs CurUNOProgressDialog, final Dataimport CurDataimport){ + Thread ProgressThread = new Thread(new Runnable() { + + public void run(){ + try{ + if (CurReportDocument.CurDBMetaData.executeCommand(sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot)){ + CurDataimport.insertDatabaseDatatoReportDocument(xMSF, CurReportDocument, CurUNOProgressDialog); + } + CurUNOProgressDialog.xComponent.dispose(); + if (bcreateTemplate == false){ + boolean bDocisStored = tools.storeDocument(xMSF, CurReportDocument.Component, StorePath, "StarOffice XML (Writer)", + false, sMsgSavingImpossible + (char)13 + sMsgLinkCreationImpossible); + if (bcreateLink && bDocisStored) + CurReportDocument.CurDBMetaData.createDBLink(CurReportDocument.CurDBMetaData.DataSource, StorePath); + } + } + catch (ThreadDeath td){ + System.out.println("could not stop thread"); + } + CurUNOProgressDialog.xComponent.dispose(); + } + }); + ProgressThread.start(); + } + + public static void getReportResources(XMultiServiceFactory xMSF, boolean bgetProgressResourcesOnly){ final int RID_COMMON = 1000; final int RID_FORM = 2200; |