IDEMPIERE-3328 Trees : Ability to force loading of all nodes / peer review

This commit is contained in:
Carlos Ruiz 2017-05-03 18:21:01 +02:00
parent 0107f87a3a
commit 802a3ee262
4 changed files with 20 additions and 12 deletions

View File

@ -7,15 +7,19 @@ INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,Cr
;
-- Apr 3, 2017 5:19:13 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212971,0,'Loads directly all nodes','If checked, all nodes are loaded before tree is displayed',288,'IsLoadAllNodesImmediately','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,203064,'Y','N','D','N','N','N','Y','692e44f6-4653-4a06-b68e-05fa3382202d','N',0,'N','N')
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212971,0,'Loads directly all nodes','If checked, all nodes are loaded before tree is displayed',288,'IsLoadAllNodesImmediately','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,203064,'Y','N','D','N','N','N','Y','692e44f6-4653-4a06-b68e-05fa3382202d','N',0,'N','N')
;
-- May 3, 2017 5:34:24 PM CEST
ALTER TABLE AD_Tree ADD IsLoadAllNodesImmediately CHAR(1) DEFAULT 'Y' CHECK (IsLoadAllNodesImmediately IN ('Y','N')) NOT NULL
;
-- Apr 3, 2017 5:19:18 PM CEST
ALTER TABLE AD_Tree MODIFY IsLoadAllNodesImmediately CHAR(1) DEFAULT 'N'
ALTER TABLE AD_Tree MODIFY IsLoadAllNodesImmediately CHAR(1) DEFAULT 'Y'
;
-- Apr 3, 2017 5:19:18 PM CEST
UPDATE AD_Tree SET IsLoadAllNodesImmediately='N' WHERE IsLoadAllNodesImmediately IS NULL
UPDATE AD_Tree SET IsLoadAllNodesImmediately='Y' WHERE IsLoadAllNodesImmediately IS NULL
;
-- Apr 3, 2017 5:19:47 PM CEST
@ -39,4 +43,4 @@ UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL,
;
SELECT register_migration_script('201704031723_IDEMPIERE-3328.sql') FROM dual
;
;

View File

@ -4,15 +4,19 @@ INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,Cr
;
-- Apr 3, 2017 5:19:13 PM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212971,0,'Loads directly all nodes','If checked, all nodes are loaded before tree is displayed',288,'IsLoadAllNodesImmediately','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,203064,'Y','N','D','N','N','N','Y','692e44f6-4653-4a06-b68e-05fa3382202d','N',0,'N','N')
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (212971,0,'Loads directly all nodes','If checked, all nodes are loaded before tree is displayed',288,'IsLoadAllNodesImmediately','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-03 17:19:13','YYYY-MM-DD HH24:MI:SS'),100,203064,'Y','N','D','N','N','N','Y','692e44f6-4653-4a06-b68e-05fa3382202d','N',0,'N','N')
;
-- May 3, 2017 5:34:24 PM CEST
ALTER TABLE AD_Tree ADD COLUMN IsLoadAllNodesImmediately CHAR(1) DEFAULT 'Y' CHECK (IsLoadAllNodesImmediately IN ('Y','N')) NOT NULL
;
-- Apr 3, 2017 5:19:18 PM CEST
INSERT INTO t_alter_column values('ad_tree','IsLoadAllNodesImmediately','CHAR(1)',null,'N')
INSERT INTO t_alter_column values('ad_tree','IsLoadAllNodesImmediately','CHAR(1)',null,'Y')
;
-- Apr 3, 2017 5:19:18 PM CEST
UPDATE AD_Tree SET IsLoadAllNodesImmediately='N' WHERE IsLoadAllNodesImmediately IS NULL
UPDATE AD_Tree SET IsLoadAllNodesImmediately='Y' WHERE IsLoadAllNodesImmediately IS NULL
;
-- Apr 3, 2017 5:19:47 PM CEST
@ -36,4 +40,4 @@ UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL,
;
SELECT register_migration_script('201704031723_IDEMPIERE-3328.sql') FROM dual
;
;

View File

@ -75,7 +75,8 @@ public class ADTreePanel extends Panel implements EventListener<Event>
{
this.AD_Tree_ID = AD_Tree_ID;
SimpleTreeModel.initADTree(tree, AD_Tree_ID, windowNo);
if (MTree_Base.isLoadAllNodesImmediately(AD_Tree_ID, null))
MTree_Base tb = MTree_Base.get(Env.getCtx(), AD_Tree_ID, null);
if (tb.isLoadAllNodesImmediately())
TreeUtils.collapseTree(tree, true);
pnlSearch.initialise();
return true;

View File

@ -40,7 +40,6 @@ import org.adempiere.webui.window.FDialog;
import org.compiere.apps.form.TreeMaintenance;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
import org.compiere.model.MTree_Base;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
@ -326,8 +325,8 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
centerTree.getTreechildren().detach();
SimpleTreeModel.initADTree(centerTree, m_tree.getAD_Tree_ID(), m_WindowNo);
if (MTree_Base.isLoadAllNodesImmediately(m_tree.getAD_Tree_ID(), null))
TreeUtils.collapseTree(centerTree, false);
if (m_tree.isLoadAllNodesImmediately())
TreeUtils.collapseTree(centerTree, true);
} // action_fillTree