Apply suggestions from code review
Co-authored-by: CyB3RC0nN0R <CyB3RC0nN0R@users.noreply.github.com>
This commit is contained in:
parent
3960f955d8
commit
2653ec5fee
@ -69,8 +69,9 @@ public class Receiver extends Thread {
|
|||||||
// Get appropriate processor
|
// Get appropriate processor
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
final Consumer processor = processors.get(obj.getClass());
|
final Consumer processor = processors.get(obj.getClass());
|
||||||
if (processor == null) logger.log(Level.WARNING,
|
if (processor == null)
|
||||||
String.format("The received object has the class %s for which no processor is defined.", obj.getClass()));
|
logger.log(Level.WARNING, String.format(
|
||||||
|
"The received object has the class %s for which no processor is defined.", obj.getClass()));
|
||||||
else processor.accept(obj);
|
else processor.accept(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public final class Startup extends Application {
|
|||||||
if (!config.isInitialized()) throw new EnvoyException("Configuration is not fully initialized");
|
if (!config.isInitialized()) throw new EnvoyException("Configuration is not fully initialized");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
new Alert(AlertType.ERROR, "Error loading configuration values:\n" + e);
|
new Alert(AlertType.ERROR, "Error loading configuration values:\n" + e);
|
||||||
logger.log(Level.SEVERE, "Error loading configuration values", e);
|
logger.log(Level.SEVERE, "Error loading configuration values: ", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -199,15 +199,15 @@ public final class ChatScene {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the text length of the {@code messageTextArea}, adjusts the
|
* Checks the text length of the {@code messageTextArea}, adjusts the
|
||||||
* {@code remainingChars} - Label and checks whether to send the message
|
* {@code remainingChars} label and checks whether to send the message
|
||||||
* automatically.
|
* automatically.
|
||||||
*
|
*
|
||||||
* @param e the keys that have been entered
|
* @param e the key event that will be analyzed for a post request
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void checkKeyCombination(KeyEvent e) {
|
private void checkKeyCombination(KeyEvent e) {
|
||||||
// checks whether the text is too long
|
// Checks whether the text is too long
|
||||||
messageTextUpdated();
|
messageTextUpdated();
|
||||||
// Automatic sending of messages via (ctrl +) enter
|
// Automatic sending of messages via (ctrl +) enter
|
||||||
checkPostConditions(e);
|
checkPostConditions(e);
|
||||||
@ -219,8 +219,8 @@ public final class ChatScene {
|
|||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void checkPostConditions(KeyEvent e) {
|
private void checkPostConditions(KeyEvent e) {
|
||||||
if (!postButton.isDisabled() && settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
|
if (!postButton.isDisabled() && (settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
|
||||||
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown())
|
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown()))
|
||||||
postMessage();
|
postMessage();
|
||||||
postButton.setDisable(messageTextArea.getText().isBlank() || currentChat == null);
|
postButton.setDisable(messageTextArea.getText().isBlank() || currentChat == null);
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ public final class ChatScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the text and text-color of the {@code remainingChars} - Label.
|
* Sets the text and text color of the {@code remainingChars} label.
|
||||||
*
|
*
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user