From f83cc16a299194dcdb7b9a2e8c9a0877cefc462b Mon Sep 17 00:00:00 2001 From: pesckal Date: Sat, 24 Sep 2011 01:26:22 +0000 Subject: [PATCH] Removed icon and category from contribution panel --- .../processing/app/ContributionListPanel.java | 85 ++----------------- 1 file changed, 8 insertions(+), 77 deletions(-) diff --git a/app/src/processing/app/ContributionListPanel.java b/app/src/processing/app/ContributionListPanel.java index ec18b4f1d..96bd00622 100644 --- a/app/src/processing/app/ContributionListPanel.java +++ b/app/src/processing/app/ContributionListPanel.java @@ -415,12 +415,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib JTextPane headerText; - JPanel descriptionPanel; - - JLabel categoryLabel; - - JPanel iconArea; - JTextPane descriptionText; JTextPane updateNotificationLabel; @@ -552,22 +546,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib add(headerText, c); } - { // The category label, which shows the names of the category in the - // upper left corner. - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.anchor = GridBagConstraints.WEST; - - categoryLabel = new JLabel(); - categoryLabel.setInheritsPopupMenu(true); - categoryLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 7)); - add(categoryLabel, c); - } - - { // The bottom part of the panel which describes the contribution. - // All components in the description (e.g. icons, text) are placed in - // the descriptionPanel + { // The bottom right of the description, used to show text describing it GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 1; @@ -575,64 +554,21 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib c.weightx = 1; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.WEST; - - descriptionPanel = new JPanel(); - descriptionPanel.setInheritsPopupMenu(true); - descriptionPanel.setOpaque(false); - descriptionPanel.setLayout(new GridBagLayout()); - add(descriptionPanel, c); - } - - { // The left part of the description, used to draw the icon. - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.gridheight = 2; - c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.CENTER; - - iconArea = new JPanel() { - protected void paintComponent(Graphics g) { - Image icon = contribManager.getContributionIcon(contrib.getType()); - if (icon != null) { - g.drawImage(icon, 0, 0, this); - } - }; - }; - iconArea.setInheritsPopupMenu(true); - iconArea.setOpaque(false); - Dimension d = new Dimension(ContributionManagerDialog.ICON_WIDTH, - ContributionManagerDialog.ICON_HEIGHT); - iconArea.setMinimumSize(d); - iconArea.setPreferredSize(d); - - descriptionPanel.add(iconArea, c); - } - - { // The bottom right of the description, used to show text describing it - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 0; - c.weighty = 1; - c.weightx = 1; - c.gridwidth = 2; - c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.EAST; descriptionText = new JTextPane(); descriptionText.setInheritsPopupMenu(true); setHtmlTextStyle(descriptionText); stripTextSelectionListeners(descriptionText); - descriptionPanel.add(descriptionText, c); + add(descriptionText, c); } { // A label below the description text showing notifications for when // updates are available, or instructing the user to restart the PDE if // necessary GridBagConstraints c = new GridBagConstraints(); - c.gridx = 1; - c.gridy = 1; + c.gridx = 0; + c.gridy = 2; c.weightx = 1; c.insets = new Insets(-5, 0, 0, 0); c.fill = GridBagConstraints.HORIZONTAL; @@ -643,14 +579,14 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib updateNotificationLabel.setVisible(false); setHtmlTextStyle(updateNotificationLabel); stripTextSelectionListeners(updateNotificationLabel); - descriptionPanel.add(updateNotificationLabel, c); + add(updateNotificationLabel, c); } { // An update button, shown in the description area, but only visible for // contributions that do not require a restart. GridBagConstraints c = new GridBagConstraints(); - c.gridx = 2; - c.gridy = 1; + c.gridx = 1; + c.gridy = 2; c.weightx = 1; c.insets = new Insets(-5, 0, 0, 0); c.anchor = GridBagConstraints.EAST; @@ -673,7 +609,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib installContribution(ad, url); } }); - descriptionPanel.add(updateButton, c); + add(updateButton, c); } } @@ -761,8 +697,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib nameText.append(""); headerText.setText(nameText.toString()); - categoryLabel.setText("[" + contrib.getCategory() + "]"); - StringBuilder description = new StringBuilder(); description.append(""); @@ -985,9 +919,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib public void setForeground(Color fg) { super.setForeground(fg); - if (categoryLabel != null) - categoryLabel.setForeground(fg); - if (htmlPanes != null) { for (JTextPane pane : htmlPanes) { Document doc = pane.getDocument();