コード例 #1
0
 @Kroll.method
 public void remove(TableViewRowProxy rowProxy) {
   if (rowProxy != null) {
     rows.remove(rowProxy);
     if (rowProxy.getParent() == this) {
       rowProxy.setParent(null);
     }
   }
 }
コード例 #2
0
 @Override
 public void setActivity(Activity activity) {
   super.setActivity(activity);
   if (rows != null) {
     for (TableViewRowProxy row : rows) {
       row.setActivity(activity);
     }
   }
 }
コード例 #3
0
 @Override
 public void releaseViews(boolean activityFinishing) {
   super.releaseViews(activityFinishing);
   if (rows != null) {
     for (TableViewRowProxy row : rows) {
       row.releaseViews(activityFinishing);
     }
   }
 }
コード例 #4
0
 @Kroll.method
 public void add(TableViewRowProxy rowProxy) {
   if (rowProxy != null) {
     rows.add(rowProxy);
     if (rowProxy.getParent() == null) {
       rowProxy.setParent(this);
     }
   }
 }
コード例 #5
0
 @Override
 public void releaseViews() {
   super.releaseViews();
   if (rows != null) {
     for (TableViewRowProxy row : rows) {
       row.releaseViews();
     }
   }
 }
コード例 #6
0
 @Override
 public void eventListenerRemoved(String eventName, int count, KrollProxy proxy) {
   super.eventListenerRemoved(eventName, count, proxy);
   if (eventName.equals(TiC.EVENT_CLICK) && count == 0 && proxy == this) {
     for (TableViewSectionProxy section : getSections()) {
       for (TableViewRowProxy row : section.getRows()) {
         row.setLabelsClickable(false);
       }
     }
   }
 }
コード例 #7
0
 @Kroll.method
 public void removeRowAt(int index) {
   if (index > -1 && index < rows.size()) {
     TableViewRowProxy rowProxy = rows.get(index);
     rows.remove(index);
     if (rowProxy.getParent() == this) {
       rowProxy.setParent(null);
     }
   } else {
     Log.e(TAG, "Index out of range. Unable to remove row at index " + index, Log.DEBUG_MODE);
   }
 }
コード例 #8
0
  private TableViewRowProxy rowProxyFor(Object row) {
    TableViewRowProxy rowProxy = null;
    if (row instanceof KrollDict) {
      KrollDict d = (KrollDict) row;
      rowProxy = new TableViewRowProxy(getTiContext());
      rowProxy.handleCreationDict(d);
      rowProxy.setProperty(TiC.PROPERTY_CLASS_NAME, CLASSNAME_NORMAL);
      rowProxy.setProperty(TiC.PROPERTY_ROW_DATA, row);
    } else {
      rowProxy = (TableViewRowProxy) row;
    }

    rowProxy.setParent(this);
    return rowProxy;
  }
コード例 #9
0
 @Kroll.method
 public void updateRowAt(int index, TableViewRowProxy row) {
   TableViewRowProxy oldRow = rows.get(index);
   if (row == oldRow) {
     return;
   }
   if (index > -1 && index < rows.size()) {
     rows.set(index, row);
     row.setParent(this);
     if (oldRow.getParent() == this) {
       oldRow.setParent(null);
     }
   } else {
     Log.e(TAG, "Index out of range. Unable to update row at index " + index, Log.DEBUG_MODE);
   }
 }
コード例 #10
0
 private void handleAppendRow(Object row) {
   TableViewRowProxy rowProxy = rowProxyFor(row);
   ArrayList<TableViewSectionProxy> sections = getSections();
   if (sections.size() == 0) {
     Object[] data = {rowProxy};
     processData(data);
   } else {
     TableViewSectionProxy lastSection = sections.get(sections.size() - 1);
     TableViewSectionProxy addedToSection = addRowToSection(rowProxy, lastSection);
     if (lastSection == null || !lastSection.equals(addedToSection)) {
       sections.add(addedToSection);
     }
     rowProxy.setProperty(TiC.PROPERTY_SECTION, addedToSection);
     rowProxy.setProperty(TiC.PROPERTY_PARENT, addedToSection);
   }
   getTableView().setModelDirty();
   updateView();
 }
コード例 #11
0
 @Kroll.method
 public void insertRowAt(int index, TableViewRowProxy row) {
   if (index > -1 && index <= rows.size()) {
     rows.add(index, row);
     row.setParent(this);
   } else {
     Log.e(TAG, "Index out of range. Unable to insert row at index " + index, Log.DEBUG_MODE);
   }
 }
コード例 #12
0
 @Kroll.method
 public int getIndexByName(String name) {
   int index = -1;
   int idx = 0;
   if (name != null) {
     for (TableViewSectionProxy section : getSections()) {
       for (TableViewRowProxy row : section.getRows()) {
         String rname = TiConvert.toString(row.getProperty(TiC.PROPERTY_NAME));
         if (rname != null && name.equals(rname)) {
           index = idx;
           break;
         }
         idx++;
       }
       if (index > -1) {
         break;
       }
     }
   }
   return index;
 }
コード例 #13
0
 /**
  * If the row does not carry section information, it will be added to the currentSection. If it
  * does carry section information (i.e., a header), that section will be created and the row added
  * to it. Either way, whichever section the row gets added to will be returned.
  */
 private TableViewSectionProxy addRowToSection(
     TableViewRowProxy row, TableViewSectionProxy currentSection) {
   KrollDict d = row.getProperties();
   TableViewSectionProxy addedToSection = null;
   if (currentSection == null || d.containsKey(TiC.PROPERTY_HEADER)) {
     addedToSection = new TableViewSectionProxy(getTiContext());
   } else {
     addedToSection = currentSection;
   }
   if (d.containsKey(TiC.PROPERTY_HEADER)) {
     addedToSection.setProperty(TiC.PROPERTY_HEADER_TITLE, d.get(TiC.PROPERTY_HEADER));
   }
   if (d.containsKey(TiC.PROPERTY_FOOTER)) {
     addedToSection.setProperty(TiC.PROPERTY_FOOTER_TITLE, d.get(TiC.PROPERTY_FOOTER));
   }
   addedToSection.add(row);
   return addedToSection;
 }