trust panel ui

pull/4/head
Zlatin Balevsky 2019-06-02 11:56:19 +01:00
parent b19b5ef315
commit 32f944a089
4 changed files with 50 additions and 6 deletions

View File

@ -101,6 +101,33 @@ class MainFrameController {
def downloader = selectedDownload()
downloader.resume()
}
private void markTrust(String tableName, TrustLevel level, def list) {
int row = builder.getVariable(tableName).getSelectedRow()
if (row < 0)
return
core.eventBus.publish(new TrustEvent(persona : list[row], level : level))
}
@ControllerAction
void markTrusted() {
markTrust("distrusted-table", TrustLevel.TRUSTED, model.distrusted)
}
@ControllerAction
void markNeutralFromDistrusted() {
markTrust("distrusted-table", TrustLevel.NEUTRAL, model.distrusted)
}
@ControllerAction
void markDistrusted() {
markTrust("trusted-table", TrustLevel.DISTRUSTED, model.trusted)
}
@ControllerAction
void markNeutralFromTrusted() {
markTrust("trusted-table", TrustLevel.NEUTRAL, model.trusted)
}
void mvcGroupInit(Map<String, String> args) {
application.addPropertyChangeListener("core", {e->

View File

@ -201,8 +201,8 @@ class MainFrameModel {
void onTrustEvent(TrustEvent e) {
runInsideUIAsync {
JTable table = builder.getVariable("results-table")
table.model.fireTableDataChanged()
// TODO: refresh any search tabs
trusted.clear()
trusted.addAll(core.trustService.good.values())

View File

@ -0,0 +1,7 @@
<html>
Some html goes here
<ul>
<li>1</li>
<li>2</li>
</ul>
</html>

View File

@ -22,6 +22,7 @@ import java.awt.FlowLayout
import java.awt.GridBagConstraints
import java.awt.GridBagLayout
import java.awt.Insets
import java.nio.charset.StandardCharsets
import javax.annotation.Nonnull
@ -183,8 +184,8 @@ class MainFrameView {
}
}
panel(constraints : "trust window") {
gridLayout(rows: 1, cols :3)
panel {
gridLayout(rows: 1, cols :2)
panel (border : etchedBorder()){
borderLayout()
panel (constraints : BorderLayout.NORTH) {
label("Trusted users")
@ -196,9 +197,13 @@ class MainFrameView {
}
}
}
panel (constraints : BorderLayout.EAST) {
gridBagLayout()
button(text : "Mark Neutral", constraints : gbc(gridx: 0, gridy: 0), markNeutralFromTrustedAction)
button(text : "Mark Distrusted", constraints : gbc(gridx: 0, gridy:1), markDistrustedAction)
}
}
panel { label("buttons go here")}
panel {
panel (border : etchedBorder()){
borderLayout()
panel (constraints : BorderLayout.NORTH) {
label("Distrusted users")
@ -210,6 +215,11 @@ class MainFrameView {
}
}
}
panel(constraints : BorderLayout.WEST) {
gridBagLayout()
button(text: "Mark Neutral", constraints: gbc(gridx: 0, gridy: 0), markNeutralFromDistrustedAction)
button(text: "Mark Trusted", constraints : gbc(gridx: 0, gridy : 1), markTrustedAction)
}
}
}
}