Skip to content

Commit

Permalink
MappingPanel: add highlighted/normalArrows
Browse files Browse the repository at this point in the history
Turns out I'm going to need to iterate over these two kinds of arrows
more than once, so I created new private methods for both
  • Loading branch information
aguynamedryan committed May 22, 2015
1 parent f7b946e commit af52dcb
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/org/ohdsi/rabbitInAHat/MappingPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ public void paint(Graphics g) {
if (component != dragRectangle)
component.paint(g2d);

for (Arrow component : arrows)
if (component != dragArrow && !component.isHighlighted())
for (Arrow component : normalArrows())
if (component != dragArrow)
component.paint(g2d);

if (dragRectangle != null)
Expand All @@ -245,8 +245,8 @@ public void paint(Graphics g) {
if (dragArrow != null)
dragArrow.paint(g2d);

for (Arrow component : arrows)
if (component != dragArrow && component.isHighlighted())
for (Arrow component : highlightedArrows())
if (component != dragArrow)
component.paint(g2d);

if (offscreen != null)
Expand Down Expand Up @@ -602,5 +602,26 @@ public void addResizeListener(ResizeListener resizeListener) {
public void setDetailsListener(DetailsListener detailsListener) {
this.detailsListener = detailsListener;
}

private List<Arrow> highlightedArrows() {
List<Arrow> highlighted = new ArrayList<Arrow>();
for(Arrow arrow : arrows) {
if (arrow.isHighlighted()) {
highlighted.add(arrow);
}
}
return highlighted;
}


private List<Arrow> normalArrows() {
List<Arrow> highlighted = new ArrayList<Arrow>();
for(Arrow arrow : arrows) {
if (!arrow.isHighlighted()) {
highlighted.add(arrow);
}
}
return highlighted;
}

}

0 comments on commit af52dcb

Please sign in to comment.