hello am working on a2l parser. now i want to convert all my parameters into html table. My code has to start with the below code. i am new here help me in the process.
public void save html () {
// New file.html with table for characteristic one for measurements ...
// 1 table overview
// 1 table characteristic
// 1 table Measurement
Created few classes:
htmlObject:
public interface htmlObject {
public void write (StringBuilder sb);
// Public void addStyle (String key, String value);
}
HtmlTable:
Import java.util.ArrayList;
import java.util.List;
/ **
*
*author Kmunukun
* /
public class HtmlTable implements htmlObject {
private List <HtmlTableRow> rows = new ArrayList <> ();
Public HtmlTable () {
}
public void appendTableRow (HtmlTableRow row) {
rows.add (row);
}
public void write (StringBuilder sb) {
sb.append ("<table>");
for (HtmlTableRow row: rows) {
row.write (sb);
}
sb.append ("</ table>");
}
}
HtmlTableCell
public class HtmlTableCell implements htmlObject {
public String content;
Public HtmlTableCell () {
}
public void setContent (String content) {
this.content = content;
}
Override
public void write (StringBuilder sb) {
sb.append ("<td>");
sb.append (content);
sb.append ("</ td>");
}
}
HtmlTable row:
Import java.util.ArrayList;
import java.util.List;
/ **
*
*author Kmunukun
* /
public class implements HtmlTableRow htmlObject {
public List <HtmlTableCell> Cells = new ArrayList <> ();
Public HtmlTableRow () {
}
public void appendCell (HtmlTableCell cell) {
cells.add (cell);
}
Override
public void write (StringBuilder sb) {
sb.append ("<tr>");
for (HtmlTableCell cell: cells) {
cell.write (sb);
}
sb.append ("</ tr>");
}
}
Actually i am new to java programming. help me in creating HTML tables for the above code.
public void save html () {
// New file.html with table for characteristic one for measurements ...
// 1 table overview
// 1 table characteristic
// 1 table Measurement
Created few classes:
htmlObject:
public interface htmlObject {
public void write (StringBuilder sb);
// Public void addStyle (String key, String value);
}
HtmlTable:
Import java.util.ArrayList;
import java.util.List;
/ **
*
*author Kmunukun
* /
public class HtmlTable implements htmlObject {
private List <HtmlTableRow> rows = new ArrayList <> ();
Public HtmlTable () {
}
public void appendTableRow (HtmlTableRow row) {
rows.add (row);
}
public void write (StringBuilder sb) {
sb.append ("<table>");
for (HtmlTableRow row: rows) {
row.write (sb);
}
sb.append ("</ table>");
}
}
HtmlTableCell
public class HtmlTableCell implements htmlObject {
public String content;
Public HtmlTableCell () {
}
public void setContent (String content) {
this.content = content;
}
Override
public void write (StringBuilder sb) {
sb.append ("<td>");
sb.append (content);
sb.append ("</ td>");
}
}
HtmlTable row:
Import java.util.ArrayList;
import java.util.List;
/ **
*
*author Kmunukun
* /
public class implements HtmlTableRow htmlObject {
public List <HtmlTableCell> Cells = new ArrayList <> ();
Public HtmlTableRow () {
}
public void appendCell (HtmlTableCell cell) {
cells.add (cell);
}
Override
public void write (StringBuilder sb) {
sb.append ("<tr>");
for (HtmlTableCell cell: cells) {
cell.write (sb);
}
sb.append ("</ tr>");
}
}
Actually i am new to java programming. help me in creating HTML tables for the above code.