Skip to Content
0
Former Member
Oct 25, 2005 at 05:30 PM

Problem in HTMLB..Please Help...urgent....:(

26 Views

Hello All,

Please refer to the below code:

package com.sap.NewOrderAssignment;

import java.io.Serializable;

import java.util.Calendar;

import java.util.Date;

import java.util.Locale;

import java.util.GregorianCalendar;

import com.sapportals.htmlb.*;

import com.sapportals.htmlb.enum.TableColumnType;

import com.sapportals.htmlb.table.DefaultTableViewModel;

import com.sapportals.htmlb.table.TableColumn;

public class BeanOrderDetails implements Serializable

{ public Date toDay, orderDate;

public String toDayAsString;

public IListModel deliveryAddress;

public TextEdit address;

public DefaultTableViewModel orderLines;

public Locale locale;

public String poNumber, model, qty;

public Object colTitle[] = {"Model","Description","Qty (pcs)","AD Price","Net Price","Total amount","Indication ETA","12 NC","Part Del","GIM","# A-box","Pcd/A-box"};

public BeanOrderDetails()

{ Calendar cal = new GregorianCalendar();

toDay = cal.getTime();

String year = String.valueOf(cal.get(Calendar.YEAR));

String month = String.valueOf(cal.get(Calendar.MONTH)+1);

String day = String.valueOf(cal.get(Calendar.DAY_OF_MONTH));

toDayAsString = year"-"month"-"day;

deliveryAddress = new DefaultListModel();

deliveryAddress.setSingleSelection(true);

deliveryAddress.addItem("1", "Delivery Address1");

deliveryAddress.addItem("2", "Delivery Address2");

deliveryAddress.addItem("3", "Delivery Address3");

//company address

address = new TextEdit("Company Address");

address.setRows(4);

address.setCols(40);

String line1 = "KPIT Cummins Infosystems Ltd.";

String line2 = "MIDC, Hinjewadi";

String line3 = "Pune, India";

address.setText(line1line2line3);

address.setEnabled(true);

//Table creation

Object data[][] = {{"HQ8894","Sensotec Dry Rota Shaver","500","1,512.00","1,498.00","749.00","08-08-2005","885889401710","N","Y","","50"}};

orderLines = new DefaultTableViewModel(data, colTitle);

TableColumn columnModel = orderLines.getColumnAt(1);

TableColumn columnDesciption = orderLines.getColumnAt(2);

TableColumn columnQty = orderLines.getColumnAt(3);

TableColumn columnADPrice = orderLines.getColumnAt(4);

TableColumn columnNetPrice = orderLines.getColumnAt(5);

TableColumn columnTotalAmunt = orderLines.getColumnAt(6);

TableColumn columnETA = orderLines.getColumnAt(7);

TableColumn column12NC = orderLines.getColumnAt(8);

TableColumn columnPartDel = orderLines.getColumnAt(9);

TableColumn columnGIM = orderLines.getColumnAt(10);

TableColumn columnABox = orderLines.getColumnAt(11);

TableColumn columnAmountInBox = orderLines.getColumnAt(11);

TableColumn columnPcsBox = orderLines.getColumnAt(12);

columnModel.setType(TableColumnType.INPUT);

columnModel.setWidth("150");

columnQty.setType(TableColumnType.INPUT);

columnDesciption.setWidth("300");

}

public void setLocale(Locale l)

{ locale = l;

}

public Locale getLocale()

{ return locale;

}

public void setOrderDate(Date od)

{ orderDate = od;

}

public Date getOrderDate()

{ return orderDate;

}

public void setOrderLines(DefaultTableViewModel mm)

{ orderLines = mm;

}

public DefaultTableViewModel getOrderLines()

{ return orderLines;

}

public void setAddress(String adr)

{ address.setText(adr);

}

public void setTextEditAddress(TextEdit adr)

{ address = adr;

}

public TextEdit getTextEditAddress()

{ return address;

}

public String getAddress()

{ return address.getText();

}

public void setDeliveryAdresses(IListModel model)

{ deliveryAddress = model;

}

public IListModel getdeliveryAddresses()

{ return deliveryAddress;

}

public void setPoNumber(String pon)

{ this.poNumber = pon;

}

public String getPoNumber()

{ return this.poNumber;

}

public void setModel(String m)

{ this.model = m;

}

public void setQty(String quantity)

{ this.qty = quantity;

}

public void getNewRow()

{ Object data[][] = { {"","Sensotec Dry Rota Shaver ABC","","1,512.00","1,498.00","749.00","08-08-2005","885889401710","N","Y","","50"}};

this.setQty("");

this.setModel("");

TableColumn columnModel = orderLines.getColumnAt(1);

TableColumn columnDesciption = orderLines.getColumnAt(2);

TableColumn columnQty = orderLines.getColumnAt(3);

TableColumn columnADPrice = orderLines.getColumnAt(4);

TableColumn columnNetPrice = orderLines.getColumnAt(5);

TableColumn columnTotalAmunt = orderLines.getColumnAt(6);

TableColumn columnETA = orderLines.getColumnAt(7);

TableColumn column12NC = orderLines.getColumnAt(8);

TableColumn columnPartDel = orderLines.getColumnAt(9);

TableColumn columnGIM = orderLines.getColumnAt(10);

TableColumn columnABox = orderLines.getColumnAt(11);

TableColumn columnAmountInBox = orderLines.getColumnAt(11);

TableColumn columnPcsBox = orderLines.getColumnAt(12);

columnModel.setType(TableColumnType.INPUT);

columnModel.setWidth("150");

columnQty.setType(TableColumnType.INPUT);

columnDesciption.setWidth("300");

}

}

The above code creates a table. It actually maps the various fields as the TableColumn.

<b><u>Question:</u></b>

I have added a button which appears below this table.

Name of button = AddNewLine

Now, when this button is clicked, a new empy row should appear in the table.

<i><b>My stmts in method - getNewRow() are not working.</b></i>

Please help me do so.

Please help...its kinda urgent.

Thanks and Warm Regards,

Ritu R Hunjan