Code formator (#236)

* Re-import code formator
This commit is contained in:
Laurent Clouet
2020-05-28 13:28:42 +02:00
committed by GitHub
parent 1dc865a979
commit 44cf85739c
67 changed files with 697 additions and 955 deletions

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -56,13 +56,13 @@ import com.sheepit.client.standalone.swing.activity.Working;
import lombok.Getter;
import lombok.Setter;
import com.formdev.flatlaf.FlatLightLaf; // Required for dark & light mode
import com.formdev.flatlaf.FlatLightLaf; // Required for dark & light mode
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLaf;
public class GuiSwing extends JFrame implements Gui {
public static final String type = "swing";
public enum ActivityType {
WORKING, SETTINGS
}
@@ -79,13 +79,11 @@ public class GuiSwing extends JFrame implements Gui {
private boolean waitingForAuthentication;
private Client client;
private BufferedImage iconSprites;
private BufferedImage[] trayIconSprites;
@Getter
@Setter
private SettingsLoader settingsLoader;
@Getter @Setter private SettingsLoader settingsLoader;
private ThreadClient threadClient;
@@ -96,8 +94,7 @@ public class GuiSwing extends JFrame implements Gui {
waitingForAuthentication = true;
new Timer().scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
@Override public void run() {
if (activityWorking != null) {
activityWorking.updateTime();
}
@@ -105,8 +102,7 @@ public class GuiSwing extends JFrame implements Gui {
}, 2 * 1000, 2 * 1000);
}
@Override
public void start() {
@Override public void start() {
if (useSysTray) {
try {
sysTray = SystemTray.getSystemTray();
@@ -124,21 +120,22 @@ public class GuiSwing extends JFrame implements Gui {
sysTray = null;
}
}
// load the images sprite and split into individual images
URL spriteSequenceUrl = getClass().getResource("/icon-sprites.png");
if (spriteSequenceUrl != null) {
try {
iconSprites = ImageIO.read(spriteSequenceUrl);
trayIconSprites = new BufferedImage[101 * 1]; // sprite sheet has 101 images in 1 column
setIconImage(extractImageFromSprite(-1)); // sprite 0 is standard Sheep It! icon
} catch (IOException e) {
trayIconSprites = new BufferedImage[101 * 1]; // sprite sheet has 101 images in 1 column
setIconImage(extractImageFromSprite(-1)); // sprite 0 is standard Sheep It! icon
}
catch (IOException e) {
e.printStackTrace();
}
}
setTitle(title);
setSize(520, 760);
@@ -157,17 +154,18 @@ public class GuiSwing extends JFrame implements Gui {
try {
if (client.getConfiguration().getTheme().equals("light")) {
UIManager.setLookAndFeel(new FlatLightLaf());
} else if (client.getConfiguration().getTheme().equals("dark")) {
}
else if (client.getConfiguration().getTheme().equals("dark")) {
UIManager.setLookAndFeel(new FlatDarkLaf());
}
// Apply the selected theme to swing components
FlatLaf.updateUI();
}
catch (UnsupportedLookAndFeelException e1) {
e1.printStackTrace();
}
while (waitingForAuthentication) {
try {
synchronized (this) {
@@ -180,51 +178,43 @@ public class GuiSwing extends JFrame implements Gui {
}
}
@Override
public void stop() {
@Override public void stop() {
System.exit(0);
}
@Override
public void status(String msg_) {
@Override public void status(String msg_) {
status(msg_, false);
}
@Override
public void status(String msg_, boolean overwriteSuspendedMsg) {
@Override public void status(String msg_, boolean overwriteSuspendedMsg) {
if (activityWorking != null) {
this.activityWorking.setStatus(msg_, overwriteSuspendedMsg);
}
}
@Override
public void setRenderingProjectName(String name_) {
@Override public void setRenderingProjectName(String name_) {
if (activityWorking != null) {
this.activityWorking.setRenderingProjectName(name_);
}
}
@Override
public void error(String msg_) {
@Override public void error(String msg_) {
status(msg_, true);
}
@Override
public void setRemainingTime(String time_) {
@Override public void setRemainingTime(String time_) {
if (activityWorking != null) {
this.activityWorking.setRemainingTime(time_);
}
}
@Override
public void setRenderingTime(String time_) {
@Override public void setRenderingTime(String time_) {
if (activityWorking != null) {
this.activityWorking.setRenderingTime(time_);
}
}
@Override
public void AddFrameRendered() {
@Override public void AddFrameRendered() {
framesRendered++;
if (activityWorking != null) {
@@ -235,41 +225,35 @@ public class GuiSwing extends JFrame implements Gui {
}
}
@Override
public void displayStats(Stats stats) {
@Override public void displayStats(Stats stats) {
if (activityWorking != null) {
this.activityWorking.displayStats(stats);
}
}
@Override
public void displayUploadQueueStats(int queueSize, long queueVolume) {
@Override public void displayUploadQueueStats(int queueSize, long queueVolume) {
if (activityWorking != null) {
this.activityWorking.displayUploadQueueStats(queueSize, queueVolume);
}
}
@Override
public Client getClient() {
@Override public Client getClient() {
return client;
}
@Override
public void setClient(Client cli) {
@Override public void setClient(Client cli) {
client = cli;
}
@Override
public void setComputeMethod(String computeMethod) {
@Override public void setComputeMethod(String computeMethod) {
this.activityWorking.setComputeMethod(computeMethod);
}
public Configuration getConfiguration() {
return client.getConfiguration();
}
@Override
public void successfulAuthenticationEvent(String publickey) {
@Override public void successfulAuthenticationEvent(String publickey) {
if (settingsLoader != null) {
if (publickey != null) {
settingsLoader.setPassword(publickey);
@@ -341,15 +325,14 @@ public class GuiSwing extends JFrame implements Gui {
public TrayIcon getTrayIcon() {
final PopupMenu trayMenu = new PopupMenu();
// on start, show the base icon
Image img = extractImageFromSprite(-1);
final TrayIcon icon = new TrayIcon(img);
MenuItem exit = new MenuItem("Exit");
exit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
@@ -357,8 +340,7 @@ public class GuiSwing extends JFrame implements Gui {
MenuItem open = new MenuItem("Open...");
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
restoreFromTray();
}
});
@@ -366,8 +348,7 @@ public class GuiSwing extends JFrame implements Gui {
MenuItem settings = new MenuItem("Settings...");
settings.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
restoreFromTray();
showActivity(ActivityType.SETTINGS);
}
@@ -379,8 +360,7 @@ public class GuiSwing extends JFrame implements Gui {
icon.setToolTip("SheepIt! Client");
icon.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
restoreFromTray();
}
});
@@ -388,7 +368,7 @@ public class GuiSwing extends JFrame implements Gui {
return icon;
}
private Image extractImageFromSprite(int spriteNumber) {
// Sprite structure
// Image 0: base sprite
@@ -398,29 +378,27 @@ public class GuiSwing extends JFrame implements Gui {
// -1 turns into 0 (base sprite with no progress bar)
// 0 to 101 turns into 1 to 101 (progress sequence starts in sprite 1 and ends on sprite 101)
ImageIcon img = new ImageIcon(iconSprites.getSubimage(0, (spriteNumber + 1) * 114, 114, 114));
return img.getImage();
}
@Override
public void updateTrayIcon(Integer percentage) {
@Override public void updateTrayIcon(Integer percentage) {
// update the app icon on the app bar
Image img = extractImageFromSprite(percentage);
setIconImage(img);
// if the app supports the system tray, update as well
if (sysTray != null && SystemTray.isSupported()) {
if (trayIcon != null) {
trayIcon.setImage(img);
trayIcon.setImageAutoSize(true); // use this method to ensure that icon is refreshed when on
// the tray
trayIcon.setImageAutoSize(true); // use this method to ensure that icon is refreshed when on
// the tray
}
}
}
public class ThreadClient extends Thread {
@Override
public void run() {
@Override public void run() {
if (GuiSwing.this.client != null) {
GuiSwing.this.client.run();
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -46,8 +46,7 @@ public class GuiText implements Gui {
this.log = Log.getInstance(null);
}
@Override
public void start() {
@Override public void start() {
if (client != null) {
CLIInputObserver cli_input_observer = new CLIInputObserver(client);
@@ -56,8 +55,7 @@ public class GuiText implements Gui {
cli_input_observer_thread.start();
Signal.handle(new Signal("INT"), new SignalHandler() {
@Override
public void handle(Signal signal) {
@Override public void handle(Signal signal) {
sigIntCount++;
if (sigIntCount == 4) {
@@ -84,22 +82,18 @@ public class GuiText implements Gui {
}
}
@Override
public void stop() {
@Override public void stop() {
Runtime.getRuntime().halt(0);
}
@Override
public void updateTrayIcon(Integer percentage) {
@Override public void updateTrayIcon(Integer percentage) {
}
@Override
public void status(String msg_) {
@Override public void status(String msg_) {
status(msg_, false);
}
@Override
public void status(String msg_, boolean overwriteSuspendedMsg) {
@Override public void status(String msg_, boolean overwriteSuspendedMsg) {
log.debug("GUI " + msg_);
if (client != null && client.isSuspended()) {
@@ -112,67 +106,54 @@ public class GuiText implements Gui {
}
}
@Override
public void error(String err_) {
@Override public void error(String err_) {
System.out.println("Error " + err_);
log.error("Error " + err_);
}
@Override
public void AddFrameRendered() {
@Override public void AddFrameRendered() {
this.framesRendered += 1;
System.out.println("Frames rendered: " + this.framesRendered);
}
@Override
public void displayStats(Stats stats) {
@Override public void displayStats(Stats stats) {
System.out.println("Frames remaining: " + stats.getRemainingFrame());
System.out.println("Credits earned: " + stats.getCreditsEarnedDuringSession());
}
@Override
public void displayUploadQueueStats(int queueSize, long queueVolume) {
@Override public void displayUploadQueueStats(int queueSize, long queueVolume) {
// No need to check if the queue is not empty to show the volume bc this line is always shown at the end
// of the render process in text GUI (unless an error occurred, where the file is uploaded synchronously)
System.out.println(String.format("Queued uploads: %d (%.2fMB)",
queueSize,
(queueVolume / 1024.0 / 1024.0)));
System.out.println(String.format("Queued uploads: %d (%.2fMB)", queueSize, (queueVolume / 1024.0 / 1024.0)));
}
@Override
public void setRenderingProjectName(String name_) {
@Override public void setRenderingProjectName(String name_) {
if (name_ != null && name_.isEmpty() == false) {
System.out.println("Rendering project \"" + name_ + "\"");
}
}
@Override
public void setRemainingTime(String time_) {
@Override public void setRemainingTime(String time_) {
System.out.println("Rendering (remaining " + time_ + ")");
}
@Override
public void setRenderingTime(String time_) {
@Override public void setRenderingTime(String time_) {
System.out.println("Rendering " + time_);
}
@Override
public void setClient(Client cli) {
@Override public void setClient(Client cli) {
client = cli;
}
@Override
public void setComputeMethod(String computeMethod) {
@Override public void setComputeMethod(String computeMethod) {
System.out.println("Compute method: " + computeMethod);
}
@Override
public Client getClient() {
@Override public Client getClient() {
return client;
}
@Override
public void successfulAuthenticationEvent(String publickey) {
@Override public void successfulAuthenticationEvent(String publickey) {
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2015 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -42,7 +42,7 @@ public class GuiTextOneLine implements Gui {
private String status;
private String line;
private int uploadQueueSize;
private int uploadQueueSize;
private long uploadQueueVolume;
private boolean exiting = false;
@@ -57,12 +57,11 @@ public class GuiTextOneLine implements Gui {
status = "";
computeMethod = "";
line = "";
uploadQueueSize = 0;
uploadQueueSize = 0;
uploadQueueVolume = 0;
}
@Override
public void start() {
@Override public void start() {
if (client != null) {
CLIInputObserver cli_input_observer = new CLIInputObserver(client);
@@ -71,8 +70,7 @@ public class GuiTextOneLine implements Gui {
cli_input_observer_thread.start();
Signal.handle(new Signal("INT"), new SignalHandler() {
@Override
public void handle(Signal signal) {
@Override public void handle(Signal signal) {
sigIntCount++;
if (sigIntCount == 5) {
@@ -95,22 +93,18 @@ public class GuiTextOneLine implements Gui {
}
}
@Override
public void stop() {
@Override public void stop() {
Runtime.getRuntime().halt(0);
}
@Override
public void updateTrayIcon(Integer percentage) {
@Override public void updateTrayIcon(Integer percentage) {
}
@Override
public void status(String msg_) {
@Override public void status(String msg_) {
status(msg_, false);
}
@Override
public void status(String msg_, boolean overwriteSuspendedMsg) {
@Override public void status(String msg_, boolean overwriteSuspendedMsg) {
if (client != null && client.isSuspended()) {
if (overwriteSuspendedMsg) {
status = msg_;
@@ -123,8 +117,7 @@ public class GuiTextOneLine implements Gui {
}
}
@Override
public void setRenderingProjectName(String name_) {
@Override public void setRenderingProjectName(String name_) {
if (name_ == null || name_.isEmpty()) {
project = "";
}
@@ -134,60 +127,50 @@ public class GuiTextOneLine implements Gui {
updateLine();
}
@Override
public void error(String msg_) {
@Override public void error(String msg_) {
status = "Error " + msg_;
updateLine();
}
@Override
public void AddFrameRendered() {
@Override public void AddFrameRendered() {
rendered += 1;
updateLine();
}
@Override
public void displayStats(Stats stats) {
@Override public void displayStats(Stats stats) {
remaining = stats.getRemainingFrame();
creditsEarned = String.valueOf(stats.getCreditsEarnedDuringSession());
updateLine();
}
@Override
public void displayUploadQueueStats(int queueSize, long queueVolume) {
this.uploadQueueSize = queueSize;
@Override public void displayUploadQueueStats(int queueSize, long queueVolume) {
this.uploadQueueSize = queueSize;
this.uploadQueueVolume = queueVolume;
}
@Override
public void setRemainingTime(String time_) {
@Override public void setRemainingTime(String time_) {
status = "(remaining " + time_ + ")";
updateLine();
}
@Override
public void setRenderingTime(String time_) {
@Override public void setRenderingTime(String time_) {
status = "Rendering " + time_;
updateLine();
}
@Override
public void setClient(Client cli) {
@Override public void setClient(Client cli) {
client = cli;
}
@Override
public void setComputeMethod(String computeMethod_) {
@Override public void setComputeMethod(String computeMethod_) {
computeMethod = computeMethod_;
}
@Override
public Client getClient() {
@Override public Client getClient() {
return client;
}
@Override
public void successfulAuthenticationEvent(String publickey) {
@Override public void successfulAuthenticationEvent(String publickey) {
}
@@ -196,15 +179,9 @@ public class GuiTextOneLine implements Gui {
System.out.print("\r");
line = String.format("Frames: %d Points: %s | Queued uploads: %d%s | %s %s %s",
rendered,
creditsEarned != null ? creditsEarned : "unknown",
this.uploadQueueSize,
(this.uploadQueueSize > 0 ? String.format(" (%.2fMB)", (this.uploadQueueVolume / 1024.0 / 1024.0)) : ""),
project,
computeMethod,
status + (exiting ? " (Exiting after all frames are uploaded)" : "")
);
line = String.format("Frames: %d Points: %s | Queued uploads: %d%s | %s %s %s", rendered, creditsEarned != null ? creditsEarned : "unknown",
this.uploadQueueSize, (this.uploadQueueSize > 0 ? String.format(" (%.2fMB)", (this.uploadQueueVolume / 1024.0 / 1024.0)) : ""), project,
computeMethod, status + (exiting ? " (Exiting after all frames are uploaded)" : ""));
System.out.print(line);
for (int i = line.length(); i <= charToRemove; i++) {

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2017 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -37,8 +37,7 @@ public class ListGpuParameterHandler<T> extends OptionHandler<T> {
super(parser, option, setter);
}
@Override
public int parseArguments(Parameters params) throws CmdLineException {
@Override public int parseArguments(Parameters params) throws CmdLineException {
List<GPUDevice> gpus = GPU.listDevices(new Configuration(null, null, null));
if (gpus != null) {
for (GPUDevice gpu : gpus) {
@@ -53,8 +52,7 @@ public class ListGpuParameterHandler<T> extends OptionHandler<T> {
return 0;
}
@Override
public String getDefaultMetaVariable() {
@Override public String getDefaultMetaVariable() {
return null;
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2015 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -33,16 +33,14 @@ public class VersionParameterHandler<T> extends OptionHandler<T> {
super(parser, option, setter);
}
@Override
public int parseArguments(Parameters params) throws CmdLineException {
@Override public int parseArguments(Parameters params) throws CmdLineException {
Configuration config = new Configuration(null, "", "");
System.out.println("Version: " + config.getJarVersion());
System.exit(0);
return 0;
}
@Override
public String getDefaultMetaVariable() {
@Override public String getDefaultMetaVariable() {
return null;
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -30,6 +30,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.LinkedList;
import com.sheepit.client.Client;
import com.sheepit.client.Configuration;
import com.sheepit.client.Configuration.ComputeType;
@@ -46,75 +47,53 @@ import com.sheepit.client.hardware.gpu.opencl.OpenCL;
import com.sheepit.client.network.Proxy;
public class Worker {
@Option(name = "-server", usage = "Render-farm server, default https://client.sheepit-renderfarm.com", metaVar = "URL", required = false)
private String server = "https://client.sheepit-renderfarm.com";
@Option(name = "-server", usage = "Render-farm server, default https://client.sheepit-renderfarm.com", metaVar = "URL", required = false) private String server = "https://client.sheepit-renderfarm.com";
@Option(name = "-login", usage = "User's login", metaVar = "LOGIN", required = false)
private String login = "";
@Option(name = "-login", usage = "User's login", metaVar = "LOGIN", required = false) private String login = "";
@Option(name = "-password", usage = "User's password", metaVar = "PASSWORD", required = false)
private String password = "";
@Option(name = "-password", usage = "User's password", metaVar = "PASSWORD", required = false) private String password = "";
@Option(name = "-cache-dir", usage = "Cache/Working directory. Caution, everything in it not related to the render-farm will be removed", metaVar = "/tmp/cache", required = false)
private String cache_dir = null;
@Option(name = "-cache-dir", usage = "Cache/Working directory. Caution, everything in it not related to the render-farm will be removed", metaVar = "/tmp/cache", required = false) private String cache_dir = null;
@Option(name = "-gpu", usage = "Name of the GPU used for the render, for example CUDA_0 for Nvidia or OPENCL_0 for AMD/Intel card", metaVar = "CUDA_0", required = false)
private String gpu_device = null;
@Option(name = "-gpu", usage = "Name of the GPU used for the render, for example CUDA_0 for Nvidia or OPENCL_0 for AMD/Intel card", metaVar = "CUDA_0", required = false) private String gpu_device = null;
@Option(name = "--no-gpu", usage = "Don't detect GPUs", required = false)
private boolean no_gpu_detection = false;
@Option(name = "--no-gpu", usage = "Don't detect GPUs", required = false) private boolean no_gpu_detection = false;
@Option(name = "-compute-method", usage = "CPU: only use cpu, GPU: only use gpu, CPU_GPU: can use cpu and gpu (not at the same time) if -gpu is not use it will not use the gpu", metaVar = "CPU", required = false)
private String method = null;
@Option(name = "-compute-method", usage = "CPU: only use cpu, GPU: only use gpu, CPU_GPU: can use cpu and gpu (not at the same time) if -gpu is not use it will not use the gpu", metaVar = "CPU", required = false) private String method = null;
@Option(name = "-cores", usage = "Number of cores/threads to use for the render", metaVar = "3", required = false)
private int nb_cores = -1;
@Option(name = "-cores", usage = "Number of cores/threads to use for the render", metaVar = "3", required = false) private int nb_cores = -1;
@Option(name = "-memory", usage = "Maximum memory allow to be used by renderer, number with unit (800M, 2G, ...)", required = false)
private String max_ram = null;
@Option(name = "-memory", usage = "Maximum memory allow to be used by renderer, number with unit (800M, 2G, ...)", required = false) private String max_ram = null;
@Option(name = "-rendertime", usage = "Maximum time allow for each frame (in minutes)", required = false)
private int max_rendertime = -1;
@Option(name = "-rendertime", usage = "Maximum time allow for each frame (in minutes)", required = false) private int max_rendertime = -1;
@Option(name = "--verbose", usage = "Display log", required = false)
private boolean print_log = false;
@Option(name = "--verbose", usage = "Display log", required = false) private boolean print_log = false;
@Option(name = "-request-time", usage = "H1:M1-H2:M2,H3:M3-H4:M4 Use the 24h format. For example to request job between 2am-8.30am and 5pm-11pm you should do --request-time 2:00-8:30,17:00-23:00 Caution, it's the requesting job time to get a project, not the working time", metaVar = "2:00-8:30,17:00-23:00", required = false)
private String request_time = null;
@Option(name = "-request-time", usage = "H1:M1-H2:M2,H3:M3-H4:M4 Use the 24h format. For example to request job between 2am-8.30am and 5pm-11pm you should do --request-time 2:00-8:30,17:00-23:00 Caution, it's the requesting job time to get a project, not the working time", metaVar = "2:00-8:30,17:00-23:00", required = false) private String request_time = null;
@Option(name = "-proxy", usage = "URL of the proxy", metaVar = "http://login:password@host:port", required = false)
private String proxy = null;
@Option(name = "-proxy", usage = "URL of the proxy", metaVar = "http://login:password@host:port", required = false) private String proxy = null;
@Option(name = "-extras", usage = "Extras data push on the authentication request", required = false)
private String extras = null;
@Option(name = "-extras", usage = "Extras data push on the authentication request", required = false) private String extras = null;
@Option(name = "-ui", usage = "Specify the user interface to use, default '" + GuiSwing.type + "', available '" + GuiTextOneLine.type + "', '" + GuiText.type + "', '" + GuiSwing.type + "' (graphical)", required = false)
private String ui_type = null;
@Option(name = "-ui", usage = "Specify the user interface to use, default '" + GuiSwing.type + "', available '" + GuiTextOneLine.type + "', '"
+ GuiText.type + "', '" + GuiSwing.type + "' (graphical)", required = false) private String ui_type = null;
@Option(name = "-config", usage = "Specify the configuration file", required = false)
private String config_file = null;
@Option(name = "-config", usage = "Specify the configuration file", required = false) private String config_file = null;
@Option(name = "--version", usage = "Display application version", required = false, handler = VersionParameterHandler.class)
private VersionParameterHandler versionHandler;
@Option(name = "--version", usage = "Display application version", required = false, handler = VersionParameterHandler.class) private VersionParameterHandler versionHandler;
@Option(name = "--show-gpu", usage = "Print available CUDA devices and exit", required = false, handler = ListGpuParameterHandler.class)
private ListGpuParameterHandler listGpuParameterHandler;
@Option(name = "--show-gpu", usage = "Print available CUDA devices and exit", required = false, handler = ListGpuParameterHandler.class) private ListGpuParameterHandler listGpuParameterHandler;
@Option(name = "--no-systray", usage = "Don't use systray", required = false)
private boolean no_systray = false;
@Option(name = "--no-systray", usage = "Don't use systray", required = false) private boolean no_systray = false;
@Option(name = "-priority", usage = "Set render process priority (19 lowest to -19 highest)", required = false)
private int priority = 19;
@Option(name = "-title", usage = "Custom title for the GUI Client", required = false)
private String title = "SheepIt Render Farm";
@Option(name = "-priority", usage = "Set render process priority (19 lowest to -19 highest)", required = false) private int priority = 19;
@Option(name = "-theme", usage = "Specify the theme to use for the graphical client, default 'light', available 'light', 'dark'", required = false)
private String theme = null;
@Option(name = "-title", usage = "Custom title for the GUI Client", required = false) private String title = "SheepIt Render Farm";
@Option(name = "-theme", usage = "Specify the theme to use for the graphical client, default 'light', available 'light', 'dark'", required = false) private String theme = null;
@Option(name = "-renderbucket-size", usage = "Set a custom GPU renderbucket size (32 for 32x32px, 64 for 64x64px, and so on). NVIDIA GPUs support a maximum renderbucket size of 512x512 pixel, while AMD GPUs support a maximum 2048x2048 pixel renderbucket size. Minimum renderbucket size is 32 pixels for all GPUs", required = false) private int renderbucketSize = -1;
@Option(name = "-renderbucket-size", usage = "Set a custom GPU renderbucket size (32 for 32x32px, 64 for 64x64px, and so on). NVIDIA GPUs support a maximum renderbucket size of 512x512 pixel, while AMD GPUs support a maximum 2048x2048 pixel renderbucket size. Minimum renderbucket size is 32 pixels for all GPUs", required = false)
private int renderbucketSize = -1;
public static void main(String[] args) {
new Worker().doMain(args);
}
@@ -137,7 +116,7 @@ public class Worker {
Configuration config = new Configuration(null, login, password);
config.setPrintLog(print_log);
config.setUsePriority(priority);
config.setDetectGPUs(! no_gpu_detection);
config.setDetectGPUs(!no_gpu_detection);
if (cache_dir != null) {
File a_dir = new File(cache_dir);
@@ -297,10 +276,10 @@ public class Worker {
System.err.println("Aborting");
System.exit(2);
}
config.setTheme(this.theme);
}
if (config_file != null) {
if (new File(config_file).exists() == false) {
System.err.println("Configuration file not found.");

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2015 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2015 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -94,7 +94,7 @@ public class Settings implements Activity {
private ButtonGroup themeOptionsGroup;
private JRadioButton lightMode;
private JRadioButton darkMode;
private JCheckBox saveFile;
private JCheckBox autoSignIn;
JButton saveButton;
@@ -108,13 +108,12 @@ public class Settings implements Activity {
haveAutoStarted = false;
}
@Override
public void show() {
@Override public void show() {
Configuration config = parent.getConfiguration();
new SettingsLoader(config.getConfigFilePath()).merge(config);
applyTheme(config.getTheme()); // apply the proper theme (light/dark)
applyTheme(config.getTheme()); // apply the proper theme (light/dark)
List<GPUDevice> gpus = GPU.listDevices(config);
useGPUs.clear(); // Empty the auxiliary list (used in the list of checkboxes)
@@ -132,10 +131,10 @@ public class Settings implements Activity {
++currentRow;
constraints.gridy = currentRow;
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between logo and first panel
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between logo and first panel
currentRow++;
// authentication
CollapsibleJPanel authentication_panel = new CollapsibleJPanel(new GridLayout(2, 2));
authentication_panel.setBorder(BorderFactory.createTitledBorder("Authentication"));
@@ -165,33 +164,33 @@ public class Settings implements Activity {
// Theme selection panel
CollapsibleJPanel themePanel = new CollapsibleJPanel(new GridLayout(1, 3));
themePanel.setBorder(BorderFactory.createTitledBorder("Theme"));
themeOptionsGroup = new ButtonGroup();
lightMode = new JRadioButton("Light");
lightMode.setActionCommand("light");
lightMode.setSelected(config.getTheme().equals("light"));
lightMode.addActionListener(new ApplyThemeAction());
darkMode = new JRadioButton("Dark");
darkMode.setActionCommand("dark");
darkMode.setSelected(config.getTheme().equals("dark"));
darkMode.addActionListener(new ApplyThemeAction());
themePanel.add(lightMode);
themePanel.add(darkMode);
// Group both radio buttons to allow only one selected
themeOptionsGroup.add(lightMode);
themeOptionsGroup.add(darkMode);
currentRow++;
constraints.gridx = 0;
constraints.gridy = currentRow;
constraints.gridwidth = 2;
parent.getContentPane().add(themePanel, constraints);
// directory
CollapsibleJPanel directory_panel = new CollapsibleJPanel(new GridLayout(1, 3));
directory_panel.setBorder(BorderFactory.createTitledBorder("Cache"));
@@ -260,7 +259,7 @@ public class Settings implements Activity {
if (gpus.size() > 0) {
renderbucketSizeLabel = new JLabel("Renderbucket size:");
renderbucketSize = new JSlider();
renderbucketSize = new JSlider();
renderbucketSize.setMajorTickSpacing(1);
renderbucketSize.setMinorTickSpacing(1);
renderbucketSize.setPaintTicks(true);
@@ -291,7 +290,7 @@ public class Settings implements Activity {
// Initialisation values will apply if we are not able to detect the proper GPU technology or
// because is a new one (different from CUDA and OPENCL). In that case, move into a safe position
// of 32x32 pixel render bucket and a maximum of 128x128 pixel for the "unknown GPU"
int maxRenderbucketSize = 128;
int maxRenderbucketSize = 128;
int recommendedBucketSize = 32;
if (config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) {
@@ -308,7 +307,7 @@ public class Settings implements Activity {
recommendedBucketSize = gpu.getRecommendedRenderBucketSize(config.getGPUDevice().getMemory());
}
}
buildRenderBucketSizeSlider(maxRenderbucketSize, config.getRenderbucketSize() != -1 ?
((int) (Math.log(config.getRenderbucketSize()) / Math.log(2))) - 5 :
((int) (Math.log(recommendedBucketSize) / Math.log(2))) - 5);
@@ -331,14 +330,14 @@ public class Settings implements Activity {
CPU cpu = new CPU();
if (cpu.cores() > 1) { // if only one core is available, no need to show the choice
double step = 1;
double display = (double)cpu.cores() / step;
double display = (double) cpu.cores() / step;
while (display > 10) {
step += 1.0;
display = (double)cpu.cores() / step;
display = (double) cpu.cores() / step;
}
cpuCores = new JSlider(1, cpu.cores());
cpuCores.setMajorTickSpacing((int)(step));
cpuCores.setMajorTickSpacing((int) (step));
cpuCores.setMinorTickSpacing(1);
cpuCores.setPaintTicks(true);
cpuCores.setPaintLabels(true);
@@ -365,10 +364,10 @@ public class Settings implements Activity {
int all_ram = (int) os.getMemory();
ram = new JSlider(0, all_ram);
int step = 1000000;
double display = (double)all_ram / (double)step;
double display = (double) all_ram / (double) step;
while (display > 10) {
step += 1000000;
display = (double)all_ram / (double)step;
display = (double) all_ram / (double) step;
}
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
for (int g = 0; g < all_ram; g += step) {
@@ -378,7 +377,7 @@ public class Settings implements Activity {
ram.setLabelTable(labelTable);
ram.setPaintTicks(true);
ram.setPaintLabels(true);
ram.setValue((int)(config.getMaxMemory() != -1 ? config.getMaxMemory() : os.getMemory()));
ram.setValue((int) (config.getMaxMemory() != -1 ? config.getMaxMemory() : os.getMemory()));
JLabel ramLabel = new JLabel("Memory:");
compute_devices_constraints.weightx = 1.0 / gpus.size();
@@ -405,7 +404,7 @@ public class Settings implements Activity {
priority.setPaintTicks(true);
priority.setPaintLabels(true);
priority.setValue(config.getPriority());
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):" );
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):");
compute_devices_constraints.weightx = 1.0 / gpus.size();
compute_devices_constraints.gridx = 0;
@@ -452,7 +451,7 @@ public class Settings implements Activity {
if (parent.getConfiguration().getMaxRenderTime() > 0) {
val = parent.getConfiguration().getMaxRenderTime() / 60;
}
renderTime = new JSpinner(new SpinnerNumberModel(val,0,1000,1));
renderTime = new JSpinner(new SpinnerNumberModel(val, 0, 1000, 1));
advanced_panel.add(renderTimeLabel);
advanced_panel.add(renderTime);
@@ -482,8 +481,8 @@ public class Settings implements Activity {
currentRow++;
constraints.gridy = currentRow;
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between last checkboxes and button
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between last checkboxes and button
currentRow++;
String buttonText = "Start";
if (parent.getClient() != null) {
@@ -540,19 +539,20 @@ public class Settings implements Activity {
if (login.getText().isEmpty() || password.getPassword().length == 0 || Proxy.isValidURL(proxy.getText()) == false) {
selected = false;
}
saveButton.setEnabled(selected);
return selected;
}
private void applyTheme(String theme_) {
try {
if (theme_.equals("light")) {
UIManager.setLookAndFeel(new FlatLightLaf());
} else if (theme_.equals("dark")) {
}
else if (theme_.equals("dark")) {
UIManager.setLookAndFeel(new FlatDarkLaf());
}
// Apply the new theme
FlatLaf.updateUI();
}
@@ -563,9 +563,10 @@ public class Settings implements Activity {
class ChooseFileAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(parent.getContentPane(), "<html>The working directory has to be dedicated directory. <br />Caution, everything not related to SheepIt-Renderfarm will be removed.<br />You should create a directory specifically for it.</html>", "Warning: files will be removed!", JOptionPane.WARNING_MESSAGE);
@Override public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(parent.getContentPane(),
"<html>The working directory has to be dedicated directory. <br />Caution, everything not related to SheepIt-Renderfarm will be removed.<br />You should create a directory specifically for it.</html>",
"Warning: files will be removed!", JOptionPane.WARNING_MESSAGE);
int returnVal = cacheDirChooser.showOpenDialog(parent.getContentPane());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = cacheDirChooser.getSelectedFile();
@@ -577,16 +578,14 @@ public class Settings implements Activity {
class CpuChangeAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
checkDisplaySaveButton();
}
}
class GpuChangeAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
renderbucketSizeLabel.setVisible(false);
renderbucketSize.setVisible(false);
@@ -597,8 +596,8 @@ public class Settings implements Activity {
}
else {
GPULister gpu;
int maxRenderbucketSize = 128; // Max default render bucket size
int recommendedBucketSize = 32; // Default recommended render bucket size
int maxRenderbucketSize = 128; // Max default render bucket size
int recommendedBucketSize = 32; // Default recommended render bucket size
if (useGPUs.get(counter).getGPUDevice().getType().equals("CUDA")) {
gpu = new Nvidia();
@@ -631,8 +630,7 @@ public class Settings implements Activity {
class AutoSignInChangeAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
if (autoSignIn.isSelected()) {
saveFile.setSelected(true);
}
@@ -640,16 +638,14 @@ public class Settings implements Activity {
}
class ApplyThemeAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
applyTheme(themeOptionsGroup.getSelection().getActionCommand());
}
}
class SaveAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
if (parent == null) {
return;
}
@@ -658,7 +654,7 @@ public class Settings implements Activity {
if (config == null) {
return;
}
if (themeOptionsGroup.getSelection().getActionCommand() != null)
config.setTheme(themeOptionsGroup.getSelection().getActionCommand());
@@ -720,7 +716,7 @@ public class Settings implements Activity {
int max_rendertime = -1;
if (renderTime != null) {
max_rendertime = (Integer)renderTime.getValue() * 60;
max_rendertime = (Integer) renderTime.getValue() * 60;
config.setMaxRenderTime(max_rendertime);
}
@@ -752,23 +748,11 @@ public class Settings implements Activity {
}
if (saveFile.isSelected()) {
parent.setSettingsLoader(new SettingsLoader(
config.getConfigFilePath(),
login.getText(),
new String(password.getPassword()),
proxyText,
hostnameText,
method,
selected_gpu,
renderbucket_size,
cpu_cores,
max_ram,
max_rendertime,
cachePath,
autoSignIn.isSelected(),
GuiSwing.type,
themeOptionsGroup.getSelection().getActionCommand(), // selected theme
priority.getValue()));
parent.setSettingsLoader(
new SettingsLoader(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method,
selected_gpu, renderbucket_size, cpu_cores, max_ram, max_rendertime, cachePath, autoSignIn.isSelected(), GuiSwing.type,
themeOptionsGroup.getSelection().getActionCommand(), // selected theme
priority.getValue()));
// wait for successful authentication (to store the public key)
// or do we already have one?
@@ -794,17 +778,14 @@ public class Settings implements Activity {
public class CheckCanStart implements KeyListener {
@Override
public void keyPressed(KeyEvent arg0) {
@Override public void keyPressed(KeyEvent arg0) {
}
@Override
public void keyReleased(KeyEvent arg0) {
@Override public void keyReleased(KeyEvent arg0) {
checkDisplaySaveButton();
}
@Override
public void keyTyped(KeyEvent arg0) {
@Override public void keyTyped(KeyEvent arg0) {
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2015 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -102,8 +102,7 @@ public class Working implements Activity {
log = Log.getInstance(parent_.getConfiguration());
}
@Override
public void show() {
@Override public void show() {
// If the stored theme and the UIManager's theme doesn't match is bc the user has changed it
if (!currentTheme.equals(UIManager.getLookAndFeel().getName())) {
// And, as the user has changed the theme, then we must recreate all the UI elements with session data
@@ -127,11 +126,11 @@ public class Working implements Activity {
lastRenderTime = new JLabel(lastRenderTime.getText());
lastRender = new JLabel(lastRender.getText());
userInfoQueuedUploadsAndSizeValue = new JLabel(userInfoQueuedUploadsAndSizeValue.getText());
// set the new theme as the current one
currentTheme = UIManager.getLookAndFeel().getName();
}
// current project
JPanel current_project_panel = new JPanel(new SpringLayout());
current_project_panel.setBorder(BorderFactory.createTitledBorder("Project"));
@@ -248,12 +247,12 @@ public class Working implements Activity {
global_constraints.weightx = 1;
global_constraints.gridx = 0;
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between logo and first panel
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between logo and first panel
parent.getContentPane().add(current_project_panel, global_constraints);
parent.getContentPane().add(global_stats_panel, global_constraints);
parent.getContentPane().add(session_info_panel, global_constraints);
parent.getContentPane().add(last_frame_panel, global_constraints);
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between last panel and buttons
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between last panel and buttons
parent.getContentPane().add(buttonsPanel, global_constraints);
Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2);
@@ -314,11 +313,9 @@ public class Working implements Activity {
}
public void displayUploadQueueStats(int queueSize, long queueVolume) {
userInfoQueuedUploadsAndSizeValue.setText(String.format("%d%s%s",
queueSize,
(queueSize > 0 ? String.format(" (%.2fMB) ", (queueVolume / 1024.0 / 1024.0)) : ""),
(queueSize == this.parent.getConfiguration().getMaxUploadingJob() ? "- Queue full!" : "")
));
userInfoQueuedUploadsAndSizeValue.setText(
String.format("%d%s%s", queueSize, (queueSize > 0 ? String.format(" (%.2fMB) ", (queueVolume / 1024.0 / 1024.0)) : ""),
(queueSize == this.parent.getConfiguration().getMaxUploadingJob() ? "- Queue full!" : "")));
// If the user has requested to exit, then we need to update the JButton with the queue size
if (this.exitAfterFrame.getText().startsWith("Cancel")) {
@@ -330,20 +327,19 @@ public class Working implements Activity {
}
}
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)",
queueSize,
(queueSize > 1 ? "s" : ""))
);
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", queueSize, (queueSize > 1 ? "s" : "")));
}
}
public void updateTime() {
if (this.parent.getClient().getStartTime() != 0) {
user_info_total_rendertime_this_session_value.setText(Utils.humanDuration(new Date((new Date().getTime() - this.parent.getClient().getStartTime()))));
user_info_total_rendertime_this_session_value
.setText(Utils.humanDuration(new Date((new Date().getTime() - this.parent.getClient().getStartTime()))));
}
Job job = this.parent.getClient().getRenderingJob();
if (job != null && job.getProcessRender() != null && job.getProcessRender().getStartTime() > 0) {
current_project_duration_value.setText("<html>" + Utils.humanDuration(new Date((new Date().getTime() - job.getProcessRender().getStartTime()))) + "</html>");
current_project_duration_value
.setText("<html>" + Utils.humanDuration(new Date((new Date().getTime() - job.getProcessRender().getStartTime()))) + "</html>");
}
else {
current_project_duration_value.setText("");
@@ -371,7 +367,7 @@ public class Working implements Activity {
else {
try {
String path = lastJob.getOutputImagePath();
BufferedImage img = ImageIO.read(new File(path));
float width = img.getWidth();
float height = img.getHeight();
@@ -386,16 +382,16 @@ public class Working implements Activity {
}
catch (IOException e) {
log.error(String.format("Working::showLastRender() Unable to load/preview rendered frame [%s]. Exception %s",
lastJob.getOutputImagePath(),
e.getMessage()));
lastJob.getOutputImagePath(), e.getMessage()));
}
}
if (icon != null) {
lastRender.setIcon(icon);
// don't use lastJob.getProcessRender().getDuration() due to timezone
if (lastJob.getProcessRender().getDuration() > 1) {
lastRenderTime.setText("Render time : " + Utils.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
lastRenderTime.setText("Render time : " + Utils
.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
}
}
}
@@ -463,8 +459,7 @@ public class Working implements Activity {
class PauseAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
Client client = parent.getClient();
if (client != null) {
if (client.isSuspended()) {
@@ -482,8 +477,7 @@ public class Working implements Activity {
}
class SettingsAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
if (parent != null) {
parent.showActivity(ActivityType.SETTINGS);
}
@@ -491,34 +485,22 @@ public class Working implements Activity {
}
class ExitAfterAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
Client client = parent.getClient();
if (client != null) {
if (client.isRunning()) {
String[] exitJobOptions = {"Exit after current Jobs", "Exit Immediately", "Do Nothing"};
String[] exitJobOptions = { "Exit after current Jobs", "Exit Immediately", "Do Nothing" };
int jobsQueueSize = client.getUploadQueueSize() + (client.isRunning() ? 1 : 0);
int userDecision = JOptionPane.showOptionDialog(
null,
String.format("<html>You have <strong>%d frame%s</strong> being uploaded or rendered. Do you want to finish the jobs or exit now?.\n\n",
jobsQueueSize , // Add the current frame to the total count ONLY if the client is running
(jobsQueueSize > 1 ? "s" : ""),
(jobsQueueSize > 1 ? (jobsQueueSize + " ") : ""),
(jobsQueueSize > 1 ? "s" : "")
),
"Exit Now or Later",
JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
exitJobOptions,
int userDecision = JOptionPane.showOptionDialog(null, String.format(
"<html>You have <strong>%d frame%s</strong> being uploaded or rendered. Do you want to finish the jobs or exit now?.\n\n",
jobsQueueSize, // Add the current frame to the total count ONLY if the client is running
(jobsQueueSize > 1 ? "s" : ""), (jobsQueueSize > 1 ? (jobsQueueSize + " ") : ""), (jobsQueueSize > 1 ? "s" : "")),
"Exit Now or Later", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, exitJobOptions,
exitJobOptions[2]); // Make the "Do nothing" button the default one to avoid mistakes
if (userDecision == 0) {
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)",
jobsQueueSize,
(jobsQueueSize > 1 ? "s" : ""))
);
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", jobsQueueSize, (jobsQueueSize > 1 ? "s" : "")));
client.askForStop();
}
@@ -536,8 +518,7 @@ public class Working implements Activity {
}
class blockJobAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
@Override public void actionPerformed(ActionEvent e) {
Client client = parent.getClient();
if (client != null) {
Job job = client.getRenderingJob();

View File

@@ -1,7 +1,7 @@
/*
* Copyright (C) 2015 Laurent CLOUET
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -105,8 +105,7 @@ public class CollapsibleJPanel extends JPanel {
setMaximumSize(new Dimension(getMaximumSize().width, height));
}
@Override
public Component add(Component component) { // Need this to get the original height of panel
@Override public Component add(Component component) { // Need this to get the original height of panel
Component returnComponent = super.add(component);
@@ -115,8 +114,7 @@ public class CollapsibleJPanel extends JPanel {
return returnComponent;
}
@Override
public void setBorder(Border border) { // Need this to get the border title
@Override public void setBorder(Border border) { // Need this to get the border title
if (border instanceof TitledBorder && (borderTitle == "")) {
borderTitle = ((TitledBorder) border).getTitle();
@@ -129,27 +127,22 @@ public class CollapsibleJPanel extends JPanel {
public class onClickHandler implements MouseListener {
@Override
public void mouseClicked(MouseEvent e) {
@Override public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
@Override public void mousePressed(MouseEvent e) {
if (e.getPoint().y < COLLAPSED_HEIGHT) { // Only if click is on top of panel
((CollapsibleJPanel) e.getComponent()).toggleCollapsed();
}
}
@Override
public void mouseEntered(MouseEvent e) {
@Override public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
@Override public void mouseExited(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
@Override public void mouseReleased(MouseEvent e) {
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2017 Laurent CLOUET
* Author Rolf Aretz Lap <rolf.aretz@ottogroup.com>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
@@ -25,8 +25,7 @@ import com.sheepit.client.Job;
public class CLIInputActionHandler implements CLIInputListener {
@Override
public void commandEntered(Client client, String command) {
@Override public void commandEntered(Client client, String command) {
int priorityLength = "priority".length();
//prevent Null Pointer at next step
@@ -89,7 +88,7 @@ public class CLIInputActionHandler implements CLIInputListener {
}
}
void displayStatus(Client client) {
if (client.isSuspended()) {
System.out.println("Status: paused");

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2017 Laurent CLOUET
* Author Rolf Aretz Lap <rolf.aretz@ottogroup.com>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2017 Laurent CLOUET
* Author Rolf Aretz Lap <rolf.aretz@ottogroup.com>
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.