Skip to content

Commit

Permalink
Fix wrapText
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayushe committed Oct 28, 2019
1 parent 74c1481 commit fecb3e8
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/seedu/algobase/ui/FindRuleCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.TextAlignment;
import seedu.algobase.model.searchrule.problemsearchrule.DifficultyIsInRangePredicate;
import seedu.algobase.model.searchrule.problemsearchrule.ProblemSearchRule;

Expand Down Expand Up @@ -47,25 +48,35 @@ public FindRuleCard(ProblemSearchRule findRule, int displayedIndex) {
super(FXML);
this.findRule = findRule;
id.setText(displayedIndex + ". ");
id.setWrapText(true);
id.setTextAlignment(TextAlignment.JUSTIFY);
ruleName.setText(findRule.getName().name);
ruleName.setWrapText(true);
ruleName.setTextAlignment(TextAlignment.JUSTIFY);

if (findRule.getNamePredicate().isEmpty()) {
problemName.setText(DEFAULT_PREDICATE);
} else {
problemName.setText(findRule.getNamePredicate().get().getKeywords().toString());
}
problemName.setWrapText(true);
problemName.setTextAlignment(TextAlignment.JUSTIFY);

if (findRule.getAuthorPredicate().isEmpty()) {
author.setText(DEFAULT_PREDICATE);
} else {
author.setText(findRule.getAuthorPredicate().get().getKeyword().keyword);
}
author.setWrapText(true);
author.setTextAlignment(TextAlignment.JUSTIFY);

if (findRule.getDescriptionPredicate().isEmpty()) {
description.setText(DEFAULT_PREDICATE);
} else {
description.setText(findRule.getDescriptionPredicate().get().getKeywords().toString());
}
description.setWrapText(true);
description.setTextAlignment(TextAlignment.JUSTIFY);

if (findRule.getDifficultyPredicate().isEmpty()) {
difficulty.setText(DEFAULT_PREDICATE);
Expand All @@ -76,18 +87,24 @@ public FindRuleCard(ProblemSearchRule findRule, int displayedIndex) {
String difficultyString = String.format("%f - %f", lowerBound, upperBound);
difficulty.setText(difficultyString);
}
difficulty.setWrapText(true);
difficulty.setTextAlignment(TextAlignment.JUSTIFY);

if (findRule.getSourcePredicate().isEmpty()) {
source.setText(DEFAULT_PREDICATE);
} else {
source.setText(findRule.getSourcePredicate().get().getKeyword().keyword);
}
source.setWrapText(true);
source.setTextAlignment(TextAlignment.JUSTIFY);

if (findRule.getTagPredicate().isEmpty()) {
tag.setText(DEFAULT_PREDICATE);
} else {
tag.setText(findRule.getTagPredicate().get().getKeywords().toString());
}
tag.setWrapText(true);
tag.setTextAlignment(TextAlignment.JUSTIFY);

}

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/seedu/algobase/ui/PlanCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.TextAlignment;
import seedu.algobase.commons.core.LogsCenter;
import seedu.algobase.logic.parser.ParserUtil;
import seedu.algobase.model.Id;
Expand Down Expand Up @@ -45,10 +46,20 @@ public PlanCard(Plan plan, int displayedIndex, WriteOnlyTabManager writeOnlyTabM
super(FXML);
this.plan = plan;
id.setText(displayedIndex + ". ");
id.setWrapText(true);
id.setTextAlignment(TextAlignment.JUSTIFY);
planName.setText(plan.getPlanName().fullName + " (" + plan.getTasks().size() + " tasks)");
planName.setWrapText(true);
planName.setTextAlignment(TextAlignment.JUSTIFY);
planDescription.setText(plan.getPlanDescription().value);
planDescription.setWrapText(true);
planDescription.setTextAlignment(TextAlignment.JUSTIFY);
startDate.setText(plan.getStartDate().format(ParserUtil.FORMATTER));
startDate.setWrapText(true);
startDate.setTextAlignment(TextAlignment.JUSTIFY);
endDate.setText(plan.getEndDate().format(ParserUtil.FORMATTER));
endDate.setWrapText(true);
endDate.setTextAlignment(TextAlignment.JUSTIFY);
addMouseClickListener(writeOnlyTabManager.addDetailsTabConsumer(ModelType.PLAN));
}

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/seedu/algobase/ui/ProblemCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.TextAlignment;
import seedu.algobase.commons.core.LogsCenter;
import seedu.algobase.model.Id;
import seedu.algobase.model.ModelType;
Expand Down Expand Up @@ -62,13 +63,29 @@ public ProblemCard(Problem problem, int displayedIndex, WriteOnlyTabManager writ
super(FXML);
this.problem = problem;
id.setText(displayedIndex + ". ");
id.setWrapText(true);
id.setTextAlignment(TextAlignment.JUSTIFY);
name.setText(problem.getName().fullName);
name.setWrapText(true);
name.setTextAlignment(TextAlignment.JUSTIFY);
author.setText(problem.getAuthor().value);
author.setWrapText(true);
author.setTextAlignment(TextAlignment.JUSTIFY);
description.setText(problem.getDescription().value);
description.setWrapText(true);
description.setTextAlignment(TextAlignment.JUSTIFY);
weblink.setText(problem.getWebLink().value);
weblink.setWrapText(true);
weblink.setTextAlignment(TextAlignment.JUSTIFY);
difficulty.setText(problem.getDifficulty().toString());
difficulty.setWrapText(true);
difficulty.setTextAlignment(TextAlignment.JUSTIFY);
remark.setText(problem.getRemark().value);
remark.setWrapText(true);
remark.setTextAlignment(TextAlignment.JUSTIFY);
source.setText(problem.getSource().value);
source.setWrapText(true);
source.setTextAlignment(TextAlignment.JUSTIFY);
problem.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/seedu/algobase/ui/TagCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.TextAlignment;
import seedu.algobase.model.tag.Tag;


Expand All @@ -27,7 +28,11 @@ public TagCard(Tag tag, int displayedIndex) {
super(FXML);
this.tag = tag;
id.setText(displayedIndex + ". ");
id.setWrapText(true);
id.setTextAlignment(TextAlignment.JUSTIFY);
tagName.setText(tag.getName());
tagName.setWrapText(true);
tagName.setTextAlignment(TextAlignment.JUSTIFY);
}

@Override
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/seedu/algobase/ui/TaskCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.text.TextAlignment;
import seedu.algobase.logic.parser.ParserUtil;
import seedu.algobase.model.task.Task;

Expand Down Expand Up @@ -54,14 +55,32 @@ public TaskCard(Task task, int displayedIndex) {
super(FXML);
this.task = task;
id.setText(displayedIndex + ". ");
id.setWrapText(true);
id.setTextAlignment(TextAlignment.JUSTIFY);
name.setText(task.getName().fullName + task.getStatusIcon());
name.setWrapText(true);
name.setTextAlignment(TextAlignment.JUSTIFY);
targetDate.setText(task.getTargetDate().format(ParserUtil.FORMATTER));
targetDate.setWrapText(true);
targetDate.setTextAlignment(TextAlignment.JUSTIFY);
author.setText(task.getAuthor().value);
author.setWrapText(true);
author.setTextAlignment(TextAlignment.JUSTIFY);
description.setText(task.getDescription().value);
description.setWrapText(true);
description.setTextAlignment(TextAlignment.JUSTIFY);
weblink.setText(task.getWebLink().value);
weblink.setWrapText(true);
weblink.setTextAlignment(TextAlignment.JUSTIFY);
difficulty.setText(task.getDifficulty().toString());
difficulty.setWrapText(true);
difficulty.setTextAlignment(TextAlignment.JUSTIFY);
remark.setText(task.getRemark().value);
remark.setWrapText(true);
remark.setTextAlignment(TextAlignment.JUSTIFY);
source.setText(task.getSource().value);
source.setWrapText(true);
source.setTextAlignment(TextAlignment.JUSTIFY);
task.getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
Expand Down

0 comments on commit fecb3e8

Please sign in to comment.