コード例 #1
0
 private void clearDeleteRecord() {
   if (deleteList != null) {
     java.util.List list = deleteList.getSelection();
     if (list.size() > 0) {
       try {
         java.util.List dbIDs = new ArrayList(list.size());
         for (Iterator it = list.iterator(); it.hasNext(); ) {
           GKInstance instance = (GKInstance) it.next();
           dbIDs.add(instance.getDBID());
         }
         fileAdaptor.clearDeleteRecord(dbIDs);
       } catch (IOException e) {
         System.err.println("SynchronizationDialog.clearDeleteRecord(): " + e);
         e.printStackTrace();
       }
       deleteList.deleteInstances(list);
       // Check if deleteList needs to be removed
       if (deleteList.getDisplayedInstances().size() == 0) {
         centerPane.remove(deleteList);
         centerPane.validate();
         centerPane.repaint();
       }
     }
   }
 }
コード例 #2
0
 /**
  * A helper method to update GUIs related the passed InstanceListPane: delete, or update the
  * assoicated title.
  *
  * @param instanceList
  */
 private void updateInstanceList(InstanceListPane instanceList) {
   if (instanceList == null) return; // Just in case
   if (instanceList.getDisplayedInstances().size() == 0) {
     removeInstanceList(instanceList);
     // Have to null the original reference
     if (instanceList == changedList) changedList = null;
     else if (instanceList == newList) newList = null;
     else if (instanceList == deleteInDBList) deleteInDBList = null;
     else if (instanceList == localHasMoreIEList) localHasMoreIEList = null;
     else if (instanceList == deleteList) deleteList = null;
   } else {
     // Update label
     SectionTitlePane titlePane = (SectionTitlePane) listToTitle.get(instanceList);
     String title = titlePane.getTitle();
     int index = title.lastIndexOf(":");
     title = title.substring(0, index) + ": " + instanceList.getDisplayedInstances().size();
     titlePane.setTitle(title);
   }
 }