Implementation

From ADempiere
Revision as of 07:40, 5 September 2011 by Mcarminati (Talk) (Adempiere Included "Form")

Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Adempiere Included "Form"

I'd like to submit to the Adempiere community a simple and pratical extention by witch include into a tab of window's Adempiere a Form (AD_Form object)


BOM.jpg

In the previous picture is shown a Window with a single Tab in wich is included the standard Form named BOM Drop. This is only an example, but by this ploy developers could include into a Tab many different objects and extend the Adempiere user interface.

For example we can include Form by which show graph or picture or specific form which could interact with the current selected record.


AD Tab Configuration
Into the Tab window I added the new Field in which we can indicate the reference to the AD_Form

ADTabConf.jpg


SQL Scripts
Here is the sql scripts for the Postgres database

SET search_path TO adempiere;
ALTER TABLE ad_field ADD COLUMN included_form_id numeric(10);
ALTER TABLE ad_field ALTER COLUMN included_form_id SET STORAGE MAIN;
ALTER TABLE ad_column ADD COLUMN included_form_id numeric(10);
ALTER TABLE ad_column ALTER COLUMN included_form_id SET STORAGE MAIN;
ALTER TABLE ad_column ALTER COLUMN included_form_id SET DEFAULT NULL::numeric;
INSERT INTO ad_element(
 ad_element_id, ad_client_id, ad_org_id, isactive, created, createdby,
 updated, updatedby, columnname, entitytype, "name", printname,
 description, help, po_name, po_printname, po_description, po_help)
 VALUES (1000003,0,0,'Y','2010-11-05 17:52:09',0,'2010-11-05
 17:52:09',0,'Included_Form_ID','U','Included_Form_ID','Included_Form_ID',,,,,,);
INSERT INTO ad_column(
  ad_column_id, ad_client_id, ad_org_id, isactive, created, updated,
  createdby, updatedby, name, description, help, version, entitytype,
  columnname, ad_table_id, ad_reference_id, ad_reference_value_id,
  ad_val_rule_id, fieldlength, defaultvalue, iskey, isparent, ismandatory,
  isupdateable, readonlylogic, isidentifier, seqno, istranslated,
  isencrypted, callout, vformat, valuemin, valuemax, isselectioncolumn,
  ad_element_id, ad_process_id, issyncdatabase, isalwaysupdateable,
  columnsql, mandatorylogic, infofactoryclass, isautocomplete,
  isallowlogging, formatpattern, included_form_id)
VALUES (1000010,0,0,'Y','2010-11-05 18:24:53','2010-11-05
          18:24:53',0,0,'Included_Form_ID',,,0,'U','Included_Form_ID',107,18,284,NULL,10,,'N','N','N','Y',,'N',NULL,
          'N','N',,,,,'N',1000003,NULL,'N','N',,,,'N','Y',,NULL);
INSERT INTO ad_field(
    ad_field_id, ad_client_id, ad_org_id, isactive, created, createdby,
    updated, updatedby, name, description, help, iscentrallymaintained,
    ad_tab_id, ad_column_id, ad_fieldgroup_id, isdisplayed, displaylogic,
    displaylength, isreadonly, seqno, sortno, issameline, isheading,
    isfieldonly, isencrypted, entitytype, obscuretype, ad_reference_id,
    ismandatory, included_tab_id, defaultvalue, ad_reference_value_id,
    ad_val_rule_id, infofactoryclass, included_form_id)
VALUES (1000008,0,0,'Y','2010-11-05 18:27:35',0,'2010-11-05 18:27:35',0,'Included_Form_ID',,,'Y',107,1000010,NULL,'Y',,10,'N',NULL,NULL,
        'N','N','N','N','U',,NULL,,NULL,,NULL,NULL,,NULL);
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, c.isalwaysupdateable, c.readonlylogic,
   c.mandatorylogic, c.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, f.included_form_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
   JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_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'::bpchar AND c.isactive = 'Y'::bpchar;
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, c.isalwaysupdateable, c.readonlylogic,
   c.mandatorylogic, c.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, f.included_form_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
   JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_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'::bpchar AND c.isactive = 'Y'::bpchar;


Program source modifications
In this paragraph I explain the modifications at the program source for the Java user interface and Web user interface and at the based object GridField and GridTabVo.

List of modified classes of the dictionary objects:
GridField.java
GridTabVo.java org.compiere.GridTabVo

List of modified classes of the Java User Interface:
Vpanel.java org.compiere.grid.VPanel
GridController.java org.compiere.grid.GridController

List of modified classes of the Web User Interface:
AdTabPanel.java org.adempiere.webui.panel

List of new class:
IncludedForm.java
IincludedForm.java



--Mcarminati 14:07, 5 September 2011 (UTC)