Temp frix for column width changing

This commit is contained in:
Akarshit Wal
2015-08-16 12:39:14 +05:30
parent d7a15d6458
commit d1f0fa6481
6 changed files with 47 additions and 42 deletions

View File

@@ -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;
}
}

View File

@@ -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<Contribution, ContributionPanel> 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();

View File

@@ -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();
}

View File

@@ -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(" <br/>");
String authorList = contrib.getAuthorList();

View File

@@ -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();
}
}

View File

@@ -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();