| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,8 @@ class ContributionPanel extends JPanel { | |||
| 81 | 81 | private final ContributionListPanel listPanel; | |
| 82 | 82 | private final ContributionListing contribListing = ContributionListing.getInstance(); | |
| 83 | 83 | ||
| 84 | - static private final int BUTTON_WIDTH = 100; | ||
| 84 | + static final int BUTTON_WIDTH = 100; | ||
| 85 | + static Icon foundationIcon; | ||
| 85 | 86 | ||
| 86 | 87 | /** | |
| 87 | 88 | * Should only be set through setContribution(), | |
@@ -93,7 +94,6 @@ public Contribution getContrib() { | |||
| 93 | 94 | return contrib; | |
| 94 | 95 | } | |
| 95 | 96 | ||
| 96 | - | ||
| 97 | 97 | private boolean alreadySelected; | |
| 98 | 98 | private boolean enableHyperlinks; | |
| 99 | 99 | private HyperlinkListener conditionalHyperlinkOpener; | |
@@ -110,13 +110,18 @@ public Contribution getContrib() { | |||
| 110 | 110 | private ActionListener installActionListener; | |
| 111 | 111 | private ActionListener undoActionListener; | |
| 112 | 112 | ||
| 113 | - boolean isUpdateInProgress; | ||
| 114 | - boolean isInstallInProgress; | ||
| 115 | - boolean isRemoveInProgress; | ||
| 113 | + boolean updateInProgress; | ||
| 114 | + boolean installInProgress; | ||
| 115 | + boolean removeInProgress; | ||
| 116 | + | ||
| 117 | + String description; | ||
| 116 | 118 | ||
| 117 | - StringBuilder description; | ||
| 118 | 119 | ||
| 119 | 120 | ContributionPanel(ContributionListPanel contributionListPanel) { | |
| 121 | + if (foundationIcon == null) { | ||
| 122 | + foundationIcon = Toolkit.getLibIconX("icons/foundation", 32); | ||
| 123 | + } | ||
| 124 | + | ||
| 120 | 125 | listPanel = contributionListPanel; | |
| 121 | 126 | barButtonCardPane = new JPanel(); | |
| 122 | 127 | ||
@@ -362,7 +367,7 @@ private void reorganizePaneComponents() { | |||
| 362 | 367 | add(rightPane, BorderLayout.EAST); | |
| 363 | 368 | ||
| 364 | 369 | ||
| 365 | - if (updateButton.isVisible() && !isRemoveInProgress && !contrib.isDeletionFlagged()) { | ||
| 370 | + if (updateButton.isVisible() && !removeInProgress && !contrib.isDeletionFlagged()) { | ||
| 366 | 371 | JPanel updateRemovePanel = new JPanel(); | |
| 367 | 372 | updateRemovePanel.setLayout(new FlowLayout()); | |
| 368 | 373 | updateRemovePanel.setOpaque(false); | |
@@ -377,7 +382,7 @@ private void reorganizePaneComponents() { | |||
| 377 | 382 | // barPane.add(installProgressBar); | |
| 378 | 383 | rightPane.add(barPane); | |
| 379 | 384 | ||
| 380 | - if (isUpdateInProgress) | ||
| 385 | + if (updateInProgress) | ||
| 381 | 386 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); | |
| 382 | 387 | ||
| 383 | 388 | } | |
@@ -397,7 +402,7 @@ private void reorganizePaneComponents() { | |||
| 397 | 402 | ||
| 398 | 403 | barButtonCardPane.add(buttonPane, BUTTON_CONSTRAINT); | |
| 399 | 404 | barButtonCardPane.add(barPane, PROGRESS_BAR_CONSTRAINT); | |
| 400 | - if (isInstallInProgress || isRemoveInProgress || isUpdateInProgress) | ||
| 405 | + if (installInProgress || removeInProgress || updateInProgress) | ||
| 401 | 406 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); | |
| 402 | 407 | else | |
| 403 | 408 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); | |
@@ -447,8 +452,7 @@ public void setContribution(Contribution contrib) { | |||
| 447 | 452 | this.contrib = contrib; | |
| 448 | 453 | ||
| 449 | 454 | if (contrib.isSpecial()) { | |
| 450 | - JLabel iconLabel = | ||
| 451 | - new JLabel(Toolkit.getLibIcon("icons/foundation-32.png")); // was 48? | ||
| 455 | + JLabel iconLabel = new JLabel(foundationIcon); | ||
| 452 | 456 | iconLabel.setBorder(new EmptyBorder(4, 7, 7, 7)); | |
| 453 | 457 | iconLabel.setVerticalAlignment(SwingConstants.TOP); | |
| 454 | 458 | add(iconLabel, BorderLayout.WEST); | |
@@ -458,33 +462,33 @@ public void setContribution(Contribution contrib) { | |||
| 458 | 462 | Font boldFont = Toolkit.getSansFont(12, Font.BOLD); | |
| 459 | 463 | String fontFace = "<font face=\"" + boldFont.getName() + "\">"; | |
| 460 | 464 | ||
| 461 | - description = new StringBuilder(); | ||
| 462 | - description.append("<html><body>" + fontFace); | ||
| 465 | + StringBuilder desc = new StringBuilder(); | ||
| 466 | + desc.append("<html><body>" + fontFace); | ||
| 463 | 467 | if (contrib.getUrl() == null) { | |
| 464 | - description.append(contrib.getName()); | ||
| 468 | + desc.append(contrib.getName()); | ||
| 465 | 469 | } else { | |
| 466 | - description.append("<a href=\"" + contrib.getUrl() + "\">" + contrib.getName() + "</a>"); | ||
| 470 | + desc.append("<a href=\"" + contrib.getUrl() + "\">" + contrib.getName() + "</a>"); | ||
| 467 | 471 | } | |
| 468 | - description.append("</font> "); | ||
| 472 | + desc.append("</font> "); | ||
| 469 | 473 | ||
| 470 | 474 | String version = contrib.getPrettyVersion(); | |
| 471 | 475 | if (version != null) { | |
| 472 | - description.append(version); | ||
| 476 | + desc.append(version); | ||
| 473 | 477 | } | |
| 474 | - description.append(" <br/>"); | ||
| 478 | + desc.append(" <br/>"); | ||
| 475 | 479 | ||
| 476 | 480 | String authorList = contrib.getAuthorList(); | |
| 477 | 481 | if (authorList != null && !authorList.isEmpty()) { | |
| 478 | - description.append(toHtmlLinks(contrib.getAuthorList())); | ||
| 482 | + desc.append(toHtmlLinks(contrib.getAuthorList())); | ||
| 479 | 483 | } | |
| 480 | - description.append("<br/><br/>"); | ||
| 484 | + desc.append("<br/><br/>"); | ||
| 481 | 485 | ||
| 482 | 486 | if (contrib.isDeletionFlagged()) { | |
| 483 | - description.append(REMOVE_RESTART_MESSAGE); | ||
| 487 | + desc.append(REMOVE_RESTART_MESSAGE); | ||
| 484 | 488 | } else if (contrib.isRestartFlagged()) { | |
| 485 | - description.append(INSTALL_RESTART_MESSAGE); | ||
| 489 | + desc.append(INSTALL_RESTART_MESSAGE); | ||
| 486 | 490 | } else if (contrib.isUpdateFlagged()) { | |
| 487 | - description.append(UPDATE_RESTART_MESSAGE); | ||
| 491 | + desc.append(UPDATE_RESTART_MESSAGE); | ||
| 488 | 492 | } else { | |
| 489 | 493 | String sentence = contrib.getSentence(); | |
| 490 | 494 | if (sentence == null || sentence.isEmpty()) { | |
@@ -493,20 +497,21 @@ public void setContribution(Contribution contrib) { | |||
| 493 | 497 | sentence = sanitizeHtmlTags(sentence); | |
| 494 | 498 | sentence = toHtmlLinks(sentence); | |
| 495 | 499 | } | |
| 496 | - description.append(sentence); | ||
| 500 | + desc.append(sentence); | ||
| 497 | 501 | } | |
| 498 | 502 | ||
| 499 | 503 | long lastUpdatedUTC = contrib.getLastUpdated(); | |
| 500 | 504 | if (lastUpdatedUTC != 0) { | |
| 501 | 505 | DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM); | |
| 502 | 506 | Date lastUpdatedDate = new Date(lastUpdatedUTC); | |
| 503 | 507 | if (version != null && !version.isEmpty()) | |
| 504 | - description.append(", "); | ||
| 505 | - description.append("Last Updated on " + dateFormatter.format(lastUpdatedDate)); | ||
| 508 | + desc.append(", "); | ||
| 509 | + desc.append("Last Updated on " + dateFormatter.format(lastUpdatedDate)); | ||
| 506 | 510 | } | |
| 507 | 511 | ||
| 508 | - description.append("</body></html>"); | ||
| 509 | - descriptionPane.setText(description.toString()); | ||
| 512 | + desc.append("</body></html>"); | ||
| 513 | + description = desc.toString(); | ||
| 514 | + descriptionPane.setText(description); | ||
| 510 | 515 | ||
| 511 | 516 | if (contribListing.hasUpdates(contrib)) { | |
| 512 | 517 | StringBuilder versionText = new StringBuilder(); | |
@@ -533,7 +538,7 @@ public void setContribution(Contribution contrib) { | |||
| 533 | 538 | ||
| 534 | 539 | updateButton.setEnabled(true); | |
| 535 | 540 | if (contrib != null) { | |
| 536 | - updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || isUpdateInProgress); | ||
| 541 | + updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || updateInProgress); | ||
| 537 | 542 | } | |
| 538 | 543 | ||
| 539 | 544 | installRemoveButton.removeActionListener(installActionListener); | |
@@ -595,9 +600,9 @@ public void cancel() { | |||
| 595 | 600 | installRemoveButton.setEnabled(!contrib.isUpdateFlagged()); | |
| 596 | 601 | ||
| 597 | 602 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); | |
| 598 | - isInstallInProgress = false; | ||
| 599 | - if(isUpdateInProgress) | ||
| 600 | - isUpdateInProgress = !isUpdateInProgress; | ||
| 603 | + installInProgress = false; | ||
| 604 | + if(updateInProgress) | ||
| 605 | + updateInProgress = !updateInProgress; | ||
| 601 | 606 | updateButton.setVisible(contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged()); | |
| 602 | 607 | setSelected(true); | |
| 603 | 608 | } | |
@@ -613,9 +618,9 @@ public void finishedAction() { | |||
| 613 | 618 | listPanel.contributionTab.statusPanel.setErrorMessage(Language.text("contrib.download_error")); | |
| 614 | 619 | } | |
| 615 | 620 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, BUTTON_CONSTRAINT); | |
| 616 | - isInstallInProgress = false; | ||
| 617 | - if(isUpdateInProgress) | ||
| 618 | - isUpdateInProgress = !isUpdateInProgress; | ||
| 621 | + installInProgress = false; | ||
| 622 | + if(updateInProgress) | ||
| 623 | + updateInProgress = !updateInProgress; | ||
| 619 | 624 | updateButton.setVisible(contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged()); | |
| 620 | 625 | setSelected(true); | |
| 621 | 626 | } | |
@@ -678,10 +683,10 @@ public void setSelected(boolean isSelected) { | |||
| 678 | 683 | enableHyperlinks = alreadySelected; | |
| 679 | 684 | ||
| 680 | 685 | if (contrib != null) { | |
| 681 | - updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || isUpdateInProgress); | ||
| 686 | + updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || updateInProgress); | ||
| 682 | 687 | updateButton.setEnabled(!contribListing.hasListDownloadFailed()); | |
| 683 | 688 | } | |
| 684 | - installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals(Language.text("contrib.remove")) || isUpdateInProgress); | ||
| 689 | + installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals(Language.text("contrib.remove")) || updateInProgress); | ||
| 685 | 690 | installRemoveButton.setEnabled(installRemoveButton.getText().equals(Language.text("contrib.remove")) ||!contribListing.hasListDownloadFailed()); | |
| 686 | 691 | reorganizePaneComponents(); | |
| 687 | 692 | ||
@@ -812,7 +817,7 @@ static void setSelectionStyle(JTextPane textPane, boolean selected) { | |||
| 812 | 817 | ||
| 813 | 818 | public void install() { | |
| 814 | 819 | listPanel.contributionTab.statusPanel.clear(); | |
| 815 | - isInstallInProgress = true; | ||
| 820 | + installInProgress = true; | ||
| 816 | 821 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); | |
| 817 | 822 | if (contrib instanceof AvailableContribution) { | |
| 818 | 823 | installContribution((AvailableContribution) contrib); | |
@@ -824,7 +829,7 @@ public void install() { | |||
| 824 | 829 | public void update() { | |
| 825 | 830 | ||
| 826 | 831 | listPanel.contributionTab.statusPanel.clear(); | |
| 827 | - isUpdateInProgress = true; | ||
| 832 | + updateInProgress = true; | ||
| 828 | 833 | if (contrib.getType().requiresRestart()) { | |
| 829 | 834 | installRemoveButton.setEnabled(false); | |
| 830 | 835 | installProgressBar.setVisible(true); | |
@@ -846,7 +851,7 @@ public void cancel() { | |||
| 846 | 851 | super.cancel(); | |
| 847 | 852 | resetInstallProgressBarState(); | |
| 848 | 853 | listPanel.contributionTab.statusPanel.setMessage(""); | |
| 849 | - isUpdateInProgress = false; | ||
| 854 | + updateInProgress = false; | ||
| 850 | 855 | installRemoveButton.setEnabled(true); | |
| 851 | 856 | if (contrib.isDeletionFlagged()) { | |
| 852 | 857 | ((LocalContribution)contrib).setUpdateFlag(true); | |
@@ -894,7 +899,7 @@ public void remove() { | |||
| 894 | 899 | ||
| 895 | 900 | listPanel.contributionTab.statusPanel.clear(); | |
| 896 | 901 | if (contrib.isInstalled() && contrib instanceof LocalContribution) { | |
| 897 | - isRemoveInProgress = true; | ||
| 902 | + removeInProgress = true; | ||
| 898 | 903 | ((CardLayout) barButtonCardPane.getLayout()).show(barButtonCardPane, PROGRESS_BAR_CONSTRAINT); | |
| 899 | 904 | updateButton.setEnabled(false); | |
| 900 | 905 | installRemoveButton.setEnabled(false); | |
@@ -905,7 +910,7 @@ public void remove() { | |||
| 905 | 910 | public void finishedAction() { | |
| 906 | 911 | // Finished uninstalling the library | |
| 907 | 912 | resetInstallProgressBarState(); | |
| 908 | - isRemoveInProgress = false; | ||
| 913 | + removeInProgress = false; | ||
| 909 | 914 | installRemoveButton.setEnabled(true); | |
| 910 | 915 | ||
| 911 | 916 | reorganizePaneComponents(); | |
@@ -915,7 +920,7 @@ public void finishedAction() { | |||
| 915 | 920 | public void cancel() { | |
| 916 | 921 | super.cancel(); | |
| 917 | 922 | resetInstallProgressBarState(); | |
| 918 | - isRemoveInProgress = false; | ||
| 923 | + removeInProgress = false; | ||
| 919 | 924 | installRemoveButton.setEnabled(true); | |
| 920 | 925 | ||
| 921 | 926 | reorganizePaneComponents(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -369,7 +369,6 @@ public FilterField () { | |||
| 369 | 369 | filterLabel.setOpaque(false); | |
| 370 | 370 | ||
| 371 | 371 | setFont(Toolkit.getSansFont(14, Font.PLAIN)); | |
| 372 | - //searchIcon = Toolkit.getLibIcon("manager/search.png"); | ||
| 373 | 372 | searchIcon = Toolkit.getLibIconX("manager/search"); | |
| 374 | 373 | filterLabel.setIcon(searchIcon); | |
| 375 | 374 | //searchIcon = new ImageIcon(java.awt.Toolkit.getDefaultToolkit().getImage("NSImage://NSComputerTemplate")); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,6 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | 47 | class StatusPanel extends JPanel { | |
| 48 | 48 | static final int BUTTON_WIDTH = 150; | |
| 49 | + static Icon foundationIcon; | ||
| 49 | 50 | ||
| 50 | 51 | JTextPane label; | |
| 51 | 52 | JButton installButton; | |
@@ -60,8 +61,12 @@ class StatusPanel extends JPanel { | |||
| 60 | 61 | ||
| 61 | 62 | private String bodyRule; | |
| 62 | 63 | ||
| 64 | + | ||
| 63 | 65 | public StatusPanel(int width, final ContributionTab contributionTab) { | |
| 64 | - super(); | ||
| 66 | + if (foundationIcon == null) { | ||
| 67 | + foundationIcon = Toolkit.getLibIconX("icons/foundation", 32); | ||
| 68 | + } | ||
| 69 | + | ||
| 65 | 70 | setBackground(new Color(0xebebeb)); | |
| 66 | 71 | // setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); | |
| 67 | 72 | this.contributionTab = contributionTab; | |
@@ -216,18 +221,14 @@ void clear() { | |||
| 216 | 221 | public void update(ContributionPanel panel) { | |
| 217 | 222 | progressBarPanel.removeAll(); | |
| 218 | 223 | ||
| 219 | - Icon icon = null; | ||
| 220 | - if (panel.getContrib().isSpecial()) { | ||
| 221 | - icon = Toolkit.getLibIcon("icons/foundation-32.png"); // was 48? | ||
| 222 | - } | ||
| 223 | - iconLabel.setIcon(icon); | ||
| 224 | - label.setText(panel.description.toString()); | ||
| 224 | + iconLabel.setIcon(panel.getContrib().isSpecial() ? foundationIcon : null); | ||
| 225 | + label.setText(panel.description); | ||
| 225 | 226 | ((HTMLDocument)label.getDocument()).getStyleSheet().addRule(bodyRule); | |
| 226 | 227 | ||
| 227 | - updateButton.setEnabled(contributionListing.hasDownloadedLatestList() | ||
| 228 | - && (contributionListing.hasUpdates(panel.getContrib()) && !panel | ||
| 229 | - .getContrib().isUpdateFlagged()) | ||
| 230 | - && !panel.isUpdateInProgress); | ||
| 228 | + updateButton.setEnabled(contributionListing.hasDownloadedLatestList() && | ||
| 229 | + (contributionListing.hasUpdates(panel.getContrib()) && | ||
| 230 | + !panel.getContrib().isUpdateFlagged()) && | ||
| 231 | + !panel.updateInProgress); | ||
| 231 | 232 | ||
| 232 | 233 | String latestVersion = | |
| 233 | 234 | contributionListing.getLatestVersion(panel.getContrib()); | |
@@ -236,7 +237,7 @@ public void update(ContributionPanel panel) { | |||
| 236 | 237 | installButton.setEnabled(!panel.getContrib().isInstalled() | |
| 237 | 238 | && contributionListing.hasDownloadedLatestList() | |
| 238 | 239 | && panel.getContrib().isCompatible(Base.getRevision()) | |
| 239 | - && !panel.isInstallInProgress); | ||
| 240 | + && !panel.installInProgress); | ||
| 240 | 241 | ||
| 241 | 242 | if (installButton.isEnabled()) { | |
| 242 | 243 | updateLabel.setText(latestVersion + " available"); | |
@@ -261,11 +262,11 @@ public void update(ContributionPanel panel) { | |||
| 261 | 262 | } | |
| 262 | 263 | ||
| 263 | 264 | removeButton.setEnabled(panel.getContrib().isInstalled() | |
| 264 | - && !panel.isRemoveInProgress); | ||
| 265 | + && !panel.removeInProgress); | ||
| 265 | 266 | progressBarPanel.add(panel.installProgressBar); | |
| 266 | 267 | progressBarPanel.setVisible(false); | |
| 267 | 268 | updateLabel.setVisible(true); | |
| 268 | - if (panel.isUpdateInProgress || panel.isInstallInProgress || panel.isRemoveInProgress) { | ||
| 269 | + if (panel.updateInProgress || panel.installInProgress || panel.removeInProgress) { | ||
| 269 | 270 | progressBarPanel.setVisible(true); | |
| 270 | 271 | updateLabel.setVisible(false); | |
| 271 | 272 | progressBarPanel.repaint(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments