/src/main/java/com/bff/slimserver/musicjukebox/ui/components/podcast/PodcastInfoPanel.java

https://code.google.com/ · Java · 677 lines · 553 code · 83 blank · 41 comment · 69 complexity · d5c70a17a6e1058b2cbb713f12c30dd0 MD5 · raw file

  1. /*
  2. * SongInfoPanel.java
  3. *
  4. * Created on September 19, 2005, 3:04 PM
  5. */
  6. package com.bff.slimserver.musicjukebox.ui.components.podcast;
  7. import com.bff.slimserver.musicjukebox.ui.ThumbnailPanel;
  8. import com.bff.bjj.ui.component.ColorProperties;
  9. import com.bff.bjj.ui.component.BJJPanel;
  10. import com.bff.bjj.utils.Resources;
  11. import java.awt.BorderLayout;
  12. import java.awt.Dimension;
  13. import org.bff.squeezeserver.domain.podcast.PodcastAudioDetails;
  14. /**
  15. *
  16. * @author Bill
  17. */
  18. public class PodcastInfoPanel
  19. extends BJJPanel {
  20. private ThumbnailPanel thumbnailPanel;
  21. private boolean showArt;
  22. private static final int MAX_URL_SIZE = 50;
  23. public PodcastInfoPanel() {
  24. this(null, false);
  25. }
  26. public PodcastInfoPanel(boolean showImageArt) {
  27. this(null, showImageArt);
  28. }
  29. public PodcastInfoPanel(PodcastAudioDetails podcast, boolean showImageArt) {
  30. initComponents();
  31. this.showArt = showImageArt;
  32. if (showImageArt) {
  33. thumbnailPanel = new ThumbnailPanel();
  34. thumbnailPanel.setPreferredSize(new Dimension(300, 300));
  35. thumbPanel.add(thumbnailPanel);
  36. } else {
  37. remove(thumbPanel);
  38. remove(songScrollPane);
  39. add(songScrollPane, BorderLayout.CENTER);
  40. }
  41. if (podcast != null) {
  42. validateFields(podcast);
  43. setSongInfo(podcast);
  44. }
  45. }
  46. /** This method is called from within the constructor to
  47. * initialize the form.
  48. * WARNING: Do NOT modify this code. The content of this method is
  49. * always regenerated by the Form Editor.
  50. */
  51. // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  52. private void initComponents() {
  53. java.awt.GridBagConstraints gridBagConstraints;
  54. jPanel2 = new BJJPanel();
  55. thumbPanel = new BJJPanel();
  56. thumbPanel.setBackground(ColorProperties.PANEL_COVER_ART_BACKGROUND);
  57. jPanel3 = new BJJPanel();
  58. detailTabbedPane = new javax.swing.JTabbedPane();
  59. songScrollPane = new javax.swing.JScrollPane();
  60. jPanel1 = new BJJPanel();
  61. jLabel1 = new javax.swing.JLabel();
  62. lblArtist = new javax.swing.JLabel();
  63. jLabel3 = new javax.swing.JLabel();
  64. lblAlbum = new javax.swing.JLabel();
  65. jLabel5 = new javax.swing.JLabel();
  66. lblTitle = new javax.swing.JLabel();
  67. jLabel7 = new javax.swing.JLabel();
  68. lblTrack = new javax.swing.JLabel();
  69. jLabel9 = new javax.swing.JLabel();
  70. lblYear = new javax.swing.JLabel();
  71. jLabel11 = new javax.swing.JLabel();
  72. lblBitrate = new javax.swing.JLabel();
  73. jLabel12 = new javax.swing.JLabel();
  74. lblComment = new javax.swing.JLabel();
  75. jLabel13 = new javax.swing.JLabel();
  76. lblType = new javax.swing.JLabel();
  77. jLabel14 = new javax.swing.JLabel();
  78. lblDate = new javax.swing.JLabel();
  79. jLabel15 = new javax.swing.JLabel();
  80. lblUrl = new javax.swing.JLabel();
  81. jLabel19 = new javax.swing.JLabel();
  82. lblDuration = new javax.swing.JLabel();
  83. jLabel20 = new javax.swing.JLabel();
  84. lblExplicit = new javax.swing.JLabel();
  85. descriptionPanel = new BJJPanel();
  86. spDescription = new javax.swing.JScrollPane();
  87. taDescription = new javax.swing.JTextArea();
  88. summaryPanel = new javax.swing.JPanel();
  89. spSummary = new javax.swing.JScrollPane();
  90. taSummary = new javax.swing.JTextArea();
  91. subTitlePanel = new javax.swing.JPanel();
  92. spSubtitle = new javax.swing.JScrollPane();
  93. taSubtitle = new javax.swing.JTextArea();
  94. setForeground(new java.awt.Color(102, 102, 102));
  95. setLayout(new java.awt.BorderLayout());
  96. jPanel2.setMaximumSize(new java.awt.Dimension(310, 310));
  97. thumbPanel.setMaximumSize(new java.awt.Dimension(300, 300));
  98. thumbPanel.setMinimumSize(new java.awt.Dimension(300, 300));
  99. thumbPanel.setPreferredSize(new java.awt.Dimension(300, 300));
  100. jPanel2.add(thumbPanel);
  101. add(jPanel2, java.awt.BorderLayout.NORTH);
  102. jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Details"));
  103. jPanel3.setLayout(new java.awt.BorderLayout());
  104. songScrollPane.setBorder(null);
  105. jPanel1.setLayout(new java.awt.GridBagLayout());
  106. jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11));
  107. jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  108. jLabel1.setText("Artist:");
  109. jLabel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  110. gridBagConstraints = new java.awt.GridBagConstraints();
  111. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  112. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  113. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  114. jPanel1.add(jLabel1, gridBagConstraints);
  115. lblArtist.setForeground(new java.awt.Color(0, 102, 255));
  116. lblArtist.setMaximumSize(new java.awt.Dimension(300, 0));
  117. lblArtist.setMinimumSize(new java.awt.Dimension(300, 25));
  118. lblArtist.setPreferredSize(new java.awt.Dimension(300, 25));
  119. gridBagConstraints = new java.awt.GridBagConstraints();
  120. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  121. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  122. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  123. jPanel1.add(lblArtist, gridBagConstraints);
  124. jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11));
  125. jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  126. jLabel3.setText("Album:");
  127. jLabel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  128. gridBagConstraints = new java.awt.GridBagConstraints();
  129. gridBagConstraints.gridx = 0;
  130. gridBagConstraints.gridy = 1;
  131. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  132. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  133. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  134. jPanel1.add(jLabel3, gridBagConstraints);
  135. lblAlbum.setForeground(new java.awt.Color(0, 102, 255));
  136. lblAlbum.setMinimumSize(new java.awt.Dimension(300, 25));
  137. lblAlbum.setPreferredSize(new java.awt.Dimension(300, 25));
  138. gridBagConstraints = new java.awt.GridBagConstraints();
  139. gridBagConstraints.gridx = 1;
  140. gridBagConstraints.gridy = 1;
  141. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  142. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  143. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  144. jPanel1.add(lblAlbum, gridBagConstraints);
  145. jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11));
  146. jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  147. jLabel5.setText("Title:");
  148. jLabel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  149. gridBagConstraints = new java.awt.GridBagConstraints();
  150. gridBagConstraints.gridx = 0;
  151. gridBagConstraints.gridy = 2;
  152. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  153. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  154. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  155. jPanel1.add(jLabel5, gridBagConstraints);
  156. lblTitle.setForeground(new java.awt.Color(0, 102, 255));
  157. lblTitle.setMinimumSize(new java.awt.Dimension(300, 25));
  158. lblTitle.setPreferredSize(new java.awt.Dimension(300, 25));
  159. gridBagConstraints = new java.awt.GridBagConstraints();
  160. gridBagConstraints.gridx = 1;
  161. gridBagConstraints.gridy = 2;
  162. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  163. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  164. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  165. jPanel1.add(lblTitle, gridBagConstraints);
  166. jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11));
  167. jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  168. jLabel7.setText("Track:");
  169. jLabel7.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  170. gridBagConstraints = new java.awt.GridBagConstraints();
  171. gridBagConstraints.gridx = 0;
  172. gridBagConstraints.gridy = 3;
  173. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  174. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  175. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  176. jPanel1.add(jLabel7, gridBagConstraints);
  177. lblTrack.setForeground(new java.awt.Color(0, 102, 255));
  178. lblTrack.setMinimumSize(new java.awt.Dimension(300, 25));
  179. lblTrack.setPreferredSize(new java.awt.Dimension(300, 25));
  180. gridBagConstraints = new java.awt.GridBagConstraints();
  181. gridBagConstraints.gridx = 1;
  182. gridBagConstraints.gridy = 3;
  183. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  184. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  185. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  186. jPanel1.add(lblTrack, gridBagConstraints);
  187. jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11));
  188. jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  189. jLabel9.setText("Year:");
  190. jLabel9.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  191. gridBagConstraints = new java.awt.GridBagConstraints();
  192. gridBagConstraints.gridx = 0;
  193. gridBagConstraints.gridy = 4;
  194. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  195. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  196. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  197. jPanel1.add(jLabel9, gridBagConstraints);
  198. lblYear.setForeground(new java.awt.Color(0, 102, 255));
  199. lblYear.setMinimumSize(new java.awt.Dimension(300, 25));
  200. lblYear.setPreferredSize(new java.awt.Dimension(300, 25));
  201. gridBagConstraints = new java.awt.GridBagConstraints();
  202. gridBagConstraints.gridx = 1;
  203. gridBagConstraints.gridy = 4;
  204. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  205. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  206. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  207. jPanel1.add(lblYear, gridBagConstraints);
  208. jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11));
  209. jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  210. jLabel11.setText("Bitrate:");
  211. jLabel11.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  212. gridBagConstraints = new java.awt.GridBagConstraints();
  213. gridBagConstraints.gridx = 0;
  214. gridBagConstraints.gridy = 5;
  215. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  216. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  217. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  218. jPanel1.add(jLabel11, gridBagConstraints);
  219. lblBitrate.setForeground(new java.awt.Color(0, 102, 255));
  220. lblBitrate.setMinimumSize(new java.awt.Dimension(300, 25));
  221. lblBitrate.setPreferredSize(new java.awt.Dimension(300, 25));
  222. gridBagConstraints = new java.awt.GridBagConstraints();
  223. gridBagConstraints.gridx = 1;
  224. gridBagConstraints.gridy = 5;
  225. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  226. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  227. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  228. jPanel1.add(lblBitrate, gridBagConstraints);
  229. jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11));
  230. jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  231. jLabel12.setText("Comment:");
  232. jLabel12.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  233. gridBagConstraints = new java.awt.GridBagConstraints();
  234. gridBagConstraints.gridx = 0;
  235. gridBagConstraints.gridy = 6;
  236. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  237. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  238. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  239. jPanel1.add(jLabel12, gridBagConstraints);
  240. lblComment.setForeground(new java.awt.Color(0, 102, 255));
  241. lblComment.setMinimumSize(new java.awt.Dimension(300, 25));
  242. lblComment.setPreferredSize(new java.awt.Dimension(300, 25));
  243. gridBagConstraints = new java.awt.GridBagConstraints();
  244. gridBagConstraints.gridx = 1;
  245. gridBagConstraints.gridy = 6;
  246. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  247. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  248. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  249. jPanel1.add(lblComment, gridBagConstraints);
  250. jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11));
  251. jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  252. jLabel13.setText("Type:");
  253. jLabel13.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  254. gridBagConstraints = new java.awt.GridBagConstraints();
  255. gridBagConstraints.gridx = 0;
  256. gridBagConstraints.gridy = 7;
  257. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  258. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  259. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  260. jPanel1.add(jLabel13, gridBagConstraints);
  261. lblType.setForeground(new java.awt.Color(0, 102, 255));
  262. lblType.setMinimumSize(new java.awt.Dimension(300, 25));
  263. lblType.setPreferredSize(new java.awt.Dimension(300, 25));
  264. gridBagConstraints = new java.awt.GridBagConstraints();
  265. gridBagConstraints.gridx = 1;
  266. gridBagConstraints.gridy = 7;
  267. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  268. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  269. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  270. jPanel1.add(lblType, gridBagConstraints);
  271. jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11));
  272. jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  273. jLabel14.setText("Date:");
  274. jLabel14.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  275. gridBagConstraints = new java.awt.GridBagConstraints();
  276. gridBagConstraints.gridx = 0;
  277. gridBagConstraints.gridy = 9;
  278. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  279. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  280. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  281. jPanel1.add(jLabel14, gridBagConstraints);
  282. lblDate.setForeground(new java.awt.Color(0, 102, 255));
  283. lblDate.setMinimumSize(new java.awt.Dimension(300, 25));
  284. lblDate.setPreferredSize(new java.awt.Dimension(300, 25));
  285. gridBagConstraints = new java.awt.GridBagConstraints();
  286. gridBagConstraints.gridx = 1;
  287. gridBagConstraints.gridy = 9;
  288. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  289. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  290. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  291. jPanel1.add(lblDate, gridBagConstraints);
  292. jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11));
  293. jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  294. jLabel15.setText("Url:");
  295. jLabel15.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  296. gridBagConstraints = new java.awt.GridBagConstraints();
  297. gridBagConstraints.gridx = 0;
  298. gridBagConstraints.gridy = 8;
  299. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  300. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  301. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  302. jPanel1.add(jLabel15, gridBagConstraints);
  303. lblUrl.setForeground(new java.awt.Color(0, 102, 255));
  304. lblUrl.setMinimumSize(new java.awt.Dimension(300, 25));
  305. lblUrl.setPreferredSize(new java.awt.Dimension(300, 25));
  306. gridBagConstraints = new java.awt.GridBagConstraints();
  307. gridBagConstraints.gridx = 1;
  308. gridBagConstraints.gridy = 8;
  309. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  310. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  311. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  312. jPanel1.add(lblUrl, gridBagConstraints);
  313. jLabel19.setFont(new java.awt.Font("Tahoma", 1, 11));
  314. jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  315. jLabel19.setText("Duration:");
  316. jLabel19.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  317. gridBagConstraints = new java.awt.GridBagConstraints();
  318. gridBagConstraints.gridx = 0;
  319. gridBagConstraints.gridy = 10;
  320. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  321. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  322. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  323. jPanel1.add(jLabel19, gridBagConstraints);
  324. lblDuration.setForeground(new java.awt.Color(0, 102, 255));
  325. lblDuration.setMinimumSize(new java.awt.Dimension(300, 25));
  326. lblDuration.setPreferredSize(new java.awt.Dimension(300, 25));
  327. gridBagConstraints = new java.awt.GridBagConstraints();
  328. gridBagConstraints.gridx = 1;
  329. gridBagConstraints.gridy = 10;
  330. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  331. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  332. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  333. jPanel1.add(lblDuration, gridBagConstraints);
  334. jLabel20.setFont(new java.awt.Font("Tahoma", 1, 11));
  335. jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  336. jLabel20.setText("Explicit:");
  337. jLabel20.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 5));
  338. gridBagConstraints = new java.awt.GridBagConstraints();
  339. gridBagConstraints.gridx = 0;
  340. gridBagConstraints.gridy = 11;
  341. gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
  342. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  343. gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
  344. jPanel1.add(jLabel20, gridBagConstraints);
  345. lblExplicit.setForeground(new java.awt.Color(0, 102, 255));
  346. lblExplicit.setMinimumSize(new java.awt.Dimension(300, 25));
  347. lblExplicit.setPreferredSize(new java.awt.Dimension(300, 25));
  348. gridBagConstraints = new java.awt.GridBagConstraints();
  349. gridBagConstraints.gridx = 1;
  350. gridBagConstraints.gridy = 11;
  351. gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
  352. gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
  353. gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
  354. jPanel1.add(lblExplicit, gridBagConstraints);
  355. songScrollPane.setViewportView(jPanel1);
  356. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_DETAILS), songScrollPane);
  357. descriptionPanel.setLayout(new java.awt.BorderLayout());
  358. taDescription.setBackground(jPanel1.getBackground());
  359. taDescription.setColumns(20);
  360. taDescription.setLineWrap(true);
  361. taDescription.setRows(5);
  362. spDescription.setViewportView(taDescription);
  363. descriptionPanel.add(spDescription, java.awt.BorderLayout.CENTER);
  364. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_DESCRIPTION), descriptionPanel);
  365. summaryPanel.setLayout(new java.awt.BorderLayout());
  366. taSummary.setBackground(jPanel1.getBackground());
  367. taSummary.setColumns(20);
  368. taSummary.setLineWrap(true);
  369. taSummary.setRows(5);
  370. spSummary.setViewportView(taSummary);
  371. summaryPanel.add(spSummary, java.awt.BorderLayout.CENTER);
  372. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_SUMMARY), summaryPanel);
  373. subTitlePanel.setLayout(new java.awt.BorderLayout());
  374. taSubtitle.setBackground(jPanel1.getBackground());
  375. taSubtitle.setColumns(20);
  376. taSubtitle.setLineWrap(true);
  377. taSubtitle.setRows(5);
  378. spSubtitle.setViewportView(taSubtitle);
  379. subTitlePanel.add(spSubtitle, java.awt.BorderLayout.CENTER);
  380. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_SUBTITLE), subTitlePanel);
  381. jPanel3.add(detailTabbedPane, java.awt.BorderLayout.CENTER);
  382. add(jPanel3, java.awt.BorderLayout.CENTER);
  383. }// </editor-fold>//GEN-END:initComponents
  384. // Variables declaration - do not modify//GEN-BEGIN:variables
  385. private javax.swing.JPanel descriptionPanel;
  386. private javax.swing.JTabbedPane detailTabbedPane;
  387. private javax.swing.JLabel jLabel1;
  388. private javax.swing.JLabel jLabel11;
  389. private javax.swing.JLabel jLabel12;
  390. private javax.swing.JLabel jLabel13;
  391. private javax.swing.JLabel jLabel14;
  392. private javax.swing.JLabel jLabel15;
  393. private javax.swing.JLabel jLabel19;
  394. private javax.swing.JLabel jLabel20;
  395. private javax.swing.JLabel jLabel3;
  396. private javax.swing.JLabel jLabel5;
  397. private javax.swing.JLabel jLabel7;
  398. private javax.swing.JLabel jLabel9;
  399. private javax.swing.JPanel jPanel1;
  400. private javax.swing.JPanel jPanel2;
  401. private javax.swing.JPanel jPanel3;
  402. private javax.swing.JLabel lblAlbum;
  403. private javax.swing.JLabel lblArtist;
  404. private javax.swing.JLabel lblBitrate;
  405. private javax.swing.JLabel lblComment;
  406. private javax.swing.JLabel lblDate;
  407. private javax.swing.JLabel lblDuration;
  408. private javax.swing.JLabel lblExplicit;
  409. private javax.swing.JLabel lblTitle;
  410. private javax.swing.JLabel lblTrack;
  411. private javax.swing.JLabel lblType;
  412. private javax.swing.JLabel lblUrl;
  413. private javax.swing.JLabel lblYear;
  414. private javax.swing.JScrollPane songScrollPane;
  415. private javax.swing.JScrollPane spDescription;
  416. private javax.swing.JScrollPane spSubtitle;
  417. private javax.swing.JScrollPane spSummary;
  418. private javax.swing.JPanel subTitlePanel;
  419. private javax.swing.JPanel summaryPanel;
  420. private javax.swing.JTextArea taDescription;
  421. private javax.swing.JTextArea taSubtitle;
  422. private javax.swing.JTextArea taSummary;
  423. private javax.swing.JPanel thumbPanel;
  424. // End of variables declaration//GEN-END:variables
  425. /**
  426. * Pass null to remove all info
  427. * @param song
  428. */
  429. public void setSongInfo(PodcastAudioDetails song) {
  430. try {
  431. if (song != null) {
  432. validateFields(song);
  433. if (showArt) {
  434. thumbnailPanel.loadImage(song);
  435. }
  436. } else {
  437. lblAlbum.setText("");
  438. lblArtist.setText("");
  439. lblTitle.setText("");
  440. lblTrack.setText("");
  441. jLabel12.setVisible(true);
  442. lblComment.setVisible(true);
  443. lblComment.setText("");
  444. setBitrate("");
  445. jLabel9.setVisible(true);
  446. lblYear.setVisible(true);
  447. lblYear.setText("");
  448. if (showArt) {
  449. thumbnailPanel.removeImage();
  450. }
  451. }
  452. } catch (NullPointerException npe) {
  453. //dont give a shit
  454. npe.printStackTrace();
  455. }
  456. }
  457. public void setBitrate(String bitrate) {
  458. lblBitrate.setText(bitrate);
  459. /*
  460. if (bitrate < 0) {
  461. jLabel11.setVisible(false);
  462. lblBitrate.setVisible(false);
  463. } else {
  464. jLabel11.setVisible(true);
  465. lblBitrate.setVisible(true);
  466. }
  467. if (bitrate > 0) {
  468. jLabel11.setVisible(true);
  469. lblBitrate.setVisible(true);
  470. if (bitrate > 1000) {
  471. lblBitrate.setText(Integer.toString(bitrate / 1000) + " kpbs");
  472. } else {
  473. lblBitrate.setText(Integer.toString(bitrate) + " kbps");
  474. }
  475. }
  476. */
  477. }
  478. private void validateFields(PodcastAudioDetails podcast) {
  479. lblTitle.setText(podcast.getTitle());
  480. if (podcast.getComment() == null || "".equals(podcast.getComment())) {
  481. jLabel12.setVisible(false);
  482. lblComment.setVisible(false);
  483. lblComment.setText(podcast.getComment());
  484. } else {
  485. jLabel12.setVisible(true);
  486. lblComment.setVisible(true);
  487. }
  488. if (podcast.getBitrate() == null || "".equals(podcast.getBitrate())) {
  489. jLabel11.setVisible(false);
  490. lblBitrate.setVisible(false);
  491. } else {
  492. jLabel11.setVisible(true);
  493. lblBitrate.setVisible(true);
  494. setBitrate(podcast.getBitrate());
  495. }
  496. if (podcast.getArtist() == null || "".equals(podcast.getArtist())) {
  497. jLabel1.setVisible(false);
  498. lblArtist.setVisible(false);
  499. } else {
  500. jLabel1.setVisible(true);
  501. lblArtist.setVisible(true);
  502. lblArtist.setText(podcast.getArtist());
  503. }
  504. if (podcast.getAlbum() == null
  505. || "".equals(podcast.getAlbum().getName())
  506. || podcast.getAlbum().getName() == null) {
  507. jLabel3.setVisible(false);
  508. lblAlbum.setVisible(false);
  509. } else {
  510. jLabel3.setVisible(true);
  511. lblAlbum.setVisible(true);
  512. lblAlbum.setText(podcast.getAlbum().getName());
  513. }
  514. if (podcast.getTrack() < 1) {
  515. jLabel7.setVisible(false);
  516. lblTrack.setVisible(false);
  517. } else {
  518. jLabel7.setVisible(true);
  519. lblTrack.setVisible(true);
  520. lblTrack.setText(Integer.toString(podcast.getTrack()));
  521. }
  522. if (podcast.getYear() == null || "".equals(podcast.getYear()) || "0".equals(podcast.getYear())) {
  523. jLabel9.setVisible(false);
  524. lblYear.setVisible(false);
  525. } else {
  526. jLabel9.setVisible(true);
  527. lblYear.setVisible(true);
  528. lblYear.setText(podcast.getYear());
  529. }
  530. if (podcast.isRemote() && podcast.getType() != null && !"".equalsIgnoreCase(podcast.getType())) {
  531. jLabel13.setVisible(true);
  532. lblType.setVisible(true);
  533. lblType.setText(podcast.getType());
  534. } else {
  535. jLabel13.setVisible(false);
  536. lblType.setVisible(false);
  537. }
  538. if (podcast.getPubDate() != null && !"".equalsIgnoreCase(podcast.getPubDate())) {
  539. jLabel14.setVisible(true);
  540. lblDate.setVisible(true);
  541. lblDate.setText(podcast.getPubDate());
  542. } else {
  543. jLabel14.setVisible(false);
  544. lblDate.setVisible(false);
  545. }
  546. if (podcast.getUrl() != null && !"".equalsIgnoreCase(podcast.getUrl())) {
  547. jLabel15.setVisible(true);
  548. lblUrl.setVisible(true);
  549. lblUrl.setText(podcast.getUrl().length() < MAX_URL_SIZE ? podcast.getUrl() : podcast.getUrl().substring(0, MAX_URL_SIZE - 3) + "...");
  550. } else {
  551. jLabel15.setVisible(false);
  552. lblUrl.setVisible(false);
  553. }
  554. if (podcast.getDescription() != null && !"".equalsIgnoreCase(podcast.getDescription())) {
  555. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_DESCRIPTION), descriptionPanel);
  556. taDescription.setText(podcast.getDescription());
  557. } else {
  558. detailTabbedPane.remove(descriptionPanel);
  559. }
  560. if (podcast.getSummary() != null && !"".equalsIgnoreCase(podcast.getSummary())) {
  561. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_SUMMARY), summaryPanel);
  562. taSummary.setText(podcast.getSummary());
  563. } else {
  564. detailTabbedPane.remove(summaryPanel);
  565. }
  566. if (podcast.getSubTitle() != null
  567. && !"".equalsIgnoreCase(podcast.getSubTitle())
  568. && !podcast.getSubTitle().equalsIgnoreCase(podcast.getSummary())
  569. && !podcast.getSubTitle().equalsIgnoreCase(podcast.getDescription())) {
  570. detailTabbedPane.addTab(Resources.getMessage(Resources.LABEL_KEY.TAB_TITLE_SUBTITLE), subTitlePanel);
  571. taSubtitle.setText(podcast.getSummary());
  572. } else {
  573. detailTabbedPane.remove(subTitlePanel);
  574. }
  575. if (podcast.getDuration() != null && !"".equalsIgnoreCase(podcast.getDuration())) {
  576. jLabel19.setVisible(true);
  577. lblDuration.setVisible(true);
  578. lblDuration.setText(podcast.getDuration());
  579. } else {
  580. jLabel19.setVisible(false);
  581. lblDuration.setVisible(false);
  582. }
  583. if (podcast.getExplicit() != null && !"".equalsIgnoreCase(podcast.getExplicit())) {
  584. jLabel20.setVisible(true);
  585. lblExplicit.setVisible(true);
  586. lblExplicit.setText(podcast.getExplicit());
  587. } else {
  588. jLabel20.setVisible(false);
  589. lblExplicit.setVisible(false);
  590. }
  591. jPanel1.revalidate();
  592. }
  593. }