IDEMPIERE-2902 UX: Implement Radio buttons (#326)

* IDEMPIERE-2902 UX: Implement Radio buttons

Integrate contribution from TrekGlobal
TC-188 Port RadioGroup field editor from AP2-19
added "Radio Group List" field type

* IDEMPIERE-2902 UX: Implement Radio buttons

Peer review
* Configure correctly wrong Validation Rule
* Fix wrong DisplayLogic from this ticket and also from other recently added features on fields:
Attribute > Attribute > Reference Key
Attribute > Attribute > Dynamic Validation
Info Window > Column > Reference Key
Info Window > Column > Dynamic Validation
Registration Attributes > Attribute > Reference Key
Table and Column > Column > Dynamic Validation
Table and Column > Column > Dynamic Validation (Lookup)
Table and Column > Column > Reference Key
Web Service Security > Web Service Field Input > Reference Key
Window Customization > Field Customization > Reference Key
Window Customization > Field Customization > Dynamic Validation
Window Customization > Field Customization > Dynamic Validation (Lookup)
Window, Tab & Field > Field > Reference Key
Window, Tab & Field > Field > Dynamic Validation
Window, Tab & Field > Field > Dynamic Validation (Lookup)
* For testing and UX, configure as Radio Group:
Broadcast Message > Broadcast Message > Target
Field Group > Field group > Field Group Type

* IDEMPIERE-2902 UX: Implement Radio buttons

* For testing and UX, configure as Radio Group in detail tab:
Info Window > Process > LayoutType

* IDEMPIERE-2902 UX: Implement Radio buttons

- Fix radio group editor lost track of selectedItem after page detached
and attached
- Standardized the construction of editors from editor factory
- Remove unnecessary refresh for list/lookup based readonly editors
created by grid view (fixed editor is not readonly during init())

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
hengsin 2020-10-28 02:17:56 +08:00 committed by GitHub
parent 78393af99d
commit 00e94b12ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 1645 additions and 133 deletions

View File

@ -0,0 +1,27 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Apr 10, 2018 7:56:35 PM GMT+08:00
-- Radio Group List
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_UU,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,200152,'bde88a42-3601-499e-a2ee-2185eb6fc785',TO_DATE('2018-04-10 19:56:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','Radio Group List',TO_DATE('2018-04-10 19:56:29','YYYY-MM-DD HH24:MI:SS'),100,'D')
;
-- Apr 10, 2018 7:57:56 PM GMT+08:00
UPDATE AD_Val_Rule SET Code='AD_Reference.ValidationType=CASE WHEN @AD_Reference_ID@ IN (17,28,200152) THEN ''L'' ELSE ''T'' END',Updated=TO_DATE('2018-04-10 19:57:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=115
;
-- Apr 10, 2018 8:00:03 PM GMT+08:00
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-10 20:00:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=171
;
-- Apr 10, 2018 8:01:28 PM GMT+08:00
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-10 20:01:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54402
;
-- Apr 10, 2018 8:02:27 PM GMT+08:00
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-10 20:02:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200855
;
SELECT register_migration_script('201804111700_TicketAP2-19.sql') FROM dual
;

View File

@ -0,0 +1,83 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2902 UX: Implement Radio buttons
-- Oct 24, 2020, 12:46:20 PM CEST
UPDATE AD_Val_Rule SET Code='AD_Reference.ValidationType=CASE WHEN @AD_Reference_ID@ IN (17,28,200152,200161) THEN ''L'' ELSE ''T'' END',Updated=TO_DATE('2020-10-24 12:46:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=115
;
-- Oct 24, 2020, 12:47:54 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 12:47:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=171
;
-- Oct 24, 2020, 12:48:35 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 12:48:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54402
;
-- Oct 24, 2020, 12:49:14 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 12:49:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200855
;
-- Oct 24, 2020, 12:58:30 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 12:58:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10225
;
-- Oct 24, 2020, 12:59:32 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 12:59:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201622
;
-- Oct 24, 2020, 1:01:26 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163 & @AttributeValueType@=''R''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:01:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Oct 24, 2020, 1:01:51 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201895
;
-- Oct 24, 2020, 1:22:34 PM CEST
UPDATE AD_Column SET AD_Reference_ID=200152,Updated=TO_DATE('2020-10-24 13:22:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53002
;
-- Oct 24, 2020, 1:26:26 PM CEST
UPDATE AD_Column SET AD_Reference_ID=200152,Updated=TO_DATE('2020-10-24 13:26:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200989
;
-- Oct 24, 2020, 1:29:27 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:29:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=172
;
-- Oct 24, 2020, 1:29:46 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206091
;
-- Oct 24, 2020, 1:31:42 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:31:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54401
;
-- Oct 24, 2020, 1:31:49 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:31:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206129
;
-- Oct 24, 2020, 1:32:45 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:32:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
-- Oct 24, 2020, 1:33:17 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163 & @AttributeValueType@=''R''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206510
;
-- Oct 24, 2020, 1:33:41 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:33:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201623
;
-- Oct 24, 2020, 1:38:25 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-10-24 13:38:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206130
;
-- Oct 24, 2020, 1:42:01 PM CEST
UPDATE AD_Column SET AD_Reference_ID=200152,Updated=TO_DATE('2020-10-24 13:42:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211257
;
SELECT register_migration_script('202010241339_IDEMPIERE-2902.sql') FROM dual
;

View File

@ -0,0 +1,24 @@
-- Apr 10, 2018 7:56:35 PM GMT+08:00
-- Radio Group List
INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_UU,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,200152,'bde88a42-3601-499e-a2ee-2185eb6fc785',TO_TIMESTAMP('2018-04-10 19:56:29','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','Radio Group List',TO_TIMESTAMP('2018-04-10 19:56:29','YYYY-MM-DD HH24:MI:SS'),100,'D')
;
-- Apr 10, 2018 7:57:56 PM GMT+08:00
UPDATE AD_Val_Rule SET Code='AD_Reference.ValidationType=CASE WHEN @AD_Reference_ID@ IN (17,28,200152) THEN ''L'' ELSE ''T'' END',Updated=TO_TIMESTAMP('2018-04-10 19:57:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=115
;
-- Apr 10, 2018 8:00:03 PM GMT+08:00
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-10 20:00:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=171
;
-- Apr 10, 2018 8:01:28 PM GMT+08:00
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-10 20:01:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54402
;
-- Apr 10, 2018 8:02:27 PM GMT+08:00
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-10 20:02:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200855
;
SELECT register_migration_script('201804111700_TicketAP2-19.sql') FROM dual
;

View File

@ -0,0 +1,80 @@
-- IDEMPIERE-2902 UX: Implement Radio buttons
-- Oct 24, 2020, 12:46:20 PM CEST
UPDATE AD_Val_Rule SET Code='AD_Reference.ValidationType=CASE WHEN @AD_Reference_ID@ IN (17,28,200152,200161) THEN ''L'' ELSE ''T'' END',Updated=TO_TIMESTAMP('2020-10-24 12:46:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=115
;
-- Oct 24, 2020, 12:47:54 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 12:47:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=171
;
-- Oct 24, 2020, 12:48:35 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 12:48:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54402
;
-- Oct 24, 2020, 12:49:14 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 12:49:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200855
;
-- Oct 24, 2020, 12:58:30 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 12:58:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10225
;
-- Oct 24, 2020, 12:59:32 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 12:59:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201622
;
-- Oct 24, 2020, 1:01:26 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163 & @AttributeValueType@=''R''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:01:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204144
;
-- Oct 24, 2020, 1:01:51 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=30 | @AD_Reference_ID@=28 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201895
;
-- Oct 24, 2020, 1:22:34 PM CEST
UPDATE AD_Column SET AD_Reference_ID=200152,Updated=TO_TIMESTAMP('2020-10-24 13:22:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53002
;
-- Oct 24, 2020, 1:26:26 PM CEST
UPDATE AD_Column SET AD_Reference_ID=200152,Updated=TO_TIMESTAMP('2020-10-24 13:26:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200989
;
-- Oct 24, 2020, 1:29:27 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:29:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=172
;
-- Oct 24, 2020, 1:29:46 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:29:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206091
;
-- Oct 24, 2020, 1:31:42 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:31:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54401
;
-- Oct 24, 2020, 1:31:49 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:31:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206129
;
-- Oct 24, 2020, 1:32:45 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:32:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203266
;
-- Oct 24, 2020, 1:33:17 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163 & @AttributeValueType@=''R''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206510
;
-- Oct 24, 2020, 1:33:41 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:33:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201623
;
-- Oct 24, 2020, 1:38:25 PM CEST
UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=17 | @AD_Reference_ID@=18 | @AD_Reference_ID@=19 | @AD_Reference_ID@=28 | @AD_Reference_ID@=30 | @AD_Reference_ID@=200012 | @AD_Reference_ID@=31 | @AD_Reference_ID@=200152 | @AD_Reference_ID@=200161 | @AD_Reference_ID@=200162 | @AD_Reference_ID@=200163', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-10-24 13:38:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206130
;
-- Oct 24, 2020, 1:42:01 PM CEST
UPDATE AD_Column SET AD_Reference_ID=200152,Updated=TO_TIMESTAMP('2020-10-24 13:42:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211257
;
SELECT register_migration_script('202010241339_IDEMPIERE-2902.sql') FROM dual
;

View File

@ -188,7 +188,7 @@ public class MLookupFactory
MLookupInfo info = null;
boolean needToAddSecurity = true;
// List
if (AD_Reference_ID == DisplayType.List || AD_Reference_ID == DisplayType.ChosenMultipleSelectionList) // 17
if (AD_Reference_ID == DisplayType.List || AD_Reference_ID == DisplayType.ChosenMultipleSelectionList || AD_Reference_ID == DisplayType.RadiogroupList) // 17
{
info = getLookup_List(language, AD_Reference_Value_ID);
needToAddSecurity = false;

View File

@ -127,6 +127,7 @@ public class SystemIDs
public final static int REFERENCE_DATATYPE_PRINTNAME = 42;
public final static int REFERENCE_DATATYPE_PRODUCTATTRIBUTE = 35;
public final static int REFERENCE_DATATYPE_QUANTITY = 29;
public final static int REFERENCE_DATATYPE_RADIOGROUP_LIST= 200152;
public final static int REFERENCE_DATATYPE_ROWID = 26;
public final static int REFERENCE_DATATYPE_SEARCH = 30;
public final static int REFERENCE_DATATYPE_STRING = 10;

View File

@ -21,11 +21,13 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_AMOUNT;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_ASSIGNMENT;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_BINARY;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_BUTTON;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHART;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_LIST;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_TABLE;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_SEARCH;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_TABLE;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_COLOR;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_COSTPRICE;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DASHBOARD_CONTENT;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DATE;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DATETIME;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_FILENAME;
@ -37,13 +39,16 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LIST;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LOCATION;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_LOCATOR;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_MEMO;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_MULTIPLE_SELECTION_GRID;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_NUMBER;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_PAYMENT;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_PRINTNAME;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_PRODUCTATTRIBUTE;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_QUANTITY;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_RADIOGROUP_LIST;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_ROWID;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SEARCH;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SINGLE_SELECTION_GRID;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_STRING;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TABLE;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TABLEDIR;
@ -52,10 +57,6 @@ import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TEXTLONG;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_TIME;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_URL;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_YES_NO;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_CHART;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_DASHBOARD_CONTENT;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_SINGLE_SELECTION_GRID;
import static org.compiere.model.SystemIDs.REFERENCE_DATATYPE_MULTIPLE_SELECTION_GRID;
import java.text.DateFormat;
import java.text.DecimalFormat;
@ -163,6 +164,8 @@ public final class DisplayType
public static final int MultipleSelectionGrid = REFERENCE_DATATYPE_MULTIPLE_SELECTION_GRID;
public static final int RadiogroupList = REFERENCE_DATATYPE_RADIOGROUP_LIST;
public static final int ChosenMultipleSelectionList = REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_LIST;
public static final int ChosenMultipleSelectionTable = REFERENCE_DATATYPE_CHOSEN_MULTIPLE_SELECTION_TABLE;
@ -311,6 +314,7 @@ public final class DisplayType
|| displayType == URL || displayType == PrinterName
|| displayType == SingleSelectionGrid || displayType == Color
|| displayType == MultipleSelectionGrid
|| displayType == RadiogroupList
|| displayType == ChosenMultipleSelectionList
|| displayType == ChosenMultipleSelectionTable
|| displayType == ChosenMultipleSelectionSearch)
@ -370,6 +374,7 @@ public final class DisplayType
{
if (displayType == List || displayType == Table
|| displayType == TableDir || displayType == Search
|| displayType == RadiogroupList
|| displayType == ChosenMultipleSelectionTable
|| displayType == ChosenMultipleSelectionSearch
|| displayType == ChosenMultipleSelectionList)
@ -655,7 +660,7 @@ public final class DisplayType
*/
public static Class<?> getClass (int displayType, boolean yesNoAsBoolean)
{
if (isText(displayType) || displayType == List || displayType == Payment)
if (isText(displayType) || displayType == List || displayType == Payment || displayType == RadiogroupList)
return String.class;
else if (isID(displayType) || displayType == Integer) // note that Integer is stored as BD
return Integer.class;
@ -744,7 +749,7 @@ public final class DisplayType
return getDatabase().getClobDataType();
if (displayType == DisplayType.YesNo)
return getDatabase().getCharacterDataType()+"(1)";
if (displayType == DisplayType.List || displayType == DisplayType.Payment) {
if (displayType == DisplayType.List || displayType == DisplayType.Payment || displayType == DisplayType.RadiogroupList) {
if (fieldLength == 1)
return getDatabase().getCharacterDataType()+"(" + fieldLength + ")";
else
@ -809,6 +814,8 @@ public final class DisplayType
return "DateTime";
if (displayType == List)
return "List";
if (displayType == RadiogroupList)
return "RadiogroupList";
if (displayType == Table)
return "Table";
if (displayType == TableDir)

View File

@ -28,6 +28,7 @@ import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Urlbox;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu;
@ -109,6 +110,18 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
/** DefaultFocusField */
private WEditor defaultFocusField = null;
private final static IEditorConfiguration readOnlyEditorConfiguration = new IEditorConfiguration() {
@Override
public Boolean getReadonly() {
return Boolean.TRUE;
}
@Override
public Boolean getMandatory() {
return Boolean.FALSE;
}
};
/**
*
* @param gridTab
@ -503,9 +516,8 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
}
//readonly for display text
WEditor readOnlyEditor = WebEditorFactory.getEditor(gridPanelFields[i], true);
WEditor readOnlyEditor = WebEditorFactory.getEditor(gridPanelFields[i], true, readOnlyEditorConfiguration);
if (readOnlyEditor != null) {
readOnlyEditor.setReadWrite(false);
readOnlyEditors.put(gridPanelFields[i], readOnlyEditor);
}
@ -706,7 +718,9 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
{
popupMenu.addMenuListener((ContextMenuListener)editor);
div.appendChild(popupMenu);
popupMenu.addContextElement((XulElement) editor.getComponent());
Component editorComponent = editor.getComponent();
if (editorComponent instanceof XulElement)
popupMenu.addContextElement((XulElement) editorComponent);
}

View File

@ -0,0 +1,49 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.editor;
/**
* Interface to override editor setting that's usually derived from GridField
* @author hengsin
*
*/
public interface IEditorConfiguration {
/**
* Return a not null Boolean to override GridField.isReadOnly
* @return Boolean
*/
public default Boolean getReadonly() {
return null;
}
/**
* Return a not null Boolean to override GridField.isMandatory
* @return Boolean
*/
public default Boolean getMandatory() {
return null;
}
}

View File

@ -0,0 +1,41 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.editor;
/**
* Interface for NumberEditor configuration
* @author hengsin
*
*/
public interface INumberEditorConfiguration extends IEditorConfiguration {
/**
* Return a not null value to override the integral setting from GridField.getDisplayType
* @return Boolean
*/
public default Boolean getIntegral() {
return null;
}
}

View File

@ -52,9 +52,24 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
/** Logger */
private static final CLogger log = CLogger.getCLogger(WAccountEditor.class);
/**
*
* @param gridField
*/
public WAccountEditor(GridField gridField)
{
super(new Combinationbox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WAccountEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Combinationbox(), gridField, tableEditor, editorConfiguration);
if (ThemeManager.isUseFontIconForImage())
getComponent().getButton().setIconSclass("z-icon-Account");
else

View File

@ -48,8 +48,22 @@ public class WAssignmentEditor extends WEditor implements ContextMenuListener {
private DateFormat m_dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
private NumberFormat m_qtyFormat = DisplayType.getNumberFormat(DisplayType.Quantity);
/**
*
* @param gridField
*/
public WAssignmentEditor(GridField gridField) {
super(new EditorBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WAssignmentEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new EditorBox(), gridField, tableEditor, editorConfiguration);
initComponents();
}

View File

@ -45,9 +45,24 @@ public class WBinaryEditor extends WEditor
private ADWindow adwindow;
/**
*
* @param gridField
*/
public WBinaryEditor(GridField gridField)
{
super(new Button(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WBinaryEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Button(), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -83,13 +83,43 @@ public class WButtonEditor extends WEditor implements IProcessButton
private IADTabpanel adTabpanel;
/**
*
* @param gridField
*/
public WButtonEditor(GridField gridField)
{
this(gridField, -1);
}
/**
*
* @param gridField
* @param rowIndex
*/
public WButtonEditor(GridField gridField, int rowIndex) {
super(new Button(), gridField, rowIndex);
this(gridField, rowIndex, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WButtonEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
this(gridField, -1, tableEditor, editorConfiguration);
}
/**
*
* @param gridField
* @param rowIndex
* @param tableEditor
* @param editorConfiguration
*/
public WButtonEditor(GridField gridField, int rowIndex, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new Button(), gridField, rowIndex, tableEditor, editorConfiguration);
m_text = gridField.getHeader();
AD_Process_ID = gridField.getAD_Process_ID();
gridfield = gridField;

View File

@ -53,9 +53,26 @@ public class WChartEditor extends WEditor
@SuppressWarnings("unused")
private static final CLogger log = CLogger.getCLogger(WChartEditor.class);
/**
*
* @param gridField
* @param windowNo
*/
public WChartEditor(GridField gridField, int windowNo)
{
super(new Panel(), gridField);
this(gridField, windowNo, false, null);
}
/**
*
* @param gridField
* @param windowNo
* @param tableEditor
* @param editorConfiguration
*/
public WChartEditor(GridField gridField, int windowNo, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Panel(), gridField, tableEditor, editorConfiguration);
chartModel = new MChart(Env.getCtx(), gridField.getAD_Chart_ID(), null);
chartModel.setWindowNo(windowNo);
init();

View File

@ -71,14 +71,29 @@ public class WChosenboxListEditor extends WEditor implements ContextMenuListener
private ListModelList<ValueNamePair> model = new ListModelList<>();
/**
*
* @param gridField
*/
public WChosenboxListEditor(GridField gridField)
{
this(new ChosenboxEditor(), gridField);
this(gridField, false, null);
}
private WChosenboxListEditor(Component comp, GridField gridField)
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WChosenboxListEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(comp, gridField);
this(new ChosenboxEditor(), gridField, tableEditor, editorConfiguration);
}
private WChosenboxListEditor(Component comp, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(comp, gridField, tableEditor, editorConfiguration);
lookup = gridField.getLookup();
init();
}

View File

@ -73,9 +73,24 @@ public class WChosenboxSearchEditor extends WEditor implements ContextMenuListen
private static final int MAX_AUTO_COMPLETE_ROWS = 50;
private boolean onselecting;
/**
*
* @param gridField
*/
public WChosenboxSearchEditor (GridField gridField)
{
super(new ChosenSearchBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WChosenboxSearchEditor (GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new ChosenSearchBox(), gridField, tableEditor, editorConfiguration);
lookup = gridField.getLookup();

View File

@ -33,11 +33,23 @@ public class WDashboardContentEditor extends WEditor {
private final static CLogger logger = CLogger.getCLogger(WDashboardContentEditor.class);
/**
* @param comp
*
* @param gridField
* @param windowNo
*/
public WDashboardContentEditor(GridField gridField, int windowNo) {
super(new Panel(), gridField);
this(gridField, windowNo, false, null);
}
/**
*
* @param gridField
* @param windowNo
* @param tableEditor
* @param editorConfiguration
*/
public WDashboardContentEditor(GridField gridField, int windowNo, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new Panel(), gridField, tableEditor, editorConfiguration);
dashboardController = new DashboardController();
content = new MDashboardContent(Env.getCtx(), gridField.getPA_DashboardContent_ID(), null);
Panelchildren pc = new Panelchildren();

View File

@ -57,7 +57,18 @@ public class WDateEditor extends WEditor implements ContextMenuListener
*/
public WDateEditor(GridField gridField)
{
super(new Datebox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WDateEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Datebox(), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -53,7 +53,16 @@ public class WDatetimeEditor extends WEditor implements ContextMenuListener
*/
public WDatetimeEditor(GridField gridField)
{
super(new DatetimeBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
*/
public WDatetimeEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new DatetimeBox(), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -94,7 +94,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
private String description;
private boolean readOnly;
protected boolean readOnly;
private String columnName;
@ -154,6 +154,11 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
}
/**
*
* @param comp
* @param gridField
*/
public WEditor(Component comp, GridField gridField) {
this(comp, gridField, -1);
}
@ -162,8 +167,32 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
*
* @param comp
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WEditor(Component comp, GridField gridField, int rowIndex)
public WEditor(Component comp, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
this(comp, gridField, -1, tableEditor, editorConfiguration);
}
/**
*
* @param comp
* @param gridField
* @param rowIndex
*/
public WEditor(Component comp, GridField gridField, int rowIndex) {
this(comp, gridField, rowIndex, false, null);
}
/**
*
* @param comp
* @param gridField
* @param rowIndex
* @param tableEditor
* @param editorConfiguration
*/
public WEditor(Component comp, GridField gridField, int rowIndex, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
if (comp == null)
{
@ -183,7 +212,14 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
} else {
comp.setClientAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, gridField.getColumnName());
}
if (editorConfiguration != null && editorConfiguration.getMandatory() != null)
this.setMandatory(editorConfiguration.getMandatory());
else
this.setMandatory(gridField.isMandatory(true));
this.tableEditor = tableEditor;
if (editorConfiguration != null && editorConfiguration.getReadonly() != null)
this.readOnly = editorConfiguration.getReadonly();
else
this.readOnly = gridField.isReadOnly();
this.description = gridField.getDescription();
this.columnName = gridField.getColumnName();
@ -613,6 +649,8 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
} else {
label.setStyle(style);
}
// if (this instanceof WRadioGroupEditor)
// System.out.println(getComponent().getUuid() + " label stype="+label.getStyle());
}
}

View File

@ -39,9 +39,24 @@ public class WFileDirectoryEditor extends WEditor
private String oldValue;
/**
*
* @param gridField
*/
public WFileDirectoryEditor(GridField gridField)
{
super(new FilenameBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WFileDirectoryEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new FilenameBox(), gridField, tableEditor, editorConfiguration);
if (ThemeManager.isUseFontIconForImage())
getComponent().getButton().setIconSclass("z-icon-Open");
else

View File

@ -45,9 +45,24 @@ public class WFilenameEditor extends WEditor
private String oldValue;
/**
*
* @param gridField
*/
public WFilenameEditor(GridField gridField)
{
super(new FilenameBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WFilenameEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new FilenameBox(), gridField, tableEditor, editorConfiguration);
if (ThemeManager.isUseFontIconForImage())
getComponent().getButton().setIconSclass("z-icon-Open");
else

View File

@ -65,9 +65,24 @@ public class WHtmlEditor extends WEditor implements ContextMenuListener
/** Logger */
private static final CLogger log = CLogger.getCLogger(WHtmlEditor.class);
/**
*
* @param gridField
*/
public WHtmlEditor(GridField gridField)
{
super(new Div(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WHtmlEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Div(), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -54,7 +54,22 @@ public class WImageEditor extends WEditor
/** Logger */
private static final CLogger log = CLogger.getCLogger(WImageEditor.class);
/**
*
* @param gridField
*/
public WImageEditor(GridField gridField)
{
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WImageEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Image() {
private static final long serialVersionUID = 8492629361709791256L;
@ -70,7 +85,7 @@ public class WImageEditor extends WEditor
}
}
}
}, gridField);
}, gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -81,7 +81,17 @@ public class WLocationEditor extends WEditor implements EventListener<Event>, Pr
* @param gridField
*/
public WLocationEditor(GridField gridField) {
super(new Locationbox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WLocationEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new Locationbox(), gridField, tableEditor, editorConfiguration);
m_Location = (MLocationLookup)gridField.getLookup();
init();
}

View File

@ -108,10 +108,21 @@ public class WLocatorEditor extends WEditor implements EventListener<Event>, Pro
}
/**
*
* @param gridField
*/
public WLocatorEditor(GridField gridField) {
super(new EditorBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WLocatorEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new EditorBox(), gridField, tableEditor, editorConfiguration);
m_mLocator = (MLocatorLookup)gridField.getLookup();
if (ThemeManager.isUseFontIconForImage())

View File

@ -59,8 +59,6 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
private int displayType;
private boolean tableEditor;
private String originalStyle;
public WNumberEditor()
@ -74,22 +72,41 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
*/
public WNumberEditor(GridField gridField)
{
this(false, gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WNumberEditor(boolean tableEditor, GridField gridField)
public WNumberEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new NumberBox(gridField.getDisplayType() == DisplayType.Integer, tableEditor),
gridField);
super(newNumberBox(gridField, tableEditor, editorConfiguration),
gridField, tableEditor, editorConfiguration);
this.displayType = gridField.getDisplayType();
this.tableEditor = tableEditor;
if (editorConfiguration != null && editorConfiguration instanceof INumberEditorConfiguration) {
INumberEditorConfiguration config = (INumberEditorConfiguration) editorConfiguration;
if (config.getIntegral() != null) {
if (config.getIntegral())
this.displayType = DisplayType.Integer;
else
this.displayType = DisplayType.Number;
}
}
init();
}
protected static NumberBox newNumberBox(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
if (editorConfiguration != null && editorConfiguration instanceof INumberEditorConfiguration) {
INumberEditorConfiguration config = (INumberEditorConfiguration) editorConfiguration;
if (config.getIntegral() != null)
return new NumberBox(config.getIntegral(), tableEditor);
}
return new NumberBox(gridField.getDisplayType() == DisplayType.Integer, tableEditor);
}
/**
*
* @param gridField
@ -97,9 +114,12 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
*/
public WNumberEditor(GridField gridField, boolean integral)
{
super(new NumberBox(integral), gridField);
this.displayType = integral ? DisplayType.Integer : DisplayType.Number;
init();
this(gridField, false, new INumberEditorConfiguration() {
@Override
public Boolean getIntegral() {
return Boolean.valueOf(integral);
}
});
}
/**

View File

@ -61,9 +61,26 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
/** No Instance Key */
private static Integer NO_INSTANCE = Integer.valueOf(0);
/**
*
* @param gridTab
* @param gridField
*/
public WPAttributeEditor(GridTab gridTab, GridField gridField)
{
super(new PAttributebox(), gridField);
this(gridTab, gridField, false, null);
}
/**
*
* @param gridTab
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WPAttributeEditor(GridTab gridTab, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new PAttributebox(), gridField, tableEditor, editorConfiguration);
m_GridTab = gridTab;
initComponents();
}

View File

@ -27,7 +27,10 @@ import org.compiere.model.GridField;
*/
public class WPasswordEditor extends WStringEditor
{
/**
*
* @param gridField
*/
public WPasswordEditor(GridField gridField)
{
super(gridField);
@ -35,9 +38,25 @@ public class WPasswordEditor extends WStringEditor
setChangeEventWhenEditing (true);
}
/**
*
* @param gridField
* @param tableEditor
*/
public WPasswordEditor(GridField gridField, boolean tableEditor)
{
super(gridField, tableEditor);
this(gridField, tableEditor, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WPasswordEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(gridField, tableEditor, editorConfiguration);
super.setTypePassword(true);
setChangeEventWhenEditing (false);
}

View File

@ -58,8 +58,22 @@ public class WPaymentEditor extends WEditor implements ListDataListener, Context
private MPaymentLookup lookup;
private Object oldValue;
/**
*
* @param gridField
*/
public WPaymentEditor(GridField gridField) {
super(new Paymentbox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WPaymentEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new Paymentbox(), gridField, tableEditor, editorConfiguration);
lookup = (MPaymentLookup) gridField.getLookup();
init();
}

View File

@ -0,0 +1,616 @@
/******************************************************************************
* Project: Trek Global ERP *
* Copyright (C) 2009-2018 Trek Global Corporation *
* *
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.editor;
import java.beans.PropertyChangeEvent;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import java.util.Properties;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.window.WFieldRecordInfo;
import org.compiere.model.GridField;
import org.compiere.model.GridTable;
import org.compiere.model.Lookup;
import org.compiere.model.MColumn;
import org.compiere.model.MLookup;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.NamePair;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Radiogroup;
/**
*
* @author hengsin
*
*/
public class WRadioGroupEditor extends WEditor implements ContextMenuListener, ListDataListener
{
public final static String[] LISTENER_EVENTS = {Events.ON_CHECK};
@SuppressWarnings("unused")
private static final CLogger logger;
static
{
logger = CLogger.getCLogger(WRadioGroupEditor.class);
}
private Lookup lookup;
private Object oldValue;
private boolean onselecting = false;
/**
*
* @param gridField
*/
public WRadioGroupEditor(GridField gridField)
{
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WRadioGroupEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new RadioGroupEditor(), gridField, tableEditor, editorConfiguration);
lookup = gridField.getLookup();
init();
}
/**
* Constructor for use if a grid field is unavailable
*
* @param lookup Store of selectable data
* @param label column name (not displayed)
* @param description description of component
* @param mandatory whether a selection must be made
* @param readonly whether or not the editor is read only
* @param updateable whether the editor contents can be changed
*/
public WRadioGroupEditor(Lookup lookup, String label, String description, boolean mandatory, boolean readonly, boolean updateable)
{
super(new RadioGroupEditor(), label, description, mandatory, readonly, updateable);
if (lookup == null)
{
throw new IllegalArgumentException("Lookup cannot be null");
}
this.lookup = lookup;
super.setColumnName(lookup.getColumnName());
init();
}
/**
* For ease of porting swing form
* @param columnName
* @param mandatory
* @param isReadOnly
* @param isUpdateable
* @param lookup
*/
public WRadioGroupEditor(String columnName, boolean mandatory, boolean isReadOnly, boolean isUpdateable,
Lookup lookup)
{
super(new RadioGroupEditor(), columnName, null, null, mandatory, isReadOnly, isUpdateable);
if (lookup == null)
{
throw new IllegalArgumentException("Lookup cannot be null");
}
this.lookup = lookup;
init();
}
private void init()
{
boolean zoom= false;
if (lookup != null)
{
lookup.addListDataListener(this);
lookup.setMandatory(true);
lookup.setMandatory(isMandatory());
if ((lookup.getDisplayType() == DisplayType.List && Env.getContextAsInt(Env.getCtx(), "#AD_Role_ID") == 0)
|| lookup.getDisplayType() != DisplayType.List)
{
zoom= true;
}
//no need to refresh readonly lookup
if (isReadWrite())
lookup.refresh();
else
refreshList();
}
popupMenu = new WEditorPopupMenu(zoom, true, isShowPreference(), false, false, false, lookup);
addChangeLogMenu(popupMenu);
}
@Override
public String getDisplay()
{
String display = "";
Radio selItem = getComponent().getSelectedItem();
if (selItem != null)
{
display = selItem.getLabel();
}
return display;
}
@Override
public Object getValue()
{
Object retVal = null;
Radio selItem = getComponent().getSelectedItem();
if (selItem != null)
{
retVal = selItem.getValue();
if ((retVal instanceof Integer) && (Integer)retVal == -1)
retVal = null;
else if ((retVal instanceof String) && "".equals(retVal))
retVal = null;
}
return retVal;
}
public void setValue(Object value)
{
if (onselecting) {
return;
}
if (value != null && (value instanceof Integer || value instanceof String || value instanceof Timestamp || value instanceof BigDecimal))
{
getComponent().setValue(value);
if (!getComponent().isSelected(value))
{
Object curValue = oldValue;
oldValue = value;
if (isReadWrite() && lookup != null)
{
lookup.refresh();
}
else
{
refreshList();
}
//still not in list, reset to zero
if (!getComponent().isSelected(value))
{
if (value instanceof Integer && gridField != null && gridField.getDisplayType() != DisplayType.ID &&
(gridTab==null || !gridTab.getTableModel().isImporting())) // for IDs is ok to be out of the list
{
//if it is problem with record lock, just keep value (no trigger change) and set field readonly
MRole role = MRole.getDefault(Env.getCtx(), false);
int refTableID = -1;
if (gridTab != null) // fields process para don't represent a column ID
{
MColumn col = MColumn.get(Env.getCtx(), gridField.getAD_Column_ID());
if (col.get_ID() > 0) {
String refTable = col.getReferenceTableName();
if (refTable != null) {
MTable table = MTable.get(Env.getCtx(), refTable);
refTableID = table.getAD_Table_ID();
}
}
}
if (refTableID > 0 && ! role.isRecordAccess(refTableID, (int)value, false))
{
oldValue = value;
setReadWrite(false);
gridField.setLockedRecord(true);
}
else
{
getComponent().setValue(null);
if (curValue == null)
curValue = value;
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
super.fireValueChange(changeEvent);
oldValue = null;
if (gridField!=null)
gridField.setLockedRecord(false);
}
}
}
}
else
{
oldValue = value;
if (gridField!=null)
gridField.setLockedRecord(false);
}
}
else
{
getComponent().setValue(null);
oldValue = null;
}
}
@Override
public RadioGroupEditor getComponent() {
return (RadioGroupEditor) component;
}
@Override
public boolean isReadWrite() {
return getComponent().isEnabled();
}
@Override
public void setReadWrite(boolean readWrite) {
getComponent().setEnabled(readWrite);
}
private void refreshList()
{
if (getComponent().getItemCount() > 0)
getComponent().removeAllItems();
if (isReadWrite())
{
if (lookup != null)
{
lookup.refresh();
int size = lookup.getSize();
boolean found = false;
for (int i = 0; i < size; i++)
{
Object obj = lookup.getElementAt(i);
if (obj instanceof KeyNamePair)
{
KeyNamePair lookupKNPair = (KeyNamePair) obj;
getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getKey());
if (!found && oldValue != null && oldValue instanceof Integer &&
lookupKNPair.getKey() == (Integer)oldValue)
{
found = true;
}
}
else if (obj instanceof ValueNamePair)
{
ValueNamePair lookupKNPair = (ValueNamePair) obj;
getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getValue());
if (!found && oldValue != null && lookupKNPair.getValue().equals(oldValue.toString()))
{
found = true;
}
}
}
if (!found && oldValue != null)
{
NamePair pair = lookup.getDirect(oldValue, false, true);
if (pair != null) {
if (pair instanceof KeyNamePair) {
int key = ((KeyNamePair)pair).getKey();
getComponent().appendItem(pair.getName(), key);
} else if (pair instanceof ValueNamePair) {
ValueNamePair valueNamePair = (ValueNamePair) pair;
getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
}
}
}
}
}
else
{
if (lookup != null)
{
String trxName = null;
if ( gridField != null
&& gridField.getGridTab() != null
&& gridField.getGridTab().getTableModel() != null) {
GridTable gt = gridField.getGridTab().getTableModel();
if (gt.isImporting()) {
trxName = gt.get_TrxName();
}
}
NamePair pair = lookup.getDirect(oldValue, false, false, trxName);
if (pair != null) {
if (pair instanceof KeyNamePair) {
int key = ((KeyNamePair)pair).getKey();
getComponent().appendItem(pair.getName(), key);
} else if (pair instanceof ValueNamePair) {
ValueNamePair valueNamePair = (ValueNamePair) pair;
getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
}
}
}
}
getComponent().setValue(oldValue);
}
public void onEvent(Event event)
{
if (Events.ON_CHECK.equalsIgnoreCase(event.getName()))
{
try {
onselecting = true;
Object newValue = getValue();
if (isValueChange(newValue)) {
try {
if (gridField != null)
gridField.setLookupEditorSettingValue(true);
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
oldValue = newValue;
getComponent().setValue(newValue);
} finally {
if (gridField != null)
gridField.setLookupEditorSettingValue(false);
}
}
} finally {
onselecting = false;
}
}
}
private boolean isValueChange(Object newValue) {
return (oldValue == null && newValue != null) || (oldValue != null && newValue == null)
|| ((oldValue != null && newValue != null) && !oldValue.equals(newValue));
}
public String[] getEvents()
{
return LISTENER_EVENTS;
}
public void actionRefresh()
{
if (lookup != null)
{
Object curValue = getValue();
if (isReadWrite())
{
if (lookup instanceof MLookup)
((MLookup) lookup).refreshItemsAndCache();
else
lookup.refresh();
}
else
refreshList();
if (curValue != null)
{
setValue(curValue);
}
}
}
public Lookup getLookup()
{
return lookup;
}
public void onMenu(ContextMenuEvent evt)
{
if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent()))
{
actionRefresh();
}
else if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
{
if (isShowPreference())
ValuePreference.start (getComponent(), this.getGridField(), getValue());
return;
}
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
{
WFieldRecordInfo.start(gridField);
}
}
public void propertyChange(PropertyChangeEvent evt)
{
if ("FieldValue".equals(evt.getPropertyName()))
{
setValue(evt.getNewValue());
}
}
@Override
public void dynamicDisplay(Properties ctx)
{
if (oldValue != null && getComponent().getItemCount() > 0 && getComponent().getSelectedItem() == null)
{
getComponent().setValue(oldValue);
}
if (lookup instanceof MLookup)
{
((MLookup) lookup).getLookupInfo().ctx = ctx;
}
if ((lookup != null) && (!lookup.isValidated() || !lookup.isLoaded()
|| (isReadWrite() && lookup.getSize() != getComponent().getItemCount())))
this.actionRefresh();
super.dynamicDisplay(ctx);
}
private static class RadioGroupEditor extends Hlayout {
/**
* generated serial id
*/
private static final long serialVersionUID = -8814498538711459900L;
private Radiogroup radioGroup;
private boolean enabled;
private RadioGroupEditor() {
newRadioGroup();
appendChild(radioGroup);
enabled = true;
setSpacing("0");
setStyle("white-space: normal");
}
private void newRadioGroup() {
radioGroup = new Radiogroup();
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean readWrite) {
enabled = readWrite;
List<Radio> items = radioGroup.getItems();
for (Radio radio : items) {
radio.setDisabled(!readWrite);
}
}
public boolean isSelected(Object value) {
Radio radio = getSelectedItem();
if (radio != null && radio.getValue() != null && value != null) {
return radio.getValue().equals(value);
}
return false;
}
public Radio getSelectedItem() {
return radioGroup.getSelectedItem();
}
public void setSelectedItem(Radio item) {
if (item != null && item.isSelected())
item.setSelected(false);
radioGroup.setSelectedItem(item);
}
public void removeAllItems() {
List<Radio> items = radioGroup.getItems();
for (Radio radio : items) {
radio.detach();
}
}
public void setValue(Object newValue) {
boolean found = false;
if (newValue != null) {
List<Radio> items = radioGroup.getItems();
for (Radio radio : items) {
if (radio.getValue() != null && radio.getValue().equals(newValue)) {
setSelectedItem(radio);
found = true;
break;
}
}
}
if (!found)
setSelectedItem(null);
}
public int getItemCount() {
return radioGroup.getItemCount();
}
public void appendItem(String name, String value) {
if (Util.isEmpty(name))
return;
Radio radio = newRadio(name, value);
radioGroup.appendChild(radio);
}
protected Radio newRadio(String name, Object value) {
Radio radio = new Radio(name);
radio.setValue(value);
radio.setDisabled(!enabled);
radio.setStyle("padding-right:1em");
return radio;
}
public void appendItem(String name, int key) {
if (Util.isEmpty(name))
return;
Radio radio = newRadio(name, key);
radioGroup.appendChild(radio);
}
@Override
public boolean addEventListener(String evtnm, EventListener<? extends Event> listener) {
if (Events.ON_CHECK.equals(evtnm))
return radioGroup.addEventListener(evtnm, listener);
else
return super.addEventListener(evtnm, listener);
}
@Override
public boolean addEventListener(int priority, String evtnm, EventListener<? extends Event> listener) {
if (Events.ON_CHECK.equals(evtnm))
return radioGroup.addEventListener(priority, evtnm, listener);
else
return super.addEventListener(priority, evtnm, listener);
}
@Override
public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) {
if (Events.ON_CHECK.equals(evtnm))
return radioGroup.removeEventListener(evtnm, listener);
else
return super.removeEventListener(evtnm, listener);
}
}
@Override
public void intervalAdded(ListDataEvent e) {
}
@Override
public void intervalRemoved(ListDataEvent e) {
}
@Override
public void contentsChanged(ListDataEvent e) {
refreshList();
}
}

View File

@ -96,9 +96,24 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
private ADWindow adwindow;
/**
*
* @param gridField
*/
public WSearchEditor (GridField gridField)
{
super(new CustomSearchBox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WSearchEditor (GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new CustomSearchBox(), gridField, tableEditor, editorConfiguration);
lookup = gridField.getLookup();

View File

@ -52,8 +52,6 @@ public class WStringEditor extends WEditor implements ContextMenuListener
private String oldValue;
private boolean tableEditor = false;
private AbstractADWindowContent adwindowContent;
/**
@ -64,14 +62,33 @@ public class WStringEditor extends WEditor implements ContextMenuListener
this("String", false, false, true, 30, 30, "", null);
}
/**
*
* @param gridField
*/
public WStringEditor(GridField gridField) {
this(gridField, false);
}
/**
*
* @param gridField
* @param tableEditor
*/
public WStringEditor(GridField gridField, boolean tableEditor)
{
super(gridField.isAutocomplete() ? new Combobox() : new Textbox(), gridField);
this.tableEditor = tableEditor;
this(gridField, tableEditor, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WStringEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(gridField.isAutocomplete() ? new Combobox() : new Textbox(), gridField, tableEditor, editorConfiguration);
if (gridField.getVFormat() != null && !gridField.getVFormat().isEmpty())
getComponent().setWidgetListener("onBind", "jq(this).mask('" + gridField.getVFormat() + "');");

View File

@ -103,14 +103,24 @@ ContextMenuListener, IZoomableEditor
private boolean onselecting = false;
/**
*
* @param gridField
*/
public WTableDirEditor(GridField gridField)
{
this(gridField.isAutocomplete() ? new EditorAutoComplete() : new EditorCombobox(), gridField);
this(gridField, false, null);
}
private WTableDirEditor(Component comp, GridField gridField)
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WTableDirEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(comp, gridField);
super(gridField.isAutocomplete() ? new EditorAutoComplete() : new EditorCombobox(), gridField, tableEditor, editorConfiguration);
((ITableDirEditor)getComponent()).setEditor(this);
lookup = gridField.getLookup();
init();

View File

@ -50,7 +50,18 @@ public class WTimeEditor extends WEditor implements ContextMenuListener
*/
public WTimeEditor(GridField gridField)
{
super(new Timebox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WTimeEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Timebox(), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -27,9 +27,24 @@ import org.compiere.model.GridField;
*/
public class WUnknownEditor extends WStringEditor
{
/**
*
* @param gridField
*/
public WUnknownEditor(GridField gridField)
{
super(gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WUnknownEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -33,9 +33,24 @@ public class WUrlEditor extends WEditor implements ContextMenuListener
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_OK};
private String oldValue;
/**
*
* @param gridField
*/
public WUrlEditor(GridField gridField)
{
super(new Urlbox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WUrlEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Urlbox(), gridField, tableEditor, editorConfiguration);
if (ThemeManager.isUseFontIconForImage())
getComponent().getButton().setIconSclass("z-icon-Online");
else

View File

@ -51,12 +51,36 @@ public class WYesNoEditor extends WEditor implements ContextMenuListener
private boolean oldValue = false;
/**
*
* @param gridField
*/
public WYesNoEditor(GridField gridField)
{
super(new Checkbox(), gridField);
this(gridField, false, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WYesNoEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(new Checkbox(), gridField, tableEditor, editorConfiguration);
init();
}
/**
*
* @param columnName
* @param label
* @param description
* @param mandatory
* @param readonly
* @param updateable
*/
public WYesNoEditor(String columnName, String label,
String description, boolean mandatory, boolean readonly,
boolean updateable) {

View File

@ -47,7 +47,19 @@ public class WebEditorFactory
*/
public static WEditor getEditor(GridField gridField, boolean tableEditor)
{
return getEditor(gridField.getGridTab(), gridField, tableEditor);
return getEditor(gridField, tableEditor, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
* @return {@link WEditor}
*/
public static WEditor getEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
return getEditor(gridField.getGridTab(), gridField, tableEditor, editorConfiguration);
}
private static final CCache<Long, IServiceReferenceHolder<IEditorFactory>> s_editorFactoryCache = new CCache<>(null, "IEditorFactory", 10, false);
@ -57,9 +69,22 @@ public class WebEditorFactory
* @param gridTab
* @param gridField
* @param tableEditor
* @return WEditor for GridField
* @return {@link WEditor}
*/
public static WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor)
{
return getEditor(gridTab, gridField, tableEditor, null);
}
/**
*
* @param gridTab
* @param gridField
* @param tableEditor
* @param editorConfiguration
* @return {@link WEditor}
*/
public static WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
List<Long> visitedIds = new ArrayList<Long>();
if (!s_editorFactoryCache.isEmpty()) {
@ -70,7 +95,7 @@ public class WebEditorFactory
IEditorFactory service = serviceReference.getService();
if (service != null) {
visitedIds.add(key);
WEditor editor = service.getEditor(gridTab, gridField, tableEditor);
WEditor editor = service.getEditor(gridTab, gridField, tableEditor, editorConfiguration);
if (editor != null)
return editor;
} else {
@ -79,6 +104,7 @@ public class WebEditorFactory
}
}
}
WEditor editor = null;
List<IServiceReferenceHolder<IEditorFactory>> serviceReferences = Service.locator().list(IEditorFactory.class).getServiceReferences();
for(IServiceReferenceHolder<IEditorFactory> serviceReference : serviceReferences)
@ -90,7 +116,7 @@ public class WebEditorFactory
if (service != null)
{
s_editorFactoryCache.put(serviceId, serviceReference);
editor = service.getEditor(gridTab, gridField, tableEditor);
editor = service.getEditor(gridTab, gridField, tableEditor, editorConfiguration);
if (editor != null)
break;
}

View File

@ -21,6 +21,7 @@ import java.util.Set;
import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu;
import org.adempiere.webui.event.ContextMenuEvent;
@ -52,22 +53,38 @@ public class WGridTabMultiSelectionEditor extends WEditor implements ContextMenu
private Object oldValue;
private boolean tableEditor = false;
private GridTab listViewGridTab = null;
private String currentLinkValue = null;
private boolean readWrite;
/**
*
* @param gridField
*/
public WGridTabMultiSelectionEditor(GridField gridField) {
this(gridField, false);
}
public WGridTabMultiSelectionEditor(GridField gridField, boolean tableEditor)
/**
*
* @param gridField
* @param tableEditor
*/
public WGridTabMultiSelectionEditor(GridField gridField, boolean tableEditor) {
this(gridField, tableEditor, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WGridTabMultiSelectionEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(tableEditor ? new Textbox() : new GridTabSelectionListView(true, gridField.getWindowNo()), gridField);
this.tableEditor = tableEditor;
super(tableEditor ? new Textbox() : new GridTabSelectionListView(true, gridField.getWindowNo()), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -16,6 +16,7 @@ package org.adempiere.webui.editor.grid.selection;
import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu;
import org.adempiere.webui.event.ContextMenuEvent;
@ -45,22 +46,38 @@ public class WGridTabSingleSelectionEditor extends WEditor implements ContextMen
private Object oldValue;
private boolean tableEditor = false;
private GridTab listViewGridTab = null;
private String currentLinkValue = null;
private boolean readWrite;
/**
*
* @param gridField
*/
public WGridTabSingleSelectionEditor(GridField gridField) {
this(gridField, false);
}
public WGridTabSingleSelectionEditor(GridField gridField, boolean tableEditor)
/**
*
* @param gridField
* @param tableEditor
*/
public WGridTabSingleSelectionEditor(GridField gridField, boolean tableEditor) {
this(gridField, tableEditor, null);
}
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public WGridTabSingleSelectionEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
super(tableEditor ? new Textbox() : new GridTabSelectionListView(false, gridField.getWindowNo()), gridField);
this.tableEditor = tableEditor;
super(tableEditor ? new Textbox() : new GridTabSelectionListView(false, gridField.getWindowNo()), gridField, tableEditor, editorConfiguration);
init();
}

View File

@ -13,6 +13,7 @@
*****************************************************************************/
package org.adempiere.webui.factory;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WAccountEditor;
import org.adempiere.webui.editor.WAssignmentEditor;
import org.adempiere.webui.editor.WBinaryEditor;
@ -34,6 +35,7 @@ import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WPAttributeEditor;
import org.adempiere.webui.editor.WPasswordEditor;
import org.adempiere.webui.editor.WPaymentEditor;
import org.adempiere.webui.editor.WRadioGroupEditor;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.editor.WTableDirEditor;
@ -57,6 +59,12 @@ public class DefaultEditorFactory implements IEditorFactory {
@Override
public WEditor getEditor(GridTab gridTab, GridField gridField,
boolean tableEditor) {
return getEditor(gridTab, gridField, tableEditor, null);
}
@Override
public WEditor getEditor(GridTab gridTab, GridField gridField,
boolean tableEditor, IEditorConfiguration editorConfiguration) {
if (gridField == null)
{
return null;
@ -78,14 +86,14 @@ public class DefaultEditorFactory implements IEditorFactory {
{
if (gridField.isEncryptedField())
{
editor = new WPasswordEditor(gridField, tableEditor);
editor = new WPasswordEditor(gridField, tableEditor, editorConfiguration);
}
else
{
if (gridField.isHtml())
editor = new WHtmlEditor(gridField);
editor = new WHtmlEditor(gridField, tableEditor, editorConfiguration);
else
editor = new WStringEditor(gridField, tableEditor);
editor = new WStringEditor(gridField, tableEditor, editorConfiguration);
}
//enable html5 color input type
if (displayType == DisplayType.Color)
@ -94,23 +102,23 @@ public class DefaultEditorFactory implements IEditorFactory {
/** File */
else if (displayType == DisplayType.FileName)
{
editor = new WFilenameEditor(gridField);
editor = new WFilenameEditor(gridField, tableEditor, editorConfiguration);
}
/** File Path */
else if (displayType == DisplayType.FilePath)
{
editor = new WFileDirectoryEditor(gridField);
editor = new WFileDirectoryEditor(gridField, tableEditor, editorConfiguration);
}
/** Number */
else if (DisplayType.isNumeric(displayType))
{
editor = new WNumberEditor(tableEditor, gridField);
editor = new WNumberEditor(gridField, tableEditor, editorConfiguration);
}
/** YesNo */
else if (displayType == DisplayType.YesNo)
{
editor = new WYesNoEditor(gridField);
editor = new WYesNoEditor(gridField, tableEditor, editorConfiguration);
if (tableEditor)
((WYesNoEditor)editor).getComponent().setLabel("");
}
@ -119,113 +127,115 @@ public class DefaultEditorFactory implements IEditorFactory {
else if (displayType == DisplayType.Text || displayType == DisplayType.Memo || displayType == DisplayType.TextLong || displayType == DisplayType.ID)
{
if (gridField.isHtml())
editor = new WHtmlEditor(gridField);
editor = new WHtmlEditor(gridField, tableEditor, editorConfiguration);
else
editor = new WStringEditor(gridField, tableEditor);
editor = new WStringEditor(gridField, tableEditor, editorConfiguration);
}
/** Date */
else if (DisplayType.isDate(displayType))
{
if (displayType == DisplayType.Time)
editor = new WTimeEditor(gridField);
editor = new WTimeEditor(gridField, tableEditor, editorConfiguration);
else if (displayType == DisplayType.DateTime)
editor = new WDatetimeEditor(gridField);
editor = new WDatetimeEditor(gridField, tableEditor, editorConfiguration);
else
editor = new WDateEditor(gridField);
editor = new WDateEditor(gridField, tableEditor, editorConfiguration);
}
/** Chart */
else if(displayType == DisplayType.Chart)
{
editor = new WChartEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()));
editor = new WChartEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()), tableEditor, editorConfiguration);
}
/** Dashboard Content */
else if(displayType == DisplayType.DashboardContent)
{
editor = new WDashboardContentEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()));
editor = new WDashboardContentEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()), tableEditor, editorConfiguration);
}
/** Button */
else if (displayType == DisplayType.Button)
{
editor = new WButtonEditor(gridField);
editor = new WButtonEditor(gridField, tableEditor, editorConfiguration);
}
/** Table Direct */
else if (displayType == DisplayType.TableDir ||
displayType == DisplayType.Table || displayType == DisplayType.List)
{
editor = new WTableDirEditor(gridField);
editor = new WTableDirEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Payment)
{
editor = new WPaymentEditor(gridField);
editor = new WPaymentEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.URL)
{
editor = new WUrlEditor(gridField);
editor = new WUrlEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Search)
{
editor = new WSearchEditor(gridField);
editor = new WSearchEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Location)
{
editor = new WLocationEditor(gridField);
editor = new WLocationEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Locator)
{
editor = new WLocatorEditor(gridField);
editor = new WLocatorEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Account)
{
editor = new WAccountEditor(gridField);
editor = new WAccountEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Image)
{
editor = new WImageEditor(gridField);
editor = new WImageEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Binary)
{
editor = new WBinaryEditor(gridField);
editor = new WBinaryEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.PAttribute)
{
editor = new WPAttributeEditor(gridTab, gridField);
editor = new WPAttributeEditor(gridTab, gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.Assignment)
{
editor = new WAssignmentEditor(gridField);
editor = new WAssignmentEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.SingleSelectionGrid)
{
editor = new WGridTabSingleSelectionEditor(gridField, tableEditor);
editor = new WGridTabSingleSelectionEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.MultipleSelectionGrid)
{
editor = new WGridTabMultiSelectionEditor(gridField, tableEditor);
editor = new WGridTabMultiSelectionEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.ChosenMultipleSelectionList || displayType == DisplayType.ChosenMultipleSelectionTable)
{
editor = new WChosenboxListEditor(gridField);
editor = new WChosenboxListEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.ChosenMultipleSelectionSearch)
{
editor = new WChosenboxSearchEditor(gridField);
editor = new WChosenboxSearchEditor(gridField, tableEditor, editorConfiguration);
}
else if (displayType == DisplayType.RadiogroupList)
{
editor = new WRadioGroupEditor(gridField, tableEditor, editorConfiguration);
}
else
{
editor = new WUnknownEditor(gridField);
editor = new WUnknownEditor(gridField, tableEditor, editorConfiguration);
}
editor.setTableEditor(tableEditor);
return editor;
}

View File

@ -13,6 +13,7 @@
*****************************************************************************/
package org.adempiere.webui.factory;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WEditor;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
@ -28,7 +29,17 @@ public interface IEditorFactory {
* @param gridTab
* @param gridField
* @param tableEditor
* @return WEditor
* @return {@link WEditor}
*/
public WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor);
/**
*
* @param gridTab
* @param gridField
* @param tableEditor
* @param editorConfiguration
* @return {@link WEditor}
*/
public WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration);
}

View File

@ -29,6 +29,7 @@ import org.adempiere.base.Core;
import org.adempiere.util.Callback;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridField;
@ -57,13 +58,45 @@ public class SchedulerStateEditor extends WEditor {
private int schedulerState;
/**
*
* @param gridField
*/
public SchedulerStateEditor(GridField gridField)
{
this(gridField, -1);
this(gridField, false, null);
}
public SchedulerStateEditor(GridField gridField, int rowIndex) {
super(new Button(), gridField, rowIndex);
/**
*
* @param gridField
* @param tableEditor
* @param editorConfiguration
*/
public SchedulerStateEditor(GridField gridField, boolean tableEditor, IEditorConfiguration editorConfiguration)
{
this(gridField, -1, tableEditor, editorConfiguration);
}
/**
*
* @param gridField
* @param rowIndex
*/
public SchedulerStateEditor(GridField gridField, int rowIndex)
{
this(gridField, rowIndex, false, null);
}
/**
*
* @param gridField
* @param rowIndex
* @param tableEditor
* @param editorConfiguration
*/
public SchedulerStateEditor(GridField gridField, int rowIndex, boolean tableEditor, IEditorConfiguration editorConfiguration) {
super(new Button(), gridField, rowIndex, tableEditor, editorConfiguration);
Button btn = getComponent();
btn.addEventListener(ON_START_SCHEDULER_EVENT, evt -> {

View File

@ -25,6 +25,7 @@
**********************************************************************/
package org.adempiere.webui.scheduler;
import org.adempiere.webui.editor.IEditorConfiguration;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.factory.IEditorFactory;
import org.compiere.model.GridField;
@ -49,8 +50,14 @@ public class SchedulerStateEditorFactory implements IEditorFactory {
@Override
public WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor) {
return getEditor(gridTab, gridField, tableEditor, null);
}
@Override
public WEditor getEditor(GridTab gridTab, GridField gridField, boolean tableEditor,
IEditorConfiguration editorConfiguration) {
if (gridField != null && gridField.getDisplayType() == SCHEDULER_STATE_AD_REFERENCE_ID) {
return new SchedulerStateEditor(gridField);
return new SchedulerStateEditor(gridField, tableEditor, editorConfiguration);
}
return null;
}