summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/query
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
committerRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
commitf0a7951ee7a9bb75519cefa5e226d186633e3e95 (patch)
treee60b8bbac6a8c4b3b0282f5cda72baf0d0ebc6ce /wizards/com/sun/star/wizards/query
parent97a48f7a4812bc224729a88dbc8272d940bcb339 (diff)
CWS-TOOLING: integrate CWS dba31e
2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
Diffstat (limited to 'wizards/com/sun/star/wizards/query')
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java90
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java144
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java165
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java329
-rw-r--r--wizards/com/sun/star/wizards/query/XCallQueryWizard.java43
5 files changed, 509 insertions, 262 deletions
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index 136f397a2064..dd9170fb741f 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -41,7 +41,8 @@ import com.sun.star.wizards.common.Properties;
* (<CODE>__writeRegistryServiceInfo</CODE>).
* @author Bertram Nolte
*/
-public class CallQueryWizard {
+public class CallQueryWizard
+{
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -56,10 +57,13 @@ public class CallQueryWizard {
* structures) of a single
* registry key accessible.
*/
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
if (stringImplementationName.equals(QueryWizardImplementation.class.getName()))
+ {
xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(QueryWizardImplementation.class, QueryWizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
return xsingleservicefactory;
}
@@ -71,14 +75,16 @@ public class CallQueryWizard {
* structures) of a single
* registry key accessible.
*/
- public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
+ {
return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(QueryWizardImplementation.class.getName(), QueryWizardImplementation.__serviceName, xregistrykey);
}
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- 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 {
+ 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;
@@ -88,39 +94,45 @@ public class CallQueryWizard {
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
*/
- public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
super();
xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
+ registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
}
- public void trigger(String sEvent) {
- try {
- if (sEvent.compareTo("start") == 0) {
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
QueryWizard CurQueryWizard = new QueryWizard(xmultiservicefactory);
XComponent[] obj = CurQueryWizard.startQueryWizard(xmultiservicefactory, databaseproperties);
- if ( obj != null ){
+ if (obj != null)
+ {
DocumentDefinition = obj[1];
Document = obj[0];
}
CurQueryWizard = null;
}
- else if (sEvent.compareTo("end") == 0) {
+ else if (sEvent.compareTo("end") == 0)
+ {
DocumentDefinition = null;
Document = null;
databaseproperties = null;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
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.query.CallQueryWizard";
-
/** The service manager, that gives access to all registered services.
*/
private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
@@ -132,14 +144,16 @@ public class CallQueryWizard {
* @throws 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 {
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
databaseproperties = Properties.convertToPropertyValueArray(object);
}
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -152,10 +166,12 @@ public class CallQueryWizard {
* @param stringService Service name.
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
return (booleanSupportsService);
@@ -172,13 +188,18 @@ public class CallQueryWizard {
* whole combination of objects.
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = new String("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -188,7 +209,8 @@ public class CallQueryWizard {
/** Return the class name of the component.
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (QueryWizardImplementation.class.getName());
}
@@ -197,13 +219,21 @@ public class CallQueryWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public Type[] getTypes() {
- Type[] typeReturn = {
+ public Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- 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 exception) {
+ 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 exception)
+ {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
index 7056c690f10f..8535b2a4a876 100644
--- a/wizards/com/sun/star/wizards/query/Finalizer.java
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -38,17 +38,19 @@ import com.sun.star.sdb.CommandType;
import com.sun.star.uno.*;
import com.sun.star.wizards.ui.*;
-public class Finalizer {
- QueryWizard CurUnoDialog;
- String resQuery;
- Object txtSummary;
- Object txtTitle;
- XRadioButton xRadioDisplayQuery;
- XRadioButton xRadioModifyQuery;
+public class Finalizer
+{
- QuerySummary CurDBMetaData;
+ private QueryWizard CurUnoDialog;
+ 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 _CurUnoDialog, QuerySummary _CurDBMetaData)
+ {
short curtabindex = (short) (100 * QueryWizard.SOSUMMARYPAGE);
String reslblQueryTitle;
String resoptDisplayQuery;
@@ -65,68 +67,122 @@ public class Finalizer {
resQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 1);
int curHelpIndex = 40955;
- CurUnoDialog.insertLabel("lblQueryTitle", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(52)});
- txtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(90)});
- CurUnoDialog.insertLabel("lblHowGoOn", new String[] { "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(112)});
+ CurUnoDialog.insertLabel("lblQueryTitle", new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(52)
+ });
+ m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(90)
+ });
+ CurUnoDialog.insertLabel("lblHowGoOn", new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(112)
+ });
this.xRadioDisplayQuery = CurUnoDialog.insertRadioButton("optDisplayQuery",
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)
+ });
this.xRadioModifyQuery = CurUnoDialog.insertRadioButton("optModifyQuery",
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)});
- CurUnoDialog.insertFixedLine("flnSummary", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209)});
- txtSummary = CurUnoDialog.insertTextField("txtSummary", 0, null, new String[] { "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "ReadOnly", "Step", "VScroll", "Width" },
- new Object[] { new Integer(96), "HID:" + curHelpIndex++, Boolean.TRUE, new Integer(95), new Integer(80), Boolean.TRUE, new Integer(8), Boolean.TRUE, new Integer(209)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)
+ });
+ CurUnoDialog.insertFixedLine("flnSummary", new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ 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[]
+ {
+ "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "ReadOnly", "Step", "VScroll", "Width"
+ },
+ new Object[]
+ {
+ new Integer(96), "HID:" + curHelpIndex++, Boolean.TRUE, new Integer(95), new Integer(80), Boolean.TRUE, new Integer(8), Boolean.TRUE, new Integer(209)
+ });
}
/* 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
- */
- protected String initialize() {
- try {
- String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(txtTitle), "Text"));
- if (sCurQueryName != null) {
- if (sCurQueryName.equals("")) {
+ a new Table has been selected if it is clear that the user has not made any input meanwhile
+ */
+ protected String initialize()
+ {
+ try
+ {
+ String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"));
+ if (sCurQueryName != null)
+ {
+ if (sCurQueryName.equals(""))
+ {
String[] sCommandNames = CurDBMetaData.getIncludedCommandNames();
sCurQueryName = resQuery + "_" + sCommandNames[0];
- sCurQueryName = CurDBMetaData.ConnectionTools.getObjectNames().suggestName(CommandType.QUERY,sCurQueryName);
- Helper.setUnoPropertyValue(UnoDialog.getModel(txtTitle), "Text", sCurQueryName);
+ sCurQueryName = CurDBMetaData.ConnectionTools.getObjectNames().suggestName(CommandType.QUERY, sCurQueryName);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text", sCurQueryName);
}
}
CurDBMetaData.setSummaryString();
CurUnoDialog.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
return sCurQueryName;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return "";
}
}
- private String getTitle() {
- return (String) Helper.getUnoPropertyValue(UnoDialog.getModel(txtTitle), "Text");
+ private String getTitle()
+ {
+ final String sTitle = (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
+ return sTitle;
}
- public XComponent[] finish() {
+ public XComponent[] finish()
+ {
XComponent[] ret = null;
- try {
+ try
+ {
CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData);
String queryname = getTitle();
boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true);
- if (bsuccess) {
+ if (bsuccess)
+ {
bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname);
- if ( bsuccess ){
+ if (bsuccess)
+ {
short igoon = AnyConverter.toShort(Helper.getUnoPropertyValue(UnoDialog.getModel(xRadioDisplayQuery), "State"));
if (igoon == (short) 1)
{
ret = CurDBMetaData.switchtoDataViewmode(queryname,
- CommandType.QUERY,
- CurUnoDialog.getCurFrame());
+ CommandType.QUERY,
+ CurUnoDialog.getCurFrame());
}
else
{
@@ -140,7 +196,9 @@ public class Finalizer {
CurDBMetaData.oSQLQueryComposer = null;
CurDBMetaData = null;
CurUnoDialog = null;
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace();
}
return ret;
diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java
index 1251ad71fb22..07e66d0a7e1c 100644
--- a/wizards/com/sun/star/wizards/query/QuerySummary.java
+++ b/wizards/com/sun/star/wizards/query/QuerySummary.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,31 +26,34 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.query;
+ ************************************************************************/
+package com.sun.star.wizards.query;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.*;
-import com.sun.star.wizards.ui.FilterComponent;
+//import com.sun.star.wizards.ui.FilterComponent;
import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.db.*;
import com.sun.star.beans.*;
-public class QuerySummary extends QueryMetaData {
+public class QuerySummary extends QueryMetaData
+{
+
final protected int RID_QUERY = 2300;
final protected int RID_REPORT = 2400;
String sSummary;
Resource oResource;
- XMultiServiceFactory xMSF;
+ // XMultiServiceFactory xMSF;
private String sSeparator;
private String sReturnChar;
private String sAnd;
private String sOr;
-
- public QuerySummary(XMultiServiceFactory _xMSF, Resource _oResource) {
+ public QuerySummary(XMultiServiceFactory _xMSF, Resource _oResource)
+ {
super(_xMSF);
this.oResource = _oResource;
- this.xMSF = _xMSF;
+ // this.xMSF = _xMSF;
sAnd = oResource.getResText(RID_QUERY + 33);
sOr = oResource.getResText(RID_QUERY + 34);
sSeparator = oResource.getResText(RID_QUERY + 91);
@@ -58,17 +61,18 @@ public class QuerySummary extends QueryMetaData {
}
/* boolean bAssignAliases = xDBMetaData.supportsColumnAliasing();
- boolean bSupportsGroupByUnrelated = xDBMetaData.supportsGroupByUnrelated();
- boolean bSupportsOrderByUnrelated = xDBMetaData.supportsOrderByUnrelated();
- boolean bSupportsNumericFunctions = xDBMetaData.getNumericFunctions() != "";
- xDBMetaData.getMaxColumnsInGroupBy();
- xDBMetaData.getMaxColumnsInOrderBy();
- xDBMetaData.getMaxColumnsInSelect();
- xDBMetaData.getMaxCharLiteralLength(); // gef?hrlich, da h?chstwahrscheinlich nicht sauber in jedem Treiber implementiert!!!!!
- * */
-
- public void setSummaryString() {
- try {
+ boolean bSupportsGroupByUnrelated = xDBMetaData.supportsGroupByUnrelated();
+ boolean bSupportsOrderByUnrelated = xDBMetaData.supportsOrderByUnrelated();
+ boolean bSupportsNumericFunctions = xDBMetaData.getNumericFunctions() != "";
+ xDBMetaData.getMaxColumnsInGroupBy();
+ xDBMetaData.getMaxColumnsInOrderBy();
+ xDBMetaData.getMaxColumnsInSelect();
+ xDBMetaData.getMaxCharLiteralLength(); // gef?hrlich, da h?chstwahrscheinlich nicht sauber in jedem Treiber implementiert!!!!!
+ * */
+ public void setSummaryString()
+ {
+ try
+ {
String sFieldNamesFraction = "";
String sSortingFraction = "";
String sFilterFraction = "";
@@ -76,44 +80,57 @@ public class QuerySummary extends QueryMetaData {
String sGroupByFraction = "";
String sHavingFraction = "";
sFieldNamesFraction = combineFieldNameFraction() + sReturnChar;
- sSortingFraction = combinePartString(RID_QUERY + 51, getSortFieldNames(), RID_QUERY + 52, RID_QUERY + 93, new String[] { "<FIELDNAME>", "<SORTMODE>" }) + sReturnChar;
+ sSortingFraction = combinePartString(RID_QUERY + 51, getSortFieldNames(), RID_QUERY + 52, RID_QUERY + 93, new String[]
+ {
+ "<FIELDNAME>", "<SORTMODE>"
+ }) + sReturnChar;
sFilterFraction = combineFilterNameFraction(this.getFilterConditions(), RID_QUERY + 53, RID_QUERY + 54) + sReturnChar;
// if (xDBMetaData.getNumericFunctions().length() > 0)
// sAggregateFraction = combinePartString(RID_QUERY + 55, AggregateFieldNames, RID_QUERY + 56, RID_QUERY + 95, new String[]{ "<CALCULATEDFUNCTION>", "<FIELDNAME>"}) + sReturnChar;
- if (xDBMetaData.supportsGroupBy()) {
+ if (xDBMetaData.supportsGroupBy())
+ {
sGroupByFraction = combinePartString(RID_QUERY + 57, GroupFieldNames, RID_QUERY + 58) + sReturnChar;
sHavingFraction = combineFilterNameFraction(getGroupByFilterConditions(), RID_QUERY + 59, RID_QUERY + 60);
}
// TODO: remove the last return from the string
sSummary = sFieldNamesFraction + sSortingFraction + sFilterFraction + sAggregateFraction + sGroupByFraction + sHavingFraction;
sSummary = JavaTools.replaceSubString(sSummary, "", "~");
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- public String getSummaryString() {
+ public String getSummaryString()
+ {
return sSummary;
}
-
- private String combineFilterNameFraction(PropertyValue[][] _filterconditions, int _InitResID, int _AlternativeResID) {
- if (_filterconditions != null) {
- if (_filterconditions.length > 0) {
+ private String combineFilterNameFraction(PropertyValue[][] _filterconditions, int _InitResID, int _AlternativeResID)
+ {
+ if (_filterconditions != null)
+ {
+ if (_filterconditions.length > 0)
+ {
String sconditions = "";
String sStart = oResource.getResText(_InitResID);
String BaseString = oResource.getResText(RID_QUERY + 96);
- if (_filterconditions.length == 1) {
+ if (_filterconditions.length == 1)
+ {
PropertyValue[] curfilterconditions = _filterconditions[0];
- for (int i = 0; i < curfilterconditions.length; i++) {
+ for (int i = 0; i < curfilterconditions.length; i++)
+ {
sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this);
sconditions = appendClauseSeparator(sconditions, " " + sAnd + " ", i, curfilterconditions.length);
}
- } else {
+ }
+ else
+ {
- for (int i = 0; i < _filterconditions.length; i++) {
- sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0],this);
+ for (int i = 0; i < _filterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this);
sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length);
}
}
@@ -124,87 +141,115 @@ public class QuerySummary extends QueryMetaData {
return oResource.getResText(_AlternativeResID);
}
- private String combineFieldNameFraction() {
+ private String combineFieldNameFraction()
+ {
String CurString = "";
String sReturn = oResource.getResText(RID_QUERY + 50);
String BaseString = oResource.getResText(RID_QUERY + 92);
- for (int i = 0; i < FieldColumns.length; i++) {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
CurString = BaseString;
- FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].DisplayFieldName);
- int iAggregate = getAggregateIndex(FieldColumns[i].FieldName);
- if (iAggregate > -1) {
+ FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName());
+ int iAggregate = getAggregateIndex(FieldColumns[i].m_sFieldName);
+ if (iAggregate > -1)
+ {
String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
CurString = JavaTools.replaceSubString(CurString, sAggregateDisplay, "<FIELDNAME>");
}
else
- CurString = JavaTools.replaceSubString(CurString, CurDBFieldColumn.DisplayFieldName, "<FIELDNAME>");
- sReturn += JavaTools.replaceSubString(CurString, CurDBFieldColumn.FieldTitle, "<FIELDTITLE>");
+ {
+ CurString = JavaTools.replaceSubString(CurString, CurDBFieldColumn.getDisplayFieldName(), "<FIELDNAME>");
+ }
+ sReturn += JavaTools.replaceSubString(CurString, CurDBFieldColumn.getFieldTitle(), "<FIELDTITLE>");
sReturn = appendClauseSeparator(sReturn, sSeparator, i, FieldColumns.length);
}
return sReturn;
}
-
- private String appendClauseSeparator(String _basestring, String _suffix, int _i, int _fieldcount) {
+ private String appendClauseSeparator(String _basestring, String _suffix, int _i, int _fieldcount)
+ {
if (_i < _fieldcount - 1)
+ {
_basestring += _suffix;
+ }
return _basestring;
}
-
-
// TODO: How can you merge the following two methods to a single one in a smarter way??
- public String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID) {
- if (_FieldNames != null) {
- if (_FieldNames.length > 0) {
+ public String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID)
+ {
+ if (_FieldNames != null)
+ {
+ if (_FieldNames.length > 0)
+ {
return ArrayFieldsToString(_InitResID, _FieldNames);
}
}
return oResource.getResText(_AlternativeResID);
}
- protected String ArrayFieldsToString(int _InitResID, String[] _FieldNames) {
+ protected String ArrayFieldsToString(int _InitResID, String[] _FieldNames)
+ {
String sReturn = oResource.getResText(_InitResID);
int FieldCount = _FieldNames.length;
- for (int i = 0; i < FieldCount; i++) {
- sReturn += this.getFieldColumnByDisplayName(_FieldNames[i]).FieldTitle;
+ for (int i = 0; i < FieldCount; i++)
+ {
+ sReturn += this.getFieldColumnByDisplayName(_FieldNames[i]).getFieldTitle();
if (i < FieldCount - 1)
+ {
sReturn += sSeparator;
+ }
}
return (sReturn);
}
- public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags) {
- if (_FieldNames != null) {
+ public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags)
+ {
+ if (_FieldNames != null)
+ {
if (_FieldNames.length > 0)
+ {
return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags);
+ }
}
return oResource.getResText(_AlternativeResID);
}
- public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags) {
+ public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags)
+ {
String CurString = "";
String sReturn = oResource.getResText(_InitResID);
int FieldCount = _FieldNames.length;
- if (FieldCount > 0) {
+ if (FieldCount > 0)
+ {
int DimCount = _FieldNames[0].length;
String BaseString = oResource.getResText(_BaseStringID);
- for (int i = 0; i < FieldCount; i++) {
- for (int a = 0; a < DimCount; a++) {
- if (a == 0){
- int iAggregate = getAggregateIndex(this.getFieldColumnByDisplayName(_FieldNames[i][a]).DisplayFieldName);
- if (iAggregate > -1){
+ for (int i = 0; i < FieldCount; i++)
+ {
+ for (int a = 0; a < DimCount; a++)
+ {
+ if (a == 0)
+ {
+ int iAggregate = getAggregateIndex(this.getFieldColumnByDisplayName(_FieldNames[i][a]).getDisplayFieldName());
+ if (iAggregate > -1)
+ {
String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
CurString = JavaTools.replaceSubString(BaseString, sAggregateDisplay, _ReplaceTags[a]);
}
else
- CurString = JavaTools.replaceSubString(BaseString, this.getFieldColumnByDisplayName(_FieldNames[i][a]).FieldTitle, _ReplaceTags[a]);
+ {
+ CurString = JavaTools.replaceSubString(BaseString, this.getFieldColumnByDisplayName(_FieldNames[i][a]).getFieldTitle(), _ReplaceTags[a]);
+ }
}
else
+ {
CurString = JavaTools.replaceSubString(CurString, _FieldNames[i][a], _ReplaceTags[a]);
+ }
}
sReturn += CurString;
if (i < FieldCount - 1)
+ {
sReturn += sSeparator;
+ }
}
}
return sReturn;
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index 7ee4d68a9229..778faeb08903 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -43,16 +43,16 @@ import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.uno.UnoRuntime;
-public class QueryWizard extends WizardDialog {
+public class QueryWizard extends WizardDialog
+{
private XFrame CurFrame;
- public XFrame getCurFrame() {
+ public XFrame getCurFrame()
+ {
return CurFrame;
}
-
public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
-
public static final int SOFIELDSELECTIONPAGE = 1;
public static final int SOSORTINGPAGE = 2;
public static final int SOFILTERPAGE = 3;
@@ -61,7 +61,6 @@ public class QueryWizard extends WizardDialog {
public static final int SOGROUPFILTERPAGE = 6;
public static final int SOTITLESPAGE = 7;
public static final int SOSUMMARYPAGE = 8;
-
CommandFieldSelection CurDBCommandFieldSelection;
SortingComponent CurSortingComponent;
FieldSelection CurGroupFieldSelection;
@@ -82,23 +81,24 @@ public class QueryWizard extends WizardDialog {
String resQueryWizard;
String reslblGroupBy;
String resmsgNonNumericAsGroupBy;
-
- XComponent[] components = null;
-
- //Resources Object
+ XComponent[] components = null; //Resources Object
short CurTabIndex = 0;
- public QueryWizard(XMultiServiceFactory xMSF) {
+ public QueryWizard(XMultiServiceFactory xMSF)
+ {
super(xMSF, 40970);
addResourceHandler("QueryWizard", "dbw");
CurDBMetaData = new QuerySummary(xMSF, m_oResource);
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; // //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
- if (xLocMSF != null) {
+ if (xLocMSF != null)
+ {
PropertyValue[] curproperties = new PropertyValue[1];
curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/Mydbwizard2DocAssign.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");
curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/nyt1.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");
@@ -108,12 +108,12 @@ public class QueryWizard extends WizardDialog {
QueryWizard CurQueryWizard = new QueryWizard(xLocMSF);
CurQueryWizard.startQueryWizard(xLocMSF, curproperties);
}
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
}
-
-
//!<<<<<<< QueryWizard.java
//! public void startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) {
//! try {
@@ -144,30 +144,43 @@ public class QueryWizard extends WizardDialog {
//! insertQueryRelatedSteps();
//! short RetValue = executeDialog(CurFrame.getContainerWindow().getPosSize());
//!=======
- public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) {
- try {
- if (CurDBMetaData.getConnection(CurPropertyValues)){
+ public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues)
+ {
+ try
+ {
+ if (CurDBMetaData.getConnection(CurPropertyValues))
+ {
reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4);
reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent
reslblAliasHeader = m_oResource.getResText(UIConsts.RID_QUERY + 20); //Fieldtitles header in AliasComponent
reslblSelFields = m_oResource.getResText(UIConsts.RID_QUERY + 50);
reslblTables = m_oResource.getResText(UIConsts.RID_QUERY + 3);
- reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18);
+ reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18);
resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2);
resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88);
- Helper.setUnoPropertyValues(xDialogModel, new String[] { "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width" },
- new Object[] { new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310)});
+ Helper.setUnoPropertyValues(xDialogModel, new String[]
+ {
+ "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310)
+ });
drawNaviBar();
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"));
+ {
+ CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, Properties.getPropertyValue(CurPropertyValues, "ParentFrame"));
+ }
else
+ {
CurFrame = Desktop.getActiveFrame(xMSF);
- // CurFrame = OfficeDocument.createNewFrame(xMSF, this);
- // desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame);
+ }
+ // CurFrame = OfficeDocument.createNewFrame(xMSF, this);
+ // desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame);
XWindowPeer windowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow());
this.xMSF = xMSF;
@@ -176,7 +189,9 @@ public class QueryWizard extends WizardDialog {
insertQueryRelatedSteps();
executeDialog(CurFrame.getContainerWindow().getPosSize());
}
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
//!>>>>>>> 1.14
}
@@ -195,46 +210,61 @@ public class QueryWizard extends WizardDialog {
return ret;
}
-
- public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled) {
- try {
+ public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled)
+ {
+ try
+ {
Object oRoadmapItem;
int CurStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step"));
boolean bEnabled = false;
int CurItemID;
- for (int i = 0; i < getRMItemCount(); i++) {
+ for (int i = 0; i < getRMItemCount(); i++)
+ {
oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
- switch (CurItemID) {
- case SOAGGREGATEPAGE :
+ switch (CurItemID)
+ {
+ case SOAGGREGATEPAGE:
if (_bEnabled == true)
+ {
bEnabled = ((CurDBMetaData.hasNumericalFields()) && (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()));
+ }
break;
- case SOGROUPSELECTIONPAGE :
+ case SOGROUPSELECTIONPAGE:
bEnabled = CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY;
break;
- case SOGROUPFILTERPAGE :
+ case SOGROUPFILTERPAGE:
bEnabled = false;
if (_bEnabled == true)
+ {
bEnabled = (CurDBMetaData.GroupByFilterConditions.length > 0);
+ }
break;
- default :
+ default:
if (CurItemID > CurStep)
+ {
bEnabled = _bEnabled;
+ }
else
+ {
bEnabled = true;
+ }
break;
}
super.setStepEnabled(CurItemID, bEnabled);
}
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void insertQueryRelatedSteps() {
- try {
+ public void insertQueryRelatedSteps()
+ {
+ try
+ {
// String[] sRMItemLabels = getRMItemLabels();
setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
addRoadmap();
@@ -243,8 +273,11 @@ public class QueryWizard extends WizardDialog {
i = insertRoadmapItem(i, false, SOSORTINGPAGE - 1, SOSORTINGPAGE); // Orderby is always supported
i = insertRoadmapItem(i, false, SOFILTERPAGE - 1, SOFILTERPAGE);
if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATEPAGE - 1, SOAGGREGATEPAGE);
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
+ }
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
i = insertRoadmapItem(i, false, SOGROUPSELECTIONPAGE - 1, SOGROUPSELECTIONPAGE);
i = insertRoadmapItem(i, false, SOGROUPFILTERPAGE - 1, SOGROUPFILTERPAGE);
}
@@ -254,13 +287,17 @@ public class QueryWizard extends WizardDialog {
setRoadmapInteractive(true);
setRoadmapComplete(true);
setCurrentRoadmapItemID((short) 1);
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
Resource.showCommonResourceError(xMSF);
}
}
- public void buildSteps() {
- try {
+ public void buildSteps()
+ {
+ try
+ {
// curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
// curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
@@ -272,8 +309,11 @@ public class QueryWizard extends WizardDialog {
CurFilterComponent.addNumberFormats();
if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATEPAGE, 97, 69, 209, 5, 40895);
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
+ }
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTIONPAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false);
CurGroupFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTERPAGE, 97, 27, 209, 3, CurDBMetaData, 40923);
@@ -281,93 +321,109 @@ public class QueryWizard extends WizardDialog {
CurTitlesComponent = new TitlesComponent(this, SOTITLESPAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940);
CurFinalizer = new Finalizer(this, CurDBMetaData);
enableNavigationButtons(false, false, false);
- } catch (com.sun.star.uno.Exception exception){
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
Resource.showCommonResourceError(xMSF);
}
}
-
- public void finishWizard() {
+ public void finishWizard()
+ {
int ncurStep = getCurrentStep();
if ((switchToStep(ncurStep, SOSUMMARYPAGE)) || (ncurStep == SOSUMMARYPAGE))
+ {
components = CurFinalizer.finish();
+ }
}
-
- protected void enterStep(int nOldStep, int nNewStep) {
- try {
- if (nOldStep <= SOGROUPSELECTIONPAGE && nNewStep > SOGROUPSELECTIONPAGE) {
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
- CurDBMetaData.setGroupFieldNames(CurGroupFieldSelection.getSelectedFieldNames());
- CurDBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.GroupFieldNames, CurDBMetaData.NonAggregateFieldNames);
- CurDBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.GroupFieldNames);
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if (nOldStep <= SOGROUPSELECTIONPAGE && nNewStep > SOGROUPSELECTIONPAGE)
+ {
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ CurDBMetaData.setGroupFieldNames(CurGroupFieldSelection.getSelectedFieldNames());
+ CurDBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.GroupFieldNames, CurDBMetaData.NonAggregateFieldNames);
+ CurDBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.GroupFieldNames);
+ }
+ }
+ switch (nNewStep)
+ {
+ case SOFIELDSELECTIONPAGE:
+ break;
+ case SOSORTINGPAGE:
+ CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames());
+ break;
+ case SOFILTERPAGE:
+ CurFilterComponent.initialize(CurDBMetaData.getFilterConditions(), CurDBMetaData.getDisplayFieldNames());
+ break;
+ case SOAGGREGATEPAGE:
+ CurAggregateComponent.initialize();
+ break;
+ case SOGROUPSELECTIONPAGE:
+ break;
+ case SOGROUPFILTERPAGE:
+ CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames());
+ break;
+ case SOTITLESPAGE:
+ CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet);
+ break;
+ case SOSUMMARYPAGE:
+ CurFinalizer.initialize();
+ break;
+ default:
+ break;
}
}
- switch (nNewStep) {
- case SOFIELDSELECTIONPAGE :
- break;
- case SOSORTINGPAGE :
- CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames());
- break;
- case SOFILTERPAGE :
- CurFilterComponent.initialize(CurDBMetaData.FilterConditions, CurDBMetaData.getDisplayFieldNames());
- break;
- case SOAGGREGATEPAGE :
- CurAggregateComponent.initialize();
- break;
- case SOGROUPSELECTIONPAGE :
- break;
- case SOGROUPFILTERPAGE :
- CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames());
- break;
- case SOTITLESPAGE :
- CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet);
- break;
- case SOSUMMARYPAGE :
- CurFinalizer.initialize();
- break;
- default :
- break;
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
}
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }}
-
+ }
- protected void leaveStep(int nOldStep, int nNewStep) {
- switch (nOldStep) {
- case SOFIELDSELECTIONPAGE :
- CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames());
- CurDBMetaData.initializeFieldTitleSet(true);
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
+ case SOFIELDSELECTIONPAGE:
+ CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames());
+ CurDBMetaData.initializeFieldTitleSet(true);
CurDBMetaData.setNumericFields();
searchForOutdatedFields();
break;
- case SOSORTINGPAGE :
+ case SOSORTINGPAGE:
CurDBMetaData.setSortFieldNames(CurSortingComponent.getSortFieldNames());
break;
- case SOFILTERPAGE :
+ case SOFILTERPAGE:
CurDBMetaData.setFilterConditions(CurFilterComponent.getFilterConditions());
break;
- case SOAGGREGATEPAGE :
+ case SOAGGREGATEPAGE:
CurDBMetaData.AggregateFieldNames = CurAggregateComponent.getAggregateFieldNames();
break;
- case SOGROUPSELECTIONPAGE :
+ case SOGROUPSELECTIONPAGE:
break;
- case SOGROUPFILTERPAGE :
+ case SOGROUPFILTERPAGE:
CurDBMetaData.setGroupByFilterConditions(this.CurGroupFilterComponent.getFilterConditions());
break;
- case SOTITLESPAGE :
+ case SOTITLESPAGE:
CurDBMetaData.setFieldTitles(CurTitlesComponent.getFieldTitles());
break;
- case SOSUMMARYPAGE :
+ case SOSUMMARYPAGE:
break;
- default :
+ default:
break;
}
- if (nOldStep < SOGROUPSELECTIONPAGE && nNewStep >= SOGROUPSELECTIONPAGE){
- try {
- if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY){
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
+ if (nOldStep < SOGROUPSELECTIONPAGE && nNewStep >= SOGROUPSELECTIONPAGE)
+ {
+ try
+ {
+ if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)
+ {
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
CurDBMetaData.setNonAggregateFieldNames();
CurGroupFieldSelection.initialize(CurDBMetaData.getUniqueAggregateFieldNames(), false, CurDBMetaData.xDBMetaData.getMaxColumnsInGroupBy());
CurGroupFieldSelection.intializeSelectedFields(CurDBMetaData.NonAggregateFieldNames);
@@ -375,7 +431,9 @@ public class QueryWizard extends WizardDialog {
setStepEnabled(SOGROUPFILTERPAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0);
}
}
- } catch (SQLException e) {
+ }
+ catch (SQLException e)
+ {
e.printStackTrace();
}
}
@@ -385,30 +443,36 @@ public class QueryWizard extends WizardDialog {
{
String[] sFieldNames = CurDBMetaData.getFieldNames();
String[][] sRemovedFields = JavaTools.removeOutdatedFields(CurDBMetaData.getSortFieldNames(), sFieldNames);
- CurDBMetaData.setSortFieldNames( sRemovedFields );
- CurDBMetaData.FilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.FilterConditions, sFieldNames);
+ CurDBMetaData.setSortFieldNames(sRemovedFields);
+ CurDBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(CurDBMetaData.getFilterConditions(), sFieldNames));
CurDBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.AggregateFieldNames, sFieldNames);
}
- private void enableWizardSteps(String[] NewItems) {
+ private void enableWizardSteps(String[] NewItems)
+ {
boolean bEnabled = NewItems.length > 0;
setControlProperty("btnWizardNext", "Enabled", new Boolean(bEnabled));
setControlProperty("btnWizardFinish", "Enabled", new Boolean(bEnabled));
enableRoadmapItems(NewItems, bEnabled); // Note: Performancewise this could be improved
}
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
- public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener {
protected int ID;
- public int getID() {
+ public int getID()
+ {
return ID;
}
- public void setID(String sIncSuffix) {
+ public void setID(String sIncSuffix)
+ {
ID = 1;
- if (sIncSuffix != null) {
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) {
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ {
String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
ID = Integer.parseInt(sID);
int a = 0;
@@ -416,21 +480,27 @@ public class QueryWizard extends WizardDialog {
}
}
- public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) {
- if (ID == 1) {
- CurDBMetaData.addSeveralFieldColumns(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
+ CurDBMetaData.addSeveralFieldColumns(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
enableWizardSteps(NewItems);
- CurDBCommandFieldSelection.changeSelectedFieldNames(CurDBMetaData.getDisplayFieldNames());
+ CurDBCommandFieldSelection.changeSelectedFieldNames(CurDBMetaData.getDisplayFieldNames());
CurDBCommandFieldSelection.toggleCommandListBox(NewItems);
- } else {
+ }
+ else
+ {
boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled));
}
}
- public void shiftFromRightToLeft(String[] SelItems, String[] NewItems) {
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
// TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
- if (ID == 1) {
+ if (ID == 1)
+ {
enableWizardSteps(NewItems);
//! <<<<<<< QueryWizard.java
//! String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
@@ -441,28 +511,39 @@ public class QueryWizard extends WizardDialog {
//! =======
String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames);
- CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems);
+ CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems);
//! >>>>>>> 1.14
CurDBCommandFieldSelection.toggleCommandListBox(NewItems);
- } else {
+ }
+ else
+ {
boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
String CurDisplayFieldName = SelItems[0];
- if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1) {
- showMessageBox( "ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy);
+ if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1)
+ {
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy);
CurGroupFieldSelection.xSelFieldsListBox.addItems(SelItems, CurGroupFieldSelection.xSelFieldsListBox.getItemCount());
String FieldList[] = CurGroupFieldSelection.xFieldsListBox.getItems();
int index = JavaTools.FieldInList(FieldList, CurDisplayFieldName);
if (index > -1)
+ {
CurGroupFieldSelection.xFieldsListBox.removeItems((short) index, (short) 1);
- } else
+ }
+ }
+ else
+ {
Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled));
+ }
}
}
- public void moveItemDown(String item) {
+
+ public void moveItemDown(String item)
+ {
}
- public void moveItemUp(String item) {
+ public void moveItemUp(String item)
+ {
}
}
}
diff --git a/wizards/com/sun/star/wizards/query/XCallQueryWizard.java b/wizards/com/sun/star/wizards/query/XCallQueryWizard.java
index 4afc21c52865..04cb6303db3f 100644
--- a/wizards/com/sun/star/wizards/query/XCallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/XCallQueryWizard.java
@@ -1,9 +1,42 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XCallQueryWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.query;
-public interface XCallQueryWizard extends com.sun.star.uno.XInterface {
+public interface XCallQueryWizard extends com.sun.star.uno.XInterface
+{
// Methods
- public void CallQueryDialog();
-
- // static Member
- public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = { new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallQueryDialog", 0, 0)};
+ public void CallQueryDialog(); // static Member
+ public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] =
+ {
+ new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallQueryDialog", 0, 0)
+ };
}