forked from nus-cs2103-AY1920S2/addressbook-level3
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add description window and touch up ui
- Loading branch information
1 parent
210f2e8
commit 22550fd
Showing
16 changed files
with
288 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package modulo.ui; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Label; | ||
import javafx.stage.Stage; | ||
import modulo.commons.core.LogsCenter; | ||
|
||
/** | ||
* Controller for a description page | ||
*/ | ||
public class DescriptionWindow extends UiPart<Stage> { | ||
|
||
private static final Logger logger = LogsCenter.getLogger(DescriptionWindow.class); | ||
private static final String FXML = "DescriptionWindow.fxml"; | ||
|
||
@FXML | ||
private Label description; | ||
|
||
@FXML | ||
private Label moduleName; | ||
|
||
/** | ||
* Creates a new DescriptionWindow. | ||
* | ||
* @param root Stage to use as the root of the DescriptionWindow. | ||
* @param description Description to display. | ||
*/ | ||
public DescriptionWindow(Stage root, String description, String moduleName) { | ||
super(FXML, root); | ||
this.moduleName.setText(moduleName); | ||
this.moduleName.setWrapText(true); | ||
this.moduleName.setMaxWidth(600.0); | ||
this.description.setText(description); | ||
this.description.setWrapText(true); | ||
this.description.setMaxWidth(600.0); | ||
} | ||
|
||
/** | ||
* Creates a new empty DescriptionWindow. | ||
*/ | ||
public DescriptionWindow() { | ||
this(new Stage(), "", ""); | ||
} | ||
|
||
/** | ||
* Creates a new DescriptionWindow with a description. | ||
*/ | ||
public DescriptionWindow(String description, String moduleName) { | ||
this(new Stage(), description, moduleName); | ||
} | ||
|
||
/** | ||
* Shows the help window. | ||
* | ||
* @throws IllegalStateException <ul> | ||
* <li> | ||
* if this method is called on a thread other than the JavaFX | ||
* Application Thread. | ||
* </li> | ||
* <li> | ||
* if this method is called during animation or layout processing. | ||
* </li> | ||
* <li> | ||
* if this method is called on the primary stage. | ||
* </li> | ||
* <li> | ||
* if {@code dialogStage} is already showing. | ||
* </li> | ||
* </ul> | ||
*/ | ||
public void show() { | ||
logger.fine("Showing help page about the application."); | ||
getRoot().show(); | ||
getRoot().centerOnScreen(); | ||
} | ||
|
||
/** | ||
* Returns true if the help window is currently being shown. | ||
*/ | ||
public boolean isShowing() { | ||
return getRoot().isShowing(); | ||
} | ||
|
||
/** | ||
* Hides the help window. | ||
*/ | ||
public void hide() { | ||
getRoot().hide(); | ||
} | ||
|
||
/** | ||
* Focuses on the help window. | ||
*/ | ||
public void focus() { | ||
getRoot().requestFocus(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.