@@ -30,6 +30,14 @@ public class StartPacket extends RailsAbstractItem {
3030 protected int minimumIncrement = 5 ;
3131 /** The modulus of all bids (i.e. of which value the bid must be a multiple) */
3232 protected int modulus = 5 ;
33+ /** Is multiple-column display enabled?
34+ * If so, row and col attributes become mandatory for all start items
35+ * (if the <MultipleColumn> tag precedes all start items).*/
36+ protected boolean multipleColumns = false ;
37+ /** The number of columns. Will be derived from the column attributes. */
38+ protected int numberOfColumns = 1 ;
39+ /** The number of rows. Will be derived from the row attributes, if multipleColumns is true. */
40+ protected int numberOfRows ;
3341
3442 /** Default name */
3543 public static final String DEFAULT_ID = "Initial" ;
@@ -56,6 +64,12 @@ public static StartPacket create(RailsItem parent, String id, String roundClassN
5664 * @throws ConfigurationException if anything goes wrong.
5765 */
5866 public void configureFromXML (Tag tag ) throws ConfigurationException {
67+
68+ // Multiple column display?
69+ Tag columnsTag = tag .getChild ("MultipleColumns" );
70+ multipleColumns = columnsTag != null ;
71+
72+ // Bidding parameters, if applicable
5973 Tag biddingTag = tag .getChild ("Bidding" );
6074 if (biddingTag != null ) {
6175 minimumInitialIncrement =
@@ -83,14 +97,27 @@ public void configureFromXML(Tag tag) throws ConfigurationException {
8397
8498 int basePrice = itemTag .getAttributeAsInteger ("basePrice" , 0 );
8599 boolean reduceable = itemTag .getAttributeAsBoolean ("reduceable" , false );
86- StartItem item = StartItem .create (this , itemName , itemType , basePrice , reduceable , index ++, president );
100+ StartItem item = StartItem .create (this , itemName , itemType ,
101+ basePrice , reduceable , index ++, president );
87102 items .add (item );
88103
89104 // Optional attributes
90105 int row = itemTag .getAttributeAsInteger ("row" , 0 );
91- if ( row > 0 ) item .setRow (row );
106+ item .setRow (row );
92107 int column = itemTag .getAttributeAsInteger ("column" , 0 );
93- if (column > 0 ) item .setColumn (column );
108+ if (multipleColumns ) {
109+ if (!(row > 0 && column > 0 )) {
110+ throw new ConfigurationException (
111+ "With multiple columns, both row and column attributes are required" );
112+ }
113+ item .setColumn (column );
114+ numberOfRows = Math .max (numberOfRows , row );
115+ numberOfColumns = Math .max (numberOfColumns , column );
116+ }
117+
118+ // Displayed name
119+ String displayName = itemTag .getAttributeAsString ("displayName" , null );
120+ if (displayName != null ) item .setDisplayName (displayName );
94121
95122 // Check if there is another certificate
96123 List <Tag > subItemTags = itemTag .getChildren ("SubItem" );
@@ -241,4 +268,15 @@ public int getModulus() {
241268 return modulus ;
242269 }
243270
271+ public boolean isMultipleColumns () {
272+ return multipleColumns ;
273+ }
274+
275+ public int getNumberOfColumns () {
276+ return numberOfColumns ;
277+ }
278+
279+ public int getNumberOfRows () {
280+ return numberOfRows ;
281+ }
244282}
0 commit comments