@@ -81,7 +81,8 @@ class ContributionPanel extends JPanel {
8181 private final ContributionListPanel listPanel ;
8282 private final ContributionListing contribListing = ContributionListing .getInstance ();
8383
84- static private final int BUTTON_WIDTH = 100 ;
84+ static final int BUTTON_WIDTH = 100 ;
85+ static Icon foundationIcon ;
8586
8687 /**
8788 * Should only be set through setContribution(),
@@ -93,7 +94,6 @@ public Contribution getContrib() {
9394 return contrib ;
9495 }
9596
96-
9797 private boolean alreadySelected ;
9898 private boolean enableHyperlinks ;
9999 private HyperlinkListener conditionalHyperlinkOpener ;
@@ -110,13 +110,18 @@ public Contribution getContrib() {
110110 private ActionListener installActionListener ;
111111 private ActionListener undoActionListener ;
112112
113- boolean isUpdateInProgress ;
114- boolean isInstallInProgress ;
115- boolean isRemoveInProgress ;
113+ boolean updateInProgress ;
114+ boolean installInProgress ;
115+ boolean removeInProgress ;
116+
117+ String description ;
116118
117- StringBuilder description ;
118119
119120 ContributionPanel (ContributionListPanel contributionListPanel ) {
121+ if (foundationIcon == null ) {
122+ foundationIcon = Toolkit .getLibIconX ("icons/foundation" , 32 );
123+ }
124+
120125 listPanel = contributionListPanel ;
121126 barButtonCardPane = new JPanel ();
122127
@@ -362,7 +367,7 @@ private void reorganizePaneComponents() {
362367 add (rightPane , BorderLayout .EAST );
363368
364369
365- if (updateButton .isVisible () && !isRemoveInProgress && !contrib .isDeletionFlagged ()) {
370+ if (updateButton .isVisible () && !removeInProgress && !contrib .isDeletionFlagged ()) {
366371 JPanel updateRemovePanel = new JPanel ();
367372 updateRemovePanel .setLayout (new FlowLayout ());
368373 updateRemovePanel .setOpaque (false );
@@ -377,7 +382,7 @@ private void reorganizePaneComponents() {
377382// barPane.add(installProgressBar);
378383 rightPane .add (barPane );
379384
380- if (isUpdateInProgress )
385+ if (updateInProgress )
381386 ((CardLayout ) barButtonCardPane .getLayout ()).show (barButtonCardPane , PROGRESS_BAR_CONSTRAINT );
382387
383388 }
@@ -397,7 +402,7 @@ private void reorganizePaneComponents() {
397402
398403 barButtonCardPane .add (buttonPane , BUTTON_CONSTRAINT );
399404 barButtonCardPane .add (barPane , PROGRESS_BAR_CONSTRAINT );
400- if (isInstallInProgress || isRemoveInProgress || isUpdateInProgress )
405+ if (installInProgress || removeInProgress || updateInProgress )
401406 ((CardLayout ) barButtonCardPane .getLayout ()).show (barButtonCardPane , PROGRESS_BAR_CONSTRAINT );
402407 else
403408 ((CardLayout ) barButtonCardPane .getLayout ()).show (barButtonCardPane , BUTTON_CONSTRAINT );
@@ -447,8 +452,7 @@ public void setContribution(Contribution contrib) {
447452 this .contrib = contrib ;
448453
449454 if (contrib .isSpecial ()) {
450- JLabel iconLabel =
451- new JLabel (Toolkit .getLibIcon ("icons/foundation-32.png" )); // was 48?
455+ JLabel iconLabel = new JLabel (foundationIcon );
452456 iconLabel .setBorder (new EmptyBorder (4 , 7 , 7 , 7 ));
453457 iconLabel .setVerticalAlignment (SwingConstants .TOP );
454458 add (iconLabel , BorderLayout .WEST );
@@ -458,33 +462,33 @@ public void setContribution(Contribution contrib) {
458462 Font boldFont = Toolkit .getSansFont (12 , Font .BOLD );
459463 String fontFace = "<font face=\" " + boldFont .getName () + "\" >" ;
460464
461- description = new StringBuilder ();
462- description .append ("<html><body>" + fontFace );
465+ StringBuilder desc = new StringBuilder ();
466+ desc .append ("<html><body>" + fontFace );
463467 if (contrib .getUrl () == null ) {
464- description .append (contrib .getName ());
468+ desc .append (contrib .getName ());
465469 } else {
466- description .append ("<a href=\" " + contrib .getUrl () + "\" >" + contrib .getName () + "</a>" );
470+ desc .append ("<a href=\" " + contrib .getUrl () + "\" >" + contrib .getName () + "</a>" );
467471 }
468- description .append ("</font> " );
472+ desc .append ("</font> " );
469473
470474 String version = contrib .getPrettyVersion ();
471475 if (version != null ) {
472- description .append (version );
476+ desc .append (version );
473477 }
474- description .append (" <br/>" );
478+ desc .append (" <br/>" );
475479
476480 String authorList = contrib .getAuthorList ();
477481 if (authorList != null && !authorList .isEmpty ()) {
478- description .append (toHtmlLinks (contrib .getAuthorList ()));
482+ desc .append (toHtmlLinks (contrib .getAuthorList ()));
479483 }
480- description .append ("<br/><br/>" );
484+ desc .append ("<br/><br/>" );
481485
482486 if (contrib .isDeletionFlagged ()) {
483- description .append (REMOVE_RESTART_MESSAGE );
487+ desc .append (REMOVE_RESTART_MESSAGE );
484488 } else if (contrib .isRestartFlagged ()) {
485- description .append (INSTALL_RESTART_MESSAGE );
489+ desc .append (INSTALL_RESTART_MESSAGE );
486490 } else if (contrib .isUpdateFlagged ()) {
487- description .append (UPDATE_RESTART_MESSAGE );
491+ desc .append (UPDATE_RESTART_MESSAGE );
488492 } else {
489493 String sentence = contrib .getSentence ();
490494 if (sentence == null || sentence .isEmpty ()) {
@@ -493,20 +497,21 @@ public void setContribution(Contribution contrib) {
493497 sentence = sanitizeHtmlTags (sentence );
494498 sentence = toHtmlLinks (sentence );
495499 }
496- description .append (sentence );
500+ desc .append (sentence );
497501 }
498502
499503 long lastUpdatedUTC = contrib .getLastUpdated ();
500504 if (lastUpdatedUTC != 0 ) {
501505 DateFormat dateFormatter = DateFormat .getDateInstance (DateFormat .MEDIUM );
502506 Date lastUpdatedDate = new Date (lastUpdatedUTC );
503507 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 ));
506510 }
507511
508- description .append ("</body></html>" );
509- descriptionPane .setText (description .toString ());
512+ desc .append ("</body></html>" );
513+ description = desc .toString ();
514+ descriptionPane .setText (description );
510515
511516 if (contribListing .hasUpdates (contrib )) {
512517 StringBuilder versionText = new StringBuilder ();
@@ -533,7 +538,7 @@ public void setContribution(Contribution contrib) {
533538
534539 updateButton .setEnabled (true );
535540 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 );
537542 }
538543
539544 installRemoveButton .removeActionListener (installActionListener );
@@ -595,9 +600,9 @@ public void cancel() {
595600 installRemoveButton .setEnabled (!contrib .isUpdateFlagged ());
596601
597602 ((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 ;
601606 updateButton .setVisible (contribListing .hasUpdates (contrib ) && !contrib .isUpdateFlagged ());
602607 setSelected (true );
603608 }
@@ -613,9 +618,9 @@ public void finishedAction() {
613618 listPanel .contributionTab .statusPanel .setErrorMessage (Language .text ("contrib.download_error" ));
614619 }
615620 ((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 ;
619624 updateButton .setVisible (contribListing .hasUpdates (contrib ) && !contrib .isUpdateFlagged ());
620625 setSelected (true );
621626 }
@@ -678,10 +683,10 @@ public void setSelected(boolean isSelected) {
678683 enableHyperlinks = alreadySelected ;
679684
680685 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 );
682687 updateButton .setEnabled (!contribListing .hasListDownloadFailed ());
683688 }
684- installRemoveButton .setVisible (isSelected () || installRemoveButton .getText ().equals (Language .text ("contrib.remove" )) || isUpdateInProgress );
689+ installRemoveButton .setVisible (isSelected () || installRemoveButton .getText ().equals (Language .text ("contrib.remove" )) || updateInProgress );
685690 installRemoveButton .setEnabled (installRemoveButton .getText ().equals (Language .text ("contrib.remove" )) ||!contribListing .hasListDownloadFailed ());
686691 reorganizePaneComponents ();
687692
@@ -812,7 +817,7 @@ static void setSelectionStyle(JTextPane textPane, boolean selected) {
812817
813818 public void install () {
814819 listPanel .contributionTab .statusPanel .clear ();
815- isInstallInProgress = true ;
820+ installInProgress = true ;
816821 ((CardLayout ) barButtonCardPane .getLayout ()).show (barButtonCardPane , PROGRESS_BAR_CONSTRAINT );
817822 if (contrib instanceof AvailableContribution ) {
818823 installContribution ((AvailableContribution ) contrib );
@@ -824,7 +829,7 @@ public void install() {
824829 public void update () {
825830
826831 listPanel .contributionTab .statusPanel .clear ();
827- isUpdateInProgress = true ;
832+ updateInProgress = true ;
828833 if (contrib .getType ().requiresRestart ()) {
829834 installRemoveButton .setEnabled (false );
830835 installProgressBar .setVisible (true );
@@ -846,7 +851,7 @@ public void cancel() {
846851 super .cancel ();
847852 resetInstallProgressBarState ();
848853 listPanel .contributionTab .statusPanel .setMessage ("" );
849- isUpdateInProgress = false ;
854+ updateInProgress = false ;
850855 installRemoveButton .setEnabled (true );
851856 if (contrib .isDeletionFlagged ()) {
852857 ((LocalContribution )contrib ).setUpdateFlag (true );
@@ -894,7 +899,7 @@ public void remove() {
894899
895900 listPanel .contributionTab .statusPanel .clear ();
896901 if (contrib .isInstalled () && contrib instanceof LocalContribution ) {
897- isRemoveInProgress = true ;
902+ removeInProgress = true ;
898903 ((CardLayout ) barButtonCardPane .getLayout ()).show (barButtonCardPane , PROGRESS_BAR_CONSTRAINT );
899904 updateButton .setEnabled (false );
900905 installRemoveButton .setEnabled (false );
@@ -905,7 +910,7 @@ public void remove() {
905910 public void finishedAction () {
906911 // Finished uninstalling the library
907912 resetInstallProgressBarState ();
908- isRemoveInProgress = false ;
913+ removeInProgress = false ;
909914 installRemoveButton .setEnabled (true );
910915
911916 reorganizePaneComponents ();
@@ -915,7 +920,7 @@ public void finishedAction() {
915920 public void cancel () {
916921 super .cancel ();
917922 resetInstallProgressBarState ();
918- isRemoveInProgress = false ;
923+ removeInProgress = false ;
919924 installRemoveButton .setEnabled (true );
920925
921926 reorganizePaneComponents ();
0 commit comments