incoming searches monitor
This commit is contained in:
@@ -15,6 +15,7 @@ import com.muwire.core.download.DownloadStartedEvent
|
|||||||
import com.muwire.core.files.FileHashedEvent
|
import com.muwire.core.files.FileHashedEvent
|
||||||
import com.muwire.core.files.FileLoadedEvent
|
import com.muwire.core.files.FileLoadedEvent
|
||||||
import com.muwire.core.files.FileSharedEvent
|
import com.muwire.core.files.FileSharedEvent
|
||||||
|
import com.muwire.core.search.QueryEvent
|
||||||
import com.muwire.core.search.UIResultEvent
|
import com.muwire.core.search.UIResultEvent
|
||||||
import com.muwire.core.trust.TrustEvent
|
import com.muwire.core.trust.TrustEvent
|
||||||
import com.muwire.core.trust.TrustService
|
import com.muwire.core.trust.TrustService
|
||||||
@@ -42,6 +43,7 @@ class MainFrameModel {
|
|||||||
def uploads = []
|
def uploads = []
|
||||||
def shared = []
|
def shared = []
|
||||||
def connectionList = []
|
def connectionList = []
|
||||||
|
def searches = new LinkedList()
|
||||||
|
|
||||||
@Observable int connections
|
@Observable int connections
|
||||||
@Observable String me
|
@Observable String me
|
||||||
@@ -65,6 +67,7 @@ class MainFrameModel {
|
|||||||
core.eventBus.register(UploadEvent.class, this)
|
core.eventBus.register(UploadEvent.class, this)
|
||||||
core.eventBus.register(UploadFinishedEvent.class, this)
|
core.eventBus.register(UploadFinishedEvent.class, this)
|
||||||
core.eventBus.register(TrustEvent.class, this)
|
core.eventBus.register(TrustEvent.class, this)
|
||||||
|
core.eventBus.register(QueryEvent.class, this)
|
||||||
})
|
})
|
||||||
Timer timer = new Timer("download-pumper", true)
|
Timer timer = new Timer("download-pumper", true)
|
||||||
timer.schedule({
|
timer.schedule({
|
||||||
@@ -153,4 +156,22 @@ class MainFrameModel {
|
|||||||
table.model.fireTableDataChanged()
|
table.model.fireTableDataChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onQueryEvent(QueryEvent e) {
|
||||||
|
StringBuilder sb = new StringBuilder()
|
||||||
|
e.searchEvent.searchTerms?.each {
|
||||||
|
sb.append(it)
|
||||||
|
sb.append(" ")
|
||||||
|
}
|
||||||
|
def search = sb.toString()
|
||||||
|
if (search.trim().size() == 0)
|
||||||
|
return
|
||||||
|
runInsideUIAsync {
|
||||||
|
searches.addFirst(search)
|
||||||
|
while(searches.size() > 200)
|
||||||
|
searches.removeLast()
|
||||||
|
JTable table = builder.getVariable("searches-table")
|
||||||
|
table.model.fireTableDataChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@@ -134,12 +134,26 @@ class MainFrameView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
panel (constraints: "monitor window") {
|
panel (constraints: "monitor window") {
|
||||||
borderLayout()
|
gridLayout(rows : 1, cols : 2)
|
||||||
label("Connections", constraints : BorderLayout.NORTH)
|
panel {
|
||||||
scrollPane(constraints : BorderLayout.CENTER) {
|
borderLayout()
|
||||||
table(id : "connections-table") {
|
label("Connections", constraints : BorderLayout.NORTH)
|
||||||
tableModel(list : model.connectionList) {
|
scrollPane(constraints : BorderLayout.CENTER) {
|
||||||
closureColumn(header : "Destination", type: String, read : { row -> row.toBase32() })
|
table(id : "connections-table") {
|
||||||
|
tableModel(list : model.connectionList) {
|
||||||
|
closureColumn(header : "Destination", type: String, read : { row -> row.toBase32() })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panel {
|
||||||
|
borderLayout()
|
||||||
|
label("Incoming searches", constraints : BorderLayout.NORTH)
|
||||||
|
scrollPane(constraints : BorderLayout.CENTER) {
|
||||||
|
table(id : "searches-table") {
|
||||||
|
tableModel(list : model.searches) {
|
||||||
|
closureColumn(header : "Keywords", type : String, read : { it })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user