1006008 Add field type for dashboard content. (IDEMPIERE-3270)

This commit is contained in:
Heng Sin Low 2016-05-10 20:31:56 +08:00
parent 06626f6674
commit 979d022418
12 changed files with 918 additions and 210 deletions

View File

@ -0,0 +1,231 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- May 9, 2016 8:34:27 PM MYT
-- 1006008 Add field type for dashboard content
INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,Description,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200122,'Dashboard Content','eddd31af-5ab7-4b88-967f-4fe7b7e091ea','N',0,'Dashboard Content','D',TO_DATE('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_DATE('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'D')
;
-- May 9, 2016 8:35:29 PM MYT
INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (212762,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','e5d70049-4a7e-49ab-aba9-ad181833c0d9',TO_DATE('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'Y','PA_DashboardContent_ID','Dashboard Content','Y','Y',100,100,'N','N',0,0,TO_DATE('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',51006,19,101)
;
-- May 9, 2016 8:35:38 PM MYT
UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PADashboardContent_ADColumn',Updated=TO_DATE('2016-05-09 20:35:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212762
;
-- May 9, 2016 8:35:38 PM MYT
ALTER TABLE AD_Column ADD PA_DashboardContent_ID NUMBER(10) DEFAULT NULL
;
-- May 9, 2016 8:58:49 PM MYT
-- 1006008 Add field type for dashboard content
INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,DisplayLogic,AD_Org_ID,Updated,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (0,204220,'N',0,'N','N',210,'Y','N','@AD_Reference_ID@=200122',0,TO_DATE('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),'Dashboard Content','dc337329-72dd-4532-8abf-e0a24ea0340b','Y','N',100,100,'Y','Y',210,1,'N',0,TO_DATE('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),2,1,'N','N',212762,'D',101)
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=204220
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=171
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=56279
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=54403
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=2574
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=2573
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=202518
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=202519
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=160
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=161
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=162
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=166
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=5122
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=169
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=2370
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=10128
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=4941
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50188
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=168
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=159
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=4940
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200288
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=200648
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=202257
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=56317
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=450,IsDisplayed='Y' WHERE AD_Field_ID=62467
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=460,IsDisplayed='Y' WHERE AD_Field_ID=167
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=470,IsDisplayed='Y' WHERE AD_Field_ID=825
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=480,IsDisplayed='Y' WHERE AD_Field_ID=1000320
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=204220
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=167
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=5121
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=56317
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=62467
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=202518
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=202519
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=5122
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200288
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y' WHERE AD_Field_ID=202257
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=440,IsDisplayedGrid='Y' WHERE AD_Field_ID=59619
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=450,IsDisplayedGrid='Y' WHERE AD_Field_ID=1000320
;
CREATE OR REPLACE VIEW ad_field_v AS
SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline,
f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable,
COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus,
c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y' AND c.isactive = 'Y'
;
CREATE OR REPLACE VIEW ad_field_vt AS
SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno,
f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable,
c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y' AND c.isactive = 'Y'
;
SELECT register_migration_script('201605101800_System_Ticket_1006008.sql') FROM dual
;

View File

@ -0,0 +1,229 @@
-- May 9, 2016 8:34:27 PM MYT
-- 1006008 Add field type for dashboard content
INSERT INTO AD_Reference (AD_Reference_ID,Name,AD_Reference_UU,IsOrderByValue,AD_Org_ID,Description,ValidationType,Updated,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,EntityType) VALUES (200122,'Dashboard Content','eddd31af-5ab7-4b88-967f-4fe7b7e091ea','N',0,'Dashboard Content','D',TO_TIMESTAMP('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'Y',100,100,0,TO_TIMESTAMP('2016-05-09 20:34:20','YYYY-MM-DD HH24:MI:SS'),'D')
;
-- May 9, 2016 8:35:29 PM MYT
INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,AD_Org_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES (212762,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','e5d70049-4a7e-49ab-aba9-ad181833c0d9',TO_TIMESTAMP('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'Y','PA_DashboardContent_ID','Dashboard Content','Y','Y',100,100,'N','N',0,0,TO_TIMESTAMP('2016-05-09 20:35:23','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',51006,19,101)
;
-- May 9, 2016 8:35:38 PM MYT
UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PADashboardContent_ADColumn',Updated=TO_TIMESTAMP('2016-05-09 20:35:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212762
;
-- May 9, 2016 8:35:38 PM MYT
ALTER TABLE AD_Column ADD COLUMN PA_DashboardContent_ID NUMERIC(10) DEFAULT NULL
;
-- May 9, 2016 8:58:49 PM MYT
-- 1006008 Add field type for dashboard content
INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,DisplayLogic,AD_Org_ID,Updated,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID) VALUES (0,204220,'N',0,'N','N',210,'Y','N','@AD_Reference_ID@=200122',0,TO_TIMESTAMP('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),'Dashboard Content','dc337329-72dd-4532-8abf-e0a24ea0340b','Y','N',100,100,'Y','Y',210,1,'N',0,TO_TIMESTAMP('2016-05-09 20:58:43','YYYY-MM-DD HH24:MI:SS'),2,1,'N','N',212762,'D',101)
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=204220
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=171
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=56279
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=54403
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=2574
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=2573
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=202518
;
-- May 9, 2016 8:59:12 PM MYT
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=202519
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=160
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=161
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=162
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=166
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=5122
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=169
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=2370
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=10128
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=4941
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50188
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=168
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=159
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=4940
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200288
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=200648
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=202257
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=56317
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=450,IsDisplayed='Y' WHERE AD_Field_ID=62467
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=460,IsDisplayed='Y' WHERE AD_Field_ID=167
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=470,IsDisplayed='Y' WHERE AD_Field_ID=825
;
-- May 9, 2016 8:59:13 PM MYT
UPDATE AD_Field SET SeqNo=480,IsDisplayed='Y' WHERE AD_Field_ID=1000320
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=204220
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=167
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=5121
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=56317
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=62467
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=202518
;
-- May 9, 2016 8:59:56 PM MYT
UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=202519
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=5122
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200288
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=430,IsDisplayedGrid='Y' WHERE AD_Field_ID=202257
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=440,IsDisplayedGrid='Y' WHERE AD_Field_ID=59619
;
-- May 9, 2016 8:59:57 PM MYT
UPDATE AD_Field SET SeqNoGrid=450,IsDisplayedGrid='Y' WHERE AD_Field_ID=1000320
;
CREATE OR REPLACE VIEW ad_field_v AS
SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline,
f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable,
COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus,
c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y' AND c.isactive = 'Y'
;
CREATE OR REPLACE VIEW ad_field_vt AS
SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno,
f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable,
c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y' AND c.isactive = 'Y'
;
SELECT register_migration_script('201605101800_System_Ticket_1006008.sql') FROM dual
;

View File

@ -2457,6 +2457,11 @@ public class GridField
return m_vo.displayType == DisplayType.Button && MColumn.ISTOOLBARBUTTON_Toolbar.equals(m_vo.IsToolbarButton);
}
public int getPA_DashboardContent_ID()
{
return m_vo.PA_DashboardContent_ID;
}
public GridField clone(Properties ctx)
{
try {

View File

@ -234,6 +234,8 @@ public class GridFieldVO implements Serializable
vo.AD_LabelStyle_ID = rs.getInt (i);
else if (columnName.equalsIgnoreCase("AD_FieldStyle_ID"))
vo.AD_FieldStyle_ID = rs.getInt (i);
else if (columnName.equalsIgnoreCase("PA_DashboardContent_ID"))
vo.PA_DashboardContent_ID = rs.getInt (i);
}
if (vo.Header == null)
vo.Header = vo.ColumnName;
@ -671,6 +673,8 @@ public class GridFieldVO implements Serializable
public int AD_FieldStyle_ID = 0;
public int PA_DashboardContent_ID = 0;
/**
* Set Context including contained elements
* @param newCtx new context
@ -802,6 +806,7 @@ public class GridFieldVO implements Serializable
clone.IsDefaultFocus = IsDefaultFocus;
clone.AD_FieldStyle_ID = AD_FieldStyle_ID;
clone.AD_LabelStyle_ID = AD_LabelStyle_ID;
clone.PA_DashboardContent_ID = PA_DashboardContent_ID;
// Lookup
clone.ValidationCode = ValidationCode;

View File

@ -570,6 +570,17 @@ public interface I_AD_Column
*/
public String getName();
/** Column name PA_DashboardContent_ID */
public static final String COLUMNNAME_PA_DashboardContent_ID = "PA_DashboardContent_ID";
/** Set Dashboard Content */
public void setPA_DashboardContent_ID (int PA_DashboardContent_ID);
/** Get Dashboard Content */
public int getPA_DashboardContent_ID();
public org.compiere.model.I_PA_DashboardContent getPA_DashboardContent() throws RuntimeException;
/** Column name ReadOnlyLogic */
public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic";

View File

@ -116,6 +116,7 @@ public class SystemIDs
public final static int REFERENCE_DATATYPE_URL = 40;
public final static int REFERENCE_DATATYPE_YES_NO = 20;
public final static int REFERENCE_DATATYPE_CHART = 53370;
public final static int REFERENCE_DATATYPE_DASHBOARD_CONTENT = 200122;
public final static int REFERENCE_AD_USER = 110;
public final static int REFERENCE_DOCUMENTACTION = 135;

View File

@ -32,7 +32,7 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20161030L;
private static final long serialVersionUID = 20161215L;
/** Standard Constructor */
public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName)
@ -924,6 +924,31 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
return (String)get_Value(COLUMNNAME_Name);
}
public org.compiere.model.I_PA_DashboardContent getPA_DashboardContent() throws RuntimeException
{
return (org.compiere.model.I_PA_DashboardContent)MTable.get(getCtx(), org.compiere.model.I_PA_DashboardContent.Table_Name)
.getPO(getPA_DashboardContent_ID(), get_TrxName()); }
/** Set Dashboard Content.
@param PA_DashboardContent_ID Dashboard Content */
public void setPA_DashboardContent_ID (int PA_DashboardContent_ID)
{
if (PA_DashboardContent_ID < 1)
set_Value (COLUMNNAME_PA_DashboardContent_ID, null);
else
set_Value (COLUMNNAME_PA_DashboardContent_ID, Integer.valueOf(PA_DashboardContent_ID));
}
/** Get Dashboard Content.
@return Dashboard Content */
public int getPA_DashboardContent_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_DashboardContent_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Read Only Logic.
@param ReadOnlyLogic
Logic to determine if field is read only (applies only when field is read-write)
@ -1051,4 +1076,4 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
{
return (String)get_Value(COLUMNNAME_VFormat);
}
}
}

View File

@ -50,6 +50,7 @@ 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 java.text.DateFormat;
import java.text.DecimalFormat;
@ -144,6 +145,8 @@ public final class DisplayType
public static final int Payment = REFERENCE_DATATYPE_PAYMENT;
public static final int Chart = REFERENCE_DATATYPE_CHART;
public static final int DashboardContent = REFERENCE_DATATYPE_DASHBOARD_CONTENT;
/**
* - New Display Type

View File

@ -211,197 +211,7 @@ public class DashboardController implements EventListener<Event> {
boolean panelEmpty = true;
// HTML content
String htmlContent = dc.get_Translation(MDashboardContent.COLUMNNAME_HTML);
if(htmlContent != null)
{
StringBuilder result = new StringBuilder("<html><head>");
URL url = getClass().getClassLoader().getResource("org/compiere/css/PAPanel.css");
InputStreamReader ins;
BufferedReader bufferedReader = null;
try {
ins = new InputStreamReader(url.openStream());
bufferedReader = new BufferedReader( ins );
String cssLine;
result.append("<style type=\"text/css\">");
while ((cssLine = bufferedReader.readLine()) != null)
result.append(cssLine + "\n");
result.append("</style>");
} catch (Exception e1) {
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
}
finally{
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception e) {}
bufferedReader = null;
}
}
result.append("</head><body><div class=\"content\">\n");
// if(description != null)
// result.append("<h2>" + description + "</h2>\n");
result.append(stripHtml(htmlContent, false) + "<br>\n");
result.append("</div>\n</body>\n</html>");
Html html = new Html();
html.setContent(result.toString());
content.appendChild(html);
panelEmpty = false;
}
// Window
int AD_Window_ID = dc.getAD_Window_ID();
if(AD_Window_ID > 0)
{
int AD_Menu_ID = dc.getAD_Menu_ID();
Div div = new Div();
ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
I_AD_Menu menu = dc.getAD_Menu();
btn.setLabel(menu.getName());
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
btn.addEventListener(Events.ON_CLICK, this);
div.appendChild(btn);
content.appendChild(div);
panelEmpty = false;
}
//Report & Process
int AD_Process_ID = dc.getAD_Process_ID();
if(AD_Process_ID > 0)
{
String sql = "SELECT AD_MENU_ID FROM AD_MENU WHERE AD_Process_ID=?";
int AD_Menu_ID = DB.getSQLValue(null, sql, AD_Process_ID);
ToolBarButton btn = new ToolBarButton();
MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
btn.addEventListener(Events.ON_CLICK, this);
panelEmpty = false;
if (dc.isEmbedReportContent())
{
String processParameters = dc.getProcessParameters();
embedReport(content, AD_Process_ID, processParameters);
Toolbar toolbar = new Toolbar();
content.appendChild(toolbar);
btn.setLabel("Open run dialog");
toolbar.appendChild(btn);
btn = new ToolBarButton();
btn.setAttribute("AD_Process_ID", AD_Process_ID);
btn.setAttribute("ProcessParameters", processParameters);
btn.addEventListener(Events.ON_CLICK, this);
btn.setLabel("View report in new tab");
toolbar.appendChild(new Separator("vertical"));
toolbar.appendChild(btn);
}
else
{
btn.setLabel(menu.getName());
content.appendChild(btn);
}
}
// Goal
int PA_Goal_ID = dc.getPA_Goal_ID();
if(PA_Goal_ID > 0)
{
//link to open performance detail
Div div = new Div();
Toolbarbutton link = new Toolbarbutton();
link.setImage(ThemeManager.getThemeResource("images/Zoom16.png"));
link.setAttribute("PA_Goal_ID", PA_Goal_ID);
link.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int PA_Goal_ID = (Integer)event.getTarget().getAttribute("PA_Goal_ID");
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
new WPerformanceDetail(goal);
}
});
div.appendChild(link);
content.appendChild(div);
String goalDisplay = dc.getGoalDisplay();
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
WGraph graph = new WGraph(goal, 55, false, true,
!(MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)),
MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay));
content.appendChild(graph);
panelEmpty = false;
}
// ZUL file url
String url = dc.getZulFilePath();
if(url != null)
{
try {
Component component = null;
List<IDashboardGadgetFactory> f = Service.locator().list(IDashboardGadgetFactory.class).getServices();
for (IDashboardGadgetFactory factory : f) {
component = factory.getGadget(url.toString(),content);
if(component != null)
break;
}
if(component != null)
{
if (component instanceof Include)
component = component.getFirstChild();
if (component instanceof DashboardPanel)
{
DashboardPanel dashboardPanel = (DashboardPanel) component;
if (!dashboardPanel.getChildren().isEmpty()) {
content.appendChild(dashboardPanel);
dashboardRunnable.add(dashboardPanel);
panelEmpty = false;
}
}
else
{
content.appendChild(component);
panelEmpty = false;
}
}
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
throw new AdempiereException(e);
}
}
//chart
final int AD_Chart_ID = dc.getAD_Chart_ID();
if (AD_Chart_ID > 0) {
final Div chartPanel = new Div();
chartPanel.setSclass("chart-gadget");
final MChart chartModel = new MChart(Env.getCtx(), AD_Chart_ID, null);
content.appendChild(chartPanel);
panelEmpty = false;
chartPanel.addEventListener(Events.ON_AFTER_SIZE, new EventListener<AfterSizeEvent>() {
@Override
public void onEvent(AfterSizeEvent event) throws Exception {
int width = event.getWidth()*90/100;
int height = event.getHeight();
//set normal height
if (height == 0) {
height = width * 85 / 100;
ZKUpdateUtil.setHeight(chartPanel, height+"px");
}
chartPanel.getChildren().clear();
ChartModel model = new ChartModel();
model.chart = chartModel;
List<IChartRendererService> list = Service.locator().list(IChartRendererService.class).getServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartPanel, width, height, model))
break;
}
}
});
}
panelEmpty = !render(content, dc, dashboardRunnable);
if (panelEmpty)
panel.detach();
@ -467,6 +277,205 @@ public class DashboardController implements EventListener<Event> {
}
}
public boolean render(Component content, MDashboardContent dc, DashboardRunnable dashboardRunnable) throws Exception {
boolean empty = true;
// HTML content
String htmlContent = dc.get_Translation(MDashboardContent.COLUMNNAME_HTML);
if(htmlContent != null)
{
StringBuilder result = new StringBuilder("<html><head>");
URL url = getClass().getClassLoader().getResource("org/compiere/css/PAPanel.css");
InputStreamReader ins;
BufferedReader bufferedReader = null;
try {
ins = new InputStreamReader(url.openStream());
bufferedReader = new BufferedReader( ins );
String cssLine;
result.append("<style type=\"text/css\">");
while ((cssLine = bufferedReader.readLine()) != null)
result.append(cssLine + "\n");
result.append("</style>");
} catch (Exception e1) {
logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
}
finally{
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception e) {}
bufferedReader = null;
}
}
result.append("</head><body><div class=\"content\">\n");
// if(description != null)
// result.append("<h2>" + description + "</h2>\n");
result.append(stripHtml(htmlContent, false) + "<br>\n");
result.append("</div>\n</body>\n</html>");
Html html = new Html();
html.setContent(result.toString());
content.appendChild(html);
empty = false;
}
// Window
int AD_Window_ID = dc.getAD_Window_ID();
if(AD_Window_ID > 0)
{
int AD_Menu_ID = dc.getAD_Menu_ID();
Div div = new Div();
ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
I_AD_Menu menu = dc.getAD_Menu();
btn.setLabel(menu.getName());
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
btn.addEventListener(Events.ON_CLICK, this);
div.appendChild(btn);
content.appendChild(div);
empty = false;
}
//Report & Process
int AD_Process_ID = dc.getAD_Process_ID();
if(AD_Process_ID > 0)
{
String sql = "SELECT AD_MENU_ID FROM AD_MENU WHERE AD_Process_ID=?";
int AD_Menu_ID = DB.getSQLValue(null, sql, AD_Process_ID);
ToolBarButton btn = new ToolBarButton();
MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
btn.addEventListener(Events.ON_CLICK, this);
empty = false;
if (dc.isEmbedReportContent())
{
String processParameters = dc.getProcessParameters();
embedReport(content, AD_Process_ID, processParameters);
Toolbar toolbar = new Toolbar();
content.appendChild(toolbar);
btn.setLabel("Open run dialog");
toolbar.appendChild(btn);
btn = new ToolBarButton();
btn.setAttribute("AD_Process_ID", AD_Process_ID);
btn.setAttribute("ProcessParameters", processParameters);
btn.addEventListener(Events.ON_CLICK, this);
btn.setLabel("View report in new tab");
toolbar.appendChild(new Separator("vertical"));
toolbar.appendChild(btn);
}
else
{
btn.setLabel(menu.getName());
content.appendChild(btn);
}
}
// Goal
int PA_Goal_ID = dc.getPA_Goal_ID();
if(PA_Goal_ID > 0)
{
//link to open performance detail
Div div = new Div();
Toolbarbutton link = new Toolbarbutton();
link.setImage(ThemeManager.getThemeResource("images/Zoom16.png"));
link.setAttribute("PA_Goal_ID", PA_Goal_ID);
link.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int PA_Goal_ID = (Integer)event.getTarget().getAttribute("PA_Goal_ID");
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
new WPerformanceDetail(goal);
}
});
div.appendChild(link);
content.appendChild(div);
String goalDisplay = dc.getGoalDisplay();
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
WGraph graph = new WGraph(goal, 55, false, true,
!(MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)),
MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay));
content.appendChild(graph);
empty = false;
}
// ZUL file url
String url = dc.getZulFilePath();
if(url != null)
{
try {
Component component = null;
List<IDashboardGadgetFactory> f = Service.locator().list(IDashboardGadgetFactory.class).getServices();
for (IDashboardGadgetFactory factory : f) {
component = factory.getGadget(url.toString(),content);
if(component != null)
break;
}
if(component != null)
{
if (component instanceof Include)
component = component.getFirstChild();
if (component instanceof DashboardPanel)
{
DashboardPanel dashboardPanel = (DashboardPanel) component;
if (!dashboardPanel.getChildren().isEmpty()) {
content.appendChild(dashboardPanel);
if (dashboardRunnable != null)
dashboardRunnable.add(dashboardPanel);
empty = false;
}
}
else
{
content.appendChild(component);
empty = false;
}
}
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to create components. zul="+url, e);
throw new AdempiereException(e);
}
}
//chart
final int AD_Chart_ID = dc.getAD_Chart_ID();
if (AD_Chart_ID > 0) {
final Div chartPanel = new Div();
chartPanel.setSclass("chart-gadget");
final MChart chartModel = new MChart(Env.getCtx(), AD_Chart_ID, null);
content.appendChild(chartPanel);
empty = false;
chartPanel.addEventListener(Events.ON_AFTER_SIZE, new EventListener<AfterSizeEvent>() {
@Override
public void onEvent(AfterSizeEvent event) throws Exception {
int width = event.getWidth()*90/100;
int height = event.getHeight();
//set normal height
if (height == 0) {
height = width * 85 / 100;
chartPanel.setHeight(height+"px");
}
chartPanel.getChildren().clear();
ChartModel model = new ChartModel();
model.chart = chartModel;
List<IChartRendererService> list = Service.locator().list(IChartRendererService.class).getServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartPanel, width, height, model))
break;
}
}
});
}
return !empty;
}
public void onEvent(Event event) throws Exception {
Component comp = event.getTarget();
String eventName = event.getName();

View File

@ -23,8 +23,10 @@ import org.compiere.model.GridField;
import org.compiere.model.MChart;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.zkoss.zk.ui.event.AfterSizeEvent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Panel;
import org.zkoss.zul.Panelchildren;
@ -40,6 +42,12 @@ public class WChartEditor extends WEditor
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
private MChart chartModel = null;
private int chartWidth;
private int chartHeight;
private Div chartDiv;
/** Logger */
@SuppressWarnings("unused")
@ -54,21 +62,16 @@ public class WChartEditor extends WEditor
}
private void createChart() {
Panel panel = getComponent();
if (panel.getPanelchildren() != null) {
panel.getPanelchildren().getChildren().clear();
} else {
Panelchildren pc = new Panelchildren();
panel.appendChild(pc);
pc.setSclass("chart-field");
}
ChartModel model = new ChartModel();
model.chart = chartModel;
List<IChartRendererService> list = Service.locator().list(IChartRendererService.class).getServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(panel.getPanelchildren(), 400, chartModel.getWinHeight(), model))
break;
}
if (chartHeight > 0 && chartWidth > 0) {
chartDiv.getChildren().clear();
ChartModel model = new ChartModel();
model.chart = chartModel;
List<IChartRendererService> list = Service.locator().list(IChartRendererService.class).getServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model))
break;
}
}
}
@Override
@ -77,10 +80,16 @@ public class WChartEditor extends WEditor
}
private void init()
{
{
Panelchildren pc = new Panelchildren();
getComponent().appendChild(pc);
pc.setSclass("chart-field");
chartDiv = new Div();
chartDiv.addEventListener(Events.ON_AFTER_SIZE, this);
pc.appendChild(chartDiv);
}
@Override
@Override
public String getDisplay()
{
return chartModel.get_Translation(MChart.COLUMNNAME_Name);
@ -129,6 +138,30 @@ public class WChartEditor extends WEditor
public void onEvent(Event event) throws Exception
{
if (event instanceof AfterSizeEvent)
{
AfterSizeEvent ase = (AfterSizeEvent) event;
chartWidth = ase.getWidth();
if (chartWidth == 0) {
chartWidth = 400;
}
chartHeight = 0;
if (chartDiv.getStyle() != null && chartDiv.getStyle().contains("height"))
chartHeight = ase.getHeight();
//set default height
if (chartHeight == 0) {
chartHeight = chartModel.getWinHeight();
chartDiv.setHeight(chartHeight+"px");
}
chartDiv.getChildren().clear();
ChartModel model = new ChartModel();
model.chart = chartModel;
List<IChartRendererService> list = Service.locator().list(IChartRendererService.class).getServices();
for (IChartRendererService renderer : list) {
if (renderer.renderChart(chartDiv, chartWidth, chartHeight, model))
break;
}
}
}
@Override
@ -136,4 +169,12 @@ public class WChartEditor extends WEditor
super.dynamicDisplay();
createChart();
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#setFieldStyle(java.lang.String)
*/
@Override
protected void setFieldStyle(String style) {
chartDiv.setStyle(style);
}
}

View File

@ -0,0 +1,141 @@
/**
*
*/
package org.adempiere.webui.editor;
import java.util.logging.Level;
import org.adempiere.webui.dashboard.DashboardRunnable;
import org.adempiere.webui.desktop.DashboardController;
import org.compiere.model.GridField;
import org.compiere.model.MDashboardContent;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Util;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Caption;
import org.zkoss.zul.Div;
import org.zkoss.zul.Panel;
import org.zkoss.zul.Panelchildren;
/**
* @author hengsin
*
*/
public class WDashboardContentEditor extends WEditor {
private static final String ON_RENDER_CONTENT = "onRenderContent";
private DashboardController dashboardController;
private MDashboardContent content;
private String fieldStyle;
private final static CLogger logger = CLogger.getCLogger(WDashboardContentEditor.class);
/**
* @param comp
* @param gridField
*/
public WDashboardContentEditor(GridField gridField, int windowNo) {
super(new Panel(), gridField);
dashboardController = new DashboardController();
content = new MDashboardContent(Env.getCtx(), gridField.getPA_DashboardContent_ID(), null);
Panelchildren pc = new Panelchildren();
getComponent().appendChild(pc);
Caption caption = new Caption(content.get_Translation(MDashboardContent.COLUMNNAME_Name));
getComponent().appendChild(caption);
getComponent().addEventListener(ON_RENDER_CONTENT, this);
}
/* (non-Javadoc)
* @see org.zkoss.zk.ui.event.EventListener#onEvent(org.zkoss.zk.ui.event.Event)
*/
@Override
public void onEvent(Event event) throws Exception {
if (event.getName().equals(ON_RENDER_CONTENT)) {
try {
render();
} catch (Exception e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#setReadWrite(boolean)
*/
@Override
public void setReadWrite(boolean readWrite) {
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#isReadWrite()
*/
@Override
public boolean isReadWrite() {
return false;
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#setValue(java.lang.Object)
*/
@Override
public void setValue(Object value) {
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#getValue()
*/
@Override
public Object getValue() {
return null;
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#getDisplay()
*/
@Override
public String getDisplay() {
return null;
}
@Override
public void dynamicDisplay() {
super.dynamicDisplay();
Events.postEvent(ON_RENDER_CONTENT, getComponent(), null);
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#getComponent()
*/
@Override
public Panel getComponent() {
return (Panel) super.getComponent();
}
private void render() throws Exception {
Panel panel = getComponent();
Panelchildren pc = panel.getPanelchildren();
pc.getChildren().clear();
Div div = new Div();
if (!Util.isEmpty(fieldStyle))
div.setStyle(fieldStyle);
DashboardRunnable dashboardRunnable = new DashboardRunnable(panel.getDesktop());
dashboardController.render(div, content, dashboardRunnable);
if (!dashboardRunnable.isEmpty())
dashboardRunnable.refreshDashboard(false);
pc.appendChild(div);
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.WEditor#setFieldStyle(java.lang.String)
*/
@Override
protected void setFieldStyle(String style) {
fieldStyle = style;
}
}

View File

@ -18,6 +18,7 @@ import org.adempiere.webui.editor.WAssignmentEditor;
import org.adempiere.webui.editor.WBinaryEditor;
import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WChartEditor;
import org.adempiere.webui.editor.WDashboardContentEditor;
import org.adempiere.webui.editor.WDateEditor;
import org.adempiere.webui.editor.WDatetimeEditor;
import org.adempiere.webui.editor.WEditor;
@ -126,6 +127,12 @@ public class DefaultEditorFactory implements IEditorFactory {
editor = new WChartEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()));
}
/** Dashboard Content */
else if(displayType == DisplayType.DashboardContent)
{
editor = new WDashboardContentEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()));
}
/** Button */
else if (displayType == DisplayType.Button)
{