This class is the main Contribution Manager Dialog. It contains all the contributions tab and the update tab.
| 36 | * It contains all the contributions tab and the update tab. |
| 37 | */ |
| 38 | public class ManagerFrame { |
| 39 | static final String ANY_CATEGORY = Language.text("contrib.all"); |
| 40 | |
| 41 | static final int AUTHOR_WIDTH = Toolkit.zoom(240); |
| 42 | static final int STATUS_WIDTH = Toolkit.zoom(66); |
| 43 | |
| 44 | static final String title = "Contribution Manager"; |
| 45 | |
| 46 | Base base; |
| 47 | JFrame frame; |
| 48 | ManagerTabs tabs; |
| 49 | |
| 50 | ContributionTab librariesTab; |
| 51 | ContributionTab modesTab; |
| 52 | ContributionTab toolsTab; |
| 53 | ContributionTab examplesTab; |
| 54 | UpdateContributionTab updatesTab; |
| 55 | |
| 56 | static Font SMALL_PLAIN; |
| 57 | static Font SMALL_BOLD; |
| 58 | static Font NORMAL_PLAIN; |
| 59 | static Font NORMAL_BOLD; |
| 60 | |
| 61 | |
| 62 | public ManagerFrame(Base base) { |
| 63 | this.base = base; |
| 64 | |
| 65 | final int smallSize = Toolkit.zoom(12); |
| 66 | final int normalSize = Toolkit.zoom(14); |
| 67 | SMALL_PLAIN = Toolkit.getSansFont(smallSize, Font.PLAIN); |
| 68 | SMALL_BOLD = Toolkit.getSansFont(smallSize, Font.BOLD); |
| 69 | NORMAL_PLAIN = Toolkit.getSansFont(normalSize, Font.PLAIN); |
| 70 | NORMAL_BOLD = Toolkit.getSansFont(normalSize, Font.BOLD); |
| 71 | |
| 72 | librariesTab = new ContributionTab(this, ContributionType.LIBRARY); |
| 73 | modesTab = new ContributionTab(this, ContributionType.MODE); |
| 74 | toolsTab = new ContributionTab(this, ContributionType.TOOL); |
| 75 | examplesTab = new ContributionTab(this, ContributionType.EXAMPLES); |
| 76 | updatesTab = new UpdateContributionTab(this); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | public void showFrame(ContributionType contributionType) { |
| 81 | ContributionTab showTab = getTab(contributionType); |
| 82 | if (frame == null) { |
| 83 | makeFrame(); |
| 84 | // done before as downloadAndUpdateContributionListing() |
| 85 | // requires the current selected tab |
| 86 | tabs.setPanel(showTab); |
| 87 | downloadAndUpdateContributionListing(base); |
| 88 | } else { |
| 89 | tabs.setPanel(showTab); |
| 90 | } |
| 91 | frame.setVisible(true); |
| 92 | // Avoid the search box taking focus and hiding the 'search' text |
| 93 | tabs.requestFocusInWindow(); |
| 94 | } |
| 95 |