diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-08 14:12:39 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-01-08 14:12:39 +0100 |
commit | cd0f4a734a7fb3cbc0a131d58b5b00d1136bc5d1 (patch) | |
tree | 65aa69dd5e199056d933e3b6fcec4e51a7689866 /wizards | |
parent | 8a5b59989048d67b567819ee2038d4bff54ca184 (diff) | |
parent | 4e40ca1e8ba821e164c32578aeee43673d0d4966 (diff) |
dba33f: merge from dba33e
Diffstat (limited to 'wizards')
17 files changed, 188 insertions, 151 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java index 23dec6a80191..82f767a61ca4 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java @@ -459,7 +459,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog running = false; } - public void finishWizard() { + public boolean finishWizard() { boolean bSaveSuccess = false; // pesimistic :( XTextDocument xTextDocument; @@ -480,7 +480,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resFileExists); if (answer == 3) // user said: no, do not overwrite.... - return; + return false; } agendaTemplate.xTextDocument.lockControllers(); @@ -550,10 +550,11 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog } } else { agendaTemplate.xTextDocument.unlockControllers(); - return; + return false; } xDialog.endExecute(); running = false; + return true; } private void closeDocument() { diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index b26259fc8a47..c23ec5cd2e5a 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -644,8 +644,8 @@ public class CommandMetaData extends DBMetaData rDispatchArguments[1] = Properties.createProperty("ActiveConnection", this.DBConnection); rDispatchArguments[2] = Properties.createProperty("Command", _commandname); rDispatchArguments[3] = Properties.createProperty("CommandType", new Integer(_commandtype)); - rDispatchArguments[4] = Properties.createProperty("ShowTreeView", Boolean.FALSE); - rDispatchArguments[5] = Properties.createProperty("ShowTreeViewButton", Boolean.FALSE); + rDispatchArguments[4] = Properties.createProperty("ShowBrowser", Boolean.FALSE); + rDispatchArguments[5] = Properties.createProperty("EnableBrowser", Boolean.FALSE); rDispatchArguments[6] = Properties.createProperty("ShowMenu", Boolean.TRUE); return showCommandView(".component:DB/DataSourceBrowser", rDispatchArguments,parentFrame); } diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 2a7151cd1135..59f63afed114 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -32,9 +32,7 @@ package com.sun.star.wizards.db; import com.sun.star.awt.XWindow; import com.sun.star.lang.XInitialization; import com.sun.star.ui.dialogs.XExecutableDialog; -import java.util.*; -// import com.sun.star.io.IOException; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; @@ -48,7 +46,6 @@ import com.sun.star.container.XHierarchicalNameAccess; import com.sun.star.container.XHierarchicalNameContainer; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; -// import com.sun.star.container.XNamed; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XModel; import com.sun.star.frame.XStorable; @@ -57,7 +54,6 @@ import com.sun.star.sdbc.DataType; import com.sun.star.sdb.XOfficeDatabaseDocument; import com.sun.star.sdb.XDocumentDataSource; import com.sun.star.sdb.tools.XConnectionTools; -// import com.sun.star.sdbcx.XAppend; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.ucb.XSimpleFileAccess; @@ -67,14 +63,11 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.util.XCloseable; import com.sun.star.util.XNumberFormatsSupplier; -import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.*; -// import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.task.XInteractionHandler; import com.sun.star.sdb.XFormDocumentsSupplier; import com.sun.star.sdb.XQueryDefinitionsSupplier; import com.sun.star.sdb.XReportDocumentsSupplier; -// import com.sun.star.sdbc.ColumnValue; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XDatabaseMetaData; import com.sun.star.sdbc.XDataSource; @@ -82,17 +75,22 @@ import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; import com.sun.star.sdb.XCompletedConnection; import com.sun.star.lang.Locale; -// import com.sun.star.util.XFlushable; import com.sun.star.lang.XSingleServiceFactory; import com.sun.star.sdb.XQueriesSupplier; +import com.sun.star.sdbc.XConnection; import com.sun.star.sdbcx.XTablesSupplier; +import com.sun.star.uno.Any; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; public class DBMetaData { private XNameAccess xQueryNames; public XDatabaseMetaData xDBMetaData; - private XDataSource xDataSource; + private XDataSource m_dataSource; + private XPropertySet m_dataSourceSettings; private XOfficeDatabaseDocument xModel; private XPropertySet xDataSourcePropertySet; public String[] DataSourceNames; @@ -150,13 +148,10 @@ public class DBMetaData private int iMaxColumnNameLength = -1; private int iMaxTableNameLength = -1; private boolean bPasswordIsRequired; - // private boolean bFormatKeysareset = false; private final static int NOLIMIT = 9999999; protected final static int RID_DB_COMMON = 1000; private final static int INVALID = 9999999; public TypeInspector oTypeInspector; - private PropertyValue[] aInfoPropertyValues = null; - private boolean bisSQL92CheckEnabled = false; private NumberFormatter oNumberFormatter = null; private long lDateCorrection = INVALID; private boolean bdisposeConnection = false; @@ -219,9 +214,9 @@ public class DBMetaData { this.xMSF = xMSF; xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext"); - xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDatabaseContext); + xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xDatabaseContext); XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - oInteractionHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); + oInteractionHandler = UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); DataSourceNames = xNameAccess.getElementNames(); } catch (Exception exception) @@ -330,10 +325,10 @@ public class DBMetaData { oCommand = getQueryNamesAsNameAccess().getByName(Name); } - XColumnsSupplier xCommandCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand); - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCommand); + XColumnsSupplier xCommandCols = UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand); + xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, oCommand); // TODO: Performance leak getColumns() take very long. - xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns()); + xColumns = UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns()); } catch (Exception exception) { @@ -379,13 +374,13 @@ public class DBMetaData public XNameAccess getQueryNamesAsNameAccess() { XQueriesSupplier xDBQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, DBConnection); - xQueryNames = (XNameAccess) xDBQueries.getQueries(); + xQueryNames = xDBQueries.getQueries(); return xQueryNames; } public XNameAccess getTableNamesAsNameAccess() { - XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); + XTablesSupplier xDBTables = UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); XNameAccess xTableNames = xDBTables.getTables(); return xTableNames; } @@ -412,7 +407,7 @@ public class DBMetaData return TableNames; } } - TableNames = (String[]) getTableNamesAsNameAccess().getElementNames(); + TableNames = getTableNamesAsNameAccess().getElementNames(); return TableNames; } @@ -458,7 +453,7 @@ public class DBMetaData int itablecount = xDBMetaData.getMaxTablesInSelect(); if (itablecount == 0) { - return this.NOLIMIT; + return DBMetaData.NOLIMIT; } else { @@ -487,7 +482,7 @@ public class DBMetaData iMaxColumnsInSelect = xDBMetaData.getMaxColumnsInSelect(); if (iMaxColumnsInSelect == 0) { - iMaxColumnsInSelect = this.NOLIMIT; + iMaxColumnsInSelect = DBMetaData.NOLIMIT; } } @@ -496,7 +491,7 @@ public class DBMetaData iMaxColumnsInGroupBy = xDBMetaData.getMaxColumnsInGroupBy(); if (iMaxColumnsInGroupBy == 0) { - iMaxColumnsInGroupBy = this.NOLIMIT; + iMaxColumnsInGroupBy = DBMetaData.NOLIMIT; } } @@ -505,7 +500,7 @@ public class DBMetaData iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable(); if (iMaxColumnsInTable == 0) { - iMaxColumnsInTable = this.NOLIMIT; + iMaxColumnsInTable = DBMetaData.NOLIMIT; } return iMaxColumnsInTable; } @@ -515,8 +510,7 @@ public class DBMetaData try { xDBMetaData = DBConnection.getMetaData(); - XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, DBConnection); - Object oDataSource = xChild.getParent(); + XChild xChild = UnoRuntime.queryInterface( XChild.class, DBConnection ); getDataSourceInterfaces(); setMaxColumnsInGroupBy(); setMaxColumnsInSelect(); @@ -527,24 +521,28 @@ public class DBMetaData } } + private void ensureDataSourceSettings() throws UnknownPropertyException, WrappedTargetException + { + if ( m_dataSourceSettings != null ) + return; + + XPropertySet dataSourceProperties = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() ); + m_dataSourceSettings = UnoRuntime.queryInterface( XPropertySet.class, dataSourceProperties.getPropertyValue( "Settings" ) ); + } + public boolean isSQL92CheckEnabled() { + boolean isSQL92CheckEnabled = false; try { - if (aInfoPropertyValues == null) - { - aInfoPropertyValues = (PropertyValue[]) AnyConverter.toArray(this.xDataSourcePropertySet.getPropertyValue("Info")); - if (Properties.hasPropertyValue(aInfoPropertyValues, "EnableSQL92Check")) - { - bisSQL92CheckEnabled = AnyConverter.toBoolean(Properties.getPropertyValue(aInfoPropertyValues, "EnableSQL92Check")); - } - } + ensureDataSourceSettings(); + isSQL92CheckEnabled = AnyConverter.toBoolean( m_dataSourceSettings.getPropertyValue( "EnableSQL92Check" ) ); } catch (Exception e) { e.printStackTrace(); } - return bisSQL92CheckEnabled; + return isSQL92CheckEnabled; } public String verifyName(String _sname, int _maxlen) @@ -562,12 +560,12 @@ public class DBMetaData public XDataSource getDataSource() { - if (xDataSource == null) + if (m_dataSource == null) { try { Object oDataSource = xNameAccess.getByName(DataSourceName); - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource); + m_dataSource = UnoRuntime.queryInterface( XDataSource.class, oDataSource ); } catch (com.sun.star.container.NoSuchElementException e) { @@ -576,7 +574,7 @@ public class DBMetaData { } } - return xDataSource; + return m_dataSource; } private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces) @@ -585,7 +583,7 @@ public class DBMetaData { this.DataSourceName = _DataSourceName; getDataSourceInterfaces(); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, getDataSource()); + XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, getDataSource() ); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); @@ -599,8 +597,8 @@ public class DBMetaData public void getDataSourceInterfaces() throws Exception { - xCompleted = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, getDataSource()); - xDataSourcePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getDataSource()); + xCompleted = UnoRuntime.queryInterface( XCompletedConnection.class, getDataSource() ); + xDataSourcePropertySet = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() ); bPasswordIsRequired = ((Boolean) xDataSourcePropertySet.getPropertyValue("IsPasswordRequired")).booleanValue(); } @@ -608,22 +606,21 @@ public class DBMetaData { try { - com.sun.star.sdbc.XConnection xConnection = null; + XConnection xConnection = null; if (Properties.hasPropertyValue(curproperties, "ActiveConnection")) { - xConnection = (com.sun.star.sdbc.XConnection) AnyConverter.toObject(com.sun.star.sdbc.XConnection.class, - Properties.getPropertyValue(curproperties, "ActiveConnection")); + xConnection = UnoRuntime.queryInterface( XConnection.class, Properties.getPropertyValue( curproperties, "ActiveConnection" ) ); if (xConnection != null) { - com.sun.star.container.XChild child = (com.sun.star.container.XChild) UnoRuntime.queryInterface(com.sun.star.container.XChild.class, xConnection); + com.sun.star.container.XChild child = UnoRuntime.queryInterface( com.sun.star.container.XChild.class, xConnection ); - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, child.getParent()); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource); + m_dataSource = UnoRuntime.queryInterface( XDataSource.class, child.getParent() ); + XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, m_dataSource ); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); } - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDataSource); + XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, m_dataSource ); if (xPSet != null) { DataSourceName = AnyConverter.toString(xPSet.getPropertyValue("Name")); @@ -646,13 +643,13 @@ public class DBMetaData } else if (Properties.hasPropertyValue(curproperties, "DataSource")) { - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, Properties.getPropertyValue(curproperties, "DataSource")); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource); + m_dataSource = UnoRuntime.queryInterface( XDataSource.class, Properties.getPropertyValue( curproperties, "DataSource" ) ); + XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, this.m_dataSource ); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); } - return getConnection(xDataSource); + return getConnection(m_dataSource); } if (Properties.hasPropertyValue(curproperties, "DatabaseLocation")) { @@ -692,7 +689,7 @@ public class DBMetaData try { this.DBConnection = _DBConnection; - this.ConnectionTools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, this.DBConnection); + this.ConnectionTools = UnoRuntime.queryInterface( XConnectionTools.class, this.DBConnection ); getDataSourceObjects(); return true; } @@ -703,7 +700,7 @@ public class DBMetaData } } - private boolean getConnection(XDataSource xDataSource) + private boolean getConnection(XDataSource _dataSource) { Resource oResource = new Resource(xMSF, "Database", "dbw"); try @@ -717,20 +714,19 @@ public class DBMetaData getDataSourceInterfaces(); if (bPasswordIsRequired == false) { - DBConnection = xDataSource.getConnection("", ""); + DBConnection = _dataSource.getConnection("", ""); bgetConnection = true; } else { - XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - XInteractionHandler oInteractionHandler2 = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); + XInteractionHandler xInteractionHandler = UnoRuntime.queryInterface( XInteractionHandler.class, xMSF.createInstance("com.sun.star.sdb.InteractionHandler") ); boolean bExitLoop = true; do { - XCompletedConnection xCompleted2 = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, xDataSource); + XCompletedConnection xCompleted2 = UnoRuntime.queryInterface( XCompletedConnection.class, _dataSource ); try { - DBConnection = xCompleted2.connectWithCompletion(oInteractionHandler2); + DBConnection = xCompleted2.connectWithCompletion( xInteractionHandler ); bgetConnection = DBConnection != null; if (bgetConnection == false) { @@ -755,8 +751,8 @@ public class DBMetaData } else { - xConnectionComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, DBConnection); - ConnectionTools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, DBConnection); + xConnectionComponent = UnoRuntime.queryInterface( XComponent.class, DBConnection ); + ConnectionTools = UnoRuntime.queryInterface( XConnectionTools.class, DBConnection ); getDataSourceObjects(); } return bgetConnection; @@ -804,6 +800,25 @@ public class DBMetaData } } + public boolean supportsPrimaryKeys() + { + boolean supportsPrimaryKeys = false; + try + { + ensureDataSourceSettings(); + Any primaryKeySupport = (Any)m_dataSourceSettings.getPropertyValue( "PrimaryKeySupport" ); + if ( AnyConverter.isVoid( primaryKeySupport ) ) + supportsPrimaryKeys = supportsCoreSQLGrammar(); + else + supportsPrimaryKeys = AnyConverter.toBoolean( primaryKeySupport ); + } + catch ( Exception ex ) + { + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, ex ); + } + return supportsPrimaryKeys; + } + public boolean supportsCoreSQLGrammar() { try @@ -831,17 +846,17 @@ public class DBMetaData { try { - XQueryDefinitionsSupplier xQueryDefinitionsSuppl = (XQueryDefinitionsSupplier) UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class, xDataSource); + XQueryDefinitionsSupplier xQueryDefinitionsSuppl = UnoRuntime.queryInterface( XQueryDefinitionsSupplier.class, m_dataSource ); XNameAccess xQueryDefs = xQueryDefinitionsSuppl.getQueryDefinitions(); - XSingleServiceFactory xSSFQueryDefs = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, xQueryDefs); + XSingleServiceFactory xSSFQueryDefs = UnoRuntime.queryInterface( XSingleServiceFactory.class, xQueryDefs ); Object oQuery = xSSFQueryDefs.createInstance(); //"com.sun.star.sdb.QueryDefinition" - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oQuery); + XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, oQuery ); String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery(); xPSet.setPropertyValue("Command", s); - XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xQueryDefs); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xQueryDefs); + XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, xQueryDefs ); + XNameAccess xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xQueryDefs ); ConnectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName); xNameCont.insertByName(_QueryName, oQuery); return true; @@ -885,23 +900,23 @@ public class DBMetaData public XHierarchicalNameAccess getReportDocuments() { - XReportDocumentsSupplier xReportDocumentSuppl = (XReportDocumentsSupplier) UnoRuntime.queryInterface(XReportDocumentsSupplier.class, this.xModel); + XReportDocumentsSupplier xReportDocumentSuppl = UnoRuntime.queryInterface( XReportDocumentsSupplier.class, this.xModel ); xReportDocumentSuppl.getReportDocuments(); - XHierarchicalNameAccess xReportHier = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments()); + XHierarchicalNameAccess xReportHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() ); return xReportHier; } public XHierarchicalNameAccess getFormDocuments() { - XFormDocumentsSupplier xFormDocumentSuppl = (XFormDocumentsSupplier) UnoRuntime.queryInterface(XFormDocumentsSupplier.class, xModel); - XHierarchicalNameAccess xFormHier = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments()); + XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel ); + XHierarchicalNameAccess xFormHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() ); return xFormHier; } public boolean hasFormDocumentByName(String _sFormName) { - XFormDocumentsSupplier xFormDocumentSuppl = (XFormDocumentsSupplier) UnoRuntime.queryInterface(XFormDocumentsSupplier.class, xModel); - XNameAccess xFormNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormDocumentSuppl.getFormDocuments()); + XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel ); + XNameAccess xFormNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xFormDocumentSuppl.getFormDocuments() ); return xFormNameAccess.hasByName(_sFormName); } @@ -929,10 +944,10 @@ public class DBMetaData try { PropertyValue[] aDocProperties; - XModel xDocumentModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xComponent); + XModel xDocumentModel = UnoRuntime.queryInterface( XModel.class, _xComponent ); String sPath = xDocumentModel.getURL(); String basename = FileAccess.getBasename(sPath, "/"); - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xComponent); + XCloseable xCloseable = UnoRuntime.queryInterface( XCloseable.class, _xComponent ); _xComponent.dispose(); xCloseable.close(false); if (_bcreateTemplate) @@ -951,13 +966,13 @@ public class DBMetaData { aDocProperties[4] = Properties.createProperty("AsTemplate", new Boolean(_bcreateTemplate)); } - XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, _xDocNameAccess); + XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess ); Object oDBDocument = xDocMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", aDocProperties); - XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocNameAccess); + XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocNameAccess ); String sdocname = Desktop.getUniqueName(_xDocNameAccess, basename); xHier.insertByHierarchicalName(sdocname, oDBDocument); XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface ); xSimpleFileAccess.kill(sPath); } catch (Exception e) @@ -971,16 +986,16 @@ public class DBMetaData XComponent[] xRetComponent = new XComponent[2]; try { - XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, _xDocuments); + XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xDocuments ); PropertyValue[] aPropertyValues = new PropertyValue[4]; aPropertyValues[0] = Properties.createProperty("OpenMode", _bOpenInDesign ? "openDesign" : "open"); aPropertyValues[1] = Properties.createProperty("ActiveConnection", this.DBConnection); aPropertyValues[2] = Properties.createProperty("DocumentTitle", _docname); aPropertyValues[3] = Properties.createProperty("AsTemplate", new Boolean(_bAsTemplate)); - XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocuments); + XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocuments ); if (xHier.hasByHierarchicalName(_docname)) { - xRetComponent[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xHier.getByHierarchicalName(_docname)); + xRetComponent[0] = UnoRuntime.queryInterface( XComponent.class, xHier.getByHierarchicalName( _docname ) ); xRetComponent[1] = xComponentLoader.loadComponentFromURL(_docname, "", 0, aPropertyValues); } } @@ -1018,7 +1033,7 @@ public class DBMetaData String[] sColValues = null; try { - XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, _xResultSet); + XRow xRow = UnoRuntime.queryInterface( XRow.class, _xResultSet ); Vector aColVector = new Vector(); while (_xResultSet.next()) { @@ -1067,9 +1082,9 @@ public class DBMetaData try { XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface ); String storepath = FileAccess.getOfficePath(xMSF, "Temp", xSimpleFileAccess) + "/" + _storename; - XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, _xcomponent); + XStorable xStoreable = UnoRuntime.queryInterface( XStorable.class, _xcomponent ); PropertyValue[] oStoreProperties = new PropertyValue[1]; oStoreProperties[0] = Properties.createProperty("FilterName", "writer8"); storepath += ".odt"; @@ -1118,12 +1133,12 @@ public class DBMetaData try { Object oDialog = xMSF.createInstance("com.sun.star.sdb.ErrorMessageDialog"); - XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oDialog); + XInitialization xInitialization = UnoRuntime.queryInterface( XInitialization.class, oDialog ); PropertyValue[] aPropertyValue = new PropertyValue[2]; aPropertyValue[0] = Properties.createProperty("SQLException", oSQLException); aPropertyValue[1] = Properties.createProperty("ParentWindow", _xWindow); xInitialization.initialize(aPropertyValue); - XExecutableDialog xExecutableDialog = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oDialog); + XExecutableDialog xExecutableDialog = UnoRuntime.queryInterface( XExecutableDialog.class, oDialog ); xExecutableDialog.execute(); } catch (com.sun.star.uno.Exception ex) @@ -1139,7 +1154,7 @@ public class DBMetaData xNameAccess = null; xDatabaseContext = null; xDBMetaData = null; - xDataSource = null; + m_dataSource = null; xModel = null; xCompleted = null; xDataSourcePropertySet = null; diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index db5ccd32b8f7..10677558488c 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -292,7 +292,7 @@ public class SQLQueryComposer return sFromClause; } - public boolean setQueryCommand(String QueryName, XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) + public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) { try { diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java index a8dbe94e5db0..fe726c430a9b 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java @@ -212,7 +212,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog running = false; } - public void finishWizard() + public boolean finishWizard() { switchToStep(getCurrentStep(), getMaxStep()); myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription); @@ -239,7 +239,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning); if (answer == 3) // user said: no, do not overwrite.... { - return; + return false; } } } @@ -297,7 +297,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog xDialog.endExecute(); running = false; } - + return true; } public void closeDocument() diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 5b0a7939f6c2..678e5d55f3b1 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -308,7 +308,7 @@ public class FormWizard extends WizardDialog } // @Override - public void finishWizard() + public boolean finishWizard() { int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE)) @@ -326,6 +326,7 @@ public class FormWizard extends WizardDialog { bcreateForm = true; xDialog.endExecute(); + return true; } } } @@ -335,6 +336,7 @@ public class FormWizard extends WizardDialog showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage); } } + return false; } // @Override diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java index 1a47712ca213..5e5ce985c0c4 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -253,7 +253,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog running = false; } - public void finishWizard() + public boolean finishWizard() { switchToStep(getCurrentStep(), getMaxStep()); try @@ -279,7 +279,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning); if (answer == 3) // user said: no, do not overwrite.... { - return; + return false; } } } @@ -356,7 +356,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog xDialog.endExecute(); running = false; } - + return true; } public void closeDocument() diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 7079b1109742..f690102ea49f 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -31,6 +31,7 @@ package com.sun.star.wizards.query; import com.sun.star.wizards.common.*; import com.sun.star.awt.XRadioButton; +import com.sun.star.awt.XTextComponent; import com.sun.star.wizards.db.*; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XComponent; @@ -44,7 +45,7 @@ public class Finalizer private QueryWizard CurUnoDialog; private String resQuery; private Object m_aTxtSummary; - private Object m_aTxtTitle; + private XTextComponent m_aTxtTitle; private XRadioButton xRadioDisplayQuery; private XRadioButton xRadioModifyQuery; private QuerySummary CurDBMetaData; @@ -75,7 +76,7 @@ public class Finalizer { new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52) }); - m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[] + m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", "changeTitle", this, new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, @@ -128,6 +129,11 @@ public class Finalizer }); } + public void changeTitle() + { + final String TitleName = m_aTxtTitle.getText(); + CurUnoDialog.enableFinishButton(!"".equals(TitleName)); + } /* TODO: The title textbox always has to be updated when a new Table has been selected if it is clear that the user has not made any input meanwhile */ @@ -171,7 +177,7 @@ public class Finalizer { CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData); String queryname = getTitle(); - boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true); + boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(CurUnoDialog.xWindow, true, true); if (bsuccess) { bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname); @@ -191,11 +197,11 @@ public class Finalizer CurUnoDialog.getCurFrame()); } CurUnoDialog.xDialog.endExecute(); + CurDBMetaData.oSQLQueryComposer = null; + CurDBMetaData = null; + CurUnoDialog = null; } } - CurDBMetaData.oSQLQueryComposer = null; - CurDBMetaData = null; - CurUnoDialog = null; } catch (IllegalArgumentException e) { diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index dcbb920e4b0d..6d6fd34f0a88 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -292,13 +292,16 @@ public class QueryWizard extends WizardDialog } } - public void finishWizard() + public boolean finishWizard() { int ncurStep = getCurrentStep(); - if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE)) + if ( ( ncurStep == SOSUMMARY_PAGE ) + || ( switchToStep( ncurStep, SOSUMMARY_PAGE ) ) + ) { components = CurFinalizer.finish(); } + return ( components != null ); } protected void enterStep(int nOldStep, int nNewStep) diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java index af8476f5c3e9..e94f93bf9d2e 100644 --- a/wizards/com/sun/star/wizards/report/IReportDocument.java +++ b/wizards/com/sun/star/wizards/report/IReportDocument.java @@ -204,7 +204,7 @@ public interface IReportDocument * @param Name * @param OpenMode */ - public void store(String Name, int OpenMode); + public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception; /** * The current report is added to the DB View under the given name diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 8c0df7c36c5c..9ffb89b768f5 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -244,8 +244,9 @@ public class ReportFinalizer public void changeReportTitle() { - String TitleName = xTitleTextBox.getText(); + final String TitleName = xTitleTextBox.getText(); CurReportDocument.liveupdate_updateReportTitle(TitleName); + CurUnoDialog.enableFinishButton(!"".equals(TitleName)); } public int getReportOpenMode() @@ -272,18 +273,25 @@ public class ReportFinalizer public boolean finish() { StoreName = getStoreName(); - if (CurReportDocument.getRecordParser().getReportDocuments().hasByHierarchicalName(StoreName)) + if (!CurReportDocument.getRecordParser().getReportDocuments().hasByHierarchicalName(StoreName)) { - String sMsgReportDocumentNameDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 76); - String sShowMsgReportNameisDuplicate = JavaTools.replaceSubString(sMsgReportDocumentNameDuplicate, StoreName, "%REPORTNAME"); - /* int iMsg = */ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sShowMsgReportNameisDuplicate); - return false; - } - else - { - CurReportDocument.store(StoreName, getReportOpenMode()); - ReportWizard.bCloseDocument = false; - return true; + try + { + CurReportDocument.store(StoreName, getReportOpenMode()); + ReportWizard.bCloseDocument = false; + return true; + } + catch(Exception e) + { + CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK,e.getLocalizedMessage() ); + CurUnoDialog.enableFinishButton(false); + return false; + } } + String sMsgReportDocumentNameDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 76); + String sShowMsgReportNameisDuplicate = JavaTools.replaceSubString(sMsgReportDocumentNameDuplicate, StoreName, "%REPORTNAME"); + /* int iMsg = */ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sShowMsgReportNameisDuplicate); + CurUnoDialog.enableFinishButton(false); + return false; } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 3d79c5d2d8ac..6e0091b52ef5 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -480,7 +480,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme return m_aDoc.xMSFDoc; } - public void store(String _sName, int _nOpenMode) + public void store(String _sName, int _nOpenMode) throws com.sun.star.uno.Exception { getDoc().createReportForm(ReportWizard.SOREPORTFORMNAME); // int nOpenMode = getReportOpenMode(); diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index a4b4e3af18ad..a959c2dfd183 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -329,7 +329,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple boolean bQueryCreated = false; if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE) { - bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false); + bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(this.xWindow, false, false); CurReportDocument.setCommandType(CommandType.COMMAND); String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery(); @@ -520,7 +520,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple enableNavigationButtons(false, false, false); } - public void finishWizard() + public boolean finishWizard() { final int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)) @@ -532,9 +532,11 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple nReportMode = CurReportFinalizer.getReportOpenMode(); m_sReportName = CurReportFinalizer.getStoreName(); xDialog.endExecute(); + return true; } } } + return false; } public void cancelWizard() diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index dad827841e96..2972e8153787 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -37,7 +37,7 @@ import com.sun.star.wizards.report.*; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XNameAccess; +import com.sun.star.container.XHierarchicalNameContainer; import com.sun.star.container.XNameContainer; import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; @@ -340,7 +340,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper throw new UnsupportedOperationException("Not supported yet."); } - public void store(String Name, int OpenMode) + public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception { // throw new UnsupportedOperationException("Not supported yet."); // getReportBuilderLayouter().store(Name); @@ -351,27 +351,14 @@ public class ReportBuilderImplementation extends ReportImplementationHelper return; } - try - { - final XNameAccess aNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, m_aReportDocument); - final String[] aNames = aNameAccess.getElementNames(); - -// m_xReportDefinition.storeToStorage(m_xReportDefinition.getDocumentStorage(), m_xReportDefinition.getArgs()); - - final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition); - com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); - aCommand.Name = "storeOwn"; + final XCommandProcessor xProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition); + final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); + aCommand.Name = "storeOwn"; - final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); + final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); - final XNameContainer aNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, m_aReportDocument); -// aNameContainer.insertByName(Name, m_xReportDefinition); - aNameContainer.insertByName(Name, m_aDocumentDefinition); - } - catch (Exception e) - { - int dummy = 0; - } + final XHierarchicalNameContainer aNameContainer = UnoRuntime.queryInterface(XHierarchicalNameContainer.class, m_aReportDocument); + aNameContainer.insertByHierarchicalName(Name, m_aDocumentDefinition); } public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount) diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 8b4e0288ef8c..bee58c071546 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -251,7 +251,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet { curScenarioSelector = new ScenarioSelector(this, this.curTableDescriptor, slblFields, slblSelFields); curFieldFormatter = new FieldFormatter(this, curTableDescriptor); - if (this.curTableDescriptor.supportsCoreSQLGrammar()) + if ( this.curTableDescriptor.supportsPrimaryKeys() ) { curPrimaryKeyHandler = new PrimaryKeyHandler(this, curTableDescriptor); } @@ -265,7 +265,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet boolean bTableCreated = false; String schemaname = curFinalizer.getSchemaName(); String catalogname = curFinalizer.getCatalogName(); - if (curTableDescriptor.supportsCoreSQLGrammar()) + if (curTableDescriptor.supportsPrimaryKeys()) { String[] keyfieldnames = curPrimaryKeyHandler.getPrimaryKeyFields(curTableDescriptor); if (keyfieldnames != null) @@ -289,7 +289,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet return bIsSuccessfull; } - public void finishWizard() + public boolean finishWizard() { super.switchToStep(super.getCurrentStep(), SOFINALPAGE); tablename = curFinalizer.getTableName(curScenarioSelector.getFirstTableName()); @@ -314,6 +314,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet components = curTableDescriptor.switchtoDataViewmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame); } super.xDialog.endExecute(); + return true; } } else @@ -323,6 +324,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet curFinalizer.setFocusToTableNameControl(); } } + return false; } private void callFormWizard() @@ -360,7 +362,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet int i = 0; i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_TABLE + 2), SOMAINPAGE); i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_TABLE + 3), SOFIELDSFORMATPAGE); - if (this.curTableDescriptor.supportsCoreSQLGrammar()) + if (this.curTableDescriptor.supportsPrimaryKeys()) { i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_TABLE + 4), SOPRIMARYKEYPAGE); } diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 15b840fa9c89..01d97c4278ed 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -685,7 +685,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } } - public abstract void finishWizard(); + public abstract boolean finishWizard(); /** * This function will call if the finish button is pressed on the UI. @@ -693,8 +693,18 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL public void finishWizard_1() { enableFinishButton(false); - finishWizard(); - removeTerminateListener(); + boolean success = false; + try + { + success = finishWizard(); + } + finally + { + if ( !success ) + enableFinishButton( true ); + } + if ( success ) + removeTerminateListener(); } public int getMaximalStep() diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java index e396a46ddd30..88b986bb631c 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -942,9 +942,10 @@ public abstract class WWD_Events extends WWD_Startup /** * the user clicks the finish/create button. */ - public void finishWizard() + public boolean finishWizard() { finishWizard(true); + return true; } /** |