def refresh(self, records):
        """
        Refreshs the current user interface to match the latest settings.
        """
        self._loaded = True
        
        if self.isLoading():
            return
        
        # load the information
        if RecordSet.typecheck(records):
            table = records.table()
            self.setTableType(table)
            
            if self.order():
                records.setOrder(self.order())
            
            # load specific data for this record box
            if self.specifiedColumnsOnly():
                records.setColumns(map(lambda x: x.name(),
                                       self.specifiedColumns()))
            
            # load the records asynchronously
            if self.isThreadEnabled() and table:
                try:
                    thread_enabled = table.getDatabase().isThreadEnabled()
                except AttributeError:
                    thread_enabled = False
                
                if thread_enabled:
                    # ensure we have a worker thread running
                    self.worker()
                    
                    # assign ordering based on tree table
                    if self.showTreePopup():
                        tree = self.treePopupWidget()
                        if tree.isSortingEnabled():
                            col = tree.sortColumn()
                            colname = tree.headerItem().text(col)
                            column = table.schema().column(colname)
                            
                            if column:
                                if tree.sortOrder() == Qt.AscendingOrder:
                                    sort_order = 'asc'
                                else:
                                    sort_order = 'desc'
                                
                                records.setOrder([(column.name(), sort_order)])
                    
                    self.loadRequested.emit(records)
                    return
        
        # load the records synchronously
        self.loadingStarted.emit()
        curr_record = self.currentRecord()
        self.blockSignals(True)
        self.setUpdatesEnabled(False)
        self.clear()
        use_dummy = not self.isRequired() or self.isCheckable()
        if use_dummy:
            self.addItem('')
        self.addRecords(records)
        self.setUpdatesEnabled(True)
        self.blockSignals(False)
        self.setCurrentRecord(curr_record)
        self.loadingFinished.emit()