From c9c663dfa9ab2320284c6cb3cc5c7abffa8d9d3f Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 19 Oct 2012 20:45:19 +0800 Subject: [PATCH] iDempiere IDEMPIERE-234 Configure Toolbar. --- .../src/org/compiere/model/GridField.java | 5 ++ .../src/org/compiere/model/GridFieldVO.java | 4 ++ .../src/org/compiere/model/I_AD_Column.java | 26 ++++++++++ .../src/org/compiere/model/MColumn.java | 14 ++++-- .../src/org/compiere/model/X_AD_Column.java | 48 ++++++++++++++++++- 5 files changed, 93 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index caf92e6aa1..a0ada2cd8f 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -1970,4 +1970,9 @@ public class GridField return m_vo.NumLines; } + public boolean isToolbarButton() + { + return m_vo.displayType == DisplayType.Button && m_vo.IsToolbarButton; + } + } // MField diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index eff9ee2293..3c62928b06 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -204,6 +204,8 @@ public class GridFieldVO implements Serializable vo.ColumnSpan=rs.getInt(i); else if (columnName.equalsIgnoreCase("NumLines")) vo.NumLines=rs.getInt(i); + else if (columnName.equalsIgnoreCase("IsToolbarButton")) + vo.IsToolbarButton = "Y".equals(rs.getString(i)); } if (vo.Header == null) vo.Header = vo.ColumnName; @@ -537,6 +539,8 @@ public class GridFieldVO implements Serializable public boolean IsAutocomplete = false; /* Allow copy - IDEMPIERE-67 - Carlos Ruiz - globalqss */ public boolean IsAllowCopy = false; + /** Toolbar Button **/ + public boolean IsToolbarButton = false; /** * Set Context including contained elements diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Column.java b/org.adempiere.base/src/org/compiere/model/I_AD_Column.java index dca0298cfc..86b58bd9c0 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Column.java @@ -480,6 +480,19 @@ public interface I_AD_Column */ public String getIsSyncDatabase(); + /** Column name IsToolbarButton */ + public static final String COLUMNNAME_IsToolbarButton = "IsToolbarButton"; + + /** Set Toolbar Button. + * Add the column button to the toolbar + */ + public void setIsToolbarButton (boolean IsToolbarButton); + + /** Get Toolbar Button. + * Add the column button to the toolbar + */ + public boolean isToolbarButton(); + /** Column name IsTranslated */ public static final String COLUMNNAME_IsTranslated = "IsTranslated"; @@ -556,6 +569,19 @@ public interface I_AD_Column */ public int getSeqNo(); + /** Column name SeqNoSelection */ + public static final String COLUMNNAME_SeqNoSelection = "SeqNoSelection"; + + /** Set Selection Column Sequence. + * Selection Column Sequence + */ + public void setSeqNoSelection (int SeqNoSelection); + + /** Get Selection Column Sequence. + * Selection Column Sequence + */ + public int getSeqNoSelection(); + /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index 624702cc6d..19faf0736d 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -205,10 +205,18 @@ public class MColumn extends X_AD_Column else if (DisplayType.isDate (displayType)) setFieldLength(7); else - { - log.saveError("FillMandatory", Msg.getElement(getCtx(), "FieldLength")); - return false; + { + log.saveError("FillMandatory", Msg.getElement(getCtx(), "FieldLength")); + return false; + } } + + if (displayType != DisplayType.Button) + { + if (isToolbarButton()) + { + setIsToolbarButton(false); + } } /** Views are not updateable diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java index 84d368c5e0..ca6a3748d5 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java @@ -32,7 +32,7 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent /** * */ - private static final long serialVersionUID = 20110918L; + private static final long serialVersionUID = 20121019L; /** Standard Constructor */ public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName) @@ -60,6 +60,8 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent setIsMandatory (false); setIsParent (false); setIsSelectionColumn (false); + setIsToolbarButton (true); +// Y setIsTranslated (false); setIsUpdateable (true); // Y @@ -742,6 +744,30 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent return (String)get_Value(COLUMNNAME_IsSyncDatabase); } + /** Set Toolbar Button. + @param IsToolbarButton + Add the column button to the toolbar + */ + public void setIsToolbarButton (boolean IsToolbarButton) + { + set_Value (COLUMNNAME_IsToolbarButton, Boolean.valueOf(IsToolbarButton)); + } + + /** Get Toolbar Button. + @return Add the column button to the toolbar + */ + public boolean isToolbarButton () + { + Object oo = get_Value(COLUMNNAME_IsToolbarButton); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Translated. @param IsTranslated This column is translated @@ -858,6 +884,26 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent return ii.intValue(); } + /** Set Selection Column Sequence. + @param SeqNoSelection + Selection Column Sequence + */ + public void setSeqNoSelection (int SeqNoSelection) + { + set_Value (COLUMNNAME_SeqNoSelection, Integer.valueOf(SeqNoSelection)); + } + + /** Get Selection Column Sequence. + @return Selection Column Sequence + */ + public int getSeqNoSelection () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SeqNoSelection); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Max. Value. @param ValueMax Maximum Value for a field