[Libreoffice-commits] core.git: 9 commits - connectivity/com connectivity/qa filter/qa forms/qa javaunohelper/com odk/examples qadevOOo/runner qadevOOo/tests stoc/test wizards/com wizards/Jar_commonwizards.mk
Noel Grandin
noel at peralex.com
Tue Nov 25 00:35:38 PST 2014
connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java | 6
connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java | 7
connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java | 6
connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java | 7
connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java | 8
filter/qa/complex/filter/misc/TypeDetection6FileFormat.java | 6
forms/qa/integration/forms/CellBinding.java | 7
forms/qa/integration/forms/ImageComparison.java | 7
forms/qa/integration/forms/SpreadsheetView.java | 6
javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java | 7
javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java | 7
odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java | 8
odk/examples/DevelopersGuide/Database/OpenQuery.java | 8
odk/examples/DevelopersGuide/Drawing/Organigram.java | 6
odk/examples/DevelopersGuide/Forms/SpreadsheetView.java | 5
odk/examples/DevelopersGuide/Text/TextDocuments.java | 5
qadevOOo/runner/helper/WindowListener.java | 7
qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java | 7
stoc/test/javavm/testapplet/TestApplet.java | 5
wizards/Jar_commonwizards.mk | 1
wizards/com/sun/star/wizards/common/Indexable.java | 6
wizards/com/sun/star/wizards/common/Properties.java | 5
wizards/com/sun/star/wizards/common/XMLHelper.java | 6
wizards/com/sun/star/wizards/common/XMLProvider.java | 6
wizards/com/sun/star/wizards/form/DataEntrySetter.java | 22
wizards/com/sun/star/wizards/form/Finalizer.java | 11
wizards/com/sun/star/wizards/form/FormConfiguration.java | 46 +
wizards/com/sun/star/wizards/form/StyleApplier.java | 40 +
wizards/com/sun/star/wizards/form/UIControlArranger.java | 18
wizards/com/sun/star/wizards/query/Finalizer.java | 11
wizards/com/sun/star/wizards/report/ReportFinalizer.java | 58 +-
wizards/com/sun/star/wizards/table/FieldFormatter.java | 51 +-
wizards/com/sun/star/wizards/table/Finalizer.java | 12
wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java | 58 +-
wizards/com/sun/star/wizards/table/ScenarioSelector.java | 18
wizards/com/sun/star/wizards/ui/ButtonList.java | 31 -
wizards/com/sun/star/wizards/ui/ImageList.java | 46 +
wizards/com/sun/star/wizards/ui/PathSelection.java | 23
wizards/com/sun/star/wizards/ui/UnoDialog.java | 1
wizards/com/sun/star/wizards/ui/UnoDialog2.java | 186 -------
wizards/com/sun/star/wizards/ui/WizardDialog.java | 147 +++--
wizards/com/sun/star/wizards/ui/event/CommonListener.java | 254 ----------
wizards/com/sun/star/wizards/ui/event/XItemListenerAdapter.java | 32 +
wizards/com/sun/star/wizards/ui/event/XMouseListenerAdapter.java | 39 +
wizards/com/sun/star/wizards/ui/event/XWindowListenerAdapter.java | 41 +
45 files changed, 560 insertions(+), 734 deletions(-)
New commits:
commit 5d602146785669063af11a96c6f716c22e0208ee
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 10:31:08 2014 +0200
java: remove some comment noise
Change-Id: I1c258b853097448d4a59334d915e94dba4c7eb34
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java
index 1ea9cd2..5a9bc8b 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * StorageAccess.java
- *
- * Created on 17. August 2004, 13:32
- */
-
package com.sun.star.sdbcx.comp.hsqldb;
public class NativeStorageAccess {
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java
index 2f3d99b..0e0fff5 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java
@@ -15,13 +15,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * StorageFileAccess.java
- *
- * Created on 31. August 2004, 11:56
- */
-
package com.sun.star.sdbcx.comp.hsqldb;
+
import org.hsqldb.lib.FileAccess;
import org.hsqldb.lib.FileSystemRuntimeException;
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java
index caeb103..cf147c9 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * StorageNativeInputStream.java
- *
- * Created on 9. September 2004, 11:52
- */
-
package com.sun.star.sdbcx.comp.hsqldb;
public class StorageNativeInputStream {
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java
index 1f1e654..8cc6cb0 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java
@@ -15,13 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * StorageNativeOutputStream.java
- *
- * Created on 1. September 2004, 10:20
- */
-
package com.sun.star.sdbcx.comp.hsqldb;
public class StorageNativeOutputStream {
diff --git a/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java b/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java
index 905ddc1..66a252d 100644
--- a/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java
+++ b/connectivity/qa/complex/connectivity/hsqldb/DatabaseMetaData.java
@@ -15,14 +15,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * Class.java
- *
- * Created on June 23, 2003, 3:19 PM
- */
-
package complex.connectivity.hsqldb;
+
import complex.connectivity.HsqlDriverTest;
import java.sql.*;
import java.lang.reflect.Method;
diff --git a/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java b/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java
index 33a1b1d..bfc4ec2 100644
--- a/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java
+++ b/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * TypeDetection6FileFormat.java
- *
- * Created on 26. April 2004, 10:37
- */
package complex.filter.misc;
import com.sun.star.container.XNameAccess;
diff --git a/forms/qa/integration/forms/CellBinding.java b/forms/qa/integration/forms/CellBinding.java
index e71975a..f4258a8 100644
--- a/forms/qa/integration/forms/CellBinding.java
+++ b/forms/qa/integration/forms/CellBinding.java
@@ -15,13 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * CellBinding.java
- *
- * Created on 12. Mai 2004, 15:15
- */
-
package integration.forms;
import com.sun.star.uno.*;
diff --git a/forms/qa/integration/forms/ImageComparison.java b/forms/qa/integration/forms/ImageComparison.java
index 034f4e5..e28771f 100644
--- a/forms/qa/integration/forms/ImageComparison.java
+++ b/forms/qa/integration/forms/ImageComparison.java
@@ -15,13 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * ImageComparison.java
- *
- * Created on 23. September 2003, 17:40
- */
-
package integration.forms;
public final class ImageComparison implements com.sun.star.awt.XImageConsumer
diff --git a/forms/qa/integration/forms/SpreadsheetView.java b/forms/qa/integration/forms/SpreadsheetView.java
index 76934bc..22ff1c0 100644
--- a/forms/qa/integration/forms/SpreadsheetView.java
+++ b/forms/qa/integration/forms/SpreadsheetView.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * SpreadsheetView.java
- *
- * Created on 2. Oktober 2003, 14:02
- */
-
package integration.forms;
import com.sun.star.uno.*;
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
index 19d5919..2d3e9a8 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
@@ -15,13 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * ByteArrayXInputStram.java
- *
- * Created on 10. April 2003, 15:45
- */
-
package com.sun.star.lib.uno.adapter;
import com.sun.star.io.XInputStream;
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
index 38dff37..4887127 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
@@ -15,13 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * ByteArrayXOutputStream.java
- *
- * Created on 11. April 2003, 14:20
- */
-
package com.sun.star.lib.uno.adapter;
import com.sun.star.io.*;
diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java
index 86d587e..7d99b0d 100644
--- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java
+++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java
@@ -31,16 +31,8 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*************************************************************************/
-
package org.openoffice.comp.test;
-
-/*
- * ImageShrink.java
- *
- * Created on 4. Mai 2002, 20:25
- */
-
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.comp.loader.FactoryHelper;
diff --git a/odk/examples/DevelopersGuide/Database/OpenQuery.java b/odk/examples/DevelopersGuide/Database/OpenQuery.java
index 0aa972a..71e47f6 100644
--- a/odk/examples/DevelopersGuide/Database/OpenQuery.java
+++ b/odk/examples/DevelopersGuide/Database/OpenQuery.java
@@ -37,14 +37,6 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.beans.XPropertySet;
-
-
-/*
- * OpenQuery.java
- *
- * Created on 6. Juli 2002, 10:25
- */
-
public class OpenQuery {
/**
diff --git a/odk/examples/DevelopersGuide/Drawing/Organigram.java b/odk/examples/DevelopersGuide/Drawing/Organigram.java
index 67d183c..799aa89 100644
--- a/odk/examples/DevelopersGuide/Drawing/Organigram.java
+++ b/odk/examples/DevelopersGuide/Drawing/Organigram.java
@@ -43,12 +43,6 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.XComponentContext;
-/*
- * OpenQuery.java
- *
- * Created on 6. Juli 2002, 10:25
- */
-
public class Organigram {
private XComponentContext xRemoteContext = null;
diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
index 6fb099b..7d4efca 100644
--- a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
+++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java
@@ -15,11 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * SpreadsheetView.java
- *
- * Created on 2. Oktober 2003, 14:02
- */
import com.sun.star.lang.*;
import com.sun.star.frame.*;
diff --git a/odk/examples/DevelopersGuide/Text/TextDocuments.java b/odk/examples/DevelopersGuide/Text/TextDocuments.java
index be749f0..510abe0 100644
--- a/odk/examples/DevelopersGuide/Text/TextDocuments.java
+++ b/odk/examples/DevelopersGuide/Text/TextDocuments.java
@@ -100,11 +100,6 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XRefreshable;
import com.sun.star.view.XPrintable;
-/*
- * TextDocuments.java
- *
- * Created on 11. April 2002, 08:47
- */
public class TextDocuments {
// adjust these constant to your local printer!
diff --git a/qadevOOo/runner/helper/WindowListener.java b/qadevOOo/runner/helper/WindowListener.java
index 00395c6..064743c 100644
--- a/qadevOOo/runner/helper/WindowListener.java
+++ b/qadevOOo/runner/helper/WindowListener.java
@@ -15,13 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * WindowListener.java
- *
- * Created on 30. Juli 2002, 12:36
- */
-
package helper;
/**
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java b/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java
index 4297c6c..31fbdc1 100644
--- a/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java
@@ -15,13 +15,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * _XSingleLayerStratum.java
- *
- * Created on 23. March 2004, 16:37
- */
package ifc.configuration.backend;
+
import com.sun.star.configuration.backend.XLayer;
import com.sun.star.configuration.backend.XSingleLayerStratum;
import com.sun.star.configuration.backend.XUpdatableLayer;
diff --git a/stoc/test/javavm/testapplet/TestApplet.java b/stoc/test/javavm/testapplet/TestApplet.java
index 2618498..e271f4d 100644
--- a/stoc/test/javavm/testapplet/TestApplet.java
+++ b/stoc/test/javavm/testapplet/TestApplet.java
@@ -21,11 +21,6 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
-/*
- * TestApplet.java
- *
- * Created on 21. November 2001, 09:37
- */
public class TestApplet extends java.applet.Applet {
diff --git a/wizards/com/sun/star/wizards/common/Indexable.java b/wizards/com/sun/star/wizards/common/Indexable.java
index d838c35..9bf6255 100644
--- a/wizards/com/sun/star/wizards/common/Indexable.java
+++ b/wizards/com/sun/star/wizards/common/Indexable.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * Indexable.java
- *
- * Created on 16. September 2003, 11:38
- */
-
package com.sun.star.wizards.common;
public interface Indexable {
diff --git a/wizards/com/sun/star/wizards/common/Properties.java b/wizards/com/sun/star/wizards/common/Properties.java
index 4c4a69d..59e48e6 100644
--- a/wizards/com/sun/star/wizards/common/Properties.java
+++ b/wizards/com/sun/star/wizards/common/Properties.java
@@ -15,11 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-/*
- * Properties.java
- *
- * Created on 1. Oktober 2003, 17:16
- */
package com.sun.star.wizards.common;
import com.sun.star.beans.PropertyValue;
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java
index 5a49b28..10bc417 100644
--- a/wizards/com/sun/star/wizards/common/XMLHelper.java
+++ b/wizards/com/sun/star/wizards/common/XMLHelper.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * XMLHelper.java
- *
- * Created on 30. September 2003, 15:38
- */
package com.sun.star.wizards.common;
import org.w3c.dom.*;
diff --git a/wizards/com/sun/star/wizards/common/XMLProvider.java b/wizards/com/sun/star/wizards/common/XMLProvider.java
index 287e861..86eef1d 100644
--- a/wizards/com/sun/star/wizards/common/XMLProvider.java
+++ b/wizards/com/sun/star/wizards/common/XMLProvider.java
@@ -15,12 +15,6 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-/*
- * XMLSupplier.java
- *
- * Created on 19. September 2003, 11:52
- */
package com.sun.star.wizards.common;
import org.w3c.dom.Node;
commit d6d6903e61d368e03d039f78dc7130cfe0206695
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 10:24:50 2014 +0200
java: remove now unused CommonListener class
Change-Id: I2b3d73dc38ab4c5b7ac60bc8b4b3903c36579891
diff --git a/wizards/Jar_commonwizards.mk b/wizards/Jar_commonwizards.mk
index f0945e3..0958a71 100644
--- a/wizards/Jar_commonwizards.mk
+++ b/wizards/Jar_commonwizards.mk
@@ -75,7 +75,6 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/db/TableDescriptor \
wizards/com/sun/star/wizards/db/SQLQueryComposer \
wizards/com/sun/star/wizards/db/DatabaseObjectWizard \
- wizards/com/sun/star/wizards/ui/event/CommonListener \
wizards/com/sun/star/wizards/ui/event/DataAware \
wizards/com/sun/star/wizards/ui/event/DataAwareFields \
wizards/com/sun/star/wizards/ui/event/EventNames \
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
index 163a354..c9a50d9 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -71,7 +71,6 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
private int selected = -1;
private int pageStart = 0;
public int helpURL = 0;
- private final CommonListener uiEventListener = new CommonListener();
private IImageRenderer renderer;
private ListModel listModel;
public IRenderer counterRenderer = new SimpleCounterRenderer();
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.java b/wizards/com/sun/star/wizards/ui/event/CommonListener.java
deleted file mode 100644
index 477ae3d..0000000
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-import com.sun.star.awt.*;
-import com.sun.star.lang.EventObject;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.PropertyNames;
-
-/**
- * <p>It uses a hashtable to map between a ComponentName, EventName and a MethodInvokation Object.
- * To use this class do the following:</p>
- * <ul>
- * <li>Write a subclass which implements the needed Listener(s).</li>
- * <li>In the even methods, use invoke(...).</li>
- * <li>When instantiating the component, register the subclass as the event listener.</li>
- * <li>Write the methods which should be performed when the event occurs.</li>
- * <li>call the "add" method, to define a component-event-action mapping.</li>
- * </ul>
- */
-public class CommonListener implements XActionListener, XItemListener, XTextListener, XWindowListener, XMouseListener, XFocusListener, XKeyListener
-{
-
- private final HashMap<String,MethodInvocation> mHashtable = new HashMap<String,MethodInvocation>();
-
- public void add(String componentName, EventNames eventName, String methodName, Object target)
- {
- try
- {
- mHashtable.put(componentName + eventName, new MethodInvocation(methodName, target));
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- private void invoke(String componentName, EventNames eventName, Object param)
- {
- try
- {
- MethodInvocation mi = mHashtable.get(componentName + eventName);
- if (mi != null)
- {
- mi.invoke(param);
- }
- }
- catch (InvocationTargetException ite)
- {
-
- System.out.println("=======================================================");
- System.out.println("=== Note: An Exception was thrown which should have ===");
- System.out.println("=== caused a crash. I caught it. Please report this ===");
- System.out.println("=== to https://www.libreoffice.org/get-help/bug/ ===");
- System.out.println("=======================================================");
-
- ite.printStackTrace();
-
- }
- catch (IllegalAccessException iae)
- {
- iae.printStackTrace();
- }
- catch (Exception ex)
- {
- System.out.println("=======================================================");
- System.out.println("=== Note: An Exception was thrown which should have ===");
- System.out.println("=== caused a crash. I caught it. Please report this ===");
- System.out.println("=== to https://www.libreoffice.org/get-help/bug/ ===");
- System.out.println("=======================================================");
- ex.printStackTrace();
- }
- }
-
- /**
- * Returns the property "name" of the Object which is the source of the event.
- */
- private static String getEventSourceName(EventObject eventObject)
- {
- XControl xControl = UnoRuntime.queryInterface(XControl.class, eventObject.Source);
- return (String) Helper.getUnoPropertyValue(xControl.getModel(), PropertyNames.PROPERTY_NAME, String.class);
- }
-
- /**
- * Implementation of com.sun.star.awt.XActionListener
- */
- public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
- {
- invoke(getEventSourceName(actionEvent), EventNames.ACTION_PERFORMED, actionEvent);
- }
-
- public void disposing(com.sun.star.lang.EventObject eventObject)
- {
- }
-
- /**
- * Implementation of com.sun.star.awt.XItemListener
- */
- public void itemStateChanged(ItemEvent itemEvent)
- {
- invoke(getEventSourceName(itemEvent), EventNames.ITEM_CHANGED, itemEvent);
- }
-
- /**
- * Implementation of com.sun.star.awt.XTextListener
- */
- public void textChanged(TextEvent textEvent)
- {
- invoke(getEventSourceName(textEvent), EventNames.TEXT_CHANGED, textEvent);
- }
-
- /**
- * @see com.sun.star.awt.XWindowListener#windowResized(com.sun.star.awt.WindowEvent)
- */
- public void windowResized(WindowEvent event)
- {
- invoke(getEventSourceName(event), EventNames.WINDOW_RESIZED, event);
- }
-
- /**
- * @see com.sun.star.awt.XWindowListener#windowMoved(com.sun.star.awt.WindowEvent)
- */
- public void windowMoved(WindowEvent event)
- {
- invoke(getEventSourceName(event), EventNames.WINDOW_MOVED, event);
- }
-
- /**
- * @see com.sun.star.awt.XWindowListener#windowShown(com.sun.star.lang.EventObject)
- */
- public void windowShown(EventObject event)
- {
- invoke(getEventSourceName(event), EventNames.WINDOW_SHOWN, event);
- }
-
- /**
- * @see com.sun.star.awt.XWindowListener#windowHidden(com.sun.star.lang.EventObject)
- */
- public void windowHidden(EventObject event)
- {
- invoke(getEventSourceName(event), EventNames.WINDOW_HIDDEN, event);
- }
-
- /**
- * @see com.sun.star.awt.XMouseListener#mousePressed(com.sun.star.awt.MouseEvent)
- */
- public void mousePressed(MouseEvent event)
- {
- invoke(getEventSourceName(event), EventNames.MOUSE_PRESSED, event);
- }
-
- /**
- * @see com.sun.star.awt.XMouseListener#mouseReleased(com.sun.star.awt.MouseEvent)
- */
- public void mouseReleased(MouseEvent event)
- {
- invoke(getEventSourceName(event), EventNames.KEY_RELEASED, event);
- }
-
- /**
- * @see com.sun.star.awt.XMouseListener#mouseEntered(com.sun.star.awt.MouseEvent)
- */
- public void mouseEntered(MouseEvent event)
- {
- invoke(getEventSourceName(event), EventNames.MOUSE_ENTERED, event);
- }
-
- /**
- * @see com.sun.star.awt.XMouseListener#mouseExited(com.sun.star.awt.MouseEvent)
- */
- public void mouseExited(MouseEvent event)
- {
- invoke(getEventSourceName(event), EventNames.MOUSE_EXITED, event);
- }
-
- /**
- * @see com.sun.star.awt.XFocusListener#focusGained(com.sun.star.awt.FocusEvent)
- */
- public void focusGained(FocusEvent event)
- {
- invoke(getEventSourceName(event), EventNames.FOCUS_GAINED, event);
- }
-
- /**
- * @see com.sun.star.awt.XFocusListener#focusLost(com.sun.star.awt.FocusEvent)
- */
- public void focusLost(FocusEvent event)
- {
- invoke(getEventSourceName(event), EventNames.FOCUS_LOST, event);
- }
-
- /**
- * @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)
- */
- public void keyPressed(KeyEvent event)
- {
- invoke(getEventSourceName(event), EventNames.KEY_PRESSED, event);
- }
-
- /**
- * @see com.sun.star.awt.XKeyListener#keyReleased(com.sun.star.awt.KeyEvent)
- */
- public void keyReleased(KeyEvent event)
- {
- invoke(getEventSourceName(event), EventNames.KEY_RELEASED, event);
- }
-}
commit 207f6c7ee15742005b2b37f26a3e2de5cb010421
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 10:22:47 2014 +0200
java,wizards: convert event listeners to inner classes
Change-Id: I3c30d3865302741c7fbdc811e32686a921b6a4df
diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java
index b9806b5..ee994b4 100644
--- a/wizards/com/sun/star/wizards/form/Finalizer.java
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -17,11 +17,13 @@
*/
package com.sun.star.wizards.form;
+import com.sun.star.awt.TextEvent;
import com.sun.star.awt.XRadioButton;
import com.sun.star.awt.XTextComponent;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
/**
*
@@ -56,7 +58,12 @@ public class Finalizer
{
UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 111
});
- txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this,
+ txtFormName = CurUnoDialog.insertTextField("txtFormName", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent event) {
+ toggleFinishButton();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH
@@ -106,7 +113,7 @@ public class Finalizer
}
}
- public void toggleFinishButton()
+ private void toggleFinishButton()
{
CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0);
}
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
index 6cf03b6..8efe9ab 100644
--- a/wizards/com/sun/star/wizards/query/Finalizer.java
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.query;
+import com.sun.star.awt.TextEvent;
import com.sun.star.awt.XRadioButton;
import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.IllegalArgumentException;
@@ -28,6 +29,7 @@ import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -66,7 +68,12 @@ public class Finalizer
{
8, reslblQueryTitle, 95, 27, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 52
});
- m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", "changeTitle", this, new String[]
+ m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent event) {
+ changeTitle();
+ }
+ }, new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
@@ -119,7 +126,7 @@ public class Finalizer
});
}
- public void changeTitle()
+ private void changeTitle()
{
final String TitleName = m_aTxtTitle.getText();
m_queryWizard.enableFinishButton( TitleName.length() > 0 );
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
index af3843a..af5ea07 100644
--- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -16,15 +16,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.report;
-import com.sun.star.uno.Exception;
-import com.sun.star.wizards.common.*;
-import com.sun.star.wizards.ui.*;
-import com.sun.star.wizards.ui.event.XItemListenerAdapter;
import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.TextEvent;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.db.RecordParser;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
public class ReportFinalizer
{
@@ -33,7 +39,6 @@ public class ReportFinalizer
XTextComponent xTitleTextBox;
XTextComponent[] xSaveTextBox = new XTextComponent[2];
Object chkTemplate;
- String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
String TemplatePath;
String StoreName;
boolean bfinalaskbeforeOverwrite;
@@ -70,7 +75,12 @@ public class ReportFinalizer
8, sReportTitle, 95, 27, Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 68
});
- xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this,
+ xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent arg0) {
+ changeReportTitle();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -211,7 +221,7 @@ public class ReportFinalizer
return StorePath;
}
- public void changeReportTitle()
+ private void changeReportTitle()
{
final String TitleName = xTitleTextBox.getText();
CurReportDocument.liveupdate_updateReportTitle(TitleName);
diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java
index cad7425..a9a41ca 100644
--- a/wizards/com/sun/star/wizards/table/FieldFormatter.java
+++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java
@@ -20,6 +20,7 @@ package com.sun.star.wizards.table;
import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.TextEvent;
import com.sun.star.awt.XButton;
import com.sun.star.awt.XItemListener;
import com.sun.star.awt.XListBox;
@@ -35,6 +36,7 @@ import com.sun.star.wizards.db.TableDescriptor;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.event.XActionListenerAdapter;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
public class FieldFormatter implements XItemListener
{
@@ -49,10 +51,6 @@ public class FieldFormatter implements XItemListener
XButton btnShiftUp;
XButton btnShiftDown;
short curtabindex;
- String TOGGLEBUTTONS = "toggleButtons";
- String ADDFIELDNAME = "addFieldName";
- String REMOVEFIELDNAME = "removeFieldName";
- String MODIFYFIELDNAME = "modifyFieldName";
String[] fieldnames;
String suntitled;
Integer IFieldFormatStep;
@@ -183,7 +181,12 @@ public class FieldFormatter implements XItemListener
UIConsts.INTEGERS[8], sFieldName, 158, 39, IFieldFormatStep, Short.valueOf(curtabindex++), 94
});
- txtfieldname = CurUnoDialog.insertTextField("txtfieldname", MODIFYFIELDNAME, this,
+ txtfieldname = CurUnoDialog.insertTextField("txtfieldname", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent event) {
+ modifyFieldName();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH
diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java
index 5d081ec..f4cb9d4 100644
--- a/wizards/com/sun/star/wizards/table/Finalizer.java
+++ b/wizards/com/sun/star/wizards/table/Finalizer.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.table;
+import com.sun.star.awt.TextEvent;
import com.sun.star.awt.XListBox;
import com.sun.star.awt.XRadioButton;
import com.sun.star.awt.XTextComponent;
@@ -26,6 +27,7 @@ import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.db.TableDescriptor;
import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
public class Finalizer
{
@@ -39,7 +41,6 @@ public class Finalizer
XListBox xCatalogListBox;
XListBox xSchemaListBox;
TableDescriptor curtabledescriptor;
- public String SETCOMPLETIONFLAG = "setCompletionFlag";
public static int WORKWITHTABLEMODE = 0;
public static int MODIFYTABLEMODE = 1;
public static int STARTFORMWIZARDMODE = 2;
@@ -76,7 +77,12 @@ public class Finalizer
{
UIConsts.INTEGERS[8], slblTableName, 97, 25, IFINALSTEP, 220
});
- txtTableName = CurUnoDialog.insertTextField("txtTableName", SETCOMPLETIONFLAG, this,
+ txtTableName = CurUnoDialog.insertTextField("txtTableName", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent event) {
+ setCompletionFlag();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH
@@ -344,7 +350,7 @@ public class Finalizer
return (txtTableName.getText().length() > 0);
}
- public void setCompletionFlag()
+ private void setCompletionFlag()
{
CurUnoDialog.setcompleted(TableWizard.SOFINALPAGE, iscompleted());
}
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java
index 207c97b..7fa09c5 100644
--- a/wizards/com/sun/star/wizards/ui/PathSelection.java
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.java
@@ -18,6 +18,7 @@
package com.sun.star.wizards.ui;
import com.sun.star.awt.ActionEvent;
+import com.sun.star.awt.TextEvent;
import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.Exception;
@@ -25,6 +26,7 @@ import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.SystemDialog;
import com.sun.star.wizards.ui.event.XActionListenerAdapter;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
public class PathSelection
{
@@ -74,7 +76,13 @@ public class PathSelection
Boolean.valueOf(Enabled), 8, LabelText, Integer.valueOf(XPos), Integer.valueOf(YPos), Integer.valueOf(DialogStep), Short.valueOf(CurTabIndex), Integer.valueOf(Width)
});
- xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", this, new String[]
+ xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent arg0) {
+ callXPathSelectionListener();
+ }
+ },
+ new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
@@ -174,7 +182,7 @@ public class PathSelection
}
}
- public void callXPathSelectionListener()
+ private void callXPathSelectionListener()
{
if (xAction != null)
{
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java
index 5b4eefe..0726670 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java
@@ -55,7 +55,6 @@ public class UnoDialog
public Resource m_oResource;
public XWindowPeer xWindowPeer = null;
private PeerConfig m_oPeerConfig;
- protected final CommonListener guiEventListener = new CommonListener();
public UnoDialog(XMultiServiceFactory xMSF)
{
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index 0c91277..f91fbf9 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -27,6 +27,7 @@ import com.sun.star.awt.XProgressBar;
import com.sun.star.awt.XRadioButton;
import com.sun.star.awt.XScrollBar;
import com.sun.star.awt.XTextComponent;
+import com.sun.star.awt.XTextListener;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
@@ -34,7 +35,6 @@ import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.SystemDialog;
-import com.sun.star.wizards.ui.event.EventNames;
/**
* This class contains convenience methods for inserting components to a dialog.
@@ -115,9 +115,9 @@ public class UnoDialog2 extends UnoDialog
return UnoRuntime.queryInterface(XControl.class, oTitledBox);
}
- public XTextComponent insertTextField(String sName, String sTextChangedMethodName, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ public XTextComponent insertTextField(String sName, XTextListener textListener, String[] sPropNames, Object[] oPropValues)
{
- return (XTextComponent) insertEditField(sName, sTextChangedMethodName, eventTarget, "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, XTextComponent.class);
+ return (XTextComponent) insertEditField(sName, textListener, "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, XTextComponent.class);
}
public XControl insertImage(String sName, String[] sPropNames, Object[] oPropValues)
@@ -144,13 +144,12 @@ public class UnoDialog2 extends UnoDialog
* This method is used for creating Edit, Currency, Date, Formatted, Pattern, File
* and Time edit components.
*/
- private Object insertEditField(String sName, String sTextChangedMethodName, Object eventTarget, String sModelClass, String[] sPropNames, Object[] oPropValues, Class<? extends XInterface> type)
+ private Object insertEditField(String sName, XTextListener textListener, String sModelClass, String[] sPropNames, Object[] oPropValues, Class<? extends XInterface> type)
{
XTextComponent xField = (XTextComponent) insertControlModel2(sModelClass, sName, sPropNames, oPropValues, XTextComponent.class);
- if (sTextChangedMethodName != null)
+ if (textListener != null)
{
- xField.addTextListener(guiEventListener);
- guiEventListener.add(sName, EventNames.TEXT_CHANGED, sTextChangedMethodName, eventTarget);
+ xField.addTextListener(textListener);
}
return UnoRuntime.queryInterface(type, xField);
}
commit 40f7f1cf749d788b328bd132ed4bbeb1a19ee90b
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 10:13:50 2014 +0200
java,wizards: convert event listeners to inner classes
Change-Id: I01143a9f3a3b563bf5da58dc4a8ed38c440a5c62
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index cc77d05..2a5288e 100644
--- a/wizards/com/sun/star/wizards/form/FormConfiguration.java
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.form;
+import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XFixedText;
@@ -29,6 +30,7 @@ import com.sun.star.wizards.ui.CommandFieldSelection;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.ui.event.XActionListenerAdapter;
import com.sun.star.wizards.ui.event.XItemListenerAdapter;
/**
@@ -48,7 +50,6 @@ public class FormConfiguration
XListBox lstRelations;
String[] sreferencedTables;
CommandFieldSelection CurSubFormFieldSelection;
- String SONEXISTINGRELATIONSELECTION = "onexistingRelationSelection";
boolean bsupportsRelations;
RelationController oRelationController = null;
@@ -115,7 +116,17 @@ public class FormConfiguration
{
Boolean.FALSE, 19, sSelectRelation, Boolean.TRUE, 119, 56, ISubFormStep, Short.valueOf(curtabindex++), 80
});
- lstRelations = CurUnoDialog.insertListBox("lstrelations", SONEXISTINGRELATIONSELECTION, SONEXISTINGRELATIONSELECTION, this,
+ lstRelations = CurUnoDialog.insertListBox("lstrelations", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ onexistingRelationSelection();
+ }
+ }, new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ onexistingRelationSelection();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -205,7 +216,7 @@ public class FormConfiguration
return PropertyNames.EMPTY_STRING;
}
- public void onexistingRelationSelection()
+ private void onexistingRelationSelection()
{
String scurreferencedTableName = getreferencedTableName();
if (scurreferencedTableName.length() > 0)
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
index 8fa04b0..17abf91 100644
--- a/wizards/com/sun/star/wizards/form/StyleApplier.java
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -39,7 +39,9 @@ import com.sun.star.wizards.document.DatabaseControl;
import com.sun.star.wizards.document.GridControl;
import com.sun.star.wizards.document.TimeStampControl;
import com.sun.star.wizards.text.TextStyleHandler;
-import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.WizardDialog;
import com.sun.star.wizards.ui.event.XItemListenerAdapter;
public class StyleApplier
@@ -52,7 +54,6 @@ public class StyleApplier
private final XListBox lstStyles;
private final FormDocument curFormDocument;
private short iOldLayoutPos;
- private static final String SCHANGELAYOUT = "changeLayout";
private String[] StyleNames;
private String[] FileNames;
private final static int SOBACKGROUNDCOLOR = 0;
@@ -92,7 +93,12 @@ public class StyleApplier
UIConsts.INTEGERS[8], sPageStyles, 92, 25, IStyleStep, Short.valueOf(curtabindex++), 90
});
- lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this,
+ lstStyles = CurUnoDialog.insertListBox("lstStyles", null, new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ changeLayout();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -212,7 +218,7 @@ public class StyleApplier
}
}
- public void changeLayout()
+ private void changeLayout()
{
short iPos = lstStyles.getSelectedItemPos();
if (iPos != iOldLayoutPos)
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
index b99bd0b..d8fb8ee 100644
--- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.table;
+import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XFixedText;
@@ -34,6 +35,7 @@ import com.sun.star.wizards.ui.FieldSelection;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.XFieldSelectionListener;
+import com.sun.star.wizards.ui.event.XActionListenerAdapter;
import com.sun.star.wizards.ui.event.XItemListenerAdapter;
public class PrimaryKeyHandler implements XFieldSelectionListener
@@ -165,7 +167,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, 116, 117, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 46
});
- lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this,
+ lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ onPrimeKeySelected();
+ }
+ }, null,
new String[]
{
"Dropdown",
@@ -363,7 +370,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
return bischecked;
}
- public void onPrimeKeySelected()
+ private void onPrimeKeySelected()
{
try
{
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index bdcfbe8..0c91277 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -85,27 +85,20 @@ public class UnoDialog2 extends UnoDialog
return xCheckBox;
}
- public XListBox insertListBox(String sName, String actionPerformedMethodName, String itemChangedMethodName, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ public XListBox insertListBox(String sName, XActionListener actionListener, XItemListener itemListener, String[] sPropNames, Object[] oPropValues)
{
XListBox xListBox = (XListBox) insertControlModel2("com.sun.star.awt.UnoControlListBoxModel", sName, sPropNames, oPropValues, XListBox.class);
- if (actionPerformedMethodName != null)
+ if (actionListener != null)
{
- xListBox.addActionListener(guiEventListener);
- guiEventListener.add(sName, EventNames.ACTION_PERFORMED, actionPerformedMethodName, eventTarget);
+ xListBox.addActionListener(actionListener);
}
- if (itemChangedMethodName != null)
+ if (itemListener != null)
{
- xListBox.addItemListener(guiEventListener);
- guiEventListener.add(sName, EventNames.ITEM_CHANGED, itemChangedMethodName, eventTarget);
+ xListBox.addItemListener(itemListener);
}
return xListBox;
}
- public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, String[] sPropNames, Object[] oPropValues)
- {
- return insertListBox(sName, actionPerformed, itemChanged, this, sPropNames, oPropValues);
- }
-
public XRadioButton insertRadioButton(String sName, XItemListener itemListener, String[] sPropNames, Object[] oPropValues)
{
XRadioButton xRadioButton = (XRadioButton) insertControlModel2("com.sun.star.awt.UnoControlRadioButtonModel", sName, sPropNames, oPropValues, XRadioButton.class);
commit 7af4d5e8c91cf7c57f8b5471ac8201a9fe1240dc
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 10:02:13 2014 +0200
java,wizards: convert event listeners to inner classes
Change-Id: Ia95a07f798de01bfedcce6cd5e97090e165a7ca9
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
index f21817f..f653bf3 100644
--- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java
+++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
@@ -17,15 +17,17 @@
*/
package com.sun.star.wizards.form;
+import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XRadioButton;
import com.sun.star.beans.PropertyValue;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.WizardDialog;
-import com.sun.star.wizards.ui.UIConsts;
-import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
public class DataEntrySetter
{
@@ -46,7 +48,12 @@ public class DataEntrySetter
String sNoAddition = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 49); // AlowInserts
String sdontdisplayExistingData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 45);
- CurUnoDialog.insertRadioButton("optNewDataOnly", "toggleCheckBoxes", this,
+ CurUnoDialog.insertRadioButton("optNewDataOnly", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleCheckBoxes();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -56,7 +63,12 @@ public class DataEntrySetter
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, 98, 25, IDataStep, Short.valueOf(curtabindex++), 195
});
- optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this,
+ optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleCheckBoxes();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -125,7 +137,7 @@ public class DataEntrySetter
}
- public void toggleCheckBoxes()
+ private void toggleCheckBoxes()
{
boolean bdisplayalldata = optDisplayAllData.getState();
Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index 0214a32..cc77d05 100644
--- a/wizards/com/sun/star/wizards/form/FormConfiguration.java
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -48,7 +48,6 @@ public class FormConfiguration
XListBox lstRelations;
String[] sreferencedTables;
CommandFieldSelection CurSubFormFieldSelection;
- String STOGGLESTEPS = "toggleSteps";
String SONEXISTINGRELATIONSELECTION = "onexistingRelationSelection";
boolean bsupportsRelations;
RelationController oRelationController = null;
@@ -79,7 +78,12 @@ public class FormConfiguration
{
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, 97, 26, ISubFormStep, Short.valueOf(curtabindex++), 160
});
- optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", STOGGLESTEPS, this,
+ optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSteps();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -88,7 +92,12 @@ public class FormConfiguration
{
Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, 107, 43, ISubFormStep, Short.valueOf(curtabindex++), 160
});
- optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", STOGGLESTEPS, this,
+ optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSteps();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
index 262fc4f..8fa04b0 100644
--- a/wizards/com/sun/star/wizards/form/StyleApplier.java
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.form;
+import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XListBox;
import com.sun.star.awt.XRadioButton;
import com.sun.star.beans.XPropertySet;
@@ -39,6 +40,7 @@ import com.sun.star.wizards.document.GridControl;
import com.sun.star.wizards.document.TimeStampControl;
import com.sun.star.wizards.text.TextStyleHandler;
import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
public class StyleApplier
{
@@ -51,7 +53,6 @@ public class StyleApplier
private final FormDocument curFormDocument;
private short iOldLayoutPos;
private static final String SCHANGELAYOUT = "changeLayout";
- private static final String SCHANGEBORDERTYPE = "changeBorderLayouts";
private String[] StyleNames;
private String[] FileNames;
private final static int SOBACKGROUNDCOLOR = 0;
@@ -101,7 +102,12 @@ public class StyleApplier
143, "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", 92, 35, SelLayoutPos, IStyleStep, this.StyleNames, Short.valueOf(curtabindex++), 90
});
- optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", SCHANGEBORDERTYPE, this,
+ optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ changeBorderLayouts();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH
@@ -111,7 +117,12 @@ public class StyleApplier
UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, 196, 39, IStyleStep, Short.valueOf(curtabindex++), "0", 93
});
- opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", SCHANGEBORDERTYPE, this,
+ opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ changeBorderLayouts();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH
@@ -121,7 +132,12 @@ public class StyleApplier
UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, 196, 53, Short.valueOf((short) 1), IStyleStep, Short.valueOf(curtabindex++), "1", 93
});
- CurUnoDialog.insertRadioButton("otpFlat", SCHANGEBORDERTYPE, this,
+ CurUnoDialog.insertRadioButton("otpFlat", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ changeBorderLayouts();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH
@@ -214,7 +230,7 @@ public class StyleApplier
return IBorderValue;
}
- public void changeBorderLayouts()
+ private void changeBorderLayouts()
{
try
{
diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java
index 9c77005..0f70029 100644
--- a/wizards/com/sun/star/wizards/form/UIControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java
@@ -29,6 +29,7 @@ import com.sun.star.wizards.document.Control;
import com.sun.star.wizards.ui.ButtonList;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
import javax.swing.DefaultListModel;
import javax.swing.ListModel;
@@ -47,7 +48,6 @@ public class UIControlArranger
private final Integer IControlStep;
private static final int SOBASEIMAGEYPOSITION = 66;
private static final int SOIMAGELISTHEIGHT = 60;
- private static final String SOALIGNMETHOD = "alignLabelControls";
public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument)
{
@@ -70,7 +70,12 @@ public class UIControlArranger
UIConsts.INTEGERS[8], sLabelPlacment, 97, 25, IControlStep, Short.valueOf(curtabindex++), 207
});
// Radio Button "Align Left"
- optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this,
+ optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ alignLabelControls();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -80,7 +85,12 @@ public class UIControlArranger
UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, 107, 38, Short.valueOf((short) 1), IControlStep, Short.valueOf(curtabindex++), 171
});
// Radio Button "Align Right"
- optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this,
+ optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ alignLabelControls();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -148,7 +158,7 @@ public class UIControlArranger
return optAlignLeft.getState() ? (short)0 : (short)2;
}
- public void alignLabelControls()
+ private void alignLabelControls()
{
try
{
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
index 4386d8a..af3843a 100644
--- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -19,10 +19,13 @@ package com.sun.star.wizards.report;
import com.sun.star.uno.Exception;
import com.sun.star.wizards.common.*;
import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
+import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.db.RecordParser;
+
public class ReportFinalizer
{
@@ -31,7 +34,6 @@ public class ReportFinalizer
XTextComponent[] xSaveTextBox = new XTextComponent[2];
Object chkTemplate;
String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
- String TOGGLESUBTEMPLATECONTROLS_FUNCNAME = "toggleSubTemplateControls";
String TemplatePath;
String StoreName;
boolean bfinalaskbeforeOverwrite;
@@ -88,7 +90,12 @@ public class ReportFinalizer
8, slblChooseReportKind, 95, 57, Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 209
});
- CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ CurUnoDialog.insertRadioButton("optCreateDocument", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSubTemplateControls();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -98,7 +105,12 @@ public class ReportFinalizer
10, "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, 95, 69, Short.valueOf((short) 0), Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 138
});
- CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ CurUnoDialog.insertRadioButton("optCreateReportTemplate", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSubTemplateControls();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -120,7 +132,12 @@ public class ReportFinalizer
});
- CurUnoDialog.insertRadioButton("optEditTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ CurUnoDialog.insertRadioButton("optEditTemplate", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSubTemplateControls();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -130,7 +147,12 @@ public class ReportFinalizer
10, "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, 111, 105, 6, Short.valueOf(curtabindex++), 138
});
- CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ CurUnoDialog.insertRadioButton("optUseTemplate", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSubTemplateControls();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -142,10 +164,10 @@ public class ReportFinalizer
}
- /*
+ /**
* This function is called if one of the radio buttons is pressed
*/
- public void toggleSubTemplateControls()
+ private void toggleSubTemplateControls()
{
// String sStorePath = PropertyNames.EMPTY_STRING;
Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", PropertyNames.PROPERTY_STATE);
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
index 9cf40f1..b99bd0b 100644
--- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -40,7 +40,6 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
{
private final TableWizard CurUnoDialog;
- private final static String SPRIMEKEYMODE = "togglePrimeKeyFields";
private final XRadioButton optAddAutomatically;
private final XRadioButton optUseExisting;
private final XRadioButton optUseSeveral;
@@ -96,7 +95,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, 97, 70, Short.valueOf((short) 1), IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 160
});
- optAddAutomatically = CurUnoDialog.insertRadioButton("optAddAutomatically", SPRIMEKEYMODE, this,
+ optAddAutomatically = CurUnoDialog.insertRadioButton("optAddAutomatically", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ togglePrimeKeyFields();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -106,7 +110,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, 106, 82, Short.valueOf((short) 1), IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 200
});
- optUseExisting = CurUnoDialog.insertRadioButton("optUseExisting", SPRIMEKEYMODE, this,
+ optUseExisting = CurUnoDialog.insertRadioButton("optUseExisting", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ togglePrimeKeyFields();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -116,7 +125,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, 106, 104, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 200
});
- optUseSeveral = CurUnoDialog.insertRadioButton("optUseSeveral", SPRIMEKEYMODE, this,
+ optUseSeveral = CurUnoDialog.insertRadioButton("optUseSeveral", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ togglePrimeKeyFields();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
index f966df4..505d9e4 100644
--- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -37,6 +37,7 @@ import com.sun.star.wizards.ui.FieldSelection;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.XFieldSelectionListener;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
/**
* To change the template for this generated type comment go to
@@ -53,7 +54,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
private final TableDescriptor curtabledescriptor;
private final CGCategory oCGCategory;
protected CGTable oCGTable;
- private static final String SELECTCATEGORY = "selectCategory";
protected boolean bcolumnnameislimited;
private final int imaxcolumnchars;
private final String smytable;
@@ -100,7 +100,12 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
8, sCategories, 91, 60, IMAINSTEP, Short.valueOf(pretabindex++), 100
});
- optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this,
+ optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ selectCategory();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -110,7 +115,12 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, 98, 70, Short.valueOf((short) 1), IMAINSTEP, Short.valueOf(pretabindex++), 78
});
- CurTableWizardUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this,
+ CurTableWizardUnoDialog.insertRadioButton("optPrivate", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ selectCategory();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -149,7 +159,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
initializeCategory(BUSINESS);
}
- public void selectCategory()
+ private void selectCategory()
{
if (optBusiness.getState())
{
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index 77f0fa3..bdcfbe8 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -106,22 +106,16 @@ public class UnoDialog2 extends UnoDialog
return insertListBox(sName, actionPerformed, itemChanged, this, sPropNames, oPropValues);
}
- public XRadioButton insertRadioButton(String sName, String itemChangedMethodName, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ public XRadioButton insertRadioButton(String sName, XItemListener itemListener, String[] sPropNames, Object[] oPropValues)
{
XRadioButton xRadioButton = (XRadioButton) insertControlModel2("com.sun.star.awt.UnoControlRadioButtonModel", sName, sPropNames, oPropValues, XRadioButton.class);
- if (itemChangedMethodName != null)
+ if (itemListener != null)
{
- xRadioButton.addItemListener(guiEventListener);
- guiEventListener.add(sName, EventNames.ITEM_CHANGED, itemChangedMethodName, eventTarget);
+ xRadioButton.addItemListener(itemListener);
}
return xRadioButton;
}
- public XRadioButton insertRadioButton(String sName, String itemChanged, String[] sPropNames, Object[] oPropValues)
- {
- return insertRadioButton(sName, itemChanged, this, sPropNames, oPropValues);
- }
-
public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues)
{
Object oTitledBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues);
commit 3d16e27d89298d4cf9efb46410c139fe1d46fa83
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 09:53:48 2014 +0200
java,wizards: convert event listeners to inner classes
Change-Id: Id6a6991704009b909e5108daf65c48722fa97447
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index b0b052b..0214a32 100644
--- a/wizards/com/sun/star/wizards/form/FormConfiguration.java
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -17,17 +17,19 @@
*/
package com.sun.star.wizards.form;
+import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XFixedText;
import com.sun.star.awt.XListBox;
import com.sun.star.awt.XRadioButton;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.db.RelationController;
import com.sun.star.wizards.ui.CommandFieldSelection;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.WizardDialog;
-import com.sun.star.wizards.db.RelationController;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
/**
* To change the template for this generated type comment go to
@@ -46,7 +48,6 @@ public class FormConfiguration
XListBox lstRelations;
String[] sreferencedTables;
CommandFieldSelection CurSubFormFieldSelection;
- String SSUBFORMMODE = "toggleSubFormMode";
String STOGGLESTEPS = "toggleSteps";
String SONEXISTINGRELATIONSELECTION = "onexistingRelationSelection";
boolean bsupportsRelations;
@@ -64,7 +65,12 @@ public class FormConfiguration
String sSubFormDescription = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 3);
// CheckBox 'Add sub form'
- chkcreateSubForm = CurUnoDialog.insertCheckBox("chkcreateSubForm", SSUBFORMMODE, this,
+ chkcreateSubForm = CurUnoDialog.insertCheckBox("chkcreateSubForm", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ toggleSubFormMode();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -132,7 +138,7 @@ public class FormConfiguration
return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState()));
}
- public void toggleSubFormMode()
+ private void toggleSubFormMode()
{
boolean bdoEnable = (this.chkcreateSubForm.getState() == 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable && bsupportsRelations));
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
index 7ec9e5b..9cf40f1 100644
--- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.table;
+import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XFixedText;
import com.sun.star.awt.XListBox;
@@ -33,6 +34,7 @@ import com.sun.star.wizards.ui.FieldSelection;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.XFieldSelectionListener;
+import com.sun.star.wizards.ui.event.XItemListenerAdapter;
public class PrimaryKeyHandler implements XFieldSelectionListener
{
@@ -79,7 +81,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
40, sExplanations, Boolean.TRUE, 91, 27, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 233
});
- chkcreatePrimaryKey = CurUnoDialog.insertCheckBox("chkcreatePrimaryKey", SPRIMEKEYMODE, this,
+ chkcreatePrimaryKey = CurUnoDialog.insertCheckBox("chkcreatePrimaryKey", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ togglePrimeKeyFields();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -119,7 +126,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, 106, 132, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 200
});
- chkApplyAutoValueAutomatic = CurUnoDialog.insertCheckBox("chkApplyAutoValueAutomatic", SPRIMEKEYMODE, this,
+ chkApplyAutoValueAutomatic = CurUnoDialog.insertCheckBox("chkApplyAutoValueAutomatic", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ togglePrimeKeyFields();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -167,7 +179,12 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
80
});
- chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", SPRIMEKEYMODE, this,
+ chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", new XItemListenerAdapter() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ togglePrimeKeyFields();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -243,7 +260,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
return false;
}
- public void togglePrimeKeyFields()
+ private void togglePrimeKeyFields()
{
boolean bdoEnable = (this.chkcreatePrimaryKey.getState() == 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index 0226e06..77f0fa3 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -21,6 +21,7 @@ import com.sun.star.awt.XActionListener;
import com.sun.star.awt.XButton;
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XControl;
+import com.sun.star.awt.XItemListener;
import com.sun.star.awt.XListBox;
import com.sun.star.awt.XProgressBar;
import com.sun.star.awt.XRadioButton;
@@ -73,23 +74,17 @@ public class UnoDialog2 extends UnoDialog
return xButton;
}
- public XCheckBox insertCheckBox(String sName, String itemChangedMethodName, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ public XCheckBox insertCheckBox(String sName, XItemListener itemListener, String[] sPropNames, Object[] oPropValues)
{
XCheckBox xCheckBox = (XCheckBox) insertControlModel2("com.sun.star.awt.UnoControlCheckBoxModel", sName, sPropNames, oPropValues, XCheckBox.class);
- if (itemChangedMethodName != null)
+ if (itemListener != null)
{
- xCheckBox.addItemListener(guiEventListener);
- guiEventListener.add(sName, EventNames.ITEM_CHANGED, itemChangedMethodName, eventTarget);
+ xCheckBox.addItemListener(itemListener);
}
return xCheckBox;
}
- public XCheckBox insertCheckBox(String sName, String itemChangedMethodName, String[] sPropNames, Object[] oPropValues)
- {
- return insertCheckBox(sName, itemChangedMethodName, this, sPropNames, oPropValues);
- }
-
public XListBox insertListBox(String sName, String actionPerformedMethodName, String itemChangedMethodName, Object eventTarget, String[] sPropNames, Object[] oPropValues)
{
XListBox xListBox = (XListBox) insertControlModel2("com.sun.star.awt.UnoControlListBoxModel", sName, sPropNames, oPropValues, XListBox.class);
commit 57a2f61e1b5c57ba78b07178dc37dc4b80005ab6
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 25 08:50:54 2014 +0200
java,wizards: convert event listeners to inner classes
Change-Id: I8379bb8194b86a194c351c5e33e1765b8feb59d2
diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java
index ffd548e..cad7425 100644
--- a/wizards/com/sun/star/wizards/table/FieldFormatter.java
+++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.table;
+import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XButton;
@@ -33,6 +34,7 @@ import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.db.TableDescriptor;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.event.XActionListenerAdapter;
public class FieldFormatter implements XItemListener
{
@@ -98,7 +100,12 @@ public class FieldFormatter implements XItemListener
FontDescriptor oFontDesc = new FontDescriptor();
oFontDesc.Name = "StarSymbol";
- btnShiftUp = CurUnoDialog.insertButton("btnShiftUp", "shiftFieldNameUp", this,
+ btnShiftUp = CurUnoDialog.insertButton("btnShiftUp", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ shiftFieldNameUp();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -108,7 +115,12 @@ public class FieldFormatter implements XItemListener
Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), 158, 139, IFieldFormatStep, Short.valueOf(curtabindex++), 14
});
- btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", "shiftFieldNameDown", this,
+ btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ shiftFieldNameDown();
+ }
+ },
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -120,7 +132,12 @@ public class FieldFormatter implements XItemListener
oFontDesc = new FontDescriptor();
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
oFontDesc.Height = (short) 13;
- btnminus = CurUnoDialog.insertButton("btnminus", "removeFieldName", this,
+ btnminus = CurUnoDialog.insertButton("btnminus", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ removeFieldName();
+ }
+ },
new String[]
{
PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -130,7 +147,12 @@ public class FieldFormatter implements XItemListener
oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", 118, 175, IFieldFormatStep, Short.valueOf(curtabindex++), 14
});
- btnplus = CurUnoDialog.insertButton("btnplus", "addFieldName", this,
+ btnplus = CurUnoDialog.insertButton("btnplus", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ addFieldName();
+ }
+ },
new String[]
{
PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
@@ -230,7 +252,7 @@ public class FieldFormatter implements XItemListener
CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated);
}
- public void addFieldName()
+ private void addFieldName()
{
String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, PropertyNames.EMPTY_STRING);
short icount = xlstFieldNames.getItemCount();
@@ -251,7 +273,7 @@ public class FieldFormatter implements XItemListener
}
}
- public void removeFieldName()
+ private void removeFieldName()
{
String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames);
@@ -323,7 +345,7 @@ public class FieldFormatter implements XItemListener
}
}
- public void shiftFieldNameUp()
+ private void shiftFieldNameUp()
{
short ipos = xlstFieldNames.getSelectedItemPos();
String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1);
@@ -339,7 +361,7 @@ public class FieldFormatter implements XItemListener
toggleButtons();
}
- public void shiftFieldNameDown()
+ private void shiftFieldNameDown()
{
short ipos = xlstFieldNames.getSelectedItemPos();
String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1);
diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java
index 81069ec..76d06fb 100644
--- a/wizards/com/sun/star/wizards/ui/ButtonList.java
+++ b/wizards/com/sun/star/wizards/ui/ButtonList.java
@@ -17,6 +17,10 @@
*/
package com.sun.star.wizards.ui;
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+
+import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.Size;
import com.sun.star.awt.XActionListener;
import com.sun.star.awt.XButton;
@@ -28,15 +32,12 @@ import com.sun.star.awt.XItemListener;
import com.sun.star.awt.XWindow;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.HelpIds;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.IRenderer;
-import com.sun.star.wizards.common.PropertySetHelper;
import com.sun.star.wizards.common.PropertyNames;
-
-import javax.swing.ListModel;
-import javax.swing.event.ListDataEvent;
-
-import com.sun.star.wizards.common.HelpIds;
+import com.sun.star.wizards.common.PropertySetHelper;
+import com.sun.star.wizards.ui.event.XActionListenerAdapter;
public class ButtonList implements XItemEventBroadcaster, XActionListener
{
@@ -149,7 +150,12 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
final Integer btnSize = Integer.valueOf(14);
// TODO: if list of strings not the same length of list object, office will die.
- btnBack = dialog.insertButton(m_aControlName + "_btnBack", "prevPage", this, pNames1, new Object[]
+ btnBack = dialog.insertButton(m_aControlName + "_btnBack", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ prevPage();
+ }
+ }, pNames1, new Object[]
{
btnSize,
HelpIds.getHelpIdString(helpURL++),
@@ -161,7 +167,12 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
btnSize
});
- btnNext = dialog.insertButton(m_aControlName + "_btnNext", "nextPage", this, pNames1, new Object[]
+ btnNext = dialog.insertButton(m_aControlName + "_btnNext", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ nextPage();
+ }
+ }, pNames1, new Object[]
{
btnSize,
HelpIds.getHelpIdString(helpURL++),
@@ -563,7 +574,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
showButtons = b;
}
- public void nextPage()
+ private void nextPage()
{
if (pageStart < getListModel().getSize() - rows * cols)
{
@@ -571,7 +582,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
}
}
- public void prevPage()
+ private void prevPage()
{
if (pageStart == 0)
{
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
index e3139ff..163a354 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.ui;
+import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.Key;
import com.sun.star.awt.KeyEvent;
import com.sun.star.awt.MouseEvent;
@@ -223,7 +224,12 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
{
final Integer btnSize = 14;
- btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[]
+ btnBack = dialog.insertButton(name + "_btnBack", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ prevPage();
+ }
+ }, pNames1, new Object[]
{
btnSize,
HelpIds.getHelpIdString(helpURL++),
@@ -235,7 +241,12 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
btnSize
});
- btnNext = dialog.insertButton(name + "_btnNext", "nextPage", this, pNames1, new Object[]
+ btnNext = dialog.insertButton(name + "_btnNext", new XActionListenerAdapter() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ nextPage();
+ }
+ }, pNames1, new Object[]
{
btnSize,
HelpIds.getHelpIdString(helpURL++),
@@ -722,7 +733,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
showButtons = b;
}
- public void nextPage()
+ private void nextPage()
{
if (pageStart < getListModel().getSize() - rows * cols)
{
@@ -730,7 +741,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}
}
- public void prevPage()
+ private void prevPage()
{
if (pageStart == 0)
{
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java
index d5dc742..207c97b 100644
--- a/wizards/com/sun/star/wizards/ui/PathSelection.java
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.java
@@ -17,12 +17,14 @@
*/
package com.sun.star.wizards.ui;
+import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.Exception;
import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.ui.event.XActionListenerAdapter;
public class PathSelection
{
@@ -81,7 +83,12 @@ public class PathSelection
});
//CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.READ_ONLY, Boolean.TRUE);
CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
- CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", this, new String[]
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list