This class is the main Contribution Manager Dialog. It contains all the contributions tab and the update tab.
| 37 | * It contains all the contributions tab and the update tab. |
| 38 | */ |
| 39 | public class ManagerFrame { |
| 40 | static final String ANY_CATEGORY = Language.text("contrib.all"); |
| 41 | |
| 42 | static final int AUTHOR_WIDTH = Toolkit.zoom(240); |
| 43 | static final int STATUS_WIDTH = Toolkit.zoom(66); |
| 44 | static final int VERSION_WIDTH = Toolkit.zoom(66); |
| 45 | |
| 46 | static final String title = "Contribution Manager"; |
| 47 | |
| 48 | Base base; |
| 49 | JFrame frame; |
| 50 | ManagerTabs tabs; |
| 51 | |
| 52 | ContributionTab librariesTab; |
| 53 | ContributionTab modesTab; |
| 54 | ContributionTab toolsTab; |
| 55 | ContributionTab examplesTab; |
| 56 | UpdateContributionTab updatesTab; |
| 57 | |
| 58 | ContributionTab[] tabList; |
| 59 | |
| 60 | |
| 61 | public ManagerFrame(Base base) { |
| 62 | this.base = base; |
| 63 | |
| 64 | // TODO Optimize these inits... unfortunately it needs to run on the EDT, |
| 65 | // and Swing is a piece of s*t, so it's gonna be slow with lots of contribs. |
| 66 | // In particular, load everything and then fire the update events. |
| 67 | // Also, don't pull all the colors over and over again. |
| 68 | // long t1 = System.currentTimeMillis(); |
| 69 | librariesTab = new ContributionTab(this, ContributionType.LIBRARY); |
| 70 | // long t2 = System.currentTimeMillis(); |
| 71 | modesTab = new ContributionTab(this, ContributionType.MODE); |
| 72 | // long t3 = System.currentTimeMillis(); |
| 73 | toolsTab = new ContributionTab(this, ContributionType.TOOL); |
| 74 | // long t4 = System.currentTimeMillis(); |
| 75 | examplesTab = new ContributionTab(this, ContributionType.EXAMPLES); |
| 76 | // long t5 = System.currentTimeMillis(); |
| 77 | updatesTab = new UpdateContributionTab(this); |
| 78 | // long t6 = System.currentTimeMillis(); |
| 79 | |
| 80 | tabList = new ContributionTab[] { |
| 81 | librariesTab, modesTab, toolsTab, examplesTab, updatesTab |
| 82 | }; |
| 83 | |
| 84 | // System.out.println("ManagerFrame.<init> " + (t2-t1) + " " + (t3-t2) + " " + (t4-t3) + " " + (t5-t4) + " " + (t6-t5)); |
| 85 | } |
| 86 | |
| 87 | |
| 88 | public void showFrame(ContributionType contributionType) { |
| 89 | ContributionTab showTab = getTab(contributionType); |
| 90 | if (frame == null) { |
| 91 | // Build the Contribution Manager UI on first use. |
| 92 | makeFrame(); |
| 93 | |
| 94 | // Update the list of contribs with what's installed locally. |
| 95 | ContributionListing.updateInstalled(base.getInstalledContribs()); |
| 96 |