From d15dff5a82af77f6f3627119fd2776ad0d6ce9d4 Mon Sep 17 00:00:00 2001 From: pesckal Date: Sat, 24 Sep 2011 07:16:10 +0000 Subject: [PATCH] Minor UI updates to contribution managers. -Odd/even coloring for linux and windows -Made description text aligned left -Added margin between description and buttons --- .../processing/app/ContributionListPanel.java | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/app/src/processing/app/ContributionListPanel.java b/app/src/processing/app/ContributionListPanel.java index 9cb35856e..343ae18da 100644 --- a/app/src/processing/app/ContributionListPanel.java +++ b/app/src/processing/app/ContributionListPanel.java @@ -253,12 +253,21 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib count++; } else { + Border border = null; - if (Base.isMacOS() && panel.isVisible()) { - if (count % 2 == 1) { - border = UIManager.getBorder("List.evenRowBackgroundPainter"); + if (panel.isVisible()) { + if (Base.isMacOS()) { + if (count % 2 == 1) { + border = UIManager.getBorder("List.evenRowBackgroundPainter"); + } else { + border = UIManager.getBorder("List.oddRowBackgroundPainter"); + } } else { - border = UIManager.getBorder("List.oddRowBackgroundPainter"); + if (count % 2 == 1) { + panel.setBackground(new Color(241, 241, 241)); + } else { + panel.setBackground(new Color(219, 224, 229)); + } } count++; } @@ -266,10 +275,8 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib if (border == null) { border = BorderFactory.createEmptyBorder(1, 1, 1, 1); } - panel.setBorder(border); - panel.setBackground(ContributionListPanel.this.getBackground()); panel.setForeground(UIManager.getColor("List.foreground")); } } @@ -559,10 +566,31 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTHEAST; - descriptionText = new JTextPane(); - descriptionText.setInheritsPopupMenu(true); - setHtmlTextStyle(descriptionText); - add(descriptionText, c); + JPanel descriptionPanel = new JPanel(new GridBagLayout()); + descriptionPanel.setInheritsPopupMenu(true); + descriptionPanel.setOpaque(false); + add(descriptionPanel, c); + + { + GridBagConstraints dc = new GridBagConstraints(); + dc.fill = GridBagConstraints.HORIZONTAL; + dc.weightx = 1; + + descriptionText = new JTextPane(); + descriptionText.setInheritsPopupMenu(true); + setHtmlTextStyle(descriptionText); + descriptionPanel.add(descriptionText, dc); + } + + int margin = 5; + if (Base.isMacOS()) { + margin = 15; + } + { + GridBagConstraints dc = new GridBagConstraints(); + dc.gridx = 1; + descriptionPanel.add(Box.createHorizontalStrut(margin), dc); + } } { // A label below the description text showing notifications for when @@ -720,7 +748,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib description.append(""); descriptionText.setText(description.toString()); - setAlignment(descriptionText, StyleConstants.ALIGN_JUSTIFIED); if (contribListing.hasUpdates(contrib)) { StringBuilder versionText = new StringBuilder(); @@ -833,7 +860,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib stylesheet.addRule("body {margin: 0; padding: 0;" + "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;" - + "font-size: 100%;" + "font-size: 0.9em;}"); + + "font-size: 100%;" + "font-size: 0.95em;}"); } htmlPanes.add(textPane); @@ -852,16 +879,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } } - /** - * @param align one of StyleConstants - */ - void setAlignment(JTextPane textPane, int align) { - StyledDocument sdoc = textPane.getStyledDocument(); - SimpleAttributeSet sa = new SimpleAttributeSet(); - StyleConstants.setAlignment(sa, align); - sdoc.setParagraphAttributes(0, 1, sa, false); - } - protected void resetInstallProgressBarState() { installProgressBar.setString("Starting"); installProgressBar.setIndeterminate(true);