From a017144d1aa8b90f798145067238e0728f1fc3b1 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 22 Sep 2015 18:58:53 -0400 Subject: [PATCH] more repeatable version of the name handling --- .../processing/app/contrib/UpdateListPanel.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/processing/app/contrib/UpdateListPanel.java b/app/src/processing/app/contrib/UpdateListPanel.java index b2dc7ec2c..9b624f150 100644 --- a/app/src/processing/app/contrib/UpdateListPanel.java +++ b/app/src/processing/app/contrib/UpdateListPanel.java @@ -26,6 +26,7 @@ import processing.app.ui.Toolkit; public class UpdateListPanel extends ListPanel { + static final Color SECTION_COLOR = new Color(0xFFf8f8f8); static final String[] PLURAL_TYPES = { ContributionType.LIBRARY.getPluralTitle(), ContributionType.MODE.getPluralTitle(), @@ -63,12 +64,8 @@ public class UpdateListPanel extends ListPanel { public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); String title = (String) getValueAt(row, 1); - if (title.equals("Libraries") || - title.equals("Modes") || - title.equals("Tools") || - title.equals("Examples")) { - c.setBackground(new Color(0xFFf0f0f0)); - //((JComponent) c).setBorder(BorderFactory.createMatteBorder(row == 0 ? 0 : 1, 0, 1, 0, Color.GRAY)); + if (sectionNames.contains(title)) { + c.setBackground(SECTION_COLOR); } else { c.setBackground(Color.WHITE); } @@ -80,10 +77,7 @@ public class UpdateListPanel extends ListPanel { boolean toggle, boolean extend) { String title = (String) getValueAt(rowIndex, 1); // Disallow selection on the fake rows - if (!title.equals("Libraries") && - !title.equals("Modes") && - !title.equals("Tools") && - !title.equals("Examples")) { + if (!sectionNames.contains(title)) { super.changeSelection(rowIndex, columnIndex, toggle, extend); } } @@ -177,7 +171,7 @@ public class UpdateListPanel extends ListPanel { if (entry.getType() != currentType) { currentType = entry.getType(); model.addRow(new Object[] { - null, currentType.getTitle(), null, null, null + null, currentType.getPluralTitle(), null, null, null }); } //TODO Make this into a function