work on trust list UI
This commit is contained in:
@@ -28,6 +28,8 @@ import com.muwire.core.search.UIResultBatchEvent
|
|||||||
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
|
||||||
|
import com.muwire.core.trust.TrustSubscriptionEvent
|
||||||
|
import com.muwire.core.trust.TrustSubscriptionUpdatedEvent
|
||||||
import com.muwire.core.update.UpdateAvailableEvent
|
import com.muwire.core.update.UpdateAvailableEvent
|
||||||
import com.muwire.core.update.UpdateDownloadedEvent
|
import com.muwire.core.update.UpdateDownloadedEvent
|
||||||
import com.muwire.core.upload.UploadEvent
|
import com.muwire.core.upload.UploadEvent
|
||||||
@@ -64,6 +66,7 @@ class MainFrameModel {
|
|||||||
def searches = new LinkedList()
|
def searches = new LinkedList()
|
||||||
def trusted = []
|
def trusted = []
|
||||||
def distrusted = []
|
def distrusted = []
|
||||||
|
def subscriptions = []
|
||||||
|
|
||||||
@Observable int connections
|
@Observable int connections
|
||||||
@Observable String me
|
@Observable String me
|
||||||
@@ -145,6 +148,7 @@ class MainFrameModel {
|
|||||||
core.eventBus.register(RouterDisconnectedEvent.class, this)
|
core.eventBus.register(RouterDisconnectedEvent.class, this)
|
||||||
core.eventBus.register(AllFilesLoadedEvent.class, this)
|
core.eventBus.register(AllFilesLoadedEvent.class, this)
|
||||||
core.eventBus.register(UpdateDownloadedEvent.class, this)
|
core.eventBus.register(UpdateDownloadedEvent.class, this)
|
||||||
|
core.eventBus.register(TrustSubscriptionUpdatedEvent.class, this)
|
||||||
|
|
||||||
timer.schedule({
|
timer.schedule({
|
||||||
if (core.shutdown.get())
|
if (core.shutdown.get())
|
||||||
@@ -173,7 +177,6 @@ class MainFrameModel {
|
|||||||
trusted.addAll(core.trustService.good.values())
|
trusted.addAll(core.trustService.good.values())
|
||||||
distrusted.addAll(core.trustService.bad.values())
|
distrusted.addAll(core.trustService.bad.values())
|
||||||
|
|
||||||
|
|
||||||
resumeButtonText = "Retry"
|
resumeButtonText = "Retry"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -185,6 +188,10 @@ class MainFrameModel {
|
|||||||
watched.addAll(core.muOptions.watchedDirectories)
|
watched.addAll(core.muOptions.watchedDirectories)
|
||||||
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
||||||
watched.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) }
|
watched.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) }
|
||||||
|
|
||||||
|
core.muOptions.trustSubscriptions.each {
|
||||||
|
core.eventBus.publish(new TrustSubscriptionEvent(persona : it, subscribe : true))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,6 +323,14 @@ class MainFrameModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onTrustSubscriptionUpdatedEvent(TrustSubscriptionUpdatedEvent e) {
|
||||||
|
runInsideUIAsync {
|
||||||
|
if (!subscriptions.contains(e.trustList))
|
||||||
|
subscriptions << e.trustList
|
||||||
|
updateTablePreservingSelection("subscription-table")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void onQueryEvent(QueryEvent e) {
|
void onQueryEvent(QueryEvent e) {
|
||||||
if (e.replyTo == core.me.destination)
|
if (e.replyTo == core.me.destination)
|
||||||
return
|
return
|
||||||
|
@@ -251,6 +251,8 @@ class MainFrameView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
panel(constraints : "trust window") {
|
panel(constraints : "trust window") {
|
||||||
|
gridLayout(rows : 2, cols : 1)
|
||||||
|
panel {
|
||||||
gridLayout(rows: 1, cols :2)
|
gridLayout(rows: 1, cols :2)
|
||||||
panel (border : etchedBorder()){
|
panel (border : etchedBorder()){
|
||||||
borderLayout()
|
borderLayout()
|
||||||
@@ -283,6 +285,31 @@ class MainFrameView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
panel {
|
||||||
|
borderLayout()
|
||||||
|
panel (constraints : BorderLayout.NORTH){
|
||||||
|
label(text : "Trust List Subscriptions")
|
||||||
|
}
|
||||||
|
scrollPane(constraints : BorderLayout.CENTER) {
|
||||||
|
table(id : "subscription-table", autoCreateRowSorter : true) {
|
||||||
|
tableModel(list : model.subscriptions) {
|
||||||
|
closureColumn(header : "Name", type: String, read : {it.persona.getHumanReadableName()})
|
||||||
|
closureColumn(header : "Trusted", type: Integer, read : {it.good.size()})
|
||||||
|
closureColumn(header : "Distrusted", type: Integer, read : {it.bad.size()})
|
||||||
|
closureColumn(header : "Status", type: String, read : {it.status.toString()})
|
||||||
|
closureColumn(header : "Last Updated", type : String, read : {
|
||||||
|
String.valueOf(new Date(it.timestamp))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panel(constraints : BorderLayout.SOUTH) {
|
||||||
|
button(text : "Review")
|
||||||
|
button(text : "Update")
|
||||||
|
button(text : "Unsubscribe")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
panel (border: etchedBorder(), constraints : BorderLayout.SOUTH) {
|
panel (border: etchedBorder(), constraints : BorderLayout.SOUTH) {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
|
Reference in New Issue
Block a user