diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-05 10:50:07 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-12-05 11:15:54 +0200 |
commit | 4ae96069bbdc243c40e98872fe5090f6bf4880f1 (patch) | |
tree | 7263f378464100d846a3b2436c86b96d9f6b2f86 | |
parent | c483ac1f20354170fe66fc42823932bd6aa7d210 (diff) |
java: static fields should be accessed in a static way
Change-Id: I727e7f2a7527c60bb45f0ba5d0e88a66c5ccdd6f
7 files changed, 24 insertions, 44 deletions
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index 1a7338e735a7..52651bba0269 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -47,7 +47,6 @@ public class NumberFormatter public XNumberFormats xNumberFormats; public XNumberFormatTypes xNumberFormatTypes; public XPropertySet xNumberFormatSettings; - private static final boolean bNullDateCorrectionIsDefined = false; private final Locale aLocale; @@ -165,22 +164,15 @@ public class NumberFormatter public long getNullDateCorrection() { - if (!this.bNullDateCorrectionIsDefined) - { - com.sun.star.util.Date dNullDate = (com.sun.star.util.Date) Helper.getUnoStructValue(this.xNumberFormatSettings, "NullDate"); - long lNullDate = Helper.convertUnoDatetoInteger(dNullDate); - java.util.Calendar oCal = java.util.Calendar.getInstance(); - oCal.set(1900, 1, 1); - Date dTime = oCal.getTime(); - long lTime = dTime.getTime(); - long lDBNullDate = lTime / (3600 * 24000); - lDateCorrection = lDBNullDate - lNullDate; - return lDateCorrection; - } - else - { - return this.lDateCorrection; - } + com.sun.star.util.Date dNullDate = (com.sun.star.util.Date) Helper.getUnoStructValue(this.xNumberFormatSettings, "NullDate"); + long lNullDate = Helper.convertUnoDatetoInteger(dNullDate); + java.util.Calendar oCal = java.util.Calendar.getInstance(); + oCal.set(1900, 1, 1); + Date dTime = oCal.getTime(); + long lTime = dTime.getTime(); + long lDBNullDate = lTime / (3600 * 24000); + lDateCorrection = lDBNullDate - lNullDate; + return lDateCorrection; } diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index d28db51b6abb..e4ff97157b69 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -168,7 +168,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen if (_bAutoincrementation) { int nDataType = oTypeInspector.getAutoIncrementIndex(xColPropertySet); - if (nDataType != oTypeInspector.INVALID) + if (nDataType != TypeInspector.INVALID) { if (xColPropertySet.getPropertySetInfo().hasPropertyByName("IsAutoIncrement")) { diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index a7bfb139a0ed..fd6241a28998 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -309,9 +309,9 @@ public class Control extends Shape { String stext; short iTextLength = AnyConverter.toShort(xPropertySet.getPropertyValue("MaxTextLen")); - if (iTextLength < this.SOMAXTEXTSIZE) + if (iTextLength < SOMAXTEXTSIZE) { - stext = FormHandler.SOSIZETEXT.substring(0, this.SOMAXTEXTSIZE); + stext = FormHandler.SOSIZETEXT.substring(0, SOMAXTEXTSIZE); } else { diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java index b358f3a51f2e..4f7ffb101722 100644 --- a/wizards/com/sun/star/wizards/form/FieldLinker.java +++ b/wizards/com/sun/star/wizards/form/FieldLinker.java @@ -222,7 +222,7 @@ public class FieldLinker extends DBLimitedFieldSelection String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX); String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefined-' String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames); - for (int i = 0; i < super.rowcount; i++) + for (int i = 0; i < rowcount; i++) { super.initializeListBox(lstMasterFields[i], ViewMasterFieldNames, MasterLinkNames, i); super.initializeListBox(lstSlaveFields[i], ViewSlaveFieldNames, SlaveLinkNames, i); diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index 07995ad8d9c2..54797e3e3b7d 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -39,7 +39,6 @@ public class CommandFieldSelection extends FieldSelection implements Comparator< private String sTablePrefix; private short m_iSelPos = -1; private short iOldSelPos = -1; - private static final boolean bpreselectCommand = true; private boolean bgetQueries; private final WizardDialog oWizardDialog; private Collator aCollator = null; @@ -180,13 +179,10 @@ public class CommandFieldSelection extends FieldSelection implements Comparator< } else { - if (this.bpreselectCommand) + String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST)); + if (sItemList.length > 0) { - String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST)); - if (sItemList.length > 0) - { - return (short) 0; - } + return (short) 0; } return (short) -1; } @@ -272,21 +268,13 @@ public class CommandFieldSelection extends FieldSelection implements Comparator< java.util.Arrays.sort(ContentList, this); Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST, ContentList); short iSelPos = getselectedItemPos(); - if (bpreselectCommand) - { - if (iSelPos > -1) - { - bgetFields = true; - iSelArray = new short[] - { - iSelPos - }; - } - } - else + if (iSelPos > -1) { - emptyFieldsListBoxes(); - iSelArray = new short[] {iSelPos}; + bgetFields = true; + iSelArray = new short[] + { + iSelPos + }; } Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, iSelArray); toggleCommandListBox(true); diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java index 6777e5c465d1..3282282636db 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -33,7 +33,7 @@ public abstract class DBLimitedFieldSelection protected String sNoField; protected Integer IStep; protected static final int rowcount = 4; - protected final int MAXSELINDEX = rowcount - 1; + protected static final int MAXSELINDEX = rowcount - 1; protected short curtabindex; protected int iCurPosY; protected int FirstHelpIndex; diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java index a54377396b05..7fc279c778f8 100644 --- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java +++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java @@ -198,7 +198,7 @@ public class TitlesComponent extends ControlScroller { String sTitleModelName = (String) Helper.getUnoPropertyValue(_fieldtitlemodel, PropertyNames.PROPERTY_NAME); String sindex = JavaTools.getSuffixNumber(sTitleModelName); - return (String) CurUnoDialog.getControlProperty(this.SOLABELPREFIX + sindex, PropertyNames.PROPERTY_LABEL); + return (String) CurUnoDialog.getControlProperty(SOLABELPREFIX + sindex, PropertyNames.PROPERTY_LABEL); } public String[] getFieldTitles() |