Skip to content

Commit

Permalink
[48] Tweak GUI to emphasize active components
Browse files Browse the repository at this point in the history
  • Loading branch information
m133225 authored Sep 14, 2016
1 parent 126d62a commit 4653f0e
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/
lib/*
*.iml
*.log
*.log.*
*.csv
config.json
*.xml
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/seedu/address/controller/CommandBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ public class CommandBox extends BaseUiPart {

private AnchorPane placeHolderPane;
private AnchorPane commandPane;
private StatusBarHeader statusBarHeader;
private ResultDisplay resultDisplay;
private ModelManager modelManager;
private Parser parser;

@FXML
private TextField commandTextField;

public static CommandBox load(Stage primaryStage, AnchorPane commandBoxPlaceholder, Parser parser,
StatusBarHeader statusBarHeader, ModelManager modelManager) {
ResultDisplay resultDisplay, ModelManager modelManager) {
CommandBox commandBox = UiPartLoader.loadUiPart(primaryStage, commandBoxPlaceholder, new CommandBox());
commandBox.configure(parser, statusBarHeader, modelManager);
commandBox.configure(parser, resultDisplay, modelManager);
return commandBox;
}

private void configure(Parser parser, StatusBarHeader statusBarHeader, ModelManager modelManager) {
private void configure(Parser parser, ResultDisplay resultDisplay, ModelManager modelManager) {
this.parser = parser;
this.statusBarHeader = statusBarHeader;
this.resultDisplay = resultDisplay;
this.modelManager = modelManager;
addToPlaceholder();
}
Expand Down Expand Up @@ -79,7 +79,7 @@ private void handleCommandInputChanged() {
commandTextField.setText("");
}

statusBarHeader.postMessage(result.feedbackToUser);
resultDisplay.postMessage(result.feedbackToUser);

logger.info("Result: " + result.feedbackToUser);
logger.fine("Invalid command: " + commandTextField.getText());
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/seedu/address/controller/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@
import javafx.scene.Scene;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import seedu.address.MainApp;
import seedu.address.browser.BrowserManager;
import seedu.address.commands.Command;
import seedu.address.commands.CommandResult;
import seedu.address.commands.IncorrectCommand;
import seedu.address.events.controller.ExitAppRequestEvent;
import seedu.address.events.hotkey.KeyBindingEvent;
import seedu.address.model.ModelManager;
Expand All @@ -36,7 +32,7 @@ public class MainWindow extends BaseUiPart {
private final Logger logger = LoggerManager.getLogger(MainWindow.class);
private static final String ICON = "/images/address_book_32.png";
private static final String FXML = "MainWindow.fxml";
private static final String HEADER_STATUSBAR_PLACEHOLDER_FIELD_ID = "#headerStatusbarPlaceholder";
private static final String RESULT_DISPLAY_PLACEHOLDER_FIELD_ID = "#resultDisplayPlaceholder";
private static final String FOOTER_STATUSBAR_PLACEHOLDER_FIELD_ID = "#footerStatusbarPlaceholder";
private static final String COMMAND_BOX_PLACEHOLDER_FIELD_ID = "#commandBoxPlaceholder";
private static final String BROWSER_PLACEHOLDER = "#personWebpage";
Expand All @@ -54,7 +50,7 @@ public class MainWindow extends BaseUiPart {

// Independent Ui parts residing in this Ui container
private PersonListPanel personListPanel;
private StatusBarHeader statusBarHeader;
private ResultDisplay resultDisplay;
private StatusBarFooter statusBarFooter;
private CommandBox commandBox;
private WebView browser;
Expand Down Expand Up @@ -124,9 +120,9 @@ private void setKeyEventHandler() {

public void fillInnerParts() {
personListPanel = PersonListPanel.load(primaryStage, getPersonListPlaceholder(), modelManager, browserManager);
statusBarHeader = StatusBarHeader.load(primaryStage, getHeaderStatusbarPlaceholder());
resultDisplay = ResultDisplay.load(primaryStage, getHeaderStatusbarPlaceholder());
statusBarFooter = StatusBarFooter.load(primaryStage, getFooterStatusbarPlaceholder(), addressBookName);
commandBox = CommandBox.load(primaryStage, getCommandBoxPlaceholder(), parser, statusBarHeader, modelManager);
commandBox = CommandBox.load(primaryStage, getCommandBoxPlaceholder(), parser, resultDisplay, modelManager);
browser = loadBrowser();
}

Expand All @@ -139,7 +135,7 @@ private AnchorPane getFooterStatusbarPlaceholder() {
}

private AnchorPane getHeaderStatusbarPlaceholder() {
return this.getAnchorPane(HEADER_STATUSBAR_PLACEHOLDER_FIELD_ID);
return this.getAnchorPane(RESULT_DISPLAY_PLACEHOLDER_FIELD_ID);
}

private WebView loadBrowser() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
/**
* A controller for the status bar that is displayed at the header of the application.
*/
public class StatusBarHeader extends BaseUiPart {
public static final String HEADER_STATUS_BAR_ID = "headerStatusBar";
private static final String STATUS_BAR_STYLE_SHEET = "status-bar-with-border";
public class ResultDisplay extends BaseUiPart {
public static final String HEADER_STATUS_BAR_ID = "resultDisplay";
private static final String STATUS_BAR_STYLE_SHEET = "result-display";
private StatusBar headerStatusBar;

private static final String FXML = "StatusBarHeader.fxml";
private static final String FXML = "ResultDisplay.fxml";

private AnchorPane placeHolder;

private AnchorPane mainPane;

public static StatusBarHeader load(Stage primaryStage, AnchorPane placeHolder) {
StatusBarHeader statusBar = UiPartLoader.loadUiPart(primaryStage, placeHolder, new StatusBarHeader());
public static ResultDisplay load(Stage primaryStage, AnchorPane placeHolder) {
ResultDisplay statusBar = UiPartLoader.loadUiPart(primaryStage, placeHolder, new ResultDisplay());
statusBar.configure();
return statusBar;
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/view/DarkTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,15 @@

.status-bar {
-fx-background-color: derive(#1d1d1d, 20%);
-fx-text-fill: white;
-fx-text-fill: black;
}

.result-display {
-fx-background-color: #ffffff;
}

.result-display .label {
-fx-text-fill: black !important;
}

.status-bar .label {
Expand Down
14 changes: 11 additions & 3 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import java.net.URL?>
<VBox maxHeight="Infinity" maxWidth="Infinity" minHeight="-Infinity" minWidth="-Infinity" stylesheets="@DarkTheme.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seedu.address.controller.MainWindow">
<VBox maxHeight="Infinity" maxWidth="Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seedu.address.controller.MainWindow">
<stylesheets>
<URL value="@DarkTheme.css" />
<URL value="@Extensions.css" />
Expand All @@ -25,8 +25,16 @@
</Menu>
</menus>
</MenuBar>
<AnchorPane VBox.vgrow="NEVER" fx:id="headerStatusbarPlaceholder" styleClass="anchor-pane-with-border" minHeight="80" prefHeight="80" maxHeight="80"/>
<AnchorPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="anchor-pane-with-border"/>
<AnchorPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="anchor-pane-with-border">
<padding>
<Insets top="5.0" bottom="5.0" left="10.0" right="10.0"/>
</padding>
</AnchorPane>
<AnchorPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="anchor-pane-with-border" minHeight="100" prefHeight="100" maxHeight="100">
<padding>
<Insets top="5.0" bottom="5.0" left="10.0" right="10.0"/>
</padding>
</AnchorPane>
<SplitPane id="splitPane" fx:id="splitPane" dividerPositions="0.4" VBox.vgrow="ALWAYS">
<items>
<VBox fx:id="personList" minWidth="340" prefWidth="340">
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/view/ResultDisplay.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.AnchorPane?>
<?import java.net.URL?>
<AnchorPane styleClass="anchor-pane-with-border" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="seedu.address.controller.ResultDisplay">
<stylesheets>
<URL value="@DarkTheme.css" />
<URL value="@Extensions.css" />
</stylesheets>
</AnchorPane>
5 changes: 0 additions & 5 deletions src/main/resources/view/StatusBarHeader.fxml

This file was deleted.

4 changes: 2 additions & 2 deletions src/test/java/guitests/guihandles/HeaderStatusBarHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import javafx.stage.Stage;
import org.controlsfx.control.StatusBar;
import seedu.address.TestApp;
import seedu.address.controller.StatusBarHeader;
import seedu.address.controller.ResultDisplay;

/**
* A handler for the HeaderStatusBar of the UI
Expand All @@ -20,6 +20,6 @@ public String getText() {
}

private StatusBar getStatusBar() {
return (StatusBar) getNode("#" + StatusBarHeader.HEADER_STATUS_BAR_ID);
return (StatusBar) getNode("#" + ResultDisplay.HEADER_STATUS_BAR_ID);
}
}

0 comments on commit 4653f0e

Please sign in to comment.