Mostly code format fixes.

This commit is contained in:
vraskulin 2017-02-09 18:30:31 +03:00
parent 7cf4ca3cae
commit f99cd21275
37 changed files with 226 additions and 189 deletions

View file

@ -53,7 +53,9 @@ public class DownloadGui extends JPanel {
p.setBorder(BorderFactory.createTitledBorder("Progress:"));
p.add(progress);
JButton b = new JButton("X");
b.addActionListener(e -> getDownloader().dispose());
b.addActionListener(e -> {
d.dispose();
});
p.add(b, BorderLayout.EAST);
add(p, BorderLayout.NORTH);
@ -154,10 +156,10 @@ public class DownloadGui extends JPanel {
add(bar = new JProgressBar(job.getProgress()));
JButton b = new JButton("X");
b.addActionListener(e -> {
switch(getJob().getState()) {
switch(this.job.getState()) {
case NEW:
case WORKING:
getJob().setState(State.ABORTED);
this.job.setState(State.ABORTED);
}
});
add(b, BorderLayout.EAST);

View file

@ -90,7 +90,7 @@ public class DownloadJob extends AbstractLaternaBean {
public void setError(String message, Exception error) {
if (message == null) {
message = "Download of " + this.getName() + "from " + this.getSource().toString() + " caused error: " + error.toString();
message = "Download of " + name + "from " + source.toString() + " caused error: " + error.toString();
}
// log.warn(message, error);
log.warn(message);
@ -167,7 +167,7 @@ public class DownloadJob extends AbstractLaternaBean {
@Override
public String toString() {
return proxy != null ? proxy.type().toString() + ' ' : "" + url;
return proxy != null ? proxy.type().toString() + ' ' : url;
}
};
@ -196,7 +196,7 @@ public class DownloadJob extends AbstractLaternaBean {
@Override
public String toString() {
return proxy != null ? proxy.type().toString() + ' ' : "" + url;
return proxy != null ? proxy.type().toString() + ' ' : String.valueOf(url);
}
};
}

View file

@ -57,7 +57,7 @@ public class Downloader extends AbstractLaternaBean implements Disposable {
@Override
public void dispose() {
for (DownloadJob j : getJobs()) {
for (DownloadJob j : jobs) {
switch (j.getState()) {
case NEW:
case WORKING:

View file

@ -59,7 +59,7 @@ public class GathererSymbols implements Iterable<DownloadJob> {
if (symIndex < symbols.length) {
sym = symbols[symIndex++];
} else if (numeric <= maxNumeric) {
sym = "" + (numeric++);
sym = String.valueOf(numeric++);
} else {
sizeIndex++;
if (sizeIndex == sizes.length) {

View file

@ -71,7 +71,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
JDialog dlg = download.getDlg(frame);
dlg.setVisible(true);
dlg.dispose();
download.setCancel(true);
download.cancel = true;
}
public JDialog getDlg(JFrame frame) {

View file

@ -124,7 +124,7 @@ public class ThemePluginImpl implements ThemePlugin {
private BufferedImage loadbuffer_selected() throws IOException {
BufferedImage res;
String path = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BATTLEFIELD_IMAGE, "");
if (path != null && !path.equals("")) {
if (path != null && !path.isEmpty()) {
try {
res = ImageIO.read(new File(path));
return res;
@ -162,7 +162,7 @@ public class ThemePluginImpl implements ThemePlugin {
background = ImageIO.read(is);
} else {
String path = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_BACKGROUND_IMAGE, "");
if (path != null && !path.equals("")) {
if (path != null && !path.isEmpty()) {
try {
File f = new File(path);
if (f != null) {