Moved response beautification logic to DashboardController
This commit is contained in:
parent
ab8a4b879a
commit
59a5f9927c
12 changed files with 117 additions and 149 deletions
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.rohitawate.restaurant.homewindow;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXSnackbar;
|
||||
import com.rohitawate.restaurant.exceptions.UnreliableResponseException;
|
||||
|
@ -27,6 +28,7 @@ import com.rohitawate.restaurant.requestmanager.DELETERequestManager;
|
|||
import com.rohitawate.restaurant.requestmanager.DataDispatchRequestManager;
|
||||
import com.rohitawate.restaurant.requestmanager.GETRequestManager;
|
||||
import com.rohitawate.restaurant.requestmanager.RequestManager;
|
||||
import com.rohitawate.restaurant.util.RestaurantUtilities;
|
||||
import com.rohitawate.restaurant.util.Services;
|
||||
import com.rohitawate.restaurant.util.settings.Settings;
|
||||
import com.rohitawate.restaurant.util.themes.ThemeManager;
|
||||
|
@ -69,7 +71,8 @@ public class DashboardController implements Initializable {
|
|||
@FXML
|
||||
private TextArea responseArea;
|
||||
@FXML
|
||||
private Label statusCode, statusCodeDescription, responseTime, responseSize, errorTitle, errorDetails;
|
||||
private Label statusCode, statusCodeDescription, responseTime,
|
||||
responseSize, errorTitle, errorDetails, responseType;
|
||||
@FXML
|
||||
private JFXButton sendButton, cancelButton;
|
||||
@FXML
|
||||
|
@ -108,13 +111,13 @@ public class DashboardController implements Initializable {
|
|||
Services.loggingService.logSevere("Could not load headers/body tabs.", e, LocalDateTime.now());
|
||||
}
|
||||
|
||||
// Select GET by default
|
||||
httpMethodBox.getSelectionModel().select("GET");
|
||||
|
||||
responseBox.getChildren().remove(0);
|
||||
promptLayer.setVisible(true);
|
||||
httpMethodBox.getItems().addAll(httpMethods);
|
||||
|
||||
// Select GET by default
|
||||
httpMethodBox.getSelectionModel().select("GET");
|
||||
|
||||
paramsControllers = new ArrayList<>();
|
||||
paramsCountProperty = new SimpleIntegerProperty(paramsControllers.size());
|
||||
|
||||
|
@ -328,7 +331,7 @@ public class DashboardController implements Initializable {
|
|||
}
|
||||
|
||||
private void updateDashboard(RestaurantResponse response) {
|
||||
responseArea.setText(response.getBody());
|
||||
prettifyResponseBody(response);
|
||||
responseBox.getChildren().add(0, responseDetails);
|
||||
statusCode.setText(Integer.toString(response.getStatusCode()));
|
||||
statusCodeDescription.setText(Response.Status.fromStatusCode(response.getStatusCode()).getReasonPhrase());
|
||||
|
@ -336,6 +339,44 @@ public class DashboardController implements Initializable {
|
|||
responseSize.setText(Integer.toString(response.getSize()) + " B");
|
||||
}
|
||||
|
||||
private void prettifyResponseBody(RestaurantResponse response) {
|
||||
String type = response.getMediaType().toString();
|
||||
// Selects only the part preceding the ';', skipping the character encoding
|
||||
type = type.split(";")[0];
|
||||
String responseBody = response.getBody();
|
||||
|
||||
try {
|
||||
if (type != null) {
|
||||
switch (type.toLowerCase()) {
|
||||
case "application/json":
|
||||
responseType.setText("JSON");
|
||||
JsonNode node = RestaurantUtilities.mapper.readTree(responseBody);
|
||||
responseArea.setText(RestaurantUtilities.mapper.writeValueAsString(node));
|
||||
break;
|
||||
case "application/xml":
|
||||
responseType.setText("XML");
|
||||
responseArea.setText(RestaurantUtilities.mapper.writeValueAsString(responseBody));
|
||||
break;
|
||||
case "text/html":
|
||||
responseType.setText("HTML");
|
||||
responseArea.setText(responseBody);
|
||||
break;
|
||||
default:
|
||||
responseType.setText("PLAIN TEXT");
|
||||
responseArea.setText(responseBody);
|
||||
}
|
||||
} else {
|
||||
response.setBody("No body found in the response.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
snackBar.show("Response could not be parsed.", 5000);
|
||||
Services.loggingService.logSevere("Response could not be parsed.", e, LocalDateTime.now());
|
||||
errorLayer.setVisible(true);
|
||||
errorTitle.setText("Parsing Error");
|
||||
errorDetails.setText("RESTaurant could not parse the response.");
|
||||
}
|
||||
}
|
||||
|
||||
private void applyDashboardSettings() {
|
||||
String responseAreaCSS = "-fx-font-family: " + Settings.responseAreaFont + ";" +
|
||||
"-fx-font-size: " + Settings.responseAreaFontSize;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package com.rohitawate.restaurant.main;
|
||||
|
||||
import com.rohitawate.restaurant.util.MiscUtils;
|
||||
import com.rohitawate.restaurant.util.RestaurantUtilities;
|
||||
import com.rohitawate.restaurant.util.Services;
|
||||
import com.rohitawate.restaurant.util.settings.SettingsLoader;
|
||||
import com.rohitawate.restaurant.util.themes.ThemeManager;
|
||||
|
@ -46,7 +46,7 @@ public class Main extends Application {
|
|||
dashboardStage.setTitle("RESTaurant");
|
||||
dashboardStage.show();
|
||||
|
||||
MiscUtils.createBugReporter();
|
||||
RestaurantUtilities.createBugReporter();
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
package com.rohitawate.restaurant.requestmanager;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.rohitawate.restaurant.exceptions.UnreliableResponseException;
|
||||
import com.rohitawate.restaurant.models.requests.DELETERequest;
|
||||
import com.rohitawate.restaurant.models.responses.RestaurantResponse;
|
||||
|
@ -76,34 +73,9 @@ public class DELETERequestManager extends RequestManager {
|
|||
throw new UnreliableResponseException("301: Resource Moved Permanently", responseHelpText);
|
||||
}
|
||||
|
||||
String type = (String) serverResponse.getHeaders().getFirst("Content-type");
|
||||
String responseBody = serverResponse.readEntity(String.class);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
if (type != null) {
|
||||
switch (type.toLowerCase()) {
|
||||
case "application/json; charset=utf-8":
|
||||
case "application/json":
|
||||
JsonNode node = mapper.readTree(responseBody);
|
||||
response.setBody(mapper.writeValueAsString(node));
|
||||
break;
|
||||
case "application/xml; charset=utf-8":
|
||||
case "application/xml":
|
||||
response.setBody(mapper.writeValueAsString(responseBody));
|
||||
break;
|
||||
case "text/html":
|
||||
case "text/html; charset=utf-8":
|
||||
response.setBody(responseBody);
|
||||
break;
|
||||
default:
|
||||
response.setBody(responseBody);
|
||||
}
|
||||
} else {
|
||||
response.setBody("No body found in the response.");
|
||||
}
|
||||
|
||||
response.setBody(responseBody);
|
||||
response.setMediaType(serverResponse.getMediaType());
|
||||
response.setStatusCode(serverResponse.getStatus());
|
||||
response.setSize(responseBody.length());
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
package com.rohitawate.restaurant.requestmanager;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.rohitawate.restaurant.exceptions.UnreliableResponseException;
|
||||
import com.rohitawate.restaurant.models.requests.DataDispatchRequest;
|
||||
import com.rohitawate.restaurant.models.responses.RestaurantResponse;
|
||||
|
@ -162,34 +159,9 @@ public class DataDispatchRequestManager extends RequestManager {
|
|||
throw new UnreliableResponseException("301: Resource Moved Permanently", responseHelpText);
|
||||
}
|
||||
|
||||
String type = (String) serverResponse.getHeaders().getFirst("Content-type");
|
||||
String responseBody = serverResponse.readEntity(String.class);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
if (type != null) {
|
||||
switch (type.toLowerCase()) {
|
||||
case "application/json; charset=utf-8":
|
||||
case "application/json":
|
||||
JsonNode node = mapper.readTree(responseBody);
|
||||
response.setBody(mapper.writeValueAsString(node));
|
||||
break;
|
||||
case "application/xml; charset=utf-8":
|
||||
case "application/xml":
|
||||
response.setBody(mapper.writeValueAsString(responseBody));
|
||||
break;
|
||||
case "text/html":
|
||||
case "text/html; charset=utf-8":
|
||||
response.setBody(responseBody);
|
||||
break;
|
||||
default:
|
||||
response.setBody(responseBody);
|
||||
}
|
||||
} else {
|
||||
response.setBody("No body found in the response.");
|
||||
}
|
||||
|
||||
response.setBody(responseBody);
|
||||
response.setMediaType(serverResponse.getMediaType());
|
||||
response.setStatusCode(serverResponse.getStatus());
|
||||
response.setSize(responseBody.length());
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
package com.rohitawate.restaurant.requestmanager;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.rohitawate.restaurant.exceptions.UnreliableResponseException;
|
||||
import com.rohitawate.restaurant.models.responses.RestaurantResponse;
|
||||
import javafx.concurrent.Task;
|
||||
|
@ -71,34 +68,9 @@ public class GETRequestManager extends RequestManager {
|
|||
throw new UnreliableResponseException("301: Resource Moved Permanently", responseHelpText);
|
||||
}
|
||||
|
||||
String type = (String) serverResponse.getHeaders().getFirst("Content-type");
|
||||
String responseBody = serverResponse.readEntity(String.class);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
|
||||
if (type != null) {
|
||||
switch (type.toLowerCase()) {
|
||||
case "application/json; charset=utf-8":
|
||||
case "application/json":
|
||||
JsonNode node = mapper.readTree(responseBody);
|
||||
response.setBody(mapper.writeValueAsString(node));
|
||||
break;
|
||||
case "application/xml; charset=utf-8":
|
||||
case "application/xml":
|
||||
response.setBody(mapper.writeValueAsString(responseBody));
|
||||
break;
|
||||
case "text/html":
|
||||
case "text/html; charset=utf-8":
|
||||
response.setBody(responseBody);
|
||||
break;
|
||||
default:
|
||||
response.setBody(responseBody);
|
||||
}
|
||||
} else {
|
||||
response.setBody("No body found in the response.");
|
||||
}
|
||||
|
||||
response.setBody(responseBody);
|
||||
response.setMediaType(serverResponse.getMediaType());
|
||||
response.setStatusCode(serverResponse.getStatus());
|
||||
response.setSize(responseBody.length());
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package com.rohitawate.restaurant.util;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -24,7 +27,14 @@ import java.nio.file.Path;
|
|||
import java.nio.file.Paths;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class MiscUtils {
|
||||
public class RestaurantUtilities {
|
||||
public static ObjectMapper mapper;
|
||||
|
||||
static {
|
||||
mapper = new ObjectMapper();
|
||||
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes leading and trailing quotation marks from strings.
|
||||
*
|
||||
|
@ -42,7 +52,7 @@ public class MiscUtils {
|
|||
new Thread(() -> {
|
||||
File bugReporterFile = new File("RESTaurant/BugReporter.jar");
|
||||
if (!bugReporterFile.exists()) {
|
||||
InputStream inputStream = MiscUtils.class.getResourceAsStream("/BugReporter.jar");
|
||||
InputStream inputStream = RestaurantUtilities.class.getResourceAsStream("/BugReporter.jar");
|
||||
Path bugReporter = Paths.get("RESTaurant/BugReporter.jar");
|
||||
try {
|
||||
Files.copy(inputStream, bugReporter);
|
|
@ -19,7 +19,7 @@ package com.rohitawate.restaurant.util.history;
|
|||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.rohitawate.restaurant.models.DashboardState;
|
||||
import com.rohitawate.restaurant.util.MiscUtils;
|
||||
import com.rohitawate.restaurant.util.RestaurantUtilities;
|
||||
import com.rohitawate.restaurant.util.Services;
|
||||
import com.rohitawate.restaurant.util.settings.Settings;
|
||||
|
||||
|
@ -54,23 +54,23 @@ public class HistoryManager {
|
|||
queries = mapper.readTree(queriesFile);
|
||||
|
||||
statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("createRequestsTable").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("createRequestsTable").toString()));
|
||||
statement.execute();
|
||||
|
||||
statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("createHeadersTable").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("createHeadersTable").toString()));
|
||||
statement.execute();
|
||||
|
||||
statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("createRequestContentMapTable").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("createRequestContentMapTable").toString()));
|
||||
statement.execute();
|
||||
|
||||
statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("createBodiesTable").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("createBodiesTable").toString()));
|
||||
statement.execute();
|
||||
|
||||
statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("createTuplesTable").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("createTuplesTable").toString()));
|
||||
statement.execute();
|
||||
} catch (Exception E) {
|
||||
Services.loggingService.logSevere("Exception while initializing HistoryManager.", E, LocalDateTime.now());
|
||||
|
@ -93,7 +93,7 @@ public class HistoryManager {
|
|||
new Thread(() -> {
|
||||
try {
|
||||
statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("saveRequest").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveRequest").toString()));
|
||||
|
||||
statement.setString(1, state.getHttpMethod());
|
||||
statement.setString(2, String.valueOf(state.getTarget()));
|
||||
|
@ -111,7 +111,7 @@ public class HistoryManager {
|
|||
|
||||
if (state.getHeaders().size() > 0) {
|
||||
// Saves request headers
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveHeader").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveHeader").toString()));
|
||||
for (Entry entry : state.getHeaders().entrySet()) {
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, entry.getKey().toString());
|
||||
|
@ -123,7 +123,7 @@ public class HistoryManager {
|
|||
|
||||
if (state.getParams().size() > 0) {
|
||||
// Saves request parameters
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveTuple").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveTuple").toString()));
|
||||
for (Entry entry : state.getParams().entrySet()) {
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, "Param");
|
||||
|
@ -136,7 +136,7 @@ public class HistoryManager {
|
|||
|
||||
if (!(state.getHttpMethod().equals("GET") || state.getHttpMethod().equals("DELETE"))) {
|
||||
// Maps the request to its ContentType for faster recovery
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveRequestContentPair").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveRequestContentPair").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, state.getContentType());
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class HistoryManager {
|
|||
case MediaType.TEXT_HTML:
|
||||
case MediaType.APPLICATION_OCTET_STREAM:
|
||||
// Saves the body in case of raw content, or the file location in case of binary
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveBody").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveBody").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, state.getBody());
|
||||
statement.executeUpdate();
|
||||
|
@ -159,7 +159,7 @@ public class HistoryManager {
|
|||
if (state.getStringTuples().size() > 0) {
|
||||
for (Entry<String, String> entry : state.getStringTuples().entrySet()) {
|
||||
// Saves the string tuples
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveTuple").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveTuple").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, "String");
|
||||
statement.setString(3, entry.getKey());
|
||||
|
@ -173,7 +173,7 @@ public class HistoryManager {
|
|||
if (state.getStringTuples().size() > 0) {
|
||||
for (Entry<String, String> entry : state.getStringTuples().entrySet()) {
|
||||
// Saves the string tuples
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveTuple").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveTuple").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, "String");
|
||||
statement.setString(3, entry.getKey());
|
||||
|
@ -186,7 +186,7 @@ public class HistoryManager {
|
|||
if (state.getFileTuples().size() > 0) {
|
||||
for (Entry<String, String> entry : state.getFileTuples().entrySet()) {
|
||||
// Saves the file tuples
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("saveTuple").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("saveTuple").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, "File");
|
||||
statement.setString(3, entry.getKey());
|
||||
|
@ -214,7 +214,7 @@ public class HistoryManager {
|
|||
List<DashboardState> history = new ArrayList<>();
|
||||
try {
|
||||
// Loads the requests from the last x number of days, x being stored in Settings.showHistoryRange
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("selectRecentRequests").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectRecentRequests").toString()));
|
||||
String historyStartDate = LocalDate.now().minusDays(Settings.showHistoryRange).toString();
|
||||
statement.setString(1, historyStartDate);
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class HistoryManager {
|
|||
|
||||
if (!(state.getHttpMethod().equals("GET") || state.getHttpMethod().equals("DELETE"))) {
|
||||
// Retrieves request body ContentType for querying corresponding table
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("selectRequestContentType").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectRequestContentType").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
|
||||
ResultSet RS = statement.executeQuery();
|
||||
|
@ -255,7 +255,7 @@ public class HistoryManager {
|
|||
case MediaType.APPLICATION_XML:
|
||||
case MediaType.TEXT_HTML:
|
||||
case MediaType.APPLICATION_OCTET_STREAM:
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("selectRequestBody").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectRequestBody").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
|
||||
RS = statement.executeQuery();
|
||||
|
@ -286,7 +286,7 @@ public class HistoryManager {
|
|||
|
||||
try {
|
||||
PreparedStatement statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("selectRequestHeaders").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectRequestHeaders").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
|
||||
ResultSet RS = statement.executeQuery();
|
||||
|
@ -316,7 +316,7 @@ public class HistoryManager {
|
|||
|
||||
try {
|
||||
PreparedStatement statement =
|
||||
conn.prepareStatement(MiscUtils.trimString(queries.get("selectTuples").toString()));
|
||||
conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectTuples").toString()));
|
||||
statement.setInt(1, requestID);
|
||||
statement.setString(2, type);
|
||||
|
||||
|
@ -342,7 +342,7 @@ public class HistoryManager {
|
|||
*/
|
||||
private boolean isDuplicate(DashboardState newState) {
|
||||
try {
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("selectMostRecentRequest").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectMostRecentRequest").toString()));
|
||||
ResultSet RS = statement.executeQuery();
|
||||
|
||||
int lastRequestID = -1;
|
||||
|
@ -378,7 +378,7 @@ public class HistoryManager {
|
|||
case MediaType.APPLICATION_XML:
|
||||
case MediaType.TEXT_HTML:
|
||||
case MediaType.APPLICATION_OCTET_STREAM:
|
||||
statement = conn.prepareStatement(MiscUtils.trimString(queries.get("selectRequestBody").toString()));
|
||||
statement = conn.prepareStatement(RestaurantUtilities.trimString(queries.get("selectRequestBody").toString()));
|
||||
statement.setInt(1, lastRequestID);
|
||||
|
||||
RS = statement.executeQuery();
|
||||
|
|
|
@ -18,7 +18,7 @@ package com.rohitawate.restaurant.util.settings;
|
|||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.rohitawate.restaurant.util.MiscUtils;
|
||||
import com.rohitawate.restaurant.util.RestaurantUtilities;
|
||||
import com.rohitawate.restaurant.util.Services;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -60,7 +60,7 @@ public class SettingsLoader implements Runnable {
|
|||
if (Settings.connectionReadTimeOutEnable)
|
||||
Settings.connectionReadTimeOut = nodes.get("connectionReadTimeOut").asInt();
|
||||
|
||||
Settings.theme = MiscUtils.trimString(nodes.get("theme").toString());
|
||||
Settings.theme = RestaurantUtilities.trimString(nodes.get("theme").toString());
|
||||
} catch (Exception E) {
|
||||
Services.loggingService.logInfo("Settings file not found. Defaults will be used.", LocalDateTime.now());
|
||||
} finally {
|
||||
|
|
|
@ -156,6 +156,7 @@
|
|||
-fx-background-color: #3d3d3d;
|
||||
}
|
||||
|
||||
|
||||
.scroll-pane .scroll-bar .thumb {
|
||||
-fx-background-color: #808080;
|
||||
}
|
||||
|
@ -240,6 +241,10 @@
|
|||
-fx-background-color: #282828;
|
||||
}
|
||||
|
||||
#rawInputArea {
|
||||
-fx-font-size: 15px;
|
||||
}
|
||||
|
||||
/* SnackBar */
|
||||
.jfx-snackbar-content {
|
||||
-fx-background-color: black;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<TabPane fx:id="bodyTabPane" prefHeight="100.0" prefWidth="1280.0" stylesheets="@../../css/Adreana.css"
|
||||
tabClosingPolicy="UNAVAILABLE" tabMinWidth="150.0" xmlns="http://javafx.com/javafx/8.0.111"
|
||||
tabClosingPolicy="UNAVAILABLE" tabMinWidth="150.0" xmlns="http://javafx.com/javafx/8.0.141"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.rohitawate.restaurant.homewindow.BodyTabController">
|
||||
<tabs>
|
||||
<Tab fx:id="formTab" text="FORM"/>
|
||||
|
|
|
@ -16,26 +16,15 @@
|
|||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<?import com.jfoenix.controls.JFXButton?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.Tooltip?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<StackPane fx:id="dashboard" stylesheets="@../../css/Adreana.css" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.rohitawate.restaurant.homewindow.DashboardController">
|
||||
<?import com.jfoenix.controls.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<StackPane fx:id="dashboard" prefHeight="720.0" prefWidth="1280.0" stylesheets="@../../css/Adreana.css"
|
||||
xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.rohitawate.restaurant.homewindow.DashboardController">
|
||||
<children>
|
||||
<VBox prefHeight="200.0" prefWidth="100.0">
|
||||
<children>
|
||||
|
@ -146,7 +135,8 @@
|
|||
<children>
|
||||
<VBox fx:id="responseBox" alignment="CENTER" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<HBox fx:id="responseDetails" alignment="CENTER_RIGHT" maxHeight="50.0" minHeight="50.0" VBox.vgrow="ALWAYS">
|
||||
<HBox fx:id="responseDetails" alignment="CENTER_RIGHT" maxHeight="50.0"
|
||||
minHeight="50.0" spacing="30.0" VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
|
@ -165,20 +155,25 @@
|
|||
</Label>
|
||||
</children>
|
||||
</HBox>
|
||||
<Label fx:id="responseType" text="JSON" textFill="#2dcd2d">
|
||||
<font>
|
||||
<Font name="Liberation Mono Bold" size="17.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="responseTime" text="151 ms" textFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
<Insets/>
|
||||
</HBox.margin>
|
||||
<font>
|
||||
<Font name="Liberation Mono" size="20.0" />
|
||||
<Font name="Liberation Mono" size="17.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="responseSize" layoutX="1187.0" layoutY="23.0" text="1998 B" textFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
<font>
|
||||
<Font name="Liberation Mono" size="20.0" />
|
||||
<Font name="Liberation Mono" size="17.0"/>
|
||||
</font>
|
||||
<HBox.margin>
|
||||
<Insets right="30.0" />
|
||||
<Insets/>
|
||||
</HBox.margin>
|
||||
</Label>
|
||||
<JFXButton fx:id="clearResponseAreaButton" buttonType="RAISED" onAction="#clearResponseArea" ripplerFill="WHITE" text=" CLEAR" textFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
|
@ -230,14 +225,15 @@
|
|||
</VBox>
|
||||
<VBox fx:id="promptLayer" alignment="CENTER" prefHeight="200.0" prefWidth="100.0" visible="false">
|
||||
<children>
|
||||
<Label text="Enter an address, select a method and hit send. 🚀" textFill="WHITE">
|
||||
<Label text="Enter an address, select a method and hit send."
|
||||
textFill="WHITE">
|
||||
<font>
|
||||
<Font size="32.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label text="It's not rocket science." textFill="#9e9e9e">
|
||||
<Label text="🚀" textFill="#0093ff">
|
||||
<font>
|
||||
<Font name="System Italic" size="27.0" />
|
||||
<Font size="43.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<children>
|
||||
<Label fx:id="requestType" textFill="ORANGERED" textOverrun="WORD_ELLIPSIS">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0" />
|
||||
<Font name="Liberation Mono Bold" size="18.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
|
|
Loading…
Reference in a new issue