mirror of https://github.com/zlatinb/muwire
Display thumbnail if one is available on creation
parent
b22dbcf4d0
commit
e374833681
|
@ -60,12 +60,7 @@ class ViewProfileView {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
panel(border: titledBorder(title : trans("PROFILE_VIEWER_HEADER"), border: etchedBorder(),
|
panel(border: titledBorder(title : trans("PROFILE_VIEWER_HEADER"), border: etchedBorder(),
|
||||||
titlePosition: TitledBorder.TOP), constraints: BorderLayout.NORTH) {
|
titlePosition: TitledBorder.TOP), constraints: BorderLayout.NORTH) {
|
||||||
if (model.profileHeader == null)
|
thumbnailPanel = panel(preferredSize: [ProfileConstants.MAX_THUMBNAIL_SIZE, ProfileConstants.MAX_THUMBNAIL_SIZE])
|
||||||
thumbnailPanel = panel(preferredSize: [ProfileConstants.MAX_THUMBNAIL_SIZE, ProfileConstants.MAX_THUMBNAIL_SIZE])
|
|
||||||
else {
|
|
||||||
Icon thumbNail = new ThumbnailIcon(model.profileHeader.getThumbNail())
|
|
||||||
thumbnailPanel = panel(icon: thumbNail.image)
|
|
||||||
}
|
|
||||||
if (model.profileTitle == null)
|
if (model.profileTitle == null)
|
||||||
titleLabel = label(text: trans("PROFILE_VIEWER_HEADER_MISSING"))
|
titleLabel = label(text: trans("PROFILE_VIEWER_HEADER_MISSING"))
|
||||||
else
|
else
|
||||||
|
@ -113,12 +108,19 @@ class ViewProfileView {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setPreferredSize([dimX, dimY] as Dimension)
|
window.setPreferredSize([dimX, dimY] as Dimension)
|
||||||
}
|
}
|
||||||
|
|
||||||
void mvcGroupInit(Map<String, String> params) {
|
void mvcGroupInit(Map<String, String> params) {
|
||||||
window.addWindowListener(new WindowAdapter() {
|
window.addWindowListener(new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
void windowOpened(WindowEvent e) {
|
||||||
|
if (model.profileHeader != null) {
|
||||||
|
Icon thumbNail = new ThumbnailIcon(model.profileHeader.getThumbNail())
|
||||||
|
drawThumbnail(thumbNail)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void windowClosed(WindowEvent e) {
|
void windowClosed(WindowEvent e) {
|
||||||
mvcGroup.destroy()
|
mvcGroup.destroy()
|
||||||
|
@ -141,11 +143,7 @@ class ViewProfileView {
|
||||||
SwingUtilities.invokeLater {
|
SwingUtilities.invokeLater {
|
||||||
|
|
||||||
Icon thumbNail = new ThumbnailIcon(profile.getHeader().getThumbNail())
|
Icon thumbNail = new ThumbnailIcon(profile.getHeader().getThumbNail())
|
||||||
def thumbDim = thumbnailPanel.getSize()
|
drawThumbnail(thumbNail)
|
||||||
thumbnailPanel.getGraphics().drawImage(thumbNail.image,
|
|
||||||
(int)(thumbDim.getWidth() / 2) - (int)(thumbNail.getIconHeight() / 2),
|
|
||||||
(int)(thumbDim.getHeight() / 2) - (int)(thumbNail.getIconHeight() / 2),
|
|
||||||
null)
|
|
||||||
|
|
||||||
def imgDim = imagePanel.getSize()
|
def imgDim = imagePanel.getSize()
|
||||||
imagePanel.getGraphics().drawImage(mainImage,
|
imagePanel.getGraphics().drawImage(mainImage,
|
||||||
|
@ -154,4 +152,12 @@ class ViewProfileView {
|
||||||
null)
|
null)
|
||||||
} as Runnable
|
} as Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawThumbnail(ThumbnailIcon thumbNail) {
|
||||||
|
def thumbDim = thumbnailPanel.getSize()
|
||||||
|
thumbnailPanel.getGraphics().drawImage(thumbNail.image,
|
||||||
|
(int)(thumbDim.getWidth() / 2) - (int)(thumbNail.getIconHeight() / 2),
|
||||||
|
(int)(thumbDim.getHeight() / 2) - (int)(thumbNail.getIconHeight() / 2),
|
||||||
|
null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue