mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
Minor UI updates and bug fixes.
-Fixed issue where categories were displayed for contributions that weren't present in the manager dialog -Fixed issue where status bar stated contribution listing was being downloaded after it already was
This commit is contained in:
@@ -197,10 +197,22 @@ public class ContributionListing {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<String> getCategories() {
|
||||
return librariesByCategory.keySet();
|
||||
public Set<String> getCategories(Filter filter) {
|
||||
Set<String> ret = new HashSet<String>();
|
||||
|
||||
Set<String> cats = librariesByCategory.keySet();
|
||||
for (String cat : cats) {
|
||||
for (Contribution contrib : librariesByCategory.get(cat)) {
|
||||
if (filter.matches(contrib)) {
|
||||
ret.add(cat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public List<Contribution> getAllContributions() {
|
||||
return new ArrayList<Contribution>(allContributions);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import processing.app.ContributionListing.Filter;
|
||||
import processing.app.contribution.*;
|
||||
|
||||
public class ContributionManagerDialog {
|
||||
@@ -39,7 +40,9 @@ public class ContributionManagerDialog {
|
||||
|
||||
JFrame dialog;
|
||||
|
||||
private String title;
|
||||
String title;
|
||||
|
||||
Filter permaFilter;
|
||||
|
||||
JComboBox categoryChooser;
|
||||
|
||||
@@ -62,6 +65,7 @@ public class ContributionManagerDialog {
|
||||
ContributionListing.Filter filter) {
|
||||
|
||||
this.title = title;
|
||||
this.permaFilter = filter;
|
||||
|
||||
contribListing = ContributionListing.getInstance();
|
||||
|
||||
@@ -104,6 +108,8 @@ public class ContributionManagerDialog {
|
||||
if (isError()) {
|
||||
statusBar.setErrorMessage("An error occured when downloading " +
|
||||
"the list of available contributions.");
|
||||
} else {
|
||||
statusBar.updateUI();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -136,8 +142,13 @@ public class ContributionManagerDialog {
|
||||
categorySelector.setLayout(new BoxLayout(categorySelector, BoxLayout.X_AXIS));
|
||||
pane.add(categorySelector, c);
|
||||
|
||||
categorySelector.add(new Label("Filter by Category:"));
|
||||
categorySelector.add(Box.createHorizontalStrut(6));
|
||||
|
||||
JLabel categoryLabel = new JLabel("Filter by Category:");
|
||||
categorySelector.add(categoryLabel);
|
||||
|
||||
categorySelector.add(Box.createHorizontalStrut(5));
|
||||
|
||||
categoryChooser = new JComboBox();
|
||||
categoryChooser.setMaximumRowCount(20);
|
||||
updateCategoryChooser();
|
||||
@@ -237,7 +248,7 @@ public class ContributionManagerDialog {
|
||||
|
||||
ArrayList<String> categories;
|
||||
categoryChooser.removeAllItems();
|
||||
categories = new ArrayList<String>(contribListing.getCategories());
|
||||
categories = new ArrayList<String>(contribListing.getCategories(permaFilter));
|
||||
Collections.sort(categories);
|
||||
categories.add(0, ContributionManagerDialog.ANY_CATEGORY);
|
||||
for (String s : categories) {
|
||||
|
||||
Reference in New Issue
Block a user