mirror of https://github.com/zlatinb/muwire
adapt the height of the result details frame based on content
parent
33292f773c
commit
2e5f17a896
|
@ -3,6 +3,7 @@ package com.muwire.gui.resultdetails
|
||||||
import net.i2p.data.Destination
|
import net.i2p.data.Destination
|
||||||
|
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
|
import java.awt.Dimension
|
||||||
import java.awt.event.WindowAdapter
|
import java.awt.event.WindowAdapter
|
||||||
import java.awt.event.WindowEvent
|
import java.awt.event.WindowEvent
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ class ResultDetailsFrameView {
|
||||||
@MVCMember @Nonnull
|
@MVCMember @Nonnull
|
||||||
ResultDetailsFrameModel model
|
ResultDetailsFrameModel model
|
||||||
|
|
||||||
def window
|
JFrame window
|
||||||
|
|
||||||
JPanel certificatesPanel
|
JPanel certificatesPanel
|
||||||
JPanel collectionsPanel
|
JPanel collectionsPanel
|
||||||
|
@ -34,10 +35,10 @@ class ResultDetailsFrameView {
|
||||||
void initUI() {
|
void initUI() {
|
||||||
int rowHeight = application.context.get("row-height")
|
int rowHeight = application.context.get("row-height")
|
||||||
|
|
||||||
|
int frameHeight = 100
|
||||||
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,
|
||||||
preferredSize: [800,800],
|
|
||||||
title: trans("DETAILS_FOR", model.resultEvent.name)) {
|
title: trans("DETAILS_FOR", model.resultEvent.name)) {
|
||||||
gridBagLayout()
|
gridBagLayout()
|
||||||
int gridy = 0
|
int gridy = 0
|
||||||
|
@ -50,6 +51,7 @@ class ResultDetailsFrameView {
|
||||||
label(text : String.valueOf(0x1 << model.resultEvent.pieceSize), constraints: gbc(gridx: 1, gridy: 1))
|
label(text : String.valueOf(0x1 << model.resultEvent.pieceSize), constraints: gbc(gridx: 1, gridy: 1))
|
||||||
}
|
}
|
||||||
if (model.resultEvent.comment != null) {
|
if (model.resultEvent.comment != null) {
|
||||||
|
frameHeight += 200
|
||||||
panel(border: titledBorder(title: trans("COMMENT"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
panel(border: titledBorder(title: trans("COMMENT"), 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)
|
||||||
|
@ -59,6 +61,7 @@ class ResultDetailsFrameView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (model.senders.size() > 1) {
|
if (model.senders.size() > 1) {
|
||||||
|
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)
|
||||||
|
@ -76,18 +79,22 @@ class ResultDetailsFrameView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (model.resultEvent.certificates > 0) {
|
if (model.resultEvent.certificates > 0) {
|
||||||
|
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) {
|
if (model.resultEvent.collections.size() > 0) {
|
||||||
|
frameHeight += 300
|
||||||
collectionsPanel = panel(border: titledBorder(title : trans("COLLECTIONS"), border: etchedBorder(), titlePosition: TitledBorder.TOP),
|
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)) {
|
constraints: gbc(gridx: 0, gridy: gridy++, fill: GridBagConstraints.BOTH, weightx: 100, weighty: 100)) {
|
||||||
gridLayout(rows: 1, cols: 1)
|
gridLayout(rows: 1, cols: 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.setPreferredSize([800, frameHeight] as Dimension)
|
||||||
}
|
}
|
||||||
|
|
||||||
void mvcGroupInit(Map<String, String> args) {
|
void mvcGroupInit(Map<String, String> args) {
|
||||||
|
|
Loading…
Reference in New Issue