From d7a15d6458454838d085330774f2e0ee7cdb5eeb Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Sat, 15 Aug 2015 22:33:39 +0530 Subject: [PATCH 1/6] Possible sets the font correctly --- .../app/contrib/ContributionListPanel.java | 6 +-- .../contrib/ContributionManagerDialog.java | 4 ++ .../processing/app/contrib/StatusPanel.java | 43 +++++++++---------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java index 865e11bd6..4bacd04fc 100644 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ b/app/src/processing/app/contrib/ContributionListPanel.java @@ -59,7 +59,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib protected ContributionListing contribListing = ContributionListing.getInstance(); protected JTable table; DefaultTableModel dtm; - Font myFont; public ContributionListPanel() { // TODO Auto-generated constructor stub @@ -97,9 +96,6 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib return c; } }; - - myFont = Toolkit.getSansFont(14, Font.PLAIN); - GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(myFont); // There is a space before Status String[] colName = { " Status", "Name", "Author" }; @@ -308,7 +304,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib if (table.isRowSelected(row)) { label.setBackground(new Color(0xe0fffd)); } - label.setFont(myFont); + label.setFont(ContributionManagerDialog.myFont); label.setOpaque(true); } else { label = new JLabel( diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index edc022378..0f642b3e4 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -74,8 +74,12 @@ public class ContributionManagerDialog { private JLabel updateTabLabel; + static Font myFont; + public ContributionManagerDialog() { + myFont = Toolkit.getSansFont(14, Font.PLAIN); + GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(myFont); numberLabel = new JLabel(Toolkit.getLibIcon("manager/notification.png"), SwingConstants.CENTER); toolsContributionTab = new ContributionTab(ContributionType.TOOL, this); librariesContributionTab = new ContributionTab(ContributionType.LIBRARY, this); diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index f093957a9..083e8b3bd 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + */ package processing.app.contrib; import java.awt.BorderLayout; @@ -43,7 +43,6 @@ import processing.app.ui.Toolkit; import processing.app.Base; import processing.app.Platform; - class StatusPanel extends JPanel { static final int BUTTON_WIDTH = 150; @@ -55,7 +54,6 @@ class StatusPanel extends JPanel { JButton removeButton; GroupLayout layout; JLabel iconLabel; - ContributionListing contributionListing = ContributionListing.getInstance(); ContributionTab contributionTab; @@ -63,7 +61,7 @@ class StatusPanel extends JPanel { super(); setBackground(new Color(0xebebeb)); // setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); - this.contributionTab = contributionTab; + this.contributionTab = contributionTab; iconLabel = new JLabel(); @@ -71,7 +69,7 @@ class StatusPanel extends JPanel { label.setEditable(false); label.setOpaque(false); label.setContentType("text/html"); - label.setFont(Toolkit.getSansFont(14, Font.PLAIN)); + label.setFont(ContributionManagerDialog.myFont); label.addHyperlinkListener(new HyperlinkListener() { @Override @@ -83,7 +81,8 @@ class StatusPanel extends JPanel { } } }); - installButton = new JButton("Install", Toolkit.getLibIcon("manager/install.png")); + installButton = new JButton("Install", + Toolkit.getLibIcon("manager/install.png")); installButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); installButton.setHorizontalAlignment(SwingConstants.LEFT); // installButton.setContentAreaFilled(false); @@ -103,7 +102,8 @@ class StatusPanel extends JPanel { progressBarPanel.setOpaque(false); updateLabel = new JLabel(" "); updateLabel.setFont(Toolkit.getSansFont(14, Font.PLAIN)); - updateButton = new JButton("Update", Toolkit.getLibIcon("manager/update.png")); + updateButton = new JButton("Update", + Toolkit.getLibIcon("manager/update.png")); updateButton.setFont(Toolkit.getSansFont(14, Font.PLAIN)); updateButton.setHorizontalAlignment(SwingConstants.LEFT); // updateButton.setAlignmentX(SwingConstants.LEFT); @@ -120,7 +120,8 @@ class StatusPanel extends JPanel { } }); - removeButton = new JButton("Remove", Toolkit.getLibIcon("manager/remove.png")); + removeButton = new JButton("Remove", + Toolkit.getLibIcon("manager/remove.png")); removeButton.setFont(Toolkit.getSansFont(14, Font.BOLD)); removeButton.setHorizontalAlignment(SwingConstants.LEFT); // removeButton.setContentAreaFilled(false); @@ -169,8 +170,8 @@ class StatusPanel extends JPanel { .addComponent(updateLabel)) .addComponent(updateButton).addComponent(removeButton))); - layout - .linkSize(SwingConstants.HORIZONTAL, installButton, progressBarPanel, updateButton, removeButton); + layout.linkSize(SwingConstants.HORIZONTAL, installButton, progressBarPanel, + updateButton, removeButton); progressBarPanel.setVisible(false); updateLabel.setVisible(false); @@ -226,24 +227,25 @@ class StatusPanel extends JPanel { && (contributionListing.hasUpdates(panel.getContrib()) && !panel .getContrib().isUpdateFlagged())); - String latestVersion = contributionListing.getLatestVersion(panel.getContrib()); + String latestVersion = contributionListing.getLatestVersion(panel + .getContrib()); String currentVersion = panel.getContrib().getPrettyVersion(); - if(latestVersion != null){ + if (latestVersion != null) { latestVersion = "Update to " + latestVersion; - }else{ + } else { latestVersion = "Update"; } - if(currentVersion != null){ + if (currentVersion != null) { currentVersion = "Version " + currentVersion; - }else{ + } else { currentVersion = ""; } - if(updateButton.isEnabled()){ + if (updateButton.isEnabled()) { updateButton.setText(latestVersion); - }else{ + } else { updateButton.setText("Update"); } @@ -251,9 +253,9 @@ class StatusPanel extends JPanel { && contributionListing.hasDownloadedLatestList() && panel.getContrib().isCompatible(Base.getRevision())); - if(installButton.isEnabled()){ + if (installButton.isEnabled()) { updateLabel.setText(currentVersion + " available"); - }else{ + } else { updateLabel.setText(currentVersion + " installed"); } @@ -266,14 +268,11 @@ class StatusPanel extends JPanel { } } } - - /* interface ErrorWidget { void setErrorMessage(String msg); } - class StatusPanel extends JPanel implements ErrorWidget { String errorMessage; From d1f0fa648175b2eef175bce3f4b31e0f75da097d Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Sun, 16 Aug 2015 12:39:14 +0530 Subject: [PATCH 2/6] Temp frix for column width changing --- .../processing/app/contrib/Contribution.java | 21 +++++++++++++++- .../app/contrib/ContributionListPanel.java | 25 +++++++++++-------- .../app/contrib/ContributionListing.java | 13 +--------- .../app/contrib/ContributionPanel.java | 15 +++-------- .../app/contrib/ContributionTab.java | 4 +-- .../processing/app/contrib/StatusPanel.java | 11 +++++--- 6 files changed, 47 insertions(+), 42 deletions(-) diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index ddd2cf537..f251d95f0 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -158,7 +158,7 @@ abstract public class Contribution { } - // "1.0.2" + // "1.0.2" or a long string like "Build 0124 12:12:12 random" public String getPrettyVersion() { return prettyVersion; } @@ -321,4 +321,23 @@ abstract public class Contribution { String cleaned = cat.replaceAll("[\\W]+", "_").toLowerCase(); return Language.text("contrib.category." + cleaned); } + + String getPrettyVersionShort() { + + String latestVersion = this.getPrettyVersion(); + if (latestVersion != null && !latestVersion.isEmpty()) { + if (latestVersion.endsWith("alpla")) { + return latestVersion.replaceAll("alpla", "a"); + } else if (latestVersion.toLowerCase().startsWith("build")) { // For Python mode + return (latestVersion.substring(5, latestVersion.indexOf(',')).trim()); + } else if (latestVersion.toLowerCase().startsWith("v")) { // For ketai library + return latestVersion.substring(1, latestVersion.length()); + } else if (latestVersion.indexOf(' ') != -1) { + return latestVersion.substring(0, latestVersion.indexOf(' ')); + } else { + return latestVersion; + } + } else + return null; + } } diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java index 4bacd04fc..22c7c78d7 100644 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ b/app/src/processing/app/contrib/ContributionListPanel.java @@ -32,6 +32,8 @@ import javax.swing.border.Border; import javax.swing.event.*; import javax.swing.table.*; +import com.sun.xml.internal.bind.v2.runtime.reflect.Lister.Pack; + import processing.app.Base; import processing.app.Platform; import processing.app.ui.Toolkit; @@ -42,7 +44,7 @@ import processing.app.ui.Toolkit; // necessary in the first place, however; seems like odd behavior. // It also allows the description text in the panels to wrap properly. -public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener { +public class ContributionListPanel extends JPanel implements ContributionChangeListener { ContributionTab contributionTab; TreeMap panelByContribution; @@ -68,6 +70,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib super(); this.contributionTab = contributionTab; this.filter = filter; + // contribListing = ContributionListing.getInstance(); @@ -408,7 +411,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib newPanel.setContribution(contribution); add(newPanel); updatePanelOrdering(panelByContribution.keySet()); - updateColors(); // XXX this is the place +// updateColors(); // XXX this is the place } } } @@ -428,7 +431,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } } updatePanelOrdering(panelByContribution.keySet()); - updateColors(); +// updateColors(); updateUI(); } }); @@ -501,7 +504,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } contributionPanel.setSelected(true); - updateColors(); +// updateColors(); requestFocusInWindow(); } } @@ -512,9 +515,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } - /** + /* *//** * Updates the colors of all library panels that are visible. - */ + *//* protected void updateColors() { int count = 0; synchronized (panelByContribution) { @@ -562,9 +565,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } - /** + *//** * Amount to scroll to reveal a new page of items - */ + *//* public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int blockAmount = visibleRect.height; @@ -581,9 +584,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } - /** + *//** * Amount to scroll to reveal the rest of something we are on or a new item - */ + *//* public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int lastHeight = 0, height = 0; @@ -630,7 +633,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib public boolean getScrollableTracksViewportWidth() { return true; } - +*/ public int getNoOfRows() { return panelByContribution.size(); diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index f47c68d83..043da8361 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -519,18 +519,7 @@ public class ContributionListing { if(newestContrib == null){ return null; } - String latestVersion = newestContrib.getPrettyVersion(); - if (latestVersion != null && !latestVersion.isEmpty()) { - if (latestVersion.toLowerCase().startsWith("build")) // For Python mode - return ("v" + latestVersion.substring(5, latestVersion.indexOf(',')) - .trim()); - else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library - return latestVersion; - else - return ("v" + latestVersion); - } - else - return null; + return newestContrib.getPrettyVersionShort(); } diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index c6730b2c6..d4346d934 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -111,8 +111,8 @@ class ContributionPanel extends JPanel { private ActionListener undoActionListener; boolean isUpdateInProgress; - private boolean isInstallInProgress; - private boolean isRemoveInProgress; + boolean isInstallInProgress; + boolean isRemoveInProgress; StringBuilder description; @@ -465,16 +465,7 @@ class ContributionPanel extends JPanel { String version = contrib.getPrettyVersion(); - // TODO this has no place here, we shouldn't be cleaning up contrib - // information in the f*king GUI. - if (version != null && !version.isEmpty()) { - if (version.toLowerCase().startsWith("build")) // For Python mode - description.append(version.substring(5, version.indexOf(',')).trim()); - else if (version.toLowerCase().startsWith("v")) // For ketai library - description.append(version); - else - description.append(version); - } + description.append(contrib.getPrettyVersionShort()); description.append("
"); String authorList = contrib.getAuthorList(); diff --git a/app/src/processing/app/contrib/ContributionTab.java b/app/src/processing/app/contrib/ContributionTab.java index d4623b02b..92d674ba2 100644 --- a/app/src/processing/app/contrib/ContributionTab.java +++ b/app/src/processing/app/contrib/ContributionTab.java @@ -253,7 +253,7 @@ public class ContributionTab { category = null; } filterLibraries(category, filterField.filters); - contributionListPanel.updateColors(); +// contributionListPanel.updateColors(); } }); @@ -485,7 +485,7 @@ public class ContributionTab { filters = Arrays.asList(filter.split(" ")); filterLibraries(category, filters); - contributionListPanel.updateColors(); +// contributionListPanel.updateColors(); } } diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index 083e8b3bd..22df2bfef 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -174,7 +174,7 @@ class StatusPanel extends JPanel { updateButton, removeButton); progressBarPanel.setVisible(false); - updateLabel.setVisible(false); + updateLabel.setVisible(true); installButton.setEnabled(false); updateButton.setEnabled(false); @@ -229,7 +229,7 @@ class StatusPanel extends JPanel { String latestVersion = contributionListing.getLatestVersion(panel .getContrib()); - String currentVersion = panel.getContrib().getPrettyVersion(); + String currentVersion = panel.getContrib().getPrettyVersionShort(); if (latestVersion != null) { latestVersion = "Update to " + latestVersion; @@ -238,7 +238,7 @@ class StatusPanel extends JPanel { } if (currentVersion != null) { - currentVersion = "Version " + currentVersion; + currentVersion = "v" + currentVersion; } else { currentVersion = ""; } @@ -261,7 +261,10 @@ class StatusPanel extends JPanel { removeButton.setEnabled(panel.getContrib().isInstalled()); progressBarPanel.add(panel.installProgressBar); - if (panel.installProgressBar.isEnabled()) { + updateLabel.setVisible(true); + progressBarPanel.setVisible(false); + if (panel.isUpdateInProgress || panel.isInstallInProgress || panel.isRemoveInProgress) { + System.out.println("wrong"); progressBarPanel.setVisible(true); updateLabel.setVisible(false); progressBarPanel.repaint(); From 8fe4554ce98a1a5729be0a1b20d7be395673ce55 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Sun, 16 Aug 2015 12:43:48 +0530 Subject: [PATCH 3/6] Revert "Temp frix for column width changing" This reverts commit d1f0fa648175b2eef175bce3f4b31e0f75da097d. --- .../processing/app/contrib/Contribution.java | 21 +--------------- .../app/contrib/ContributionListPanel.java | 25 ++++++++----------- .../app/contrib/ContributionListing.java | 13 +++++++++- .../app/contrib/ContributionPanel.java | 15 ++++++++--- .../app/contrib/ContributionTab.java | 4 +-- .../processing/app/contrib/StatusPanel.java | 11 +++----- 6 files changed, 42 insertions(+), 47 deletions(-) diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index f251d95f0..ddd2cf537 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -158,7 +158,7 @@ abstract public class Contribution { } - // "1.0.2" or a long string like "Build 0124 12:12:12 random" + // "1.0.2" public String getPrettyVersion() { return prettyVersion; } @@ -321,23 +321,4 @@ abstract public class Contribution { String cleaned = cat.replaceAll("[\\W]+", "_").toLowerCase(); return Language.text("contrib.category." + cleaned); } - - String getPrettyVersionShort() { - - String latestVersion = this.getPrettyVersion(); - if (latestVersion != null && !latestVersion.isEmpty()) { - if (latestVersion.endsWith("alpla")) { - return latestVersion.replaceAll("alpla", "a"); - } else if (latestVersion.toLowerCase().startsWith("build")) { // For Python mode - return (latestVersion.substring(5, latestVersion.indexOf(',')).trim()); - } else if (latestVersion.toLowerCase().startsWith("v")) { // For ketai library - return latestVersion.substring(1, latestVersion.length()); - } else if (latestVersion.indexOf(' ') != -1) { - return latestVersion.substring(0, latestVersion.indexOf(' ')); - } else { - return latestVersion; - } - } else - return null; - } } diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java index 22c7c78d7..4bacd04fc 100644 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ b/app/src/processing/app/contrib/ContributionListPanel.java @@ -32,8 +32,6 @@ import javax.swing.border.Border; import javax.swing.event.*; import javax.swing.table.*; -import com.sun.xml.internal.bind.v2.runtime.reflect.Lister.Pack; - import processing.app.Base; import processing.app.Platform; import processing.app.ui.Toolkit; @@ -44,7 +42,7 @@ import processing.app.ui.Toolkit; // necessary in the first place, however; seems like odd behavior. // It also allows the description text in the panels to wrap properly. -public class ContributionListPanel extends JPanel implements ContributionChangeListener { +public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener { ContributionTab contributionTab; TreeMap panelByContribution; @@ -70,7 +68,6 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL super(); this.contributionTab = contributionTab; this.filter = filter; - // contribListing = ContributionListing.getInstance(); @@ -411,7 +408,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL newPanel.setContribution(contribution); add(newPanel); updatePanelOrdering(panelByContribution.keySet()); -// updateColors(); // XXX this is the place + updateColors(); // XXX this is the place } } } @@ -431,7 +428,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } } updatePanelOrdering(panelByContribution.keySet()); -// updateColors(); + updateColors(); updateUI(); } }); @@ -504,7 +501,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } contributionPanel.setSelected(true); -// updateColors(); + updateColors(); requestFocusInWindow(); } } @@ -515,9 +512,9 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } - /* *//** + /** * Updates the colors of all library panels that are visible. - *//* + */ protected void updateColors() { int count = 0; synchronized (panelByContribution) { @@ -565,9 +562,9 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } - *//** + /** * Amount to scroll to reveal a new page of items - *//* + */ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int blockAmount = visibleRect.height; @@ -584,9 +581,9 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } - *//** + /** * Amount to scroll to reveal the rest of something we are on or a new item - *//* + */ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int lastHeight = 0, height = 0; @@ -633,7 +630,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL public boolean getScrollableTracksViewportWidth() { return true; } -*/ + public int getNoOfRows() { return panelByContribution.size(); diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index 043da8361..f47c68d83 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -519,7 +519,18 @@ public class ContributionListing { if(newestContrib == null){ return null; } - return newestContrib.getPrettyVersionShort(); + String latestVersion = newestContrib.getPrettyVersion(); + if (latestVersion != null && !latestVersion.isEmpty()) { + if (latestVersion.toLowerCase().startsWith("build")) // For Python mode + return ("v" + latestVersion.substring(5, latestVersion.indexOf(',')) + .trim()); + else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library + return latestVersion; + else + return ("v" + latestVersion); + } + else + return null; } diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index d4346d934..c6730b2c6 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -111,8 +111,8 @@ class ContributionPanel extends JPanel { private ActionListener undoActionListener; boolean isUpdateInProgress; - boolean isInstallInProgress; - boolean isRemoveInProgress; + private boolean isInstallInProgress; + private boolean isRemoveInProgress; StringBuilder description; @@ -465,7 +465,16 @@ class ContributionPanel extends JPanel { String version = contrib.getPrettyVersion(); - description.append(contrib.getPrettyVersionShort()); + // TODO this has no place here, we shouldn't be cleaning up contrib + // information in the f*king GUI. + if (version != null && !version.isEmpty()) { + if (version.toLowerCase().startsWith("build")) // For Python mode + description.append(version.substring(5, version.indexOf(',')).trim()); + else if (version.toLowerCase().startsWith("v")) // For ketai library + description.append(version); + else + description.append(version); + } description.append("
"); String authorList = contrib.getAuthorList(); diff --git a/app/src/processing/app/contrib/ContributionTab.java b/app/src/processing/app/contrib/ContributionTab.java index 92d674ba2..d4623b02b 100644 --- a/app/src/processing/app/contrib/ContributionTab.java +++ b/app/src/processing/app/contrib/ContributionTab.java @@ -253,7 +253,7 @@ public class ContributionTab { category = null; } filterLibraries(category, filterField.filters); -// contributionListPanel.updateColors(); + contributionListPanel.updateColors(); } }); @@ -485,7 +485,7 @@ public class ContributionTab { filters = Arrays.asList(filter.split(" ")); filterLibraries(category, filters); -// contributionListPanel.updateColors(); + contributionListPanel.updateColors(); } } diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index 22df2bfef..083e8b3bd 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -174,7 +174,7 @@ class StatusPanel extends JPanel { updateButton, removeButton); progressBarPanel.setVisible(false); - updateLabel.setVisible(true); + updateLabel.setVisible(false); installButton.setEnabled(false); updateButton.setEnabled(false); @@ -229,7 +229,7 @@ class StatusPanel extends JPanel { String latestVersion = contributionListing.getLatestVersion(panel .getContrib()); - String currentVersion = panel.getContrib().getPrettyVersionShort(); + String currentVersion = panel.getContrib().getPrettyVersion(); if (latestVersion != null) { latestVersion = "Update to " + latestVersion; @@ -238,7 +238,7 @@ class StatusPanel extends JPanel { } if (currentVersion != null) { - currentVersion = "v" + currentVersion; + currentVersion = "Version " + currentVersion; } else { currentVersion = ""; } @@ -261,10 +261,7 @@ class StatusPanel extends JPanel { removeButton.setEnabled(panel.getContrib().isInstalled()); progressBarPanel.add(panel.installProgressBar); - updateLabel.setVisible(true); - progressBarPanel.setVisible(false); - if (panel.isUpdateInProgress || panel.isInstallInProgress || panel.isRemoveInProgress) { - System.out.println("wrong"); + if (panel.installProgressBar.isEnabled()) { progressBarPanel.setVisible(true); updateLabel.setVisible(false); progressBarPanel.repaint(); From f8e1451aa6f22825c3a7d1ab9ad66a09a8a7dbe0 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Sun, 16 Aug 2015 12:45:23 +0530 Subject: [PATCH 4/6] Revert "Revert "Temp frix for column width changing"" This reverts commit 8fe4554ce98a1a5729be0a1b20d7be395673ce55. --- .../processing/app/contrib/Contribution.java | 21 +++++++++++++++- .../app/contrib/ContributionListPanel.java | 25 +++++++++++-------- .../app/contrib/ContributionListing.java | 13 +--------- .../app/contrib/ContributionPanel.java | 15 +++-------- .../app/contrib/ContributionTab.java | 4 +-- .../processing/app/contrib/StatusPanel.java | 11 +++++--- 6 files changed, 47 insertions(+), 42 deletions(-) diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index ddd2cf537..f251d95f0 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -158,7 +158,7 @@ abstract public class Contribution { } - // "1.0.2" + // "1.0.2" or a long string like "Build 0124 12:12:12 random" public String getPrettyVersion() { return prettyVersion; } @@ -321,4 +321,23 @@ abstract public class Contribution { String cleaned = cat.replaceAll("[\\W]+", "_").toLowerCase(); return Language.text("contrib.category." + cleaned); } + + String getPrettyVersionShort() { + + String latestVersion = this.getPrettyVersion(); + if (latestVersion != null && !latestVersion.isEmpty()) { + if (latestVersion.endsWith("alpla")) { + return latestVersion.replaceAll("alpla", "a"); + } else if (latestVersion.toLowerCase().startsWith("build")) { // For Python mode + return (latestVersion.substring(5, latestVersion.indexOf(',')).trim()); + } else if (latestVersion.toLowerCase().startsWith("v")) { // For ketai library + return latestVersion.substring(1, latestVersion.length()); + } else if (latestVersion.indexOf(' ') != -1) { + return latestVersion.substring(0, latestVersion.indexOf(' ')); + } else { + return latestVersion; + } + } else + return null; + } } diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java index 4bacd04fc..22c7c78d7 100644 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ b/app/src/processing/app/contrib/ContributionListPanel.java @@ -32,6 +32,8 @@ import javax.swing.border.Border; import javax.swing.event.*; import javax.swing.table.*; +import com.sun.xml.internal.bind.v2.runtime.reflect.Lister.Pack; + import processing.app.Base; import processing.app.Platform; import processing.app.ui.Toolkit; @@ -42,7 +44,7 @@ import processing.app.ui.Toolkit; // necessary in the first place, however; seems like odd behavior. // It also allows the description text in the panels to wrap properly. -public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener { +public class ContributionListPanel extends JPanel implements ContributionChangeListener { ContributionTab contributionTab; TreeMap panelByContribution; @@ -68,6 +70,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib super(); this.contributionTab = contributionTab; this.filter = filter; + // contribListing = ContributionListing.getInstance(); @@ -408,7 +411,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib newPanel.setContribution(contribution); add(newPanel); updatePanelOrdering(panelByContribution.keySet()); - updateColors(); // XXX this is the place +// updateColors(); // XXX this is the place } } } @@ -428,7 +431,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } } updatePanelOrdering(panelByContribution.keySet()); - updateColors(); +// updateColors(); updateUI(); } }); @@ -501,7 +504,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } contributionPanel.setSelected(true); - updateColors(); +// updateColors(); requestFocusInWindow(); } } @@ -512,9 +515,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } - /** + /* *//** * Updates the colors of all library panels that are visible. - */ + *//* protected void updateColors() { int count = 0; synchronized (panelByContribution) { @@ -562,9 +565,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } - /** + *//** * Amount to scroll to reveal a new page of items - */ + *//* public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int blockAmount = visibleRect.height; @@ -581,9 +584,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib } - /** + *//** * Amount to scroll to reveal the rest of something we are on or a new item - */ + *//* public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int lastHeight = 0, height = 0; @@ -630,7 +633,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib public boolean getScrollableTracksViewportWidth() { return true; } - +*/ public int getNoOfRows() { return panelByContribution.size(); diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index f47c68d83..043da8361 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -519,18 +519,7 @@ public class ContributionListing { if(newestContrib == null){ return null; } - String latestVersion = newestContrib.getPrettyVersion(); - if (latestVersion != null && !latestVersion.isEmpty()) { - if (latestVersion.toLowerCase().startsWith("build")) // For Python mode - return ("v" + latestVersion.substring(5, latestVersion.indexOf(',')) - .trim()); - else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library - return latestVersion; - else - return ("v" + latestVersion); - } - else - return null; + return newestContrib.getPrettyVersionShort(); } diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index c6730b2c6..d4346d934 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -111,8 +111,8 @@ class ContributionPanel extends JPanel { private ActionListener undoActionListener; boolean isUpdateInProgress; - private boolean isInstallInProgress; - private boolean isRemoveInProgress; + boolean isInstallInProgress; + boolean isRemoveInProgress; StringBuilder description; @@ -465,16 +465,7 @@ class ContributionPanel extends JPanel { String version = contrib.getPrettyVersion(); - // TODO this has no place here, we shouldn't be cleaning up contrib - // information in the f*king GUI. - if (version != null && !version.isEmpty()) { - if (version.toLowerCase().startsWith("build")) // For Python mode - description.append(version.substring(5, version.indexOf(',')).trim()); - else if (version.toLowerCase().startsWith("v")) // For ketai library - description.append(version); - else - description.append(version); - } + description.append(contrib.getPrettyVersionShort()); description.append("
"); String authorList = contrib.getAuthorList(); diff --git a/app/src/processing/app/contrib/ContributionTab.java b/app/src/processing/app/contrib/ContributionTab.java index d4623b02b..92d674ba2 100644 --- a/app/src/processing/app/contrib/ContributionTab.java +++ b/app/src/processing/app/contrib/ContributionTab.java @@ -253,7 +253,7 @@ public class ContributionTab { category = null; } filterLibraries(category, filterField.filters); - contributionListPanel.updateColors(); +// contributionListPanel.updateColors(); } }); @@ -485,7 +485,7 @@ public class ContributionTab { filters = Arrays.asList(filter.split(" ")); filterLibraries(category, filters); - contributionListPanel.updateColors(); +// contributionListPanel.updateColors(); } } diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index 083e8b3bd..22df2bfef 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -174,7 +174,7 @@ class StatusPanel extends JPanel { updateButton, removeButton); progressBarPanel.setVisible(false); - updateLabel.setVisible(false); + updateLabel.setVisible(true); installButton.setEnabled(false); updateButton.setEnabled(false); @@ -229,7 +229,7 @@ class StatusPanel extends JPanel { String latestVersion = contributionListing.getLatestVersion(panel .getContrib()); - String currentVersion = panel.getContrib().getPrettyVersion(); + String currentVersion = panel.getContrib().getPrettyVersionShort(); if (latestVersion != null) { latestVersion = "Update to " + latestVersion; @@ -238,7 +238,7 @@ class StatusPanel extends JPanel { } if (currentVersion != null) { - currentVersion = "Version " + currentVersion; + currentVersion = "v" + currentVersion; } else { currentVersion = ""; } @@ -261,7 +261,10 @@ class StatusPanel extends JPanel { removeButton.setEnabled(panel.getContrib().isInstalled()); progressBarPanel.add(panel.installProgressBar); - if (panel.installProgressBar.isEnabled()) { + updateLabel.setVisible(true); + progressBarPanel.setVisible(false); + if (panel.isUpdateInProgress || panel.isInstallInProgress || panel.isRemoveInProgress) { + System.out.println("wrong"); progressBarPanel.setVisible(true); updateLabel.setVisible(false); progressBarPanel.repaint(); From 0f7ed150833ac99db4d11381e1b026c6020e5bfc Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Sun, 16 Aug 2015 12:46:13 +0530 Subject: [PATCH 5/6] Revert "Revert "Revert "Temp frix for column width changing""" This reverts commit f8e1451aa6f22825c3a7d1ab9ad66a09a8a7dbe0. --- .../processing/app/contrib/Contribution.java | 21 +--------------- .../app/contrib/ContributionListPanel.java | 25 ++++++++----------- .../app/contrib/ContributionListing.java | 13 +++++++++- .../app/contrib/ContributionPanel.java | 15 ++++++++--- .../app/contrib/ContributionTab.java | 4 +-- .../processing/app/contrib/StatusPanel.java | 11 +++----- 6 files changed, 42 insertions(+), 47 deletions(-) diff --git a/app/src/processing/app/contrib/Contribution.java b/app/src/processing/app/contrib/Contribution.java index f251d95f0..ddd2cf537 100644 --- a/app/src/processing/app/contrib/Contribution.java +++ b/app/src/processing/app/contrib/Contribution.java @@ -158,7 +158,7 @@ abstract public class Contribution { } - // "1.0.2" or a long string like "Build 0124 12:12:12 random" + // "1.0.2" public String getPrettyVersion() { return prettyVersion; } @@ -321,23 +321,4 @@ abstract public class Contribution { String cleaned = cat.replaceAll("[\\W]+", "_").toLowerCase(); return Language.text("contrib.category." + cleaned); } - - String getPrettyVersionShort() { - - String latestVersion = this.getPrettyVersion(); - if (latestVersion != null && !latestVersion.isEmpty()) { - if (latestVersion.endsWith("alpla")) { - return latestVersion.replaceAll("alpla", "a"); - } else if (latestVersion.toLowerCase().startsWith("build")) { // For Python mode - return (latestVersion.substring(5, latestVersion.indexOf(',')).trim()); - } else if (latestVersion.toLowerCase().startsWith("v")) { // For ketai library - return latestVersion.substring(1, latestVersion.length()); - } else if (latestVersion.indexOf(' ') != -1) { - return latestVersion.substring(0, latestVersion.indexOf(' ')); - } else { - return latestVersion; - } - } else - return null; - } } diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java index 22c7c78d7..4bacd04fc 100644 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ b/app/src/processing/app/contrib/ContributionListPanel.java @@ -32,8 +32,6 @@ import javax.swing.border.Border; import javax.swing.event.*; import javax.swing.table.*; -import com.sun.xml.internal.bind.v2.runtime.reflect.Lister.Pack; - import processing.app.Base; import processing.app.Platform; import processing.app.ui.Toolkit; @@ -44,7 +42,7 @@ import processing.app.ui.Toolkit; // necessary in the first place, however; seems like odd behavior. // It also allows the description text in the panels to wrap properly. -public class ContributionListPanel extends JPanel implements ContributionChangeListener { +public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener { ContributionTab contributionTab; TreeMap panelByContribution; @@ -70,7 +68,6 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL super(); this.contributionTab = contributionTab; this.filter = filter; - // contribListing = ContributionListing.getInstance(); @@ -411,7 +408,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL newPanel.setContribution(contribution); add(newPanel); updatePanelOrdering(panelByContribution.keySet()); -// updateColors(); // XXX this is the place + updateColors(); // XXX this is the place } } } @@ -431,7 +428,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } } updatePanelOrdering(panelByContribution.keySet()); -// updateColors(); + updateColors(); updateUI(); } }); @@ -504,7 +501,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } contributionPanel.setSelected(true); -// updateColors(); + updateColors(); requestFocusInWindow(); } } @@ -515,9 +512,9 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } - /* *//** + /** * Updates the colors of all library panels that are visible. - *//* + */ protected void updateColors() { int count = 0; synchronized (panelByContribution) { @@ -565,9 +562,9 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } - *//** + /** * Amount to scroll to reveal a new page of items - *//* + */ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int blockAmount = visibleRect.height; @@ -584,9 +581,9 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL } - *//** + /** * Amount to scroll to reveal the rest of something we are on or a new item - *//* + */ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.VERTICAL) { int lastHeight = 0, height = 0; @@ -633,7 +630,7 @@ public class ContributionListPanel extends JPanel implements ContributionChangeL public boolean getScrollableTracksViewportWidth() { return true; } -*/ + public int getNoOfRows() { return panelByContribution.size(); diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java index 043da8361..f47c68d83 100644 --- a/app/src/processing/app/contrib/ContributionListing.java +++ b/app/src/processing/app/contrib/ContributionListing.java @@ -519,7 +519,18 @@ public class ContributionListing { if(newestContrib == null){ return null; } - return newestContrib.getPrettyVersionShort(); + String latestVersion = newestContrib.getPrettyVersion(); + if (latestVersion != null && !latestVersion.isEmpty()) { + if (latestVersion.toLowerCase().startsWith("build")) // For Python mode + return ("v" + latestVersion.substring(5, latestVersion.indexOf(',')) + .trim()); + else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library + return latestVersion; + else + return ("v" + latestVersion); + } + else + return null; } diff --git a/app/src/processing/app/contrib/ContributionPanel.java b/app/src/processing/app/contrib/ContributionPanel.java index d4346d934..c6730b2c6 100644 --- a/app/src/processing/app/contrib/ContributionPanel.java +++ b/app/src/processing/app/contrib/ContributionPanel.java @@ -111,8 +111,8 @@ class ContributionPanel extends JPanel { private ActionListener undoActionListener; boolean isUpdateInProgress; - boolean isInstallInProgress; - boolean isRemoveInProgress; + private boolean isInstallInProgress; + private boolean isRemoveInProgress; StringBuilder description; @@ -465,7 +465,16 @@ class ContributionPanel extends JPanel { String version = contrib.getPrettyVersion(); - description.append(contrib.getPrettyVersionShort()); + // TODO this has no place here, we shouldn't be cleaning up contrib + // information in the f*king GUI. + if (version != null && !version.isEmpty()) { + if (version.toLowerCase().startsWith("build")) // For Python mode + description.append(version.substring(5, version.indexOf(',')).trim()); + else if (version.toLowerCase().startsWith("v")) // For ketai library + description.append(version); + else + description.append(version); + } description.append("
"); String authorList = contrib.getAuthorList(); diff --git a/app/src/processing/app/contrib/ContributionTab.java b/app/src/processing/app/contrib/ContributionTab.java index 92d674ba2..d4623b02b 100644 --- a/app/src/processing/app/contrib/ContributionTab.java +++ b/app/src/processing/app/contrib/ContributionTab.java @@ -253,7 +253,7 @@ public class ContributionTab { category = null; } filterLibraries(category, filterField.filters); -// contributionListPanel.updateColors(); + contributionListPanel.updateColors(); } }); @@ -485,7 +485,7 @@ public class ContributionTab { filters = Arrays.asList(filter.split(" ")); filterLibraries(category, filters); -// contributionListPanel.updateColors(); + contributionListPanel.updateColors(); } } diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index 22df2bfef..083e8b3bd 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -174,7 +174,7 @@ class StatusPanel extends JPanel { updateButton, removeButton); progressBarPanel.setVisible(false); - updateLabel.setVisible(true); + updateLabel.setVisible(false); installButton.setEnabled(false); updateButton.setEnabled(false); @@ -229,7 +229,7 @@ class StatusPanel extends JPanel { String latestVersion = contributionListing.getLatestVersion(panel .getContrib()); - String currentVersion = panel.getContrib().getPrettyVersionShort(); + String currentVersion = panel.getContrib().getPrettyVersion(); if (latestVersion != null) { latestVersion = "Update to " + latestVersion; @@ -238,7 +238,7 @@ class StatusPanel extends JPanel { } if (currentVersion != null) { - currentVersion = "v" + currentVersion; + currentVersion = "Version " + currentVersion; } else { currentVersion = ""; } @@ -261,10 +261,7 @@ class StatusPanel extends JPanel { removeButton.setEnabled(panel.getContrib().isInstalled()); progressBarPanel.add(panel.installProgressBar); - updateLabel.setVisible(true); - progressBarPanel.setVisible(false); - if (panel.isUpdateInProgress || panel.isInstallInProgress || panel.isRemoveInProgress) { - System.out.println("wrong"); + if (panel.installProgressBar.isEnabled()) { progressBarPanel.setVisible(true); updateLabel.setVisible(false); progressBarPanel.repaint(); From 6e3fa644d797b9fbfaa5f8f9559d0169aa654e32 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Sun, 16 Aug 2015 20:02:36 +0530 Subject: [PATCH 6/6] Tried to edit CSS --- app/src/processing/app/contrib/StatusPanel.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index 083e8b3bd..d20989196 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -38,6 +38,7 @@ import javax.swing.LayoutStyle; import javax.swing.SwingConstants; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; +import javax.swing.text.html.HTMLDocument; import processing.app.ui.Toolkit; import processing.app.Base; @@ -57,6 +58,8 @@ class StatusPanel extends JPanel { ContributionListing contributionListing = ContributionListing.getInstance(); ContributionTab contributionTab; + private String bodyRule; + public StatusPanel(int width, final ContributionTab contributionTab) { super(); setBackground(new Color(0xebebeb)); @@ -69,7 +72,8 @@ class StatusPanel extends JPanel { label.setEditable(false); label.setOpaque(false); label.setContentType("text/html"); - label.setFont(ContributionManagerDialog.myFont); + bodyRule = "body { font-family: " + ContributionManagerDialog.myFont.getFamily() + "; " + + "font-size: " + ContributionManagerDialog.myFont.getSize() + "pt; }"; label.addHyperlinkListener(new HyperlinkListener() { @Override @@ -222,6 +226,7 @@ class StatusPanel extends JPanel { iconLabel.setIcon(null); } label.setText(panel.description.toString()); + ((HTMLDocument)label.getDocument()).getStyleSheet().addRule(bodyRule); updateButton.setEnabled(contributionListing.hasDownloadedLatestList() && (contributionListing.hasUpdates(panel.getContrib()) && !panel