FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

checking after contrib manager PR · dhootha/processing@cff2f66 · GitHub

Repository navigation

Commit cff2f66

Browse files
committed
checking after contrib manager PR
1 parent 919cdaf commit cff2f66

1 file changed

Lines changed: 29 additions & 37 deletions

File tree

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

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2013 The Processing Foundation
6+
Copyright (c) 2013-15 The Processing Foundation
77
Copyright (c) 2011-12 Ben Fry and Casey Reas
88
99
This program is free software; you can redistribute it and/or modify
@@ -15,52 +15,44 @@
1515
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1616
GNU General Public License for more details.
1717
18-
You should have received a copy of the GNU General Public License along
18+
You should have received a copy of the GNU General Public License along
1919
with this program; if not, write to the Free Software Foundation, Inc.
2020
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2121
*/
2222
package processing.app.contrib;
2323

24-
import java.awt.BorderLayout;
2524
import java.awt.Color;
2625
import java.awt.event.ActionEvent;
2726
import java.awt.event.ActionListener;
28-
import java.text.DateFormat;
29-
import java.util.Date;
3027

3128
import javax.swing.GroupLayout;
32-
import javax.swing.ImageIcon;
3329
import javax.swing.JButton;
3430
import javax.swing.JLabel;
3531
import javax.swing.JPanel;
3632
import javax.swing.JProgressBar;
3733
import javax.swing.JTextPane;
3834
import javax.swing.LayoutStyle;
3935
import javax.swing.SwingConstants;
40-
import javax.swing.border.EmptyBorder;
4136
import javax.swing.event.HyperlinkEvent;
4237
import javax.swing.event.HyperlinkListener;
4338

4439
import processing.app.Base;
45-
import processing.app.Language;
46-
import processing.app.Toolkit;
47-
4840

4941

5042
class StatusPanel extends JPanel {
51-
43+
5244
final int BUTTON_WIDTH = 20;
53-
45+
5446
JTextPane label;
5547
JButton installButton;
5648
JProgressBar installProgressBar;
5749
JLabel updateLabel;
5850
JButton updateButton;
5951
JButton removeButton;
60-
52+
6153
ContributionListing contributionListing = ContributionListing.getInstance();
6254
ContributionManagerDialog contributionManagerDialog;
63-
55+
6456
public StatusPanel(int width, ContributionManagerDialog contributionManagerDialog) {
6557
final int BUTTON_WIDTH = 150;
6658
this.contributionManagerDialog = contributionManagerDialog;
@@ -81,7 +73,7 @@ public void hyperlinkUpdate(HyperlinkEvent e) {
8173
});
8274
installButton = new JButton("Install");
8375
installButton.addActionListener(new ActionListener() {
84-
76+
8577
@Override
8678
public void actionPerformed(ActionEvent e) {
8779
StatusPanel.this.contributionManagerDialog.getActiveTab().contributionListPanel
@@ -92,16 +84,16 @@ public void actionPerformed(ActionEvent e) {
9284
updateLabel = new JLabel(" ");
9385
updateButton = new JButton("Update");
9486
updateButton.addActionListener(new ActionListener() {
95-
87+
9688
@Override
9789
public void actionPerformed(ActionEvent e) {
9890
StatusPanel.this.contributionManagerDialog.getActiveTab().contributionListPanel.getSelectedPanel().update();
9991
}
10092
});
101-
93+
10294
removeButton = new JButton("Remove");
10395
removeButton.addActionListener(new ActionListener() {
104-
96+
10597
@Override
10698
public void actionPerformed(ActionEvent e) {
10799
StatusPanel.this.contributionManagerDialog.getActiveTab().contributionListPanel.getSelectedPanel().remove();
@@ -111,7 +103,7 @@ public void actionPerformed(ActionEvent e) {
111103
int labelWidth = width != 0 ? width * 3 / 4 : GroupLayout.PREFERRED_SIZE;
112104
GroupLayout layout = new GroupLayout(this);
113105
this.setLayout(layout);
114-
106+
115107
layout.setAutoCreateContainerGaps(true);
116108
layout.setAutoCreateGaps(true);
117109

@@ -140,76 +132,76 @@ public void actionPerformed(ActionEvent e) {
140132

141133
layout
142134
.linkSize(SwingConstants.HORIZONTAL, installButton, installProgressBar, updateButton, removeButton);
143-
135+
144136
installProgressBar.setVisible(false);
145137
updateLabel.setVisible(false);
146-
138+
147139
installButton.setEnabled(false);
148140
updateButton.setEnabled(false);
149141
removeButton.setEnabled(false);
150-
142+
151143
layout.setHonorsVisibility(updateLabel, false); // Makes the label take up space even though not visible
152-
144+
153145
}
154-
146+
155147
void setMessage(String message) {
156148
label.setForeground(Color.BLACK);
157149
label.setText(message);
158150
label.repaint();
159151
}
160-
152+
161153
void setErrorMessage(String message) {
162154
//setForeground(Color.RED);
163155
label.setForeground(new Color(160, 0, 0));
164156
label.setText(message);
165157
label.repaint();
166158
}
167-
159+
168160
void clear() {
169161
label.setText(null);
170162
label.repaint();
171163
}
172164

173165
public void update(ContributionPanel panel) {
174-
166+
175167
label.setText(panel.description.toString());
176168

177169
updateButton.setEnabled(!contributionListing.hasListDownloadFailed()
178170
&& (contributionListing.hasUpdates(panel.getContrib()) && !panel
179171
.getContrib().isUpdateFlagged()));
180-
172+
181173
String latestVersion = contributionListing.getLatestVersion(panel.getContrib());
182174
String currentVersion = panel.getContrib().getPrettyVersion();
183-
175+
184176
if(latestVersion != null){
185177
latestVersion = "Update to " + latestVersion;
186178
}else{
187179
latestVersion = "Update";
188180
}
189-
181+
190182
if(currentVersion != null){
191183
currentVersion = "Version " + currentVersion;
192184
}else{
193185
currentVersion = "";
194186
}
195-
187+
196188
if(updateButton.isEnabled()){
197189
updateButton.setText(latestVersion);
198190
}else{
199191
updateButton.setText("Update");
200192
}
201-
193+
202194
installButton.setEnabled(!panel.getContrib().isInstalled() && !contributionListing.hasListDownloadFailed());
203-
204-
195+
196+
205197
if(installButton.isEnabled()){
206198
updateLabel.setText(currentVersion + " available");
207199
}else{
208200
updateLabel.setText(currentVersion + " installed");
209201
}
210-
202+
211203
updateLabel.setVisible(true);
212-
204+
213205
removeButton.setEnabled(panel.getContrib().isInstalled());
214206

215207
}
@@ -272,5 +264,5 @@ void clearErrorMessage() {
272264
273265
getPlaceholder().setVisible(false);
274266
}
275-
}
267+
}
276268
*/

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL