(DetailPanel panel)
| 235 | |
| 236 | |
| 237 | public void update(DetailPanel panel) { |
| 238 | progressPanel.removeAll(); |
| 239 | |
| 240 | iconLabel.setIcon(panel.getContrib().isSpecial() ? foundationIcon : null); |
| 241 | label.setText(panel.description); |
| 242 | ((HTMLDocument)label.getDocument()).getStyleSheet().addRule(bodyRule); |
| 243 | |
| 244 | updateButton.setEnabled(contributionListing.hasDownloadedLatestList() && |
| 245 | (contributionListing.hasUpdates(panel.getContrib()) && |
| 246 | !panel.getContrib().isUpdateFlagged()) && |
| 247 | !panel.updateInProgress); |
| 248 | |
| 249 | String latestVersion = |
| 250 | contributionListing.getLatestPrettyVersion(panel.getContrib()); |
| 251 | String currentVersion = panel.getContrib().getPrettyVersion(); |
| 252 | |
| 253 | installButton.setEnabled(!panel.getContrib().isInstalled() && |
| 254 | contributionListing.hasDownloadedLatestList() && |
| 255 | panel.getContrib().isCompatible(Base.getRevision()) && |
| 256 | !panel.installInProgress); |
| 257 | |
| 258 | if (panel.getContrib().isCompatible(Base.getRevision())) { |
| 259 | if (installButton.isEnabled()) { |
| 260 | if (latestVersion != null) { |
| 261 | updateLabel.setText(latestVersion + " available"); |
| 262 | } else { |
| 263 | updateLabel.setText("Available"); |
| 264 | } |
| 265 | } else { |
| 266 | if (currentVersion != null) { |
| 267 | updateLabel.setText(currentVersion + " installed"); |
| 268 | } else { |
| 269 | updateLabel.setText("Installed"); |
| 270 | } |
| 271 | } |
| 272 | } else { |
| 273 | if (currentVersion != null) { |
| 274 | updateLabel.setText(currentVersion + " not compatible"); |
| 275 | } else { |
| 276 | updateLabel.setText("Not compatible"); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | if (latestVersion != null) { |
| 281 | latestVersion = "Update to " + latestVersion; |
| 282 | } else { |
| 283 | latestVersion = "Update"; |
| 284 | } |
| 285 | |
| 286 | if (updateButton.isEnabled()) { |
| 287 | updateButton.setText(latestVersion); |
| 288 | } else { |
| 289 | updateButton.setText("Update"); |
| 290 | } |
| 291 | |
| 292 | removeButton.setEnabled(panel.getContrib().isInstalled() && !panel.removeInProgress); |
| 293 | progressPanel.add(panel.installProgressBar); |
| 294 | progressPanel.setVisible(false); |
no test coverage detected