summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-03 12:44:27 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-03 12:44:27 +0100
commit619a6a4ab19ba81c46caad249eaf926281f897d9 (patch)
treed15ed85db0cff514c998009696a5d7a0c736ce92 /wizards/com/sun/star/wizards
parente2fa939261e012bfe2a675079a0707bcdf8fec54 (diff)
autorecovery: also moved the QueryWizard to using XDatabaseDocumentUI.loadComponent, instead of opening the sub component itself
Diffstat (limited to 'wizards/com/sun/star/wizards')
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java88
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java38
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java90
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java79
4 files changed, 104 insertions, 191 deletions
diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java
index b26259fc8a47..7fae3651a61d 100644
--- a/wizards/com/sun/star/wizards/db/CommandMetaData.java
+++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java
@@ -30,10 +30,6 @@
package com.sun.star.wizards.db;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XSingleServiceFactory;
-import com.sun.star.wizards.common.Properties;
-import com.sun.star.wizards.common.*;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdbc.SQLException;
import com.sun.star.sdbcx.KeyType;
@@ -41,29 +37,31 @@ import com.sun.star.sdbcx.XColumnsSupplier;
import com.sun.star.sdbcx.XKeysSupplier;
import com.sun.star.uno.AnyConverter;
import com.sun.star.awt.VclWindowPeerAttribute;
-import com.sun.star.beans.*;
import com.sun.star.uno.UnoRuntime;
-import java.util.*;
import com.sun.star.lang.Locale;
-import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.embed.EntryInitModes;
-import com.sun.star.frame.*;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NumberFormatter;
+import com.sun.star.wizards.common.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
public class CommandMetaData extends DBMetaData
{
public Map FieldTitleSet = new HashMap();
public String[] m_aAllFieldNames = new String[]{};
public FieldColumn[] FieldColumns = new FieldColumn[]{};
-// public String[] FieldNames = new String[] {};
public String[] GroupFieldNames = new String[] {};
private String[][] SortFieldNames = new String[][] {};
private String[] RecordFieldNames = new String[] {};
public String[][] AggregateFieldNames = new String[][] {};
public String[] NumericFieldNames = new String[] {};
public String[] NonAggregateFieldNames;
- // private int[] FieldTypes;
private int CommandType;
private String Command;
boolean bCatalogAtStart = true;
@@ -154,7 +152,7 @@ public class CommandMetaData extends DBMetaData
String CurCommandName = CurFieldColumn.getCommandName();
CommandObject oCommand = getTableByName(CurCommandName);
Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName());
- XPropertySet xColumn = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
+ XPropertySet xColumn = UnoRuntime.queryInterface( XPropertySet.class, oColumn );
return xColumn;
}
catch (Exception exception)
@@ -616,64 +614,6 @@ public class CommandMetaData extends DBMetaData
return RecordFieldNames[i];
}
- public XComponent[] switchtoDesignmode(String _commandname, int _commandtype,XFrame parentFrame)
- {
- XComponent[] ret = null;
- PropertyValue[] rDispatchArguments = new PropertyValue[_commandtype == com.sun.star.sdb.CommandType.QUERY ? 5 : 3];
- rDispatchArguments[0] = Properties.createProperty("DataSourceName", this.DataSourceName);
- rDispatchArguments[1] = Properties.createProperty("ActiveConnection", this.DBConnection);
- if (_commandtype == com.sun.star.sdb.CommandType.QUERY)
- {
- rDispatchArguments[2] = Properties.createProperty("GraphicalDesign", Boolean.TRUE);
- rDispatchArguments[3] = Properties.createProperty("Command", _commandname);
- rDispatchArguments[4] = Properties.createProperty("CommandType", new Integer(_commandtype));
- ret = showCommandView(".component:DB/QueryDesign", rDispatchArguments,parentFrame);
- }
- else
- {
- rDispatchArguments[2] = Properties.createProperty("CurrentTable", _commandname);
- ret = showCommandView(".component:DB/TableDesign", rDispatchArguments,parentFrame);
- }
- return ret;
- }
-
- public XComponent[] switchtoDataViewmode(String _commandname, int _commandtype,XFrame parentFrame)
- {
- PropertyValue[] rDispatchArguments = new PropertyValue[7];
- rDispatchArguments[0] = Properties.createProperty("DataSourceName", this.DataSourceName);
- 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[6] = Properties.createProperty("ShowMenu", Boolean.TRUE);
- return showCommandView(".component:DB/DataSourceBrowser", rDispatchArguments,parentFrame);
- }
-
- //
- public XComponent[] showCommandView(String surl, PropertyValue[] _rArgs,XFrame parentFrame)
- {
- XComponent[] ret = new XComponent[2];
- try
- {
- XSingleServiceFactory xFac = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class,xMSF.createInstance("com.sun.star.frame.TaskCreator"));
- Object[] args = new Object[2];
- args[0] = Properties.createProperty("ParentFrame",parentFrame);
- args[1] = Properties.createProperty("TopWindow",Boolean.TRUE);
-
- XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xFac.createInstanceWithArguments(args));
- ret[0] = xLoader.loadComponentFromURL(surl, "_self", 0, _rArgs);
- if ( ret[0] != null)
- {
- ret[0] = (XComponent)UnoRuntime.queryInterface(XComponent.class,xLoader);
- }
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- }
- return ret;
- }
/**@deprecated use 'RelationController' class instead
*
* @param _stablename
@@ -691,11 +631,11 @@ public class CommandMetaData extends DBMetaData
{
java.util.Vector<String> TableVector = new java.util.Vector<String>();
Object oTable = getTableNamesAsNameAccess().getByName(_stablename);
- XKeysSupplier xKeysSupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, oTable);
+ XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface( XKeysSupplier.class, oTable );
xIndexKeys = xKeysSupplier.getKeys();
for (int i = 0; i < xIndexKeys.getCount(); i++)
{
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i) );
+ XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) );
int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
if (curtype == KeyType.FOREIGN)
{
@@ -734,7 +674,7 @@ public class CommandMetaData extends DBMetaData
{
for (int i = 0; i < xIndexKeys.getCount(); i++)
{
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i) );
+ XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) );
int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
if (curtype == KeyType.FOREIGN)
{
@@ -743,14 +683,14 @@ public class CommandMetaData extends DBMetaData
{
if (scurreftablename.equals(_sreferencedtablename))
{
- XColumnsSupplier xColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet);
+ XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface( XColumnsSupplier.class, xPropertySet );
String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames();
skeycolumnnames = new String[2][smastercolnames.length];
skeycolumnnames[0] = smastercolnames;
skeycolumnnames[1] = new String[smastercolnames.length];
for (int n = 0; n < smastercolnames.length; n++)
{
- XPropertySet xcolPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n]));
+ XPropertySet xcolPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xColumnsSupplier.getColumns().getByName( smastercolnames[n] ) );
skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn"));
}
return skeycolumnnames;
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index dd9170fb741f..0fa602f67358 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -32,6 +32,7 @@ package com.sun.star.wizards.query;
import com.sun.star.beans.PropertyAttribute;
import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Properties;
@@ -85,21 +86,22 @@ public class CallQueryWizard
*/
public static class QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor
{
-
- PropertyValue[] databaseproperties;
- public XComponent Document = null;
- public XComponent DocumentDefinition = null;
+ private PropertyValue[] m_wizardContext;
+ // <properties>
+ public String Command;
+ public final Integer CommandType = com.sun.star.sdb.CommandType.QUERY;
+ // </properties>
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
*/
- public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ public QueryWizardImplementation( XMultiServiceFactory i_serviceFactory )
{
super();
- xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ m_serviceFactory = i_serviceFactory;
+ registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
+ registerProperty( "CommandType", PropertyAttribute.READONLY );
}
public void trigger(String sEvent)
@@ -108,20 +110,8 @@ public class CallQueryWizard
{
if (sEvent.compareTo("start") == 0)
{
- QueryWizard CurQueryWizard = new QueryWizard(xmultiservicefactory);
- XComponent[] obj = CurQueryWizard.startQueryWizard(xmultiservicefactory, databaseproperties);
- if (obj != null)
- {
- DocumentDefinition = obj[1];
- Document = obj[0];
- }
- CurQueryWizard = null;
- }
- else if (sEvent.compareTo("end") == 0)
- {
- DocumentDefinition = null;
- Document = null;
- databaseproperties = null;
+ QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext );
+ Command = CurQueryWizard.startQueryWizard();
}
}
catch (Exception exception)
@@ -135,7 +125,7 @@ public class CallQueryWizard
private static final String __serviceName = "com.sun.star.wizards.query.CallQueryWizard";
/** The service manager, that gives access to all registered services.
*/
- private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
+ private com.sun.star.lang.XMultiServiceFactory m_serviceFactory;
/** This method is a member of the interface for initializing an object
* directly after its creation.
@@ -146,7 +136,7 @@ public class CallQueryWizard
*/
public void initialize(Object[] object) throws com.sun.star.uno.Exception
{
- databaseproperties = Properties.convertToPropertyValueArray(object);
+ m_wizardContext = Properties.convertToPropertyValueArray(object);
}
/** This method returns an array of all supported service names.
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
index 7079b1109742..24f71220c5c7 100644
--- a/wizards/com/sun/star/wizards/query/Finalizer.java
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -37,19 +37,18 @@ import com.sun.star.lang.XComponent;
import com.sun.star.sdb.CommandType;
import com.sun.star.uno.*;
import com.sun.star.wizards.ui.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class Finalizer
{
-
- private QueryWizard CurUnoDialog;
+ private QueryWizard m_queryWizard;
private String resQuery;
- private Object m_aTxtSummary;
private Object m_aTxtTitle;
private XRadioButton xRadioDisplayQuery;
- private XRadioButton xRadioModifyQuery;
private QuerySummary CurDBMetaData;
- public Finalizer(QueryWizard _CurUnoDialog, QuerySummary _CurDBMetaData)
+ public Finalizer( QueryWizard i_queryWizard, QuerySummary _CurDBMetaData )
{
short curtabindex = (short) (100 * QueryWizard.SOSUMMARY_PAGE);
String reslblQueryTitle;
@@ -57,17 +56,17 @@ public class Finalizer
String resoptModifyQuery;
String resflnSummary;
String reslblHowGoOn;
- this.CurUnoDialog = _CurUnoDialog;
+ this.m_queryWizard = i_queryWizard;
this.CurDBMetaData = _CurDBMetaData;
- reslblQueryTitle = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 5);
- resoptDisplayQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 6);
- resoptModifyQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 7);
- resflnSummary = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 87);
- reslblHowGoOn = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 8);
- resQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 1);
+ reslblQueryTitle = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 5);
+ resoptDisplayQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 6);
+ resoptModifyQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 7);
+ resflnSummary = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 87);
+ reslblHowGoOn = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 8);
+ resQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 1);
int curHelpIndex = 40955;
- CurUnoDialog.insertLabel("lblQueryTitle", new String[]
+ m_queryWizard.insertLabel("lblQueryTitle", new String[]
{
"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
},
@@ -75,7 +74,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 = m_queryWizard.insertTextField("txtQueryTitle", 0, null, new String[]
{
"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
},
@@ -83,7 +82,7 @@ public class Finalizer
{
new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90)
});
- CurUnoDialog.insertLabel("lblHowGoOn", new String[]
+ m_queryWizard.insertLabel("lblHowGoOn", new String[]
{
"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
},
@@ -91,7 +90,7 @@ public class Finalizer
{
new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(112)
});
- this.xRadioDisplayQuery = CurUnoDialog.insertRadioButton("optDisplayQuery",
+ this.xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery",
new String[]
{
"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
@@ -101,7 +100,7 @@ public class Finalizer
new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118)
});
- this.xRadioModifyQuery = CurUnoDialog.insertRadioButton("optModifyQuery",
+ m_queryWizard.insertRadioButton("optModifyQuery",
new String[]
{
"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
@@ -110,7 +109,7 @@ public class Finalizer
{
new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118)
});
- CurUnoDialog.insertFixedLine("flnSummary", new String[]
+ m_queryWizard.insertFixedLine("flnSummary", new String[]
{
"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
},
@@ -118,7 +117,7 @@ public class Finalizer
{
new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209)
});
- m_aTxtSummary = CurUnoDialog.insertTextField("txtSummary", 0, null, new String[]
+ m_queryWizard.insertTextField("txtSummary", 0, null, new String[]
{
"Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "ReadOnly", "Step", "VScroll", "Width"
},
@@ -148,7 +147,7 @@ public class Finalizer
}
CurDBMetaData.setSummaryString();
- CurUnoDialog.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
+ m_queryWizard.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
return sCurQueryName;
}
catch (com.sun.star.uno.Exception exception)
@@ -164,43 +163,30 @@ public class Finalizer
return sTitle;
}
- public XComponent[] finish()
+ public String finish()
+ {
+ CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData);
+ String queryName = getTitle();
+ if ( CurDBMetaData.oSQLQueryComposer.setQueryCommand( queryName, m_queryWizard.xWindow, true, true )
+ && CurDBMetaData.createQuery( CurDBMetaData.oSQLQueryComposer, queryName )
+ )
+ return queryName;
+
+ return "";
+ }
+
+ public final boolean displayQueryDesign()
{
- XComponent[] ret = null;
try
{
- CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData);
- String queryname = getTitle();
- boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true);
- if (bsuccess)
- {
- bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname);
- if (bsuccess)
- {
- short igoon = AnyConverter.toShort(Helper.getUnoPropertyValue(UnoDialog.getModel(xRadioDisplayQuery), "State"));
- if (igoon == (short) 1)
- {
- ret = CurDBMetaData.switchtoDataViewmode(queryname,
- CommandType.QUERY,
- CurUnoDialog.getCurFrame());
- }
- else
- {
- ret = CurDBMetaData.switchtoDesignmode(queryname,
- CommandType.QUERY,
- CurUnoDialog.getCurFrame());
- }
- CurUnoDialog.xDialog.endExecute();
- }
- }
- CurDBMetaData.oSQLQueryComposer = null;
- CurDBMetaData = null;
- CurUnoDialog = null;
+ final short state = AnyConverter.toShort( Helper.getUnoPropertyValue( UnoDialog.getModel( xRadioDisplayQuery ), "State" ) );
+ final boolean viewMode = state == (short)1;
+ return !viewMode;
}
- catch (IllegalArgumentException e)
+ catch ( IllegalArgumentException ex )
{
- e.printStackTrace();
+ Logger.getLogger( Finalizer.class.getName() ).log( Level.SEVERE, null, ex );
}
- return ret;
+ return false;
}
}
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index dcbb920e4b0d..e46065a4d430 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -29,29 +29,30 @@
************************************************************************/
package com.sun.star.wizards.query;
-import com.sun.star.frame.XFrame;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
-import com.sun.star.lang.XComponent;
-import com.sun.star.wizards.common.*;
-import com.sun.star.wizards.db.*;
+import com.sun.star.frame.XFrame;
+import com.sun.star.sdb.CommandType;
import com.sun.star.sdbc.SQLException;
-import com.sun.star.uno.*;
-import com.sun.star.wizards.ui.*;
+import com.sun.star.uno.AnyConverter;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.QueryMetaData;
+import com.sun.star.wizards.ui.AggregateComponent;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.FilterComponent;
+import com.sun.star.wizards.ui.SortingComponent;
+import com.sun.star.wizards.ui.TitlesComponent;
-public class QueryWizard extends WizardDialog
+public class QueryWizard extends DatabaseObjectWizard
{
-
- private XFrame CurFrame;
-
- public XFrame getCurFrame()
- {
- return CurFrame;
- }
public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
private static final int SOFIELDSELECTION_PAGE = 1;
private static final int SOSORTING_PAGE = 2;
@@ -75,23 +76,21 @@ public class QueryWizard extends WizardDialog
private String reslblFields;
private String reslblSelFields;
private String reslblTables;
- // private String resQuery;
private String resQueryWizard;
private String reslblGroupBy;
private String resmsgNonNumericAsGroupBy;
- private XComponent[] components = null; //Resources Object
- // private short CurTabIndex = 0;
+ private String m_createdQuery;
- public QueryWizard(XMultiServiceFactory xMSF)
+ public QueryWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext )
{
- super(xMSF, 40970);
+ super( xMSF, 40970, i_wizardContext );
addResourceHandler("QueryWizard", "dbw");
CurDBMetaData = new QuerySummary(xMSF, m_oResource);
}
- public static void main(String args[])
+/* public static void main(String args[])
{
- String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager";
+ String ConnectStr = "uno:pipe,name=foo;urp;StarOffice.ServiceManager";
try
{
XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
@@ -109,13 +108,18 @@ public class QueryWizard extends WizardDialog
{
jexception.printStackTrace(System.out);
}
+ }*/
+
+ public final XFrame getFrame()
+ {
+ return m_frame;
}
- public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues)
+ public String startQueryWizard()
{
try
{
- if (CurDBMetaData.getConnection(CurPropertyValues))
+ if ( CurDBMetaData.getConnection( m_wizardContext ) )
{
reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4);
reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent
@@ -137,22 +141,13 @@ public class QueryWizard extends WizardDialog
setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8);
this.setMaxStep(8);
buildSteps();
- this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValues, false);
- if (Properties.hasPropertyValue(CurPropertyValues, "ParentFrame"))
- {
- CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, Properties.getPropertyValue(CurPropertyValues, "ParentFrame"));
- }
- else
- {
- CurFrame = Desktop.getActiveFrame(xMSF);
- }
+ this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
- XWindowPeer windowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow());
- this.xMSF = xMSF;
+ XWindowPeer windowPeer = UnoRuntime.queryInterface( XWindowPeer.class, m_frame.getContainerWindow() );
createWindowPeer(windowPeer);
CurDBMetaData.setWindowPeer(this.xControl.getPeer());
insertQueryRelatedSteps();
- executeDialog(CurFrame.getContainerWindow().getPosSize());
+ executeDialog( m_frame.getContainerWindow().getPosSize() );
}
}
catch (java.lang.Exception jexception)
@@ -164,14 +159,12 @@ public class QueryWizard extends WizardDialog
CurAggregateComponent = null;
CurDBCommandFieldSelection = null;
xWindowPeer = null;
- CurFrame = null;
CurFinalizer = null;
CurDBMetaData.finish();
CurDBMetaData = null;
- XComponent[] ret = components;
- components = null;
System.gc();
- return ret;
+
+ return m_createdQuery;
}
public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled)
@@ -229,7 +222,6 @@ public class QueryWizard extends WizardDialog
{
try
{
-// String[] sRMItemLabels = getRMItemLabels();
setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
addRoadmap();
int i = 0;
@@ -297,7 +289,12 @@ public class QueryWizard extends WizardDialog
int ncurStep = getCurrentStep();
if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE))
{
- components = CurFinalizer.finish();
+ m_createdQuery = CurFinalizer.finish();
+ if ( m_createdQuery.length() > 0 )
+ {
+ loadSubComponent( CommandType.QUERY, m_createdQuery, CurFinalizer.displayQueryDesign() );
+ xDialog.endExecute();
+ }
}
}