IDEMPIERE-3855 Implement AD_Tree.IsValueDisplayed - FHCA-817
This commit is contained in:
parent
fbb6e1cf53
commit
6037389ced
|
@ -0,0 +1,45 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- IDEMPIERE-3855 Implement AD_Tree.IsValueDisplayed
|
||||
-- Dec 26, 2018, 2:00:58 PM CET
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,IsHtml) VALUES (213822,0,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',288,'IsValueDisplayed','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,284,'Y','N','D','N','N','N','Y','2894fcac-3036-489d-8976-2f8bb178ecae','Y',0,'N','N','N')
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:01:02 PM CET
|
||||
ALTER TABLE AD_Tree ADD IsValueDisplayed CHAR(1) DEFAULT 'N' CHECK (IsValueDisplayed IN ('Y','N')) NOT NULL
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:02:36 PM CET
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (205898,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',243,213822,'Y',1,130,'N','N','N','N',0,0,'Y',TO_DATE('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','1f428273-321c-4514-8f62-29d600deda79','Y',120,2,2)
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5228
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12421
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204379
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8371
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:54 PM CET
|
||||
UPDATE AD_Field SET Name='Display Search Key', Description='Displays Search Key in the tree', Help='The Display Search Key checkbox indicates if the Search Key will display in the tree before the Name', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
|
||||
;
|
||||
|
||||
UPDATE AD_Tree SET IsValueDisplayed='Y' WHERE IsValueDisplayed='N' AND IsTreeDrivenByValue='Y';
|
||||
|
||||
SELECT register_migration_script('201812261404_IDEMPIERE-3855.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
-- IDEMPIERE-3855 Implement AD_Tree.IsValueDisplayed
|
||||
-- Dec 26, 2018, 2:00:58 PM CET
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,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,IsHtml) VALUES (213822,0,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',288,'IsValueDisplayed','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,284,'Y','N','D','N','N','N','Y','2894fcac-3036-489d-8976-2f8bb178ecae','Y',0,'N','N','N')
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:01:02 PM CET
|
||||
ALTER TABLE AD_Tree ADD COLUMN IsValueDisplayed CHAR(1) DEFAULT 'N' CHECK (IsValueDisplayed IN ('Y','N')) NOT NULL
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:02:36 PM CET
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (205898,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',243,213822,'Y',1,130,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','1f428273-321c-4514-8f62-29d600deda79','Y',120,2,2)
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5228
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12421
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204379
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:06 PM CET
|
||||
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8371
|
||||
;
|
||||
|
||||
-- Dec 26, 2018, 2:03:54 PM CET
|
||||
UPDATE AD_Field SET Name='Display Search Key', Description='Displays Search Key in the tree', Help='The Display Search Key checkbox indicates if the Search Key will display in the tree before the Name', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
|
||||
;
|
||||
|
||||
UPDATE AD_Tree SET IsValueDisplayed='Y' WHERE IsValueDisplayed='N' AND IsTreeDrivenByValue='Y';
|
||||
|
||||
SELECT register_migration_script('201812261404_IDEMPIERE-3855.sql') FROM dual
|
||||
;
|
||||
|
|
@ -189,6 +189,19 @@ public interface I_AD_Tree
|
|||
/** Get Driven by Search Key */
|
||||
public boolean isTreeDrivenByValue();
|
||||
|
||||
/** Column name IsValueDisplayed */
|
||||
public static final String COLUMNNAME_IsValueDisplayed = "IsValueDisplayed";
|
||||
|
||||
/** Set Display Value.
|
||||
* Displays Value column with the Display column
|
||||
*/
|
||||
public void setIsValueDisplayed (boolean IsValueDisplayed);
|
||||
|
||||
/** Get Display Value.
|
||||
* Displays Value column with the Display column
|
||||
*/
|
||||
public boolean isValueDisplayed();
|
||||
|
||||
/** Column name Name */
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ public class MTree extends MTree_Base
|
|||
String tableName =MTable.getTableName(getCtx(), getAD_Table_ID());
|
||||
sqlNode.append("SELECT t.").append(tableName)
|
||||
.append("_ID,");
|
||||
if (isTreeDrivenByValue())
|
||||
if (isValueDisplayed())
|
||||
sqlNode.append("t.Value || ' - ' || t.Name,");
|
||||
else
|
||||
sqlNode.append("t.Name,");
|
||||
|
@ -490,7 +490,7 @@ public class MTree extends MTree_Base
|
|||
.append(" FROM ").append(tableName).append(" t ");
|
||||
if (!m_editable)
|
||||
sqlNode.append(" WHERE t.IsActive='Y'");
|
||||
} else if (isTreeDrivenByValue()) {
|
||||
} else if (isValueDisplayed()) {
|
||||
sqlNode.append("SELECT t.").append(columnNameX)
|
||||
.append("_ID, t.Value || ' - ' || t.Name, t.Description, t.IsSummary,").append(color)
|
||||
.append(" FROM ").append(fromClause);
|
||||
|
|
|
@ -352,11 +352,15 @@ public class MTree_Base extends X_AD_Tree
|
|||
log.saveError("Error", "IsSummary column required for tree tables");
|
||||
return false;
|
||||
}
|
||||
if (isTreeDrivenByValue()) {
|
||||
if (table.getColumnIndex("Value") < 0) {
|
||||
if (table.getColumnIndex("Value") < 0) {
|
||||
if (isTreeDrivenByValue()) {
|
||||
// Value is mandatory column to have a tree driven by Value
|
||||
setIsTreeDrivenByValue(false);
|
||||
}
|
||||
if (isValueDisplayed()) {
|
||||
// Value is mandatory column to be displayed
|
||||
setIsValueDisplayed(false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -30,7 +30,7 @@ public class X_AD_Tree extends PO implements I_AD_Tree, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20181104L;
|
||||
private static final long serialVersionUID = 20181226L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_Tree (Properties ctx, int AD_Tree_ID, String trxName)
|
||||
|
@ -45,6 +45,8 @@ public class X_AD_Tree extends PO implements I_AD_Tree, I_Persistent
|
|||
setIsLoadAllNodesImmediately (true);
|
||||
// Y
|
||||
setIsTreeDrivenByValue (false);
|
||||
// N
|
||||
setIsValueDisplayed (false);
|
||||
// N
|
||||
setName (null);
|
||||
setTreeType (null);
|
||||
|
@ -254,6 +256,30 @@ public class X_AD_Tree extends PO implements I_AD_Tree, I_Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Set Display Value.
|
||||
@param IsValueDisplayed
|
||||
Displays Value column with the Display column
|
||||
*/
|
||||
public void setIsValueDisplayed (boolean IsValueDisplayed)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsValueDisplayed, Boolean.valueOf(IsValueDisplayed));
|
||||
}
|
||||
|
||||
/** Get Display Value.
|
||||
@return Displays Value column with the Display column
|
||||
*/
|
||||
public boolean isValueDisplayed ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsValueDisplayed);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Name.
|
||||
@param Name
|
||||
Alphanumeric identifier of the entity
|
||||
|
|
|
@ -1499,7 +1499,9 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
|||
String value = gridTab.getValue("Value").toString();
|
||||
parentID = PO.retrieveIdOfParentValue(value, getTableName(), Env.getAD_Client_ID(Env.getCtx()), null);
|
||||
parentNode = model.find(treeNode, parentID);
|
||||
name = value + " - " + name;
|
||||
if (isValueDisplayed()) {
|
||||
name = value + " - " + name;
|
||||
}
|
||||
}
|
||||
MTreeNode node = new MTreeNode (gridTab.getRecord_ID(), 0, name, description,
|
||||
parentID, summary, imageIndicator, false, null);
|
||||
|
@ -1544,7 +1546,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
|||
}
|
||||
|
||||
boolean changed = false;
|
||||
if (isTreeDrivenByValue()) {
|
||||
if (isValueDisplayed()) {
|
||||
String value = (String) gridTab.getValue("Value");
|
||||
String name = (String) gridTab.getValue("Name");
|
||||
String full = value + " - " + name;
|
||||
|
@ -1879,6 +1881,13 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
|||
return retValue;
|
||||
}
|
||||
|
||||
private boolean isValueDisplayed() {
|
||||
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
|
||||
boolean retValue = false;
|
||||
retValue = model.isValueDisplayed();
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageDetached(Page page) {
|
||||
if (formContainer.getSouth() != null) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2689107390272278321L;
|
||||
private static final long serialVersionUID = -1591436379012706094L;
|
||||
|
||||
private static final CLogger logger = CLogger.getCLogger(SimpleTreeModel.class);
|
||||
|
||||
|
@ -83,6 +83,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
|
|||
SimpleTreeModel treeModel = SimpleTreeModel.createFrom(root);
|
||||
treeModel.setItemDraggable(true);
|
||||
treeModel.setTreeDrivenByValue(vTree.isTreeDrivenByValue());
|
||||
treeModel.setIsValueDisplayed(vTree.isValueDisplayed());
|
||||
treeModel.addOnDropEventListener(new ADTreeOnDropListener(tree, treeModel, vTree, windowNo));
|
||||
|
||||
if (tree.getTreecols() == null)
|
||||
|
@ -115,6 +116,16 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
|
|||
this.isTreeDrivenByValue = isTreeDrivenByValue;
|
||||
}
|
||||
|
||||
private boolean isValueDisplayed = false;
|
||||
|
||||
public boolean isValueDisplayed() {
|
||||
return isValueDisplayed;
|
||||
}
|
||||
|
||||
public void setIsValueDisplayed(boolean isValueDisplayed) {
|
||||
this.isValueDisplayed = isValueDisplayed;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param root
|
||||
|
|
Loading…
Reference in New Issue