Example #1
0
 protected XList buildItems(XList list) {
   ISqlConnection cnn = null;
   XList xlist = new XList();
   try {
     int count = list.children().count();
     for (int n = 0; n < count; n++) {
       IXmlObject xobject = list.children().get(n);
       String type = xobject.innerGet("type");
       if (XListItem.TYPE_SQL.equals(type)) {
         if (null == cnn) {
           cnn = _databaseConsole.alloc();
         }
         FDataset ds = cnn.fetchDataset(xobject.innerGet("value"));
         for (FRow row : ds) {
           XListItem item = new XListItem();
           item.innerSet("value", row.value(0));
           item.innerSet("label", row.value(1));
           xlist.children().push(item);
         }
       } else {
         XListItem item = new XListItem();
         item.innerSet("value", xobject.innerGet("value"));
         item.innerSet("label", xobject.innerGet("label"));
         xlist.children().push(item);
       }
     }
   } finally {
     if (null != cnn) {
       _databaseConsole.free(cnn);
     }
   }
   return xlist;
 }
 // ============================================================
 // <T>判断是否指定实例。</T>
 //
 // @param xobject 对象
 // @return 是否指定
 // ============================================================
 public static boolean isInstance(IXmlObject xobject) {
   return NAME.equals(xobject.name());
 }