summaryrefslogtreecommitdiff
path: root/wizards/com
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2018-11-06 18:43:03 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2018-11-06 19:14:23 +0100
commitfec8c14e960fbcd639a04d6c3354caff2d0bd365 (patch)
tree6438d76757d039c9ace70d7a88cc41ee95cea642 /wizards/com
parentebc5d16a99c9e6f9d41b6c12f75fd950c1125b73 (diff)
tdf#121188 form controls should have InputRequired false by default
Unless the underlying column is not nullable and has no default value this is only a guess, form designer can change it Change-Id: Ifa403e00b21fdaf86aef383503d54879b25ac62b Reviewed-on: https://gerrit.libreoffice.org/62969 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'wizards/com')
-rw-r--r--wizards/com/sun/star/wizards/common/PropertyNames.java3
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java4
2 files changed, 7 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/common/PropertyNames.java b/wizards/com/sun/star/wizards/common/PropertyNames.java
index 2d7cdd865336..5e5df5c879e1 100644
--- a/wizards/com/sun/star/wizards/common/PropertyNames.java
+++ b/wizards/com/sun/star/wizards/common/PropertyNames.java
@@ -20,6 +20,9 @@ package com.sun.star.wizards.common;
public class PropertyNames
{
+ public static String PROPERTY_DEFAULT_VALUE = "DefaultValue";
+ public static String PROPERTY_IS_NULLABLE = "IsNullable";
+ public static String PROPERTY_INPUT_REQUIRED = "InputRequired";
public static String PROPERTY_ENABLED = "Enabled";
public static String PROPERTY_HEIGHT = "Height";
public static String PROPERTY_HELPURL = "HelpURL";
diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java
index 9a46928ac045..a1eacc71366d 100644
--- a/wizards/com/sun/star/wizards/form/FormControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java
@@ -21,6 +21,7 @@ import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
import com.sun.star.container.XNameContainer;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbc.ColumnValue;
import com.sun.star.sdbc.DataType;
import com.sun.star.task.XStatusIndicator;
import com.sun.star.uno.AnyConverter;
@@ -588,6 +589,8 @@ public class FormControlArranger
{
String sFieldName = FieldColumns[i].getFieldName();
int nFieldType = FieldColumns[i].getFieldType();
+ boolean bFieldNullable = AnyConverter.toInt(FieldColumns[i].getXColumnPropertySet().getPropertyValue(PropertyNames.PROPERTY_IS_NULLABLE)) != ColumnValue.NO_NULLS;
+ boolean bFieldHasDefaultValue = !AnyConverter.toString(FieldColumns[i].getXColumnPropertySet().getPropertyValue(PropertyNames.PROPERTY_DEFAULT_VALUE)).isEmpty();
Point aPoint = new Point(m_currentControlPosX, m_currentControlPosY);
if (bControlsareCreated)
@@ -629,6 +632,7 @@ public class FormControlArranger
}
checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, true);
aDBControl.setPropertyValue(PropertyNames.PROPERTY_BORDER, NBorderType);
+ aDBControl.setPropertyValue(PropertyNames.PROPERTY_INPUT_REQUIRED, !(bFieldNullable || bFieldHasDefaultValue));
}
catch (Exception e)
{