summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-25 10:13:50 +0200
committerNoel Grandin <noel@peralex.com>2014-11-25 10:34:19 +0200
commit40f7f1cf749d788b328bd132ed4bbeb1a19ee90b (patch)
treea32c8bd8aede5b02f4e04e5831ee0c3b4746b9d5 /wizards
parent7af4d5e8c91cf7c57f8b5471ac8201a9fe1240dc (diff)
java,wizards: convert event listeners to inner classes
Change-Id: I01143a9f3a3b563bf5da58dc4a8ed38c440a5c62
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java17
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java14
-rw-r--r--wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java11
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.java17
4 files changed, 38 insertions, 21 deletions
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index cc77d05c6075..2a5288e8c976 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 8fa04b003e19..17abf915cea9 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 b99bd0b838df..d8fb8ee9ea88 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 bdcfbe853db3..0c912779b2be 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);