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 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 5
5
<?import javafx .scene.control.Menu?>
6
6
<?import javafx .scene.control.MenuBar?>
7
7
<?import javafx .scene.control.MenuItem?>
8
- <?import javafx .scene.layout.HBox ?>
8
+ <?import javafx .scene.control.SplitPane ?>
9
9
<?import javafx .scene.layout.StackPane?>
10
10
<?import javafx .scene.layout.VBox?>
11
11
<?import javafx .stage.Stage?>
30
30
</Menu >
31
31
</menus >
32
32
</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 " >
36
36
<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" />
38
38
</children >
39
39
</VBox >
40
- <VBox prefHeight =" 200.0" prefWidth =" 100.0" spacing = " 10.0 " HBox.hgrow= " ALWAYS " >
40
+ <VBox prefHeight =" 200.0" prefWidth =" 100.0" >
41
41
<children >
42
42
<StackPane fx : id =" resultDisplayPlaceHolder" prefHeight =" 299.0" prefWidth =" 359.0" VBox.vgrow=" ALWAYS" />
43
43
<StackPane fx : id =" lastInputPlaceHolder" prefHeight =" 15.0" prefWidth =" 301.0" VBox.vgrow=" NEVER" />
44
44
</children >
45
45
</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 >
51
48
<StackPane fx : id =" commandBoxPlaceHolder" prefHeight =" 41.0" prefWidth =" 501.0" >
52
49
<padding >
53
50
<Insets left =" 10.0" right =" 10.0" />
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