Kaydet (Commit) 40f7f1cf authored tarafından Noel Grandin's avatar Noel Grandin

java,wizards: convert event listeners to inner classes

Change-Id: I01143a9f3a3b563bf5da58dc4a8ed38c440a5c62
üst 7af4d5e8
......@@ -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)
......
......@@ -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)
......
......@@ -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
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment