diff options
author | Ocke Janssen <oj@openoffice.org> | 2011-03-10 12:59:15 +0100 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2011-03-10 12:59:15 +0100 |
commit | 27ef3ca46b4a2cf3963a5bc012b9d8278653c8ac (patch) | |
tree | 6c2ad51d24704ca3df6c1e4a89baf054d7e60f5e /wizards/com/sun/star/wizards/table | |
parent | 3cbf819cef381f0c5137aac3e48d398d25065178 (diff) |
dba34d: remove unnescessary casts
Diffstat (limited to 'wizards/com/sun/star/wizards/table')
7 files changed, 33 insertions, 37 deletions
diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java index ea74b33f09ad..228891c12927 100644 --- a/wizards/com/sun/star/wizards/table/CGCategory.java +++ b/wizards/com/sun/star/wizards/table/CGCategory.java @@ -75,9 +75,8 @@ public class CGCategory { try { - xNameAccessTablesNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables")); - String[] sTableNames = Configuration.getNodeDisplayNames(xNameAccessTablesNode); - return sTableNames; + xNameAccessTablesNode = UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables")); + return Configuration.getNodeDisplayNames(xNameAccessTablesNode); } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java index 21174d59ff74..e3c5c690fad3 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -167,7 +167,7 @@ public class CallTableWizard try { - byteReturn = new String(PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java index 70fa37f18a2f..95e556f920b7 100644 --- a/wizards/com/sun/star/wizards/table/FieldDescription.java +++ b/wizards/com/sun/star/wizards/table/FieldDescription.java @@ -132,7 +132,7 @@ public class FieldDescription { try { - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode); + xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode); // Integer Index = (Integer) xPropertySet.getPropertyValue("Index"); if (propertyexists(PropertyNames.PROPERTY_NAME)) { @@ -140,21 +140,21 @@ public class FieldDescription } if (propertyexists("Type")) { - aPropertyValues.addElement(Properties.createProperty("Type", (Integer) xPropertySet.getPropertyValue("Type"))); + aPropertyValues.addElement(Properties.createProperty("Type", xPropertySet.getPropertyValue("Type"))); } if (propertyexists("Scale")) { - aPropertyValues.addElement(Properties.createProperty("Scale", (Integer) xPropertySet.getPropertyValue("Scale"))); + aPropertyValues.addElement(Properties.createProperty("Scale", xPropertySet.getPropertyValue("Scale"))); // Scale = } if (propertyexists("Precision")) { - aPropertyValues.addElement(Properties.createProperty("Precision", (Integer) xPropertySet.getPropertyValue("Precision"))); + aPropertyValues.addElement(Properties.createProperty("Precision", xPropertySet.getPropertyValue("Precision"))); // Precision = (Integer) xPropertySet.getPropertyValue("Precision"); } if (propertyexists("DefaultValue")) { - aPropertyValues.addElement(Properties.createProperty("DefaultValue", (Boolean) xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue"); + aPropertyValues.addElement(Properties.createProperty("DefaultValue", xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue"); //Type = 4; // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type"); } } diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index dbf2aeb730b7..d19a6e0eb21d 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -233,9 +233,9 @@ public class FieldFormatter implements XItemListener benableShiftUpButton = (iselpos != 0); benableShiftDownButton = (iselpos != ilistcount - 1); } - Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), PropertyNames.PROPERTY_ENABLED, new Boolean(benableShiftUpButton)); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), PropertyNames.PROPERTY_ENABLED, new Boolean(benableShiftDownButton)); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(blistispopulated)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableShiftUpButton)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableShiftDownButton)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(blistispopulated)); CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated); } @@ -298,10 +298,10 @@ public class FieldFormatter implements XItemListener else { Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", PropertyNames.EMPTY_STRING); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable); } - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable)); CurUnoDialog.setControlVisible("oColumnDescriptor", benable); CurUnoDialog.repaintDialogStep(); } @@ -379,7 +379,7 @@ public class FieldFormatter implements XItemListener public boolean updateColumnofColumnDescriptor() { Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column"); - XPropertySet xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn); + XPropertySet xColPropertySet = UnoRuntime.queryInterface(XPropertySet.class, oColumn); if (xColPropertySet != null) { curTableDescriptor.modifyColumn(txtfieldname.getText(), xColPropertySet); @@ -401,8 +401,7 @@ public class FieldFormatter implements XItemListener public XPropertySet clonePropertySet(XPropertySet _xPropertySet) { - XPropertySet xlocpropertyset = null; - return xlocpropertyset; + return null; } public void itemStateChanged(ItemEvent arg0) diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 34c880c3bab5..6246b3ef037f 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -260,16 +260,16 @@ public class PrimaryKeyHandler implements XFieldSelectionListener public void togglePrimeKeyFields() { boolean bdoEnable = (this.chkcreatePrimaryKey.getState() == 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, new Boolean(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); //toggle subcontrols of the radiobuttons... toggleAutomaticAutoValueCheckBox(); boolean benableSinglePrimekeyControls = bdoEnable && optUseExisting.getState(); toggleSinglePrimeKeyFields(benableSinglePrimekeyControls); boolean benableSeveralPrimekeyControls = bdoEnable && optUseSeveral.getState(); - curPrimaryKeySelection.toggleListboxControls(new Boolean(benableSeveralPrimekeyControls)); + curPrimaryKeySelection.toggleListboxControls(Boolean.valueOf(benableSeveralPrimekeyControls)); // toggle the following steps of the dialog... if (!bdoEnable) { @@ -354,7 +354,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener String selfieldname = lstSinglePrimeKey.getSelectedItem(); boolean bdoenable = isAutoIncrementatable(selfieldname); CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname); boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue(); if (bIsAutoIncremented) @@ -378,7 +378,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener { boolean bisAutomaticMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED)); boolean bdoenable = bAutoPrimaryKeysupportsAutoIncrmentation && optAddAutomatically.getState() && bisAutomaticMode; - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable)); } catch (IllegalArgumentException e) { @@ -388,17 +388,17 @@ public class PrimaryKeyHandler implements XFieldSelectionListener private void toggleSinglePrimeKeyFields(boolean _bdoenable) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable)); boolean bdoenableAutoValueCheckBox = (isAutoIncrementatable(lstSinglePrimeKey.getSelectedItem()) && _bdoenable); - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenableAutoValueCheckBox)); + Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenableAutoValueCheckBox)); } private void toggleSeveralPrimeKeyFields() { boolean bdoEnable = (this.optUseSeveral.getState()); - curPrimaryKeySelection.toggleListboxControls(new Boolean(bdoEnable)); + curPrimaryKeySelection.toggleListboxControls(Boolean.valueOf(bdoEnable)); } public String[] getPrimaryKeyFields(TableDescriptor _curtabledescriptor) diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 8c2b52cf5244..3ee366eb761a 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -26,6 +26,7 @@ ************************************************************************/ package com.sun.star.wizards.table; +import java.util.ArrayList; import java.util.Vector; import com.sun.star.awt.ItemEvent; @@ -207,8 +208,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public String[] getSelectedFieldNames() { String[] displayfieldnames = super.getSelectedFieldNames(); - Vector<String> afieldnameVector = new Vector<String>(); - int a = 0; + ArrayList<String> afieldnameVector = new ArrayList<String>(); for (int i = 0; i < displayfieldnames.length; i++) { try @@ -216,8 +216,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(displayfieldnames[i]); if (ofielddescription != null) { - afieldnameVector.addElement(ofielddescription.getName()); - a++; + afieldnameVector.add(ofielddescription.getName()); } } catch (RuntimeException e) @@ -225,9 +224,8 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X e.printStackTrace(System.out); } } - String[] fieldnames = new String[a]; - afieldnameVector.toArray(fieldnames); - return fieldnames; + String[] fieldnames = new String[afieldnameVector.size()]; + return afieldnameVector.toArray(fieldnames); } public boolean iscompleted() diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index deb38a044f76..d5f4c706b174 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -88,7 +88,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, drawNaviBar(); fielditems = new Hashtable(); //TODO if reportResouces cannot be gotten dispose officedocument - if (getTableResources() == true) + if (getTableResources()) { setRightPaneHeaders(m_oResource, UIConsts.RID_TABLE + 8, 4); } |