Status bar in contribution manager no longer obstructs viewing of the last item

This commit is contained in:
pesckal
2011-09-06 16:59:45 +00:00
parent e5b871b4db
commit d3a4c5d97f
2 changed files with 36 additions and 11 deletions
@@ -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<Contribution, ContributionPanel>(
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) {
@@ -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);
}
}