| 37 | |
| 38 | |
| 39 | public class ContributionTab extends JPanel { |
| 40 | static final String ANY_CATEGORY = Language.text("contrib.all"); |
| 41 | static final int FILTER_WIDTH = Toolkit.zoom(180); |
| 42 | |
| 43 | ContributionType contribType; |
| 44 | ManagerFrame contribDialog; |
| 45 | |
| 46 | Contribution.Filter filter; |
| 47 | JComboBox<String> categoryChooser; |
| 48 | ListPanel contributionListPanel; |
| 49 | StatusPanel statusPanel; |
| 50 | FilterField filterField; |
| 51 | // TODO: remove or initialize restartButton |
| 52 | //JButton restartButton; |
| 53 | JLabel categoryLabel; |
| 54 | JLabel loaderLabel; |
| 55 | |
| 56 | JPanel errorPanel; |
| 57 | JTextPane errorMessage; |
| 58 | JButton tryAgainButton; |
| 59 | JButton closeButton; |
| 60 | |
| 61 | // the calling editor, so updates can be applied |
| 62 | Editor editor; |
| 63 | String category; |
| 64 | ContributionListing contribListing; |
| 65 | |
| 66 | JProgressBar progressBar; |
| 67 | |
| 68 | |
| 69 | public ContributionTab() { } |
| 70 | |
| 71 | |
| 72 | public ContributionTab(ManagerFrame dialog, ContributionType type) { |
| 73 | this.contribDialog = dialog; |
| 74 | this.contribType = type; |
| 75 | |
| 76 | filter = contrib -> contrib.getType() == contribType; |
| 77 | |
| 78 | contribListing = ContributionListing.getInstance(); |
| 79 | statusPanel = new StatusPanel(this, 650); |
| 80 | contributionListPanel = new ListPanel(this, filter, false); |
| 81 | contribListing.addListener(contributionListPanel); |
| 82 | } |
| 83 | |
| 84 | public void showFrame(final Editor editor, boolean error, boolean loading) { |
| 85 | this.editor = editor; |
| 86 | |
| 87 | setLayout(error, loading); |
| 88 | contributionListPanel.setVisible(!loading); |
| 89 | loaderLabel.setVisible(loading); |
| 90 | errorPanel.setVisible(error); |
| 91 | |
| 92 | validate(); |
| 93 | repaint(); |
| 94 | } |
| 95 | |
| 96 | |