From d3a4c5d97f7f42449edd410290f90ba8e2aa2f56 Mon Sep 17 00:00:00 2001 From: pesckal Date: Tue, 6 Sep 2011 16:59:45 +0000 Subject: [PATCH] Status bar in contribution manager no longer obstructs viewing of the last item --- .../processing/app/ContributionListPanel.java | 27 ++++++++++++------- .../processing/app/ContributionManager.java | 20 +++++++++++++- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/app/src/processing/app/ContributionListPanel.java b/app/src/processing/app/ContributionListPanel.java index bd417f3e6..8234f963f 100644 --- a/app/src/processing/app/ContributionListPanel.java +++ b/app/src/processing/app/ContributionListPanel.java @@ -68,6 +68,8 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib protected ContributionPanel selectedPanel; + protected JPanel statusPlaceholder; + public ContributionListPanel(ContributionManager libraryManager) { super(); @@ -77,10 +79,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib setOpaque(true); if (Base.isLinux()) { - // Thanks to a bug with GNOME, getColor returns the wrong value for - // List.background. We'll just assume its white. The intersection - // of people using Linux and people using a weird inverted color theme - // should be small enough. + // Because of a bug with GNOME, getColor returns the wrong value for + // List.background. We'll just assume its white. The number of people + // using Linux and an inverted color theme should be small enough. setBackground(Color.white); } else { setBackground(UIManager.getColor("List.background")); @@ -89,12 +90,8 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib panelByContribution = new TreeMap( contribManager.getListing().getComparator()); - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.weighty = 1; - c.anchor = GridBagConstraints.CENTER; - + statusPlaceholder = new JPanel(); + statusPlaceholder.setVisible(false); } private void updatePanelOrdering() { @@ -105,9 +102,19 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib c.weightx = 1; c.gridx = 0; c.gridy = row++; + c.anchor = GridBagConstraints.NORTH; add(entry.getValue(), c); } + + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.BOTH; + c.weightx = 1; + c.weighty = 1; + c.gridx = 0; + c.gridy = row++; + c.anchor = GridBagConstraints.NORTH; + add(statusPlaceholder, c); } public void contributionAdded(final Contribution contribution) { diff --git a/app/src/processing/app/ContributionManager.java b/app/src/processing/app/ContributionManager.java index 9518f1c5d..aaeb2754c 100644 --- a/app/src/processing/app/ContributionManager.java +++ b/app/src/processing/app/ContributionManager.java @@ -66,6 +66,8 @@ public class ContributionManager { FilterField filterField; + JScrollPane scrollPane; + ContributionListPanel contributionListPanel; StatusPanel statusBar; @@ -216,7 +218,7 @@ public class ContributionManager { c.weighty = 1; c.weightx = 1; - final JScrollPane scrollPane = new JScrollPane(); + scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(300, 300)); scrollPane.setViewportView(contributionListPanel); scrollPane.getViewport().setOpaque(true); @@ -411,6 +413,7 @@ public class ContributionManager { advertisedVersion); } } else { + // There was a failure backing up the folder if (doBackup) { } else { @@ -1075,11 +1078,26 @@ public class ContributionManager { void setErrorMessage(String message) { errorMessage = message; setVisible(true); + + JPanel placeholder = ContributionManager.this.contributionListPanel.statusPlaceholder; + Dimension d = getPreferredSize(); + if (Base.isWindows()) { + d.height += 5; + placeholder.setPreferredSize(d); + } + placeholder.setVisible(true); + +// Rectangle rect = scrollPane.getViewport().getViewRect(); +// rect.x += d.height; +// scrollPane.getViewport().scrollRectToVisible(rect); } void clearErrorMessage() { errorMessage = null; repaint(); + + ContributionManager.this.contributionListPanel.statusPlaceholder + .setVisible(false); } }