/** * Sets up lists of instances that are different between database and local instances. If * uncheckableList is null, then the "difference" between database and local will be used to * generate these lists. If uncheckableList contains something, then the contents of the list * (assumed to be of type GKInstance) will be taken instead. * * @param fileAdaptor * @param dbAdaptor * @param uncheckableList */ public void setAdaptors( XMLFileAdaptor fileAdaptor, MySQLAdaptor dbAdaptor, List uncheckableList) { try { this.fileAdaptor = fileAdaptor; this.dbAdaptor = dbAdaptor; typeMap = new HashMap(); if (uncheckableList != null) { // Create a "fake" syncMap if a list of instances // already exists. syncMap = new HashMap(); syncMap.put(CHANGED_KEY, uncheckableList); // Create the corresponding "fake" type map. This // is needed so that the correct actions are assigned // to these instances, e.g. "update from db". GKInstance uncheckableInstance; for (Iterator it = uncheckableList.iterator(); it.hasNext(); ) { uncheckableInstance = (GKInstance) it.next(); typeMap.put(uncheckableInstance, NEW_CHANGE_IN_DB_KEY); } } else // The usual case // Create a syncMap based on the discrepancies // between local and database instances. syncMap = synchronize(fileAdaptor, dbAdaptor); if (syncMap.size() == 0) isSame = true; else { isSame = false; JPanel mapPane = createDisplayMapPane(); getContentPane().add(mapPane, BorderLayout.CENTER); setTitle( "Synchronization Results vs. " + dbAdaptor.getDBName() + "@" + dbAdaptor.getDBHost()); } } catch (Exception e) { System.err.println("SynchronizationPane.setAdaptors(): " + e); e.printStackTrace(); } }