コード例 #1
0
 private void fillTable() {
   results = ContactService.getInstance().getAll();
   groupInfoList = new ArrayList<ContactGroupInfo>();
   for (int i = 0; i < results.size(); i++) {
     ContactInfo info = results.get(i);
     String catalog = info.getCatalog();
     ContactGroupInfo lastGroupInfo = null;
     if (groupInfoList.size() > 0) {
       lastGroupInfo = groupInfoList.get(groupInfoList.size() - 1);
     }
     if (lastGroupInfo != null
         && lastGroupInfo.getGroupName() != null
         && lastGroupInfo.getGroupName().equals(catalog)) {
       lastGroupInfo.setIndexEnd(i);
     } else {
       lastGroupInfo = new ContactGroupInfo();
       lastGroupInfo.setGroupName(catalog);
       lastGroupInfo.setIndexStart(i);
       lastGroupInfo.setIndexEnd(i);
       groupInfoList.add(lastGroupInfo);
     }
   }
 }
コード例 #2
0
 private void appendRow(ContactInfo info) {
   // System.out.println(str);
   final TreeItem item;
   String catalog = info.getCatalog();
   if (catalog == "" || catalog.length() == 0) {
     catalog = "未分组";
   }
   if (parentItem == null
       || parentItem.getText() == null
       || !parentItem.getText().equals(catalog)) {
     if (parentItem != null) {
       parentItem.setExpanded(true);
       parentItem.setText(parentItem.getText() + " (共" + parentItemChildrenCount + "人)");
     }
     parentItem = new TreeItem(tree, SWT.NONE);
     parentItem.setText(catalog);
     parentItemChildrenCount = 0;
   }
   item = new TreeItem(parentItem, SWT.NONE);
   parentItemChildrenCount++;
   fillItem(item, info);
 }
コード例 #3
0
 private void fillItem(TreeItem item, ContactInfo info) {
   item.setText(1, Integer.toString(info.getContactId()));
   item.setText(2, info.getNumber());
   item.setText(3, info.getName());
   item.setText(4, info.getSex());
   item.setText(5, info.getJob());
   item.setText(6, info.getPostTimeBegin() + " 至 " + info.getPostTimeEnd());
   item.setText(7, info.getCardId());
   item.setText(8, info.getPhoto());
   item.setText(9, info.getPhone());
   item.setText(10, info.getFax());
   item.setText(11, info.getEmail());
   item.setData(info);
   item.setItemCount(0);
 }