diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-25 10:02:13 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-25 10:34:16 +0200 |
commit | 7af4d5e8c91cf7c57f8b5471ac8201a9fe1240dc (patch) | |
tree | ffb0fa021948e74219610c8895d37626a21f2c4f /wizards | |
parent | 3d16e27d89298d4cf9efb46410c139fe1d46fa83 (diff) |
java,wizards: convert event listeners to inner classes
Change-Id: Ia95a07f798de01bfedcce6cd5e97090e165a7ca9
Diffstat (limited to 'wizards')
8 files changed, 128 insertions, 41 deletions
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index f21817f529cc..f653bf322a46 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 0214a3251d9e..cc77d05c6075 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 262fc4f312c1..8fa04b003e19 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 9c77005cb51c..0f700299cc94 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 4386d8a7a093..af3843af2d82 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 9cf40f1fd839..b99bd0b838df 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 f966df4ffc11..505d9e443850 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 77f0fa36e6c5..bdcfbe853db3 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); |