summaryrefslogtreecommitdiff
path: root/wizards/com/sun
diff options
context:
space:
mode:
authorOcke.Janssen <Ocke.Janssen@oracle.com>2010-11-04 14:44:00 +0100
committerOcke.Janssen <Ocke.Janssen@oracle.com>2010-11-04 14:44:00 +0100
commitf7c43885c95a44c712f7303b271d1659b8262b98 (patch)
tree6815de1d00e380172276f335b368437379b21a71 /wizards/com/sun
parente54eb384c35942dfdc9462dded1635c15ac0f53d (diff)
dba34b: #i110536# remove extra order by for grouping fields
Diffstat (limited to 'wizards/com/sun')
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java104
-rw-r--r--wizards/com/sun/star/wizards/ui/SortingComponent.java32
2 files changed, 70 insertions, 66 deletions
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index 2bffd2b4bea3..92abe46fdd4e 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -28,7 +28,6 @@
package com.sun.star.wizards.report;
// import java.util.Vector;
-
import com.sun.star.awt.TextEvent;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.awt.XTextListener;
@@ -53,6 +52,7 @@ import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.common.SystemDialog;
import com.sun.star.wizards.db.DBMetaData;
import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.RecordParser;
import com.sun.star.wizards.db.SQLQueryComposer;
import com.sun.star.wizards.ui.CommandFieldSelection;
import com.sun.star.wizards.ui.FieldSelection;
@@ -69,6 +69,7 @@ import java.util.Map;
public class ReportWizard extends DatabaseObjectWizard implements XTextListener, XCompletion
{
+
protected FieldSelection CurGroupFieldSelection;
private SortingComponent CurSortingComponent;
private TitlesComponent CurTitlesComponent;
@@ -85,7 +86,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
private static final int SOSORTPAGE = 4;
protected static final int SOTEMPLATEPAGE = 5;
protected static final int SOSTOREPAGE = 6;
-
private IReportDocument m_reportDocument;
private static String sMsgWizardName;
private static String slblFields;
@@ -98,9 +98,9 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
protected static boolean bCloseDocument;
private boolean bHasEscapeProcessing = true;
- public ReportWizard( XMultiServiceFactory i_serviceFactory, final PropertyValue[] i_wizardContext )
+ public ReportWizard(XMultiServiceFactory i_serviceFactory, final PropertyValue[] i_wizardContext)
{
- super(i_serviceFactory, 34320, i_wizardContext );
+ super(i_serviceFactory, 34320, i_wizardContext);
super.addResourceHandler("Report Wizard", "dbw");
if (getReportResources(false) == true)
{
@@ -193,7 +193,9 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
{
// cleanup document
m_reportDocument.clearDocument();
- m_reportDocument.getRecordParser().setGroupFieldNames(new String[]{});
+ m_reportDocument.getRecordParser().setGroupFieldNames(new String[]
+ {
+ });
CurGroupFieldHandler.removeGroupFieldNames();
}
break;
@@ -248,30 +250,30 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
return;
}
- if ( ( nReportMode == ReportFinalizer.SOCREATETEMPLATE )
- || ( nReportMode == ReportFinalizer.SOUSETEMPLATE )
- )
+ if ((nReportMode == ReportFinalizer.SOCREATETEMPLATE)
+ || (nReportMode == ReportFinalizer.SOUSETEMPLATE))
{
m_reportDocument.addReportToDBView();
boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE);
- m_reportDocument.createAndOpenReportDocument( m_sReportName, true, bOpenInDesign);
+ m_reportDocument.createAndOpenReportDocument(m_sReportName, true, bOpenInDesign);
}
else
{
m_reportDocument.importReportData(this);
- m_reportDocument.createAndOpenReportDocument( m_sReportName, false, false );
+ m_reportDocument.createAndOpenReportDocument(m_sReportName, false, false);
}
}
private boolean executeQuery()
{
boolean bQueryCreated = false;
+ final RecordParser recordParser = m_reportDocument.getRecordParser();
+ final SQLQueryComposer sqlQueryComposer = recordParser.getSQLQueryComposer();
if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
{
- bQueryCreated = m_reportDocument.getRecordParser().getSQLQueryComposer().setQueryCommand(this.xWindow, false, false);
-
+ bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false);
m_reportDocument.setCommandType(CommandType.COMMAND);
- String sQuery = m_reportDocument.getRecordParser().getSQLQueryComposer().getQuery();
+ String sQuery = sqlQueryComposer.getQuery();
m_reportDocument.setCommand(sQuery);
}
else
@@ -279,18 +281,18 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
try
{
String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
- DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName);
- bHasEscapeProcessing = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
+ DBMetaData.CommandObject oCommand = recordParser.getQueryByName(sQueryName);
+ bHasEscapeProcessing = recordParser.hasEscapeProcessing(oCommand.getPropertySet());
String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command");
if (bHasEscapeProcessing)
{
// String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
bQueryCreated = (!sCommand.equals(""));
- m_reportDocument.getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(sCommand);
- m_reportDocument.getRecordParser().getSQLQueryComposer().prependSortingCriteria();
+ sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
+ sqlQueryComposer.prependSortingCriteria();
// TODO: check with query
m_reportDocument.setCommandType(CommandType.COMMAND);
- m_reportDocument.setCommand(m_reportDocument.getRecordParser().getSQLQueryComposer().getQuery());
+ m_reportDocument.setCommand(sqlQueryComposer.getQuery());
bQueryCreated = true;
}
else
@@ -311,12 +313,13 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
}
return bQueryCreated;
}
+
public void buildSteps()
{
// CurReportDocument.getDoc().xProgressBar.setValue(30);
CurDBCommandFieldSelection = new CommandFieldSelection(this, m_reportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
- if ( !isReportBuilderInstalled() )
+ if (!isReportBuilderInstalled())
{
insertLabel("lblBinaryFields",
new String[]
@@ -388,7 +391,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
private boolean isReportBuilderInstalled()
{
//! Check if the new Report Builder Extension is available
- XContentEnumerationAccess a = com.sun.star.uno.UnoRuntime.queryInterface( XContentEnumerationAccess.class, xMSF );
+ XContentEnumerationAccess a = com.sun.star.uno.UnoRuntime.queryInterface(XContentEnumerationAccess.class, xMSF);
com.sun.star.container.XEnumeration e = a.createContentEnumeration("com.sun.star.report.pentaho.SOReportJobFactory");
if (e == null)
{
@@ -411,42 +414,41 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
// Get the path to the extension and try to add the path to the class loader
final XComponentContext xComponentContext = Helper.getComponentContext(_xMSF);
final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider");
- XPackageInformationProvider xProvider = UnoRuntime.queryInterface( XPackageInformationProvider.class, aSingleton );
+ XPackageInformationProvider xProvider = UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton);
final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
return sLocation;
}
+ private static XLogger m_xLogger;
-private static XLogger m_xLogger;
+ private static void initializeLogger(XMultiServiceFactory _xMSF)
+ {
+ XComponentContext xContext = Helper.getComponentContext(_xMSF);
-private static void initializeLogger(XMultiServiceFactory _xMSF)
-{
- XComponentContext xContext = Helper.getComponentContext(_xMSF);
+ final Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool");
+ if (aLoggerPool == null)
+ {
+ System.out.println("Can't get singleton from logging");
+ }
+ final XLoggerPool xLoggerPool = UnoRuntime.queryInterface(XLoggerPool.class, aLoggerPool);
+ m_xLogger = xLoggerPool.getNamedLogger("com.sun.star.wizards.ReportBuilder");
+ }
- final Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool");
- if (aLoggerPool == null)
+ public static XLogger getLogger()
{
- System.out.println("Can't get singleton from logging");
+ return m_xLogger;
}
- final XLoggerPool xLoggerPool = UnoRuntime.queryInterface( XLoggerPool.class, aLoggerPool );
- m_xLogger = xLoggerPool.getNamedLogger("com.sun.star.wizards.ReportBuilder");
-}
-
-public static XLogger getLogger()
-{
- return m_xLogger;
-}
public void startReportWizard()
{
initializeLogger(xMSF);
getLogger().log(LogLevel.SEVERE, "Start Report Wizard");
- if ( isReportBuilderInstalled() )
+ if (isReportBuilderInstalled())
{
// Get the path to the extension and try to add the path to the class loader
String sLocation = getPathToExtension(xMSF);
// TODO: Umlaut in filename!
- if ( sLocation.length() > 0 )
+ if (sLocation.length() > 0)
{
try
{
@@ -456,8 +458,14 @@ public static XLogger getLogger()
aURLs[0] = aLocationURI.toURL();
URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader());
Class a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
- Method aMethod = a.getMethod("create", new Class[] { XMultiServiceFactory.class });
- m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[] { xMSF });
+ Method aMethod = a.getMethod("create", new Class[]
+ {
+ XMultiServiceFactory.class
+ });
+ m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[]
+ {
+ xMSF
+ });
}
catch (Exception e)
{
@@ -472,26 +480,28 @@ public static XLogger getLogger()
if (m_reportDocument == null)
{
// Fallback, if there is no reportbuilder wizard implementation, we use the old wizard
- m_reportDocument = new ReportTextImplementation( xMSF );
+ m_reportDocument = new ReportTextImplementation(xMSF);
}
- m_reportDocument.initialize( m_docUI, m_oResource );
+ m_reportDocument.initialize(m_docUI, m_oResource);
- if ( m_reportDocument.getRecordParser().getConnection( m_wizardContext ) )
+ if (m_reportDocument.getRecordParser().getConnection(m_wizardContext))
{
buildSteps();
m_reportDocument.checkInvariants();
- this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+ this.CurDBCommandFieldSelection.preselectCommand(m_wizardContext, false);
createWindowPeer(m_reportDocument.getWizardParent());
m_reportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
insertQueryRelatedSteps();
short RetValue = executeDialog(m_reportDocument.getFrame().getComponentWindow().getPosSize());
- if ( RetValue == 0 )
+ if (RetValue == 0)
+ {
dialogFinish();
+ }
}
m_reportDocument.getRecordParser().dispose();
}
@@ -668,8 +678,8 @@ public static XLogger getLogger()
}
super.setStepEnabled(SOSORTPAGE, bdoenable);
- // int nCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
- // super.setStepEnabled(SOSORTPAGE, (nCommandType == CommandType.TABLE));
+ // int nCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
+ // super.setStepEnabled(SOSORTPAGE, (nCommandType == CommandType.TABLE));
}
public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java
index 29b646d3e852..9081112f13a4 100644
--- a/wizards/com/sun/star/wizards/ui/SortingComponent.java
+++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java
@@ -28,9 +28,9 @@ package com.sun.star.wizards.ui;
import java.beans.PropertyChangeEvent;
-import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.*;
import com.sun.star.awt.*;
+import java.util.ArrayList;
public class SortingComponent
{
@@ -255,32 +255,26 @@ public class SortingComponent
{
short iCurState;
String CurFieldName;
- String CurFieldTitle;
setMaxSortIndex();
- String[][] SortFieldNames = new String[MaxSortIndex + 1][2];
- String[] SortDescriptions = new String[MaxSortIndex + 1];
+ // String[][] SortFieldNames = new String[MaxSortIndex + 1][2];
+ ArrayList<String[]> SortFieldNames = new ArrayList<String[]>();
+ ArrayList<String> SortDescriptions = new ArrayList<String>();
for (int i = 0; i <= MaxSortIndex; i++)
{
- CurFieldName = xSortListBox[i].getSelectedItem();
- SortFieldNames[i][0] = CurFieldName;
- SortDescriptions[i] = CurFieldName;
- iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + new Integer(i + 1).toString(), "State")).shortValue();
- SortFieldNames[i][0] = CurFieldName;
- if (iCurState == 1)
+ if (!((Boolean) CurUnoDialog.getControlProperty("lstSort" + (i + 1), "ReadOnly")))
{
- SortFieldNames[i][1] = "ASC";
- }
- else
- {
- SortFieldNames[i][1] = "DESC";
+ CurFieldName = xSortListBox[i].getSelectedItem();
+ SortDescriptions.add(CurFieldName);
+ iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + new Integer(i + 1).toString(), "State")).shortValue();
+ SortFieldNames.add(new String[]{CurFieldName,iCurState == 1 ? "ASC" :"DESC" });
}
}
// When searching for a duplicate entry we can neglect wether the entries are to be sorted ascending or descending
// TODO for the future we should deliver a messagebox when two different sorting modes have been applied to one field
- int iduplicate = JavaTools.getDuplicateFieldIndex(SortDescriptions);
+ int iduplicate = JavaTools.getDuplicateFieldIndex(SortDescriptions.toArray(new String[SortDescriptions.size()]));
if (iduplicate != -1)
{
- String sLocSortCriteriaisduplicate = JavaTools.replaceSubString(sSortCriteriaisduplicate, SortFieldNames[iduplicate][0], "<FIELDNAME>");
+ String sLocSortCriteriaisduplicate = JavaTools.replaceSubString(sSortCriteriaisduplicate, SortFieldNames.get(iduplicate)[0], "<FIELDNAME>");
CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocSortCriteriaisduplicate);
CurUnoDialog.vetoableChange(new PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2)));
CurUnoDialog.setFocus("lstSort" + (iduplicate + 1));
@@ -290,7 +284,7 @@ public class SortingComponent
}
else
{
- return SortFieldNames;
+ return SortFieldNames.toArray(new String[SortFieldNames.size()][2]);
}
}
catch (Exception exception)
@@ -314,7 +308,7 @@ public class SortingComponent
0
});
}
- // xSortListBox[i+1].selectItemPos((short)0, true);
+ // xSortListBox[i+1].selectItemPos((short)0, true);
}
CurUnoDialog.setFocus("lblSort" + new Integer(CurIndex + 1));
MaxSortIndex = CurIndex - 1;