Skip to content

Commit 9c3c297

Browse files
committed
unified not overlapping error messages (using the more elaborate one)
1 parent 99b8fcf commit 9c3c297

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/main/java/net/itarray/automotion/internal/ResponsiveUIChunkValidatorBase.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@ private void validateElementsAreNotOverlapped(List<UIElement> elements) {
281281
UIElement first = elements.get(firstIndex);
282282
for (int secondIndex = firstIndex+1; secondIndex < elements.size(); secondIndex++) {
283283
UIElement second = elements.get(secondIndex);
284-
if (!first.doesNotOverlap(second, context)) {
285-
context.add("Elements are overlapped");
286-
context.draw(first);
284+
if (!first.validateNotOverlappingWithElement(second, context)) {
287285
break;
288286
}
289287
}

src/main/java/net/itarray/automotion/internal/UIElement.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ public Expression<Boolean> overlaps(UIElement other) {
176176
);
177177
}
178178

179-
public boolean doesNotOverlap(UIElement other, Context context) {
180-
return notOverlaps(other).evaluateIn(context, DOWN);
181-
}
182-
183179
public Expression<Boolean> notOverlaps(UIElement other) {
184180
return Expression.or(
185181
Expression.or(
@@ -366,13 +362,15 @@ public void validateOverlappingWithElement(UIElement element, Context context) {
366362
}
367363
}
368364

369-
public void validateNotOverlappingWithElement(UIElement element, Context context) {
365+
public boolean validateNotOverlappingWithElement(UIElement element, Context context) {
370366
if (!notOverlaps(element).evaluateIn(context, DOWN)) {
371367
context.add(String.format("Element %s is overlapped with element %s but should not",
372368
getQuotedName(),
373369
element.getQuotedName()));
374370
context.draw(element);
371+
return false;
375372
}
373+
return true;
376374
}
377375

378376
public void validateLeftOffset(Condition condition, UIElement page, Context context) {

0 commit comments

Comments
 (0)