Skip to content

Commit b37aabf

Browse files
committed
more icon cleaning, should be set with the 2x
1 parent 7776d47 commit b37aabf

10 files changed

Lines changed: 63 additions & 58 deletions

File tree

app/src/processing/app/contrib/ContributionPanel.java

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

app/src/processing/app/contrib/ContributionTab.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ public FilterField () {
369369
filterLabel.setOpaque(false);
370370

371371
setFont(Toolkit.getSansFont(14, Font.PLAIN));
372-
//searchIcon = Toolkit.getLibIcon("manager/search.png");
373372
searchIcon = Toolkit.getLibIconX("manager/search");
374373
filterLabel.setIcon(searchIcon);
375374
//searchIcon = new ImageIcon(java.awt.Toolkit.getDefaultToolkit().getImage("NSImage://NSComputerTemplate"));

app/src/processing/app/contrib/StatusPanel.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
class StatusPanel extends JPanel {
4848
static final int BUTTON_WIDTH = 150;
49+
static Icon foundationIcon;
4950

5051
JTextPane label;
5152
JButton installButton;
@@ -60,8 +61,12 @@ class StatusPanel extends JPanel {
6061

6162
private String bodyRule;
6263

64+
6365
public StatusPanel(int width, final ContributionTab contributionTab) {
64-
super();
66+
if (foundationIcon == null) {
67+
foundationIcon = Toolkit.getLibIconX("icons/foundation", 32);
68+
}
69+
6570
setBackground(new Color(0xebebeb));
6671
// setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK));
6772
this.contributionTab = contributionTab;
@@ -216,18 +221,14 @@ void clear() {
216221
public void update(ContributionPanel panel) {
217222
progressBarPanel.removeAll();
218223

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);
225226
((HTMLDocument)label.getDocument()).getStyleSheet().addRule(bodyRule);
226227

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);
231232

232233
String latestVersion =
233234
contributionListing.getLatestVersion(panel.getContrib());
@@ -236,7 +237,7 @@ public void update(ContributionPanel panel) {
236237
installButton.setEnabled(!panel.getContrib().isInstalled()
237238
&& contributionListing.hasDownloadedLatestList()
238239
&& panel.getContrib().isCompatible(Base.getRevision())
239-
&& !panel.isInstallInProgress);
240+
&& !panel.installInProgress);
240241

241242
if (installButton.isEnabled()) {
242243
updateLabel.setText(latestVersion + " available");
@@ -261,11 +262,11 @@ public void update(ContributionPanel panel) {
261262
}
262263

263264
removeButton.setEnabled(panel.getContrib().isInstalled()
264-
&& !panel.isRemoveInProgress);
265+
&& !panel.removeInProgress);
265266
progressBarPanel.add(panel.installProgressBar);
266267
progressBarPanel.setVisible(false);
267268
updateLabel.setVisible(true);
268-
if (panel.isUpdateInProgress || panel.isInstallInProgress || panel.isRemoveInProgress) {
269+
if (panel.updateInProgress || panel.installInProgress || panel.removeInProgress) {
269270
progressBarPanel.setVisible(true);
270271
updateLabel.setVisible(false);
271272
progressBarPanel.repaint();
-514 Bytes
Binary file not shown.
-238 Bytes
Binary file not shown.
-386 Bytes
Binary file not shown.
-226 Bytes
Binary file not shown.
-981 Bytes
Binary file not shown.
-561 Bytes
Binary file not shown.
-633 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)