IDEMPIERE-5581 : Dialog.askForInput : allow Integer (#1680)

* IDEMPIERE-5581 : Dialog.askForInput : allow Integer

https://idempiere.atlassian.net/browse/IDEMPIERE-5581

* IDEMPIERE-5581 : Dialog.askForInput : allow Integer

Add check on displaytype as suggested by @hengsin

Co-Authored-By: hengsin <152246+hengsin@users.noreply.github.com>

---------

Co-authored-by: hengsin <152246+hengsin@users.noreply.github.com>
This commit is contained in:
Nicolas Micoud 2023-02-17 15:43:02 +01:00 committed by GitHub
parent e7b9b72582
commit 3e957e6c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -63,7 +63,16 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
public WNumberEditor() public WNumberEditor()
{ {
this("Number", false, false, true, DisplayType.Number, ""); this(DisplayType.Number);
}
/**
*
* @param displayType
*/
public WNumberEditor(int displayType)
{
this("Number", false, false, true, displayType, "");
} }
/** /**
@ -136,6 +145,10 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
{ {
super(new NumberBox(displayType == DisplayType.Integer), columnName, title, null, mandatory, super(new NumberBox(displayType == DisplayType.Integer), columnName, title, null, mandatory,
readonly, updateable); readonly, updateable);
if (!DisplayType.isNumeric(displayType))
throw new IllegalArgumentException("DisplayType must be numeric");
this.displayType = displayType; this.displayType = displayType;
init(); init();
} }

View File

@ -347,6 +347,8 @@ public final class Dialog {
return new WStringEditor(); return new WStringEditor();
case DisplayType.Number: case DisplayType.Number:
return new WNumberEditor(); return new WNumberEditor();
case DisplayType.Integer:
return new WNumberEditor(editorType);
case DisplayType.TableDir: case DisplayType.TableDir:
return new WTableDirEditor(lookup, "", "", true, false, true); return new WTableDirEditor(lookup, "", "", true, false, true);
case DisplayType.Search: case DisplayType.Search: