IDEMPIERE-1120 Implement Field SeqNo customization

This commit is contained in:
Dirk Niemeyer 2013-07-10 16:41:55 +02:00
parent 656fe8a366
commit ce5a67c220
3 changed files with 30 additions and 3 deletions

View File

@ -28,6 +28,7 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -1782,6 +1783,7 @@ public class GridField
AD_Window_ID, AD_Tab_ID, readOnly, rs); AD_Window_ID, AD_Tab_ID, readOnly, rs);
listVO.add(vo); listVO.add(vo);
} }
Collections.sort(listVO, new GridFieldVO.SeqNoComparator());
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -21,6 +21,7 @@ import java.io.Serializable;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Comparator;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -66,6 +67,7 @@ public class GridFieldVO implements Serializable
return sql.toString(); return sql.toString();
} // getSQL } // getSQL
/** /**
* Create Field Value Object * Create Field Value Object
* @param ctx context * @param ctx context
@ -112,6 +114,8 @@ public class GridFieldVO implements Serializable
vo.IsDisplayed = "Y".equals(rs.getString (i)); vo.IsDisplayed = "Y".equals(rs.getString (i));
else if (columnName.equalsIgnoreCase("IsDisplayedGrid")) else if (columnName.equalsIgnoreCase("IsDisplayedGrid"))
vo.IsDisplayedGrid = "Y".equals(rs.getString (i)); vo.IsDisplayedGrid = "Y".equals(rs.getString (i));
else if (columnName.equalsIgnoreCase("SeqNo"))
vo.SeqNo = rs.getInt (i);
else if (columnName.equalsIgnoreCase("SeqNoGrid")) else if (columnName.equalsIgnoreCase("SeqNoGrid"))
vo.SeqNoGrid = rs.getInt (i); vo.SeqNoGrid = rs.getInt (i);
else if (columnName.equalsIgnoreCase("DisplayLogic")) else if (columnName.equalsIgnoreCase("DisplayLogic"))
@ -275,7 +279,11 @@ public class GridFieldVO implements Serializable
if (userDef.getNumLines() > 0) if (userDef.getNumLines() > 0)
vo.NumLines=userDef.getNumLines(); vo.NumLines=userDef.getNumLines();
if (userDef.getIsToolbarButton() != null) if (userDef.getIsToolbarButton() != null)
vo.IsToolbarButton = "Y".equals(userDef.getIsToolbarButton()); vo.IsToolbarButton = "Y".equals(userDef.getIsToolbarButton());
//IDEMPIERE-1120 Implement Field SeqNo customization
if (userDef.getSeqNo() > 0)
vo.SeqNo = userDef.getSeqNo();
} }
} }
// //
@ -491,8 +499,10 @@ public class GridFieldVO implements Serializable
public boolean IsDisplayed = false; public boolean IsDisplayed = false;
/** Displayed Grid */ /** Displayed Grid */
public boolean IsDisplayedGrid = false; public boolean IsDisplayedGrid = false;
/** Position */
public int SeqNo = 0;
/** Grid Display sequence */ /** Grid Display sequence */
public int SeqNoGrid = 0; public int SeqNoGrid = 0;
/** Dislay Logic */ /** Dislay Logic */
public String DisplayLogic = ""; public String DisplayLogic = "";
/** Default Value */ /** Default Value */
@ -684,6 +694,7 @@ public class GridFieldVO implements Serializable
clone.IsDisplayed = IsDisplayed; clone.IsDisplayed = IsDisplayed;
clone.IsDisplayedGrid = IsDisplayedGrid; clone.IsDisplayedGrid = IsDisplayedGrid;
clone.AD_Field_ID = AD_Field_ID; clone.AD_Field_ID = AD_Field_ID;
clone.SeqNo = SeqNo;
clone.SeqNoGrid = SeqNoGrid; clone.SeqNoGrid = SeqNoGrid;
clone.DisplayLogic = DisplayLogic; clone.DisplayLogic = DisplayLogic;
clone.DefaultValue = DefaultValue; clone.DefaultValue = DefaultValue;
@ -741,4 +752,16 @@ public class GridFieldVO implements Serializable
return sb.toString (); return sb.toString ();
} // toString } // toString
} // MFieldVO /**
*
* @author a42niem
* IDEMPIERE-1120 Implement Field SeqNo customization
*/
public static class SeqNoComparator implements Comparator<GridFieldVO> {
@Override
public int compare(GridFieldVO gf1, GridFieldVO gf2) {
return (new Integer(gf1.SeqNo)).compareTo(new Integer(gf2.SeqNo));
}
}
} // GridFieldVO

View File

@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -314,6 +315,7 @@ public class GridTabVO implements Evaluatee, Serializable
pstmt = null; pstmt = null;
} }
Collections.sort(mTabVO.Fields, new GridFieldVO.SeqNoComparator());
mTabVO.initFields = true; mTabVO.initFields = true;
return mTabVO.Fields.size() != 0; return mTabVO.Fields.size() != 0;