mirror of https://github.com/zlatinb/muwire
add a Close button to result details frame
parent
38948034a1
commit
2128d3eac7
|
@ -1,8 +1,20 @@
|
||||||
package com.muwire.gui.resultdetails
|
package com.muwire.gui.resultdetails
|
||||||
|
|
||||||
import griffon.core.artifact.GriffonController
|
import griffon.core.artifact.GriffonController
|
||||||
|
import griffon.core.controller.ControllerAction
|
||||||
|
import griffon.inject.MVCMember
|
||||||
import griffon.metadata.ArtifactProviderFor
|
import griffon.metadata.ArtifactProviderFor
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull
|
||||||
|
|
||||||
@ArtifactProviderFor(GriffonController)
|
@ArtifactProviderFor(GriffonController)
|
||||||
class ResultDetailsFrameController {
|
class ResultDetailsFrameController {
|
||||||
|
@MVCMember @Nonnull
|
||||||
|
ResultDetailsFrameView view
|
||||||
|
|
||||||
|
@ControllerAction
|
||||||
|
void close() {
|
||||||
|
view.window.setVisible(false)
|
||||||
|
mvcGroup.destroy()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.muwire.gui.resultdetails
|
||||||
import net.i2p.data.Destination
|
import net.i2p.data.Destination
|
||||||
|
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
|
import javax.swing.border.Border
|
||||||
|
import java.awt.BorderLayout
|
||||||
import java.awt.Dimension
|
import java.awt.Dimension
|
||||||
import java.awt.event.WindowAdapter
|
import java.awt.event.WindowAdapter
|
||||||
import java.awt.event.WindowEvent
|
import java.awt.event.WindowEvent
|
||||||
|
@ -35,62 +37,68 @@ class ResultDetailsFrameView {
|
||||||
void initUI() {
|
void initUI() {
|
||||||
int rowHeight = application.context.get("row-height")
|
int rowHeight = application.context.get("row-height")
|
||||||
|
|
||||||
int frameHeight = 100
|
int frameHeight = 200
|
||||||
window = builder.frame(visible : false, locationRelativeTo: application.windowManager.findWindow("main-frame"),
|
window = builder.frame(visible : false, locationRelativeTo: application.windowManager.findWindow("main-frame"),
|
||||||
defaultCloseOperation: JFrame.DISPOSE_ON_CLOSE,
|
defaultCloseOperation: JFrame.DISPOSE_ON_CLOSE,
|
||||||
iconImage: builder.imageIcon("/MuWire-48x48.png").image,
|
iconImage: builder.imageIcon("/MuWire-48x48.png").image,
|
||||||
title: trans("DETAILS_FOR", model.resultEvent.name)) {
|
title: trans("DETAILS_FOR", model.resultEvent.name)) {
|
||||||
gridBagLayout()
|
borderLayout()
|
||||||
int gridy = 0
|
panel(constraints: BorderLayout.CENTER) {
|
||||||
panel(border: titledBorder(title : trans("BASIC_DETAILS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
|
||||||
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100)) {
|
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
label(text : trans("SIZE"), constraints: gbc(gridx: 0, gridy: 0))
|
int gridy = 0
|
||||||
label(text : String.valueOf(model.resultEvent.size), constraints: gbc(gridx: 1, gridy: 0))
|
panel(border: titledBorder(title: trans("BASIC_DETAILS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
||||||
label(text : trans("PIECE_SIZE"), constraints: gbc(gridx: 0, gridy : 1))
|
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100)) {
|
||||||
label(text : String.valueOf(0x1 << model.resultEvent.pieceSize), constraints: gbc(gridx: 1, gridy: 1))
|
gridBagLayout()
|
||||||
}
|
label(text: trans("SIZE"), constraints: gbc(gridx: 0, gridy: 0))
|
||||||
if (model.resultEvent.comment != null) {
|
label(text: String.valueOf(model.resultEvent.size), constraints: gbc(gridx: 1, gridy: 0))
|
||||||
frameHeight += 200
|
label(text: trans("PIECE_SIZE"), constraints: gbc(gridx: 0, gridy: 1))
|
||||||
panel(border: titledBorder(title: trans("COMMENT"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
label(text: String.valueOf(0x1 << model.resultEvent.pieceSize), constraints: gbc(gridx: 1, gridy: 1))
|
||||||
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
}
|
||||||
gridLayout(rows: 1, cols: 1)
|
if (model.resultEvent.comment != null) {
|
||||||
scrollPane {
|
frameHeight += 200
|
||||||
textArea(text: model.resultEvent.comment, editable: false, lineWrap: true, wrapStyleWord: true)
|
panel(border: titledBorder(title: trans("COMMENT"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
||||||
|
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
||||||
|
gridLayout(rows: 1, cols: 1)
|
||||||
|
scrollPane {
|
||||||
|
textArea(text: model.resultEvent.comment, editable: false, lineWrap: true, wrapStyleWord: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (model.senders.size() > 1) {
|
||||||
if (model.senders.size() > 1) {
|
frameHeight += 200
|
||||||
frameHeight += 200
|
panel(border: titledBorder(title: trans("SENDERS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
||||||
panel(border: titledBorder(title : trans("SENDERS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
||||||
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
gridLayout(rows: 1, cols: 1)
|
||||||
gridLayout(rows: 1, cols: 1)
|
scrollPane {
|
||||||
scrollPane {
|
table(autoCreateRowSorter: true, rowHeight: rowHeight) {
|
||||||
table(autoCreateRowSorter : true, rowHeight: rowHeight) {
|
tableModel(list: model.senders.toList()) {
|
||||||
tableModel(list : model.senders.toList()) {
|
closureColumn(header: trans("SENDER"), read: { it.getHumanReadableName() })
|
||||||
closureColumn(header : trans("SENDER"), read : {it.getHumanReadableName()})
|
closureColumn(header: trans("TRUST_NOUN"), read: {
|
||||||
closureColumn(header : trans("TRUST_NOUN"), read :{
|
Destination destination = it.destination
|
||||||
Destination destination = it.destination
|
trans(model.core.trustService.getLevel(destination).name())
|
||||||
trans(model.core.trustService.getLevel(destination).name())
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (model.resultEvent.certificates > 0) {
|
||||||
if (model.resultEvent.certificates > 0) {
|
frameHeight += 300
|
||||||
frameHeight += 300
|
certificatesPanel = panel(border: titledBorder(title: trans("CERTIFICATES"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
||||||
certificatesPanel = panel(border: titledBorder(title : trans("CERTIFICATES"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
||||||
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
gridLayout(rows: 1, cols: 1)
|
||||||
gridLayout(rows: 1, cols: 1)
|
}
|
||||||
|
}
|
||||||
|
if (model.resultEvent.collections.size() > 0) {
|
||||||
|
frameHeight += 300
|
||||||
|
collectionsPanel = panel(border: titledBorder(title: trans("COLLECTIONS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
||||||
|
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
||||||
|
gridLayout(rows: 1, cols: 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (model.resultEvent.collections.size() > 0) {
|
panel(constraints: BorderLayout.SOUTH) {
|
||||||
frameHeight += 300
|
button(text : trans("CLOSE"), closeAction)
|
||||||
collectionsPanel = panel(border: titledBorder(title : trans("COLLECTIONS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
|
||||||
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
|
||||||
gridLayout(rows: 1, cols: 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue