-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[W7.8][W12-3]Ler Wei Sheng #145
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* Represents a Person's address in the address book. | ||
* Guarantees: immutable; is valid as declared in {@link #isValidAddress(String)} | ||
*/ | ||
public class Address { | ||
public class Address implements Printable{ | ||
|
||
public static final String EXAMPLE = "123, some street"; | ||
public static final String MESSAGE_ADDRESS_CONSTRAINTS = "Person addresses can be in any format"; | ||
|
@@ -55,4 +55,11 @@ public int hashCode() { | |
public boolean isPrivate() { | ||
return isPrivate; | ||
} | ||
|
||
@Override | ||
public String getPrintableString (Printable... printables) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of taking in |
||
return "Address: " + value; | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* Represents a Person's email in the address book. | ||
* Guarantees: immutable; is valid as declared in {@link #isValidEmail(String)} | ||
*/ | ||
public class Email { | ||
public class Email implements Printable{ | ||
|
||
public static final String EXAMPLE = "[email protected]"; | ||
public static final String MESSAGE_EMAIL_CONSTRAINTS = | ||
|
@@ -58,4 +58,11 @@ public int hashCode() { | |
public boolean isPrivate() { | ||
return isPrivate; | ||
} | ||
|
||
@Override | ||
public String getPrintableString (Printable... printables) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: |
||
return "Email: " + value; | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* Represents a Person's name in the address book. | ||
* Guarantees: immutable; is valid as declared in {@link #isValidName(String)} | ||
*/ | ||
public class Name { | ||
public class Name implements Printable{ | ||
|
||
public static final String EXAMPLE = "John Doe"; | ||
public static final String MESSAGE_NAME_CONSTRAINTS = "Person names should be spaces or alphanumeric characters"; | ||
|
@@ -61,4 +61,9 @@ public int hashCode() { | |
return fullName.hashCode(); | ||
} | ||
|
||
@Override | ||
public String getPrintableString (Printable... printables) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return "Nama-ewa: " + fullName; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* Represents a Person's phone number in the address book. | ||
* Guarantees: immutable; is valid as declared in {@link #isValidPhone(String)} | ||
*/ | ||
public class Phone { | ||
public class Phone implements Printable{ | ||
|
||
public static final String EXAMPLE = "123456789"; | ||
public static final String MESSAGE_PHONE_CONSTRAINTS = "Person phone numbers should only contain numbers"; | ||
|
@@ -56,4 +56,12 @@ public int hashCode() { | |
public boolean isPrivate() { | ||
return isPrivate; | ||
} | ||
|
||
|
||
@Override | ||
public String getPrintableString (Printable... printables) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return "Phono-desu: " + value; | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package seedu.addressbook.data.person; | ||
|
||
public interface Printable { | ||
public String getPrintableString (Printable... printables); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ | |
-fx-font-family: "Segoe UI Semibold"; | ||
-fx-font-size: 10pt; | ||
-fx-padding: 5 5 5 5; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
import javafx.fxml.FXML; | ||
import javafx.scene.control.TextArea; | ||
import javafx.scene.control.TextField; | ||
import javafx.beans.value.ChangeListener; | ||
import javafx.beans.value.ObservableValue; | ||
import seedu.addressbook.commands.ExitCommand; | ||
import seedu.addressbook.logic.Logic; | ||
import seedu.addressbook.commands.CommandResult; | ||
|
@@ -23,24 +25,12 @@ public class MainWindow { | |
private Logic logic; | ||
private Stoppable mainApp; | ||
|
||
public MainWindow(){ | ||
} | ||
|
||
public void setLogic(Logic logic){ | ||
this.logic = logic; | ||
} | ||
|
||
public void setMainApp(Stoppable mainApp){ | ||
this.mainApp = mainApp; | ||
} | ||
|
||
@FXML | ||
private TextArea outputConsole; | ||
|
||
@FXML | ||
private TextField commandInput; | ||
|
||
|
||
@FXML | ||
void onCommand(ActionEvent event) { | ||
try { | ||
|
@@ -58,6 +48,30 @@ void onCommand(ActionEvent event) { | |
} | ||
} | ||
|
||
@FXML | ||
private void initialize() { | ||
commandInput.textProperty().addListener(new ChangeListener<String>() { | ||
@Override | ||
public void changed(ObservableValue<? extends String> observable, | ||
String oldValue, String newValue) { | ||
// System.out.println(newValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can remove this instead of just comment out. |
||
} | ||
}); | ||
} | ||
|
||
public MainWindow(){ | ||
} | ||
|
||
|
||
public void setLogic(Logic logic){ | ||
this.logic = logic; | ||
} | ||
|
||
public void setMainApp(Stoppable mainApp){ | ||
this.mainApp = mainApp; | ||
} | ||
|
||
|
||
private void exitApp() throws Exception { | ||
mainApp.stop(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,18 @@ | |
<?import javafx.scene.control.TextField?> | ||
<?import javafx.scene.layout.VBox?> | ||
|
||
<?import javafx.scene.image.ImageView?> | ||
<?import javafx.scene.image.Image?> | ||
|
||
<VBox stylesheets="@/seedu/addressbook/ui/DarkTheme.css" alignment="center" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" | ||
fx:controller="seedu.addressbook.ui.MainWindow"> | ||
|
||
<children> | ||
<ImageView> | ||
<image> | ||
<Image url="@/seedu/addressbook/resources/[email protected]" /> | ||
</image> | ||
</ImageView> | ||
|
||
<TextField fx:id="commandInput" onAction="#onCommand" VBox.vgrow="NEVER"> | ||
</TextField> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import