mirror of https://github.com/zlatinb/muwire
use icon instead of text for trust level
parent
8da4be2e6b
commit
4b2bea2754
|
@ -7,6 +7,7 @@ import com.muwire.gui.HTMLSanitizer
|
||||||
|
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
|
import javax.swing.ImageIcon
|
||||||
import javax.swing.JLabel
|
import javax.swing.JLabel
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
import javax.swing.JTextArea
|
import javax.swing.JTextArea
|
||||||
|
@ -49,6 +50,8 @@ class ViewProfileView {
|
||||||
ImagePanel imagePanel
|
ImagePanel imagePanel
|
||||||
JTextArea bodyArea
|
JTextArea bodyArea
|
||||||
|
|
||||||
|
private Icon trusted, neutral, distrusted
|
||||||
|
|
||||||
void initUI() {
|
void initUI() {
|
||||||
mainFrame = application.windowManager.findWindow("main-frame")
|
mainFrame = application.windowManager.findWindow("main-frame")
|
||||||
def mainDim = mainFrame.getSize()
|
def mainDim = mainFrame.getSize()
|
||||||
|
@ -60,6 +63,10 @@ class ViewProfileView {
|
||||||
thumbnailPanel.setPreferredSize([ProfileConstants.MAX_THUMBNAIL_SIZE, ProfileConstants.MAX_THUMBNAIL_SIZE] as Dimension)
|
thumbnailPanel.setPreferredSize([ProfileConstants.MAX_THUMBNAIL_SIZE, ProfileConstants.MAX_THUMBNAIL_SIZE] as Dimension)
|
||||||
imagePanel = new ImagePanel()
|
imagePanel = new ImagePanel()
|
||||||
|
|
||||||
|
trusted = new ImageIcon(getClass().getClassLoader().getResource("trusted.png"))
|
||||||
|
neutral = new ImageIcon(getClass().getClassLoader().getResource("neutral.png"))
|
||||||
|
distrusted = new ImageIcon(getClass().getClassLoader().getResource("distrusted.png"))
|
||||||
|
|
||||||
window = builder.frame(visible: false, defaultCloseOperation: JFrame.DISPOSE_ON_CLOSE,
|
window = builder.frame(visible: false, defaultCloseOperation: JFrame.DISPOSE_ON_CLOSE,
|
||||||
iconImage: builder.imageIcon("/MuWire-48x48.png").image,
|
iconImage: builder.imageIcon("/MuWire-48x48.png").image,
|
||||||
title: trans("PROFILE_VIEWER_TITLE", model.persona.getHumanReadableName())) {
|
title: trans("PROFILE_VIEWER_TITLE", model.persona.getHumanReadableName())) {
|
||||||
|
@ -107,8 +114,8 @@ class ViewProfileView {
|
||||||
panel {
|
panel {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
panel(constraints: BorderLayout.WEST) {
|
panel(constraints: BorderLayout.WEST) {
|
||||||
label(text: trans("YOUR_TRUST") + " : ")
|
label(text: "", icon: bind{ getIcon(model.trustLevel) } ,
|
||||||
label(text: bind {trans(model.trustLevel.name())})
|
toolTipText: bind {trans(model.trustLevel.name())})
|
||||||
}
|
}
|
||||||
panel(constraints: BorderLayout.EAST) {
|
panel(constraints: BorderLayout.EAST) {
|
||||||
label(text: bind { model.status == null ? "" : trans(model.status.name()) })
|
label(text: bind { model.status == null ? "" : trans(model.status.name()) })
|
||||||
|
@ -132,6 +139,13 @@ class ViewProfileView {
|
||||||
window.setPreferredSize([dimX, dimY] as Dimension)
|
window.setPreferredSize([dimX, dimY] as Dimension)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Icon getIcon(TrustLevel level) {
|
||||||
|
switch(level) {
|
||||||
|
case TrustLevel.TRUSTED : return trusted
|
||||||
|
case TrustLevel.NEUTRAL : return neutral
|
||||||
|
case TrustLevel.DISTRUSTED : return distrusted
|
||||||
|
}
|
||||||
|
}
|
||||||
void mvcGroupInit(Map<String, String> params) {
|
void mvcGroupInit(Map<String, String> params) {
|
||||||
window.addWindowListener(new WindowAdapter() {
|
window.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue