Skip to content

Commit 411b2fc

Browse files
committed
renamed classes
1 parent 8c8fbd5 commit 411b2fc

File tree

6 files changed

+104
-109
lines changed

6 files changed

+104
-109
lines changed

src/main/java/com/csgt/controller/CanvasController.java

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import com.csgt.dataaccess.DTO.EdgeDTO;
88
import com.csgt.dataaccess.DTO.ElementDTO;
99
import com.csgt.dataaccess.DTO.HighlightDTO;
10-
import com.csgt.presentation.graph.CircleCell;
10+
import com.csgt.presentation.graph.NodeCell;
1111
import com.csgt.presentation.graph.BoundBox;
1212
import com.csgt.presentation.graph.Edge;
13-
import com.csgt.presentation.graph.RectangleCell;
13+
import com.csgt.presentation.graph.HighlightCell;
1414
import com.csgt.presentation.graph.CustomScrollPane;
1515
import javafx.beans.value.ChangeListener;
1616
import javafx.fxml.FXML;
@@ -34,9 +34,9 @@ public class CanvasController {
3434
public Pane canvas;
3535

3636
public CustomScrollPane scrollPane;
37-
private Map<String, CircleCell> circleCellsOnUI = new HashMap<>();
37+
private Map<String, NodeCell> circleCellsOnUI = new HashMap<>();
3838
private Map<String, Edge> edgesOnUI = new HashMap<>();
39-
private Map<Integer, com.csgt.presentation.graph.RectangleCell> highlightsOnUI = new HashMap<>();
39+
private Map<Integer, HighlightCell> highlightsOnUI = new HashMap<>();
4040

4141
// Region where UI components are loaded.
4242
private static BoundingBox activeRegion = null;
@@ -124,38 +124,38 @@ private void addCirclesToUI() {
124124
BoundingBox viewPort = getPrefetchViewPortDims();
125125

126126
List<ElementDTO> elementDTOList = ElementDAOImpl.getElementDTOsInViewport(viewPort);
127-
List<CircleCell> circleCells = ControllerUtil.convertElementDTOTOCell(elementDTOList);
127+
List<NodeCell> nodeCells = ControllerUtil.convertElementDTOTOCell(elementDTOList);
128128

129-
circleCells.forEach(this::addNewCellToUI);
129+
nodeCells.forEach(this::addNewCellToUI);
130130
}
131131

132132
/**
133133
* Draws a new element node on UI if not already present.
134134
*
135-
* @param circleCell
135+
* @param nodeCell
136136
*/
137-
private void addNewCellToUI(CircleCell circleCell) {
138-
if (!circleCellsOnUI.containsKey(circleCell.getCellId())) {
139-
circleCellsOnUI.put(circleCell.getCellId(), circleCell);
140-
canvas.getChildren().add(circleCell);
141-
circleCell.toFront();
142-
ControllerLoader.getEventHandlers().setCustomMouseEventHandlers(circleCell);
143-
// System.out.print("+" + circleCell.getCellId() + ", ");
137+
private void addNewCellToUI(NodeCell nodeCell) {
138+
if (!circleCellsOnUI.containsKey(nodeCell.getCellId())) {
139+
circleCellsOnUI.put(nodeCell.getCellId(), nodeCell);
140+
canvas.getChildren().add(nodeCell);
141+
nodeCell.toFront();
142+
ControllerLoader.getEventHandlers().setCustomMouseEventHandlers(nodeCell);
143+
// System.out.print("+" + nodeCell.getCellId() + ", ");
144144
}
145145
}
146146

147147
private void removeCirclesFromUI() {
148-
List<CircleCell> removeCircleCellsList = circleCellsOnUI.values().stream()
149-
.filter(circleCell -> !activeRegion.contains(circleCell.getBoundsInParent()))
148+
List<NodeCell> removeNodeCellsList = circleCellsOnUI.values().stream()
149+
.filter(nodeCell -> !activeRegion.contains(nodeCell.getBoundsInParent()))
150150
.collect(Collectors.toList());
151151

152-
removeCircleCellsList.forEach(this::removeCellFromUI);
152+
removeNodeCellsList.forEach(this::removeCellFromUI);
153153
}
154154

155-
private void removeCellFromUI(CircleCell circleCell) {
156-
if (circleCell != null && circleCellsOnUI.containsKey(circleCell.getCellId())) {
157-
circleCellsOnUI.remove(circleCell.getCellId());
158-
canvas.getChildren().remove(circleCell);
155+
private void removeCellFromUI(NodeCell nodeCell) {
156+
if (nodeCell != null && circleCellsOnUI.containsKey(nodeCell.getCellId())) {
157+
circleCellsOnUI.remove(nodeCell.getCellId());
158+
canvas.getChildren().remove(nodeCell);
159159
}
160160
}
161161

@@ -198,33 +198,33 @@ public void removeUIComponentsBetween(ElementDTO elementDTO, int endCellId) {
198198
float clickedCellBottomY = clickedCellTopY + BoundBox.unitHeightFactor;
199199
float clickedCellBoundBottomY = elementDTO.getBoundBoxYBottomLeft();
200200

201-
List<CircleCell> removeCircleCells = new ArrayList<>();
201+
List<NodeCell> removeNodeCells = new ArrayList<>();
202202
List<Edge> removeEdges = new ArrayList<>();
203203

204-
Map<Integer, RectangleCell> highlightsOnUi = ControllerLoader.canvasController.getHighlightsOnUI();
205-
List<RectangleCell> removeHighlights = new ArrayList<>();
204+
Map<Integer, HighlightCell> highlightsOnUi = ControllerLoader.canvasController.getHighlightsOnUI();
205+
List<HighlightCell> removeHighlights = new ArrayList<>();
206206

207-
circleCellsOnUI.forEach((id, circleCell) -> {
207+
circleCellsOnUI.forEach((id, nodeCell) -> {
208208
int intId = Integer.parseInt(id);
209209
if (intId > startCellId && intId < endCellId) {
210-
removeCircleCells.add(circleCell);
210+
removeNodeCells.add(nodeCell);
211211
}
212212

213213
// Remove all children cells and edges that end at these cells from UI
214-
double thisCellTopLeftX = circleCell.getLayoutX();
215-
double thisCellTopY = circleCell.getLayoutY();
214+
double thisCellTopLeftX = nodeCell.getLayoutX();
215+
double thisCellTopY = nodeCell.getLayoutY();
216216

217-
if (!removeCircleCells.contains(circleCell) && thisCellTopY >= clickedCellBottomY && thisCellTopY < clickedCellBoundBottomY && thisCellTopLeftX > clickedCellTopRightX) {
218-
removeCircleCells.add(circleCell);
217+
if (!removeNodeCells.contains(nodeCell) && thisCellTopY >= clickedCellBottomY && thisCellTopY < clickedCellBoundBottomY && thisCellTopLeftX > clickedCellTopRightX) {
218+
removeNodeCells.add(nodeCell);
219219
removeEdges.add(edgesOnUI.get(id));
220-
} else if (!removeCircleCells.contains(circleCell) && thisCellTopY == clickedCellTopY && thisCellTopLeftX >= clickedCellTopRightX) {
221-
removeCircleCells.add(circleCell);
220+
} else if (!removeNodeCells.contains(nodeCell) && thisCellTopY == clickedCellTopY && thisCellTopLeftX >= clickedCellTopRightX) {
221+
removeNodeCells.add(nodeCell);
222222
removeEdges.add(edgesOnUI.get(id));
223223
}
224224
});
225225

226-
removeCircleCells.forEach((circleCell) -> {
227-
ControllerLoader.canvasController.removeCellFromUI(circleCell);
226+
removeNodeCells.forEach((nodeCell) -> {
227+
ControllerLoader.canvasController.removeCellFromUI(nodeCell);
228228
});
229229

230230
edgesOnUI.forEach((id, edge) -> {
@@ -259,10 +259,10 @@ public void removeUIComponentsBetween(ElementDTO elementDTO, int endCellId) {
259259
}
260260
});
261261

262-
removeHighlights.forEach((rectangleCell) -> {
263-
if (highlightsOnUi.containsKey(rectangleCell)) {
264-
highlightsOnUi.remove(rectangleCell);
265-
canvas.getChildren().remove(rectangleCell);
262+
removeHighlights.forEach((highlightCell) -> {
263+
if (highlightsOnUi.containsKey(highlightCell)) {
264+
highlightsOnUi.remove(highlightCell);
265+
canvas.getChildren().remove(highlightCell);
266266
}
267267
});
268268
}
@@ -273,11 +273,11 @@ public void moveLowerTreeByDelta(ElementDTO elementDTO) {
273273
double delta = elementDTO.getDeltaY();
274274

275275
// For each circle cell on UI that is below the clicked cell, move up by delta
276-
circleCellsOnUI.forEach((thisCellID, thisCircleCell) -> {
277-
double thisCellTopY = thisCircleCell.getLayoutY();
276+
circleCellsOnUI.forEach((thisCellID, thisNodeCell) -> {
277+
double thisCellTopY = thisNodeCell.getLayoutY();
278278

279279
if (thisCellTopY >= clickedCellBottomY) {
280-
thisCircleCell.relocate(thisCircleCell.getLayoutX(), thisCellTopY - delta);
280+
thisNodeCell.relocate(thisNodeCell.getLayoutX(), thisCellTopY - delta);
281281
}
282282

283283
});
@@ -297,10 +297,10 @@ public void moveLowerTreeByDelta(ElementDTO elementDTO) {
297297
});
298298

299299
// For each highlight rectangle whose startY is below the clicked cell, relocate that rectangle appropriately
300-
highlightsOnUI.forEach((id, rectangleCell) -> {
301-
double y = rectangleCell.getLayoutY();
300+
highlightsOnUI.forEach((id, highlightCell) -> {
301+
double y = highlightCell.getLayoutY();
302302
if (y >= clickedCellBottomY - BoundBox.unitHeightFactor/2) {
303-
rectangleCell.relocate(rectangleCell.getLayoutX(), y - delta);
303+
highlightCell.relocate(highlightCell.getLayoutX(), y - delta);
304304
}
305305
});
306306

@@ -311,30 +311,30 @@ private void addHighlightsToUI() {
311311
BoundingBox viewPort = getPrefetchViewPortDims();
312312

313313
List<HighlightDTO> highlightDTOs = HighlightDAOImpl.getHighlightDTOsInViewPort(viewPort);
314-
List<RectangleCell> highlightRectList = ControllerUtil.convertHighlightDTOsToHighlights(highlightDTOs);
314+
List<HighlightCell> highlightRectList = ControllerUtil.convertHighlightDTOsToHighlights(highlightDTOs);
315315

316316
highlightRectList.forEach(this::addNewHighlightsToUI);
317317
}
318318

319-
private void addNewHighlightsToUI(RectangleCell rectangleCell) {
320-
if (!highlightsOnUI.containsKey(rectangleCell.getElementId())) {
321-
highlightsOnUI.putIfAbsent(rectangleCell.getElementId(), rectangleCell);
322-
canvas.getChildren().add(rectangleCell);
319+
private void addNewHighlightsToUI(HighlightCell highlightCell) {
320+
if (!highlightsOnUI.containsKey(highlightCell.getElementId())) {
321+
highlightsOnUI.putIfAbsent(highlightCell.getElementId(), highlightCell);
322+
canvas.getChildren().add(highlightCell);
323323
}
324324
}
325325

326326
private void removeHighlightsFromUI() {
327-
List<RectangleCell> removeCircleCellsList = highlightsOnUI.values().stream()
328-
.filter(rectangleCell -> !activeRegion.intersects(rectangleCell.getBoundsInParent()))
327+
List<HighlightCell> removeCircleCellsList = highlightsOnUI.values().stream()
328+
.filter(highlightCell -> !activeRegion.intersects(highlightCell.getBoundsInParent()))
329329
.collect(Collectors.toList());
330330

331331
removeCircleCellsList.forEach(this::removeHighlightFromUI);
332332
}
333333

334-
private void removeHighlightFromUI(RectangleCell rectangleCell) {
335-
if (rectangleCell != null && highlightsOnUI.containsKey(rectangleCell.getCellId())) {
336-
highlightsOnUI.remove(rectangleCell.getCellId());
337-
canvas.getChildren().remove(rectangleCell);
334+
private void removeHighlightFromUI(HighlightCell highlightCell) {
335+
if (highlightCell != null && highlightsOnUI.containsKey(highlightCell.getCellId())) {
336+
highlightsOnUI.remove(highlightCell.getCellId());
337+
canvas.getChildren().remove(highlightCell);
338338
}
339339
}
340340

@@ -357,9 +357,9 @@ public void removeBookmarkFromUI(String circleCellId) {
357357
public void removeAllBookmarksFromUI() {
358358
Map<String, BookmarkDTO> bookmarkDTOs = ControllerLoader.menuController.getBookmarkDTOs();
359359

360-
circleCellsOnUI.forEach((id, circleCell) -> {
360+
circleCellsOnUI.forEach((id, nodeCell) -> {
361361
if (bookmarkDTOs.containsKey(id)) {
362-
circleCell.removeBookmark();
362+
nodeCell.removeBookmark();
363363
}
364364
});
365365
}
@@ -369,8 +369,8 @@ public void removeAllBookmarksFromUI() {
369369
* Clears all UI components on canvas except the placeholder lines.
370370
*/
371371
private void clear() {
372-
circleCellsOnUI.forEach((id, circleCell) -> {
373-
canvas.getChildren().remove(circleCell);
372+
circleCellsOnUI.forEach((id, nodeCell) -> {
373+
canvas.getChildren().remove(nodeCell);
374374
});
375375
circleCellsOnUI.clear();
376376
// bookmarks are part of circle cells, so no need to remove them explicitly.
@@ -380,8 +380,8 @@ private void clear() {
380380
});
381381
edgesOnUI.clear();
382382

383-
highlightsOnUI.forEach((id, rectangleCell) -> {
384-
canvas.getChildren().remove(rectangleCell);
383+
highlightsOnUI.forEach((id, highlightCell) -> {
384+
canvas.getChildren().remove(highlightCell);
385385
});
386386
highlightsOnUI.clear();
387387
}
@@ -565,15 +565,15 @@ private double getVValue(double yCoordinate) {
565565

566566
public void stackRectangles() {
567567

568-
List<com.csgt.presentation.graph.RectangleCell> list = new ArrayList<>(highlightsOnUI.values());
568+
List<HighlightCell> list = new ArrayList<>(highlightsOnUI.values());
569569

570570
// Sort the list of rectangles according to area.
571571
list.sort((o1, o2) -> (int) (o1.getBoundsInParent().getWidth() * o1.getBoundsInParent().getHeight()
572572
- o2.getBoundsInParent().getWidth() * o2.getBoundsInParent().getHeight()));
573573
list.forEach(Node::toBack);
574574

575575
edgesOnUI.forEach((id, edge) -> edge.toFront());
576-
circleCellsOnUI.forEach((id, circleCell) -> circleCell.toFront());
576+
circleCellsOnUI.forEach((id, nodeCell) -> nodeCell.toFront());
577577
}
578578

579579
public void jumpTo(String cellId, String threadId, int collapsed) {
@@ -591,7 +591,7 @@ public void onReset() {
591591
highlightsOnUI = new HashMap<>();
592592
}
593593

594-
public Map<Integer, RectangleCell> getHighlightsOnUI() {
594+
public Map<Integer, HighlightCell> getHighlightsOnUI() {
595595
return highlightsOnUI;
596596
}
597597
}

src/main/java/com/csgt/controller/ControllerUtil.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import com.csgt.dataaccess.DTO.HighlightDTO;
66
import com.csgt.dataaccess.model.EdgeElement;
77
import com.csgt.dataaccess.model.Element;
8-
import com.csgt.presentation.graph.CircleCell;
8+
import com.csgt.presentation.graph.NodeCell;
99
import com.csgt.presentation.graph.Edge;
10-
import com.csgt.presentation.graph.RectangleCell;
10+
import com.csgt.presentation.graph.HighlightCell;
1111
import javafx.stage.DirectoryChooser;
1212
import javafx.stage.FileChooser;
1313
import javafx.stage.Stage;
@@ -59,33 +59,33 @@ public static List<ElementDTO> convertElementToElementDTO(List<Element> elements
5959
.collect(Collectors.toList());
6060
}
6161

62-
static List<CircleCell> convertElementDTOTOCell(List<ElementDTO> elementDTOList) {
63-
List<CircleCell> circleCellList = new ArrayList<>();
62+
static List<NodeCell> convertElementDTOTOCell(List<ElementDTO> elementDTOList) {
63+
List<NodeCell> nodeCellList = new ArrayList<>();
6464

6565
elementDTOList.forEach(elementDTO -> {
66-
CircleCell circleCell = new CircleCell(elementDTO.getId(), elementDTO.getBoundBoxXCoordinate(), elementDTO.getBoundBoxYCoordinate(), elementDTO.getMethodName(), elementDTO.getCollapsed());
67-
circleCellList.add(circleCell);
66+
NodeCell nodeCell = new NodeCell(elementDTO.getId(), elementDTO.getBoundBoxXCoordinate(), elementDTO.getBoundBoxYCoordinate(), elementDTO.getMethodName(), elementDTO.getCollapsed());
67+
nodeCellList.add(nodeCell);
6868
});
6969

70-
return circleCellList;
70+
return nodeCellList;
7171
}
7272

73-
static List<RectangleCell> convertHighlightDTOsToHighlights(List<HighlightDTO> highlightDTOs) {
74-
List<RectangleCell> rectangleCells = new ArrayList<>();
73+
static List<HighlightCell> convertHighlightDTOsToHighlights(List<HighlightDTO> highlightDTOs) {
74+
List<HighlightCell> highlightCells = new ArrayList<>();
7575

7676
highlightDTOs.forEach(highlightDTO -> {
77-
RectangleCell rect = new RectangleCell(highlightDTO.getId(),
77+
HighlightCell rect = new HighlightCell(highlightDTO.getId(),
7878
highlightDTO.getElementId(),
7979
highlightDTO.getStartX(), highlightDTO.getStartY(),
8080
highlightDTO.getWidth(), highlightDTO.getHeight());
8181

8282
rect.setColor(highlightDTO.getColor());
8383
rect.setArcHeight(20);
8484
rect.setArcWidth(20);
85-
rectangleCells.add(rect);
85+
highlightCells.add(rect);
8686
});
8787

88-
return rectangleCells;
88+
return highlightCells;
8989
}
9090

9191
public static List<EdgeDTO> convertEdgeElementsToEdgeDTO(List<EdgeElement> edgeList) {

0 commit comments

Comments
 (0)