mirror of https://github.com/zlatinb/muwire
tables
parent
d9aeb030d4
commit
d7cb534813
|
@ -17,6 +17,7 @@ public class Downloader {
|
||||||
private final int pieceSize
|
private final int pieceSize
|
||||||
private final I2PConnector connector
|
private final I2PConnector connector
|
||||||
private final Destination destination
|
private final Destination destination
|
||||||
|
private final int nPieces
|
||||||
|
|
||||||
private Endpoint endpoint
|
private Endpoint endpoint
|
||||||
private volatile DownloadSession currentSession
|
private volatile DownloadSession currentSession
|
||||||
|
@ -35,6 +36,7 @@ public class Downloader {
|
||||||
nPieces = length / pieceSize
|
nPieces = length / pieceSize
|
||||||
else
|
else
|
||||||
nPieces = length / pieceSize + 1
|
nPieces = length / pieceSize + 1
|
||||||
|
this.nPieces = nPieces
|
||||||
|
|
||||||
pieces = new Pieces(nPieces, Constants.DOWNLOAD_SEQUENTIAL_RATIO)
|
pieces = new Pieces(nPieces, Constants.DOWNLOAD_SEQUENTIAL_RATIO)
|
||||||
currentState = DownloadState.CONNECTING
|
currentState = DownloadState.CONNECTING
|
||||||
|
|
|
@ -13,6 +13,9 @@ class MainFrameModel {
|
||||||
@Inject @Nonnull GriffonApplication application
|
@Inject @Nonnull GriffonApplication application
|
||||||
@Observable boolean coreInitialized = false
|
@Observable boolean coreInitialized = false
|
||||||
|
|
||||||
|
@Observable def results
|
||||||
|
@Observable def downloads
|
||||||
|
|
||||||
void mvcGroupInit(Map<String, Object> args) {
|
void mvcGroupInit(Map<String, Object> args) {
|
||||||
application.addPropertyChangeListener("core", {e ->
|
application.addPropertyChangeListener("core", {e ->
|
||||||
coreInitialized = (e.getNewValue() != null)
|
coreInitialized = (e.getNewValue() != null)
|
||||||
|
|
|
@ -58,11 +58,19 @@ class MainFrameView {
|
||||||
cardLayout()
|
cardLayout()
|
||||||
panel (constraints : "search window") {
|
panel (constraints : "search window") {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
splitPane( orientation : JSplitPane.VERTICAL_SPLIT, dividerLocation : -1,
|
splitPane( orientation : JSplitPane.VERTICAL_SPLIT, dividerLocation : 500,
|
||||||
continuousLayout : true, constraints : BorderLayout.CENTER) {
|
continuousLayout : true, constraints : BorderLayout.CENTER) {
|
||||||
panel (constraints : JSplitPane.TOP, preferredSize : [1020, 500]) {
|
panel (constraints : JSplitPane.TOP) {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
label(text : "results go here", constraints : BorderLayout.CENTER)
|
scrollPane (constraints : BorderLayout.CENTER){
|
||||||
|
table() {
|
||||||
|
tableModel(list: model.results) {
|
||||||
|
closureColumn(header: "Name", type: String, read : {row -> row.name})
|
||||||
|
closureColumn(header: "Size", preferredWidth: 150, type: Long, read : {row -> row.size})
|
||||||
|
closureColumn(header: "Sender", type: String, read : {row -> row.sender.getHumanReadableName()})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
panel(constraints : BorderLayout.SOUTH) {
|
panel(constraints : BorderLayout.SOUTH) {
|
||||||
button(text : "Download")
|
button(text : "Download")
|
||||||
button(text : "Trust")
|
button(text : "Trust")
|
||||||
|
@ -71,7 +79,19 @@ class MainFrameView {
|
||||||
}
|
}
|
||||||
panel (constraints : JSplitPane.BOTTOM) {
|
panel (constraints : JSplitPane.BOTTOM) {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
label(text : "downloads go here", constraints : BorderLayout.CENTER)
|
scrollPane (constraints : BorderLayout.CENTER) {
|
||||||
|
table() {
|
||||||
|
tableModel(list: model.downloads) {
|
||||||
|
closureColumn(header: "Name", type: String, read : {row -> row.downloader.file.getName()})
|
||||||
|
closureColumn(header: "Status", type: String, read : {row -> row.downloader.getCurrentState()})
|
||||||
|
closureColumn(header: "Progress", type: String, read: { row ->
|
||||||
|
int pieces = row.downloader.nPieces
|
||||||
|
int done = row.downloader.donePieces()
|
||||||
|
"$pieces/$done pieces"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue