File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 24
24
public class MainWindow extends UiPart <Stage > {
25
25
26
26
private static final String FXML = "MainWindow.fxml" ;
27
+ private static MainWindow instance = null ;
27
28
28
29
private final Logger logger = LogsCenter .getLogger (getClass ());
29
30
@@ -67,6 +68,13 @@ public MainWindow(Stage primaryStage, Logic logic) {
67
68
setWindowDefaultSize (logic .getGuiSettings ());
68
69
69
70
// setAccelerators();
71
+
72
+ // Set instance
73
+ instance = this ;
74
+ }
75
+
76
+ public static MainWindow getInstance () {
77
+ return instance ;
70
78
}
71
79
72
80
public Stage getPrimaryStage () {
@@ -173,7 +181,7 @@ private void handleExit() {
173
181
*
174
182
* @see seedu.address.logic.Logic#execute(String)
175
183
*/
176
- private CommandResult executeCommand (String commandText ) throws CommandException , ParseException {
184
+ public CommandResult executeCommand (String commandText ) throws CommandException , ParseException {
177
185
try {
178
186
CommandResult commandResult = logic .execute (commandText );
179
187
logger .info ("Result: " + commandResult .getFeedbackToUser ());
Original file line number Diff line number Diff line change 4
4
import javafx .scene .control .Label ;
5
5
import javafx .scene .layout .HBox ;
6
6
import javafx .scene .layout .Region ;
7
+ import seedu .address .logic .commands .exceptions .CommandException ;
8
+ import seedu .address .logic .parser .exceptions .ParseException ;
7
9
import seedu .address .model .tag .Tag ;
8
10
9
11
/**
@@ -43,6 +45,21 @@ public TagCard(Tag tag, int displayedIndex) {
43
45
fileAddress .setText (tag .getFileAddress ().value );
44
46
}
45
47
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
+
46
63
@ Override
47
64
public boolean equals (Object other ) {
48
65
// short circuit if same object
Original file line number Diff line number Diff line change 10
10
<?import javafx .scene.layout.VBox?>
11
11
<?import javafx .scene.text.Font?>
12
12
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" >
14
14
<GridPane HBox.hgrow=" ALWAYS" >
15
15
<columnConstraints >
16
16
<ColumnConstraints hgrow =" SOMETIMES" minWidth =" 10" prefWidth =" 150" />
You can’t perform that action at this time.
0 commit comments