Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 protected void innerBuildList(FXmlNodes config, String name) {
   // 通过列表取数据
   XList xlist = get(name);
   if (xlist.hasChild()) {
     IXmlObjects xitems = xlist.children();
     int count = xitems.count();
     for (int n = 0; n < count; n++) {
       XListItem xitem = (XListItem) xitems.get(n);
       if (null != xitem) {
         FXmlNode itemNode = config.create(XListItem.NAME);
         itemNode.set(XListItem.PTY_VALUE, xitem.getValue());
         itemNode.set(XListItem.PTY_LABEL, xitem.getLabel());
       }
     }
   }
 }