File tree Expand file tree Collapse file tree 4 files changed +35
-13
lines changed
Expand file tree Collapse file tree 4 files changed +35
-13
lines changed Original file line number Diff line number Diff line change 2424public class MainWindow extends UiPart <Stage > {
2525
2626 private static final String FXML = "MainWindow.fxml" ;
27+ private static MainWindow instance = null ;
2728
2829 private final Logger logger = LogsCenter .getLogger (getClass ());
2930
@@ -67,6 +68,13 @@ public MainWindow(Stage primaryStage, Logic logic) {
6768 setWindowDefaultSize (logic .getGuiSettings ());
6869
6970 // setAccelerators();
71+
72+ // Set instance
73+ instance = this ;
74+ }
75+
76+ public static MainWindow getInstance () {
77+ return instance ;
7078 }
7179
7280 public Stage getPrimaryStage () {
@@ -173,7 +181,7 @@ private void handleExit() {
173181 *
174182 * @see seedu.address.logic.Logic#execute(String)
175183 */
176- private CommandResult executeCommand (String commandText ) throws CommandException , ParseException {
184+ public CommandResult executeCommand (String commandText ) throws CommandException , ParseException {
177185 try {
178186 CommandResult commandResult = logic .execute (commandText );
179187 logger .info ("Result: " + commandResult .getFeedbackToUser ());
Original file line number Diff line number Diff line change 44import javafx .scene .control .Label ;
55import javafx .scene .layout .HBox ;
66import javafx .scene .layout .Region ;
7+ import seedu .address .logic .commands .exceptions .CommandException ;
8+ import seedu .address .logic .parser .exceptions .ParseException ;
79import seedu .address .model .tag .Tag ;
810
911/**
@@ -43,6 +45,21 @@ public TagCard(Tag tag, int displayedIndex) {
4345 fileAddress .setText (tag .getFileAddress ().value );
4446 }
4547
48+ /**
49+ * Displays the information of the tag in the main window.
50+ *
51+ * @see seedu.address.logic.Logic#execute(String)
52+ */
53+ public void showTagInfo () throws CommandException , ParseException {
54+ MainWindow mainWindow = MainWindow .getInstance ();
55+ if (mainWindow == null ) {
56+ return ;
57+ }
58+
59+ String showInfoCommand = "show t/" + tag .getTagName ();
60+ mainWindow .executeCommand (showInfoCommand );
61+ }
62+
4663 @ Override
4764 public boolean equals (Object other ) {
4865 // short circuit if same object
Original file line number Diff line number Diff line change 55<?import javafx .scene.control.Menu?>
66<?import javafx .scene.control.MenuBar?>
77<?import javafx .scene.control.MenuItem?>
8- <?import javafx .scene.layout.HBox ?>
8+ <?import javafx .scene.control.SplitPane ?>
99<?import javafx .scene.layout.StackPane?>
1010<?import javafx .scene.layout.VBox?>
1111<?import javafx .stage.Stage?>
3030 </Menu >
3131 </menus >
3232 </MenuBar >
33- <HBox prefHeight = " 100.0 " prefWidth = " 200 .0" spacing = " 10 .0" VBox.vgrow=" ALWAYS" >
34- < children >
35- <VBox prefHeight =" 314 .0" prefWidth =" 188.0 " HBox.hgrow= " NEVER " >
33+ <SplitPane dividerPositions = " 0.3224299065420561 " prefHeight = " 160 .0" prefWidth = " 200 .0" VBox.vgrow=" ALWAYS" >
34+ < items >
35+ <VBox prefHeight =" 200 .0" prefWidth =" 100.0 " >
3636 <children >
37- <StackPane fx : id =" tagListPlaceholder" prefHeight =" 306 .0" prefWidth =" 139 .0" VBox.vgrow=" ALWAYS" />
37+ <StackPane fx : id =" tagListPlaceholder" prefHeight =" 294 .0" prefWidth =" 143 .0" VBox.vgrow=" ALWAYS" />
3838 </children >
3939 </VBox >
40- <VBox prefHeight =" 200.0" prefWidth =" 100.0" spacing = " 10.0 " HBox.hgrow= " ALWAYS " >
40+ <VBox prefHeight =" 200.0" prefWidth =" 100.0" >
4141 <children >
4242 <StackPane fx : id =" resultDisplayPlaceHolder" prefHeight =" 299.0" prefWidth =" 359.0" VBox.vgrow=" ALWAYS" />
4343 <StackPane fx : id =" lastInputPlaceHolder" prefHeight =" 15.0" prefWidth =" 301.0" VBox.vgrow=" NEVER" />
4444 </children >
4545 </VBox >
46- </children >
47- <padding >
48- <Insets bottom =" 10.0" left =" 10.0" right =" 10.0" top =" 10.0" />
49- </padding >
50- </HBox >
46+ </items >
47+ </SplitPane >
5148 <StackPane fx : id =" commandBoxPlaceHolder" prefHeight =" 41.0" prefWidth =" 501.0" >
5249 <padding >
5350 <Insets left =" 10.0" right =" 10.0" />
Original file line number Diff line number Diff line change 1010<?import javafx .scene.layout.VBox?>
1111<?import javafx .scene.text.Font?>
1212
13- <HBox id =" cardPane" fx : id =" cardPane" xmlns =" http://javafx.com/javafx/11" xmlns : fx =" http://javafx.com/fxml/1" >
13+ <HBox id =" cardPane" fx : id =" cardPane" onMouseClicked = " #showTagInfo " xmlns =" http://javafx.com/javafx/11" xmlns : fx =" http://javafx.com/fxml/1" >
1414 <GridPane HBox.hgrow=" ALWAYS" >
1515 <columnConstraints >
1616 <ColumnConstraints hgrow =" SOMETIMES" minWidth =" 10" prefWidth =" 150" />
You can’t perform that action at this time.
0 commit comments