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.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Properties;
@ -1782,6 +1783,7 @@ public class GridField
AD_Window_ID, AD_Tab_ID, readOnly, rs);
listVO.add(vo);
}
Collections.sort(listVO, new GridFieldVO.SeqNoComparator());
}
catch (Exception e)
{

View File

@ -21,6 +21,7 @@ import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Comparator;
import java.util.Properties;
import java.util.logging.Level;
@ -66,6 +67,7 @@ public class GridFieldVO implements Serializable
return sql.toString();
} // getSQL
/**
* Create Field Value Object
* @param ctx context
@ -112,6 +114,8 @@ public class GridFieldVO implements Serializable
vo.IsDisplayed = "Y".equals(rs.getString (i));
else if (columnName.equalsIgnoreCase("IsDisplayedGrid"))
vo.IsDisplayedGrid = "Y".equals(rs.getString (i));
else if (columnName.equalsIgnoreCase("SeqNo"))
vo.SeqNo = rs.getInt (i);
else if (columnName.equalsIgnoreCase("SeqNoGrid"))
vo.SeqNoGrid = rs.getInt (i);
else if (columnName.equalsIgnoreCase("DisplayLogic"))
@ -276,6 +280,10 @@ public class GridFieldVO implements Serializable
vo.NumLines=userDef.getNumLines();
if (userDef.getIsToolbarButton() != null)
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;
/** Displayed Grid */
public boolean IsDisplayedGrid = false;
/** Position */
public int SeqNo = 0;
/** Grid Display sequence */
public int SeqNoGrid = 0;
public int SeqNoGrid = 0;
/** Dislay Logic */
public String DisplayLogic = "";
/** Default Value */
@ -684,6 +694,7 @@ public class GridFieldVO implements Serializable
clone.IsDisplayed = IsDisplayed;
clone.IsDisplayedGrid = IsDisplayedGrid;
clone.AD_Field_ID = AD_Field_ID;
clone.SeqNo = SeqNo;
clone.SeqNoGrid = SeqNoGrid;
clone.DisplayLogic = DisplayLogic;
clone.DefaultValue = DefaultValue;
@ -741,4 +752,16 @@ public class GridFieldVO implements Serializable
return sb.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.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Properties;
import java.util.logging.Level;
@ -314,6 +315,7 @@ public class GridTabVO implements Evaluatee, Serializable
pstmt = null;
}
Collections.sort(mTabVO.Fields, new GridFieldVO.SeqNoComparator());
mTabVO.initFields = true;
return mTabVO.Fields.size() != 0;