Kaydet (Commit) 3d16e27d authored tarafından Noel Grandin's avatar Noel Grandin

java,wizards: convert event listeners to inner classes

Change-Id: Id6a6991704009b909e5108daf65c48722fa97447
üst 57a2f61e
......@@ -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));
......
......@@ -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));
......
......@@ -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);
......
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