Skip to content
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

Show Total Cost in UI #157

Closed
wants to merge 11 commits into from

Conversation

jiaweiteo
Copy link

No description provided.

@jiaweiteo jiaweiteo added this to the v1.3 milestone Oct 24, 2020
@lyeyixian lyeyixian linked an issue Oct 25, 2020 that may be closed by this pull request
@@ -234,6 +234,7 @@ public void setTravelPlanObject(TravelPlanObject target, TravelPlanObject edited
requireAllNonNull(target, editedTravelPlanObject);
assert directory instanceof TravelPlan : "Directory must be set to a TravelPlan to call setTravelPlanObject.";
TravelPlan tp = (TravelPlan) directory;
Directory d = tp;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this line suppose to do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted

private final Logger logger = LogsCenter.getLogger(TravelPlanPanel.class);

private Directory directory;

private Logic logic;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need logic here tho? Doesn't seem to be used anywhere in the changes in this class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted

@@ -39,11 +46,16 @@ public TravelPlanPanel(Directory directory) {
public void update() {
if (directory instanceof TravelPlan) {
TravelPlan travelPlan = (TravelPlan) directory;
String cost = travelPlan.getTotalCost();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now no need do typecasting already. You can add this getTotalCost() method into Directory class.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But still need to check isTravelPlan() to setText lah

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok solved

@@ -85,6 +87,7 @@ public void setAllTabsVisible() {
@Override
protected void updateItem(Activity activity, boolean empty) {
super.updateItem(activity, empty);
travelPlanPanel.update();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is calling the update() here suitable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No choice...

@@ -159,6 +159,15 @@ private void handleDirectoryChange(Directory directory) {
}
}

private void handleCostChange(Directory directory) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the travelPlanPanel.update() can be called here instead? So, no need to pass into TravelPlanObjectListPanel

@jiaweiteo jiaweiteo closed this Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show Total Cost
2 participants