package com.sometrik.framework;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewParent;
import android.widget.TableLayout;
import android.widget.TableRow;

public class FWTable extends TableLayout implements NativeCommandHandler {
  
  FrameWork frame;
  int columnCount = 1;
  ArrayList<TableRow> rowList;
  ArrayList<View> dataList;
  
  public FWTable(Context context) {
    super(context);
    context = (FrameWork)context;
    rowList = new ArrayList<TableRow>();
    rowList.add(new TableRow(context));
    dataList = new ArrayList<View>();
  }
  
  private TableRow getCurrentRow(){
    if (dataList.size() / columnCount > rowList.size()){
      TableRow row = new TableRow(frame);
      rowList.add(row);
      return row;
    } else {
      return rowList.get(rowList.size() - 1);
    }
  }
  
  public void setColumnCount(int columnCount) { this.columnCount = columnCount; };


  @Override
  public void addChild(View view) {
    TableRow row = getCurrentRow();
    row.addView(view);
    dataList.add(view);
  }

  @Override
  public void showView() {
    frame.setCurrentView(this);
  }

@Override
public void addOption(int position, String text) {
}

@Override
public int getElementId() {
  return getId();
}

@Override
public void removeChild(int id) {
  // TODO Auto-generated method stub
  
}



}

@@ -1157,16 +1157,18 @@
 );%0A  %7D%0A%0A
+  
 @Overrid
@@ -1161,32 +1161,34 @@
  %7D%0A%0A  @Override%0A
+  
 public void addO
@@ -1222,19 +1222,23 @@
 text) %7B%0A
+  
 %7D%0A%0A
+  
 @Overrid
@@ -1235,24 +1235,26 @@
   @Override%0A
+  
 public int g
@@ -1269,16 +1269,18 @@
 tId() %7B%0A
+  
   return
@@ -1289,19 +1289,23 @@
 etId();%0A
+  
 %7D%0A%0A
+  
 @Overrid
@@ -1306,16 +1306,18 @@
 verride%0A
+  
 public v
@@ -1348,49 +1348,293 @@
 %7B%0A  
-// TODO Auto-generated method stub%0A  %0A%7D%0A%0A
+  for (int i = 0; i %3C getChildCount(); i++) %7B%0A      View v = getChildAt(i);%0A      if (v.getId() == id) %7B%0A%09removeView(v);%0A%09System.out.println(%22Child %22 + id + %22 removed succesfully%22);%0A%09return;%0A      %7D%0A    %7D%0A    System.out.println(%22Child %22 + id + %22 wasn't found and wasn't removed%22);%0A%0A  %7D
 %0A%0A%7D%0A

Add removeChild code