1 /* 2 * This file is a part of CAST project. 3 * (c) Copyright 2007, AGH University of Science & Technology 4 * All rights reserved. Check the documentation for licensing terms. 5 * https://caribou.iisg.agh.edu.pl/trac/cast 6 */ 7 package pl.edu.agh.cast.zestalgorithms.core; 8 9 import org.eclipse.zest.layouts.LayoutBendPoint; 10 import org.eclipse.zest.layouts.LayoutEntity; 11 import org.eclipse.zest.layouts.LayoutRelationship; 12 import org.eclipse.zest.layouts.constraints.LayoutConstraint; 13 14 /** 15 * Implementation of Zest's layout relationship between two nodes. This class just represents connection between two 16 * nodes. All relationships are directed. 17 * 18 * @author Paweł Koperek <pkoperek@gmail.com> 19 * @author Mateusz Kupisz <mkupisz@gmail.com> 20 * 21 */ 22 public class LayoutRelationshipImpl implements LayoutRelationship { 23 24 /** 25 * Destination node 26 */ 27 private LayoutEntity destination; 28 29 /** 30 * Destination node 31 */ 32 private LayoutEntity source; 33 34 /** 35 * Place for optional information about layout. Can be used to hold any data. 36 */ 37 private Object layoutInformation; 38 39 /** 40 * Place for optional information about layout. Can be used to hold any data. 41 */ 42 public LayoutRelationshipImpl(LayoutEntity source, LayoutEntity destination) { 43 this.source = source; 44 this.destination = destination; 45 } 46 47 /** 48 * Method required by {@link LayoutRelationship} interface. In our case does nothing 49 */ 50 public void clearBendPoints() { 51 // nothing 52 } 53 54 /** 55 * Returns the node that is the destination of the connection 56 * 57 * @return Destination node of the connection 58 */ 59 public LayoutEntity getDestinationInLayout() { 60 return destination; 61 } 62 63 /** 64 * Getter for optional information about the layout (or any other data that is stored in this field) 65 * 66 * @return Object representing optional information about the connection (or any other data) 67 */ 68 public Object getLayoutInformation() { 69 return layoutInformation; 70 } 71 72 /** 73 * Returns the source node of the connection 74 * 75 * @return source node 76 */ 77 public LayoutEntity getSourceInLayout() { 78 return source; 79 } 80 81 /** 82 * Method required by {@link LayoutRelationship} interface. In our case does nothing 83 */ 84 public void populateLayoutConstraint(LayoutConstraint constraint) { 85 // nothing 86 } 87 88 /** 89 * Method required by {@link LayoutRelationship} interface. In our case does nothing 90 */ 91 public void setBendPoints(LayoutBendPoint[] bendPoints) { 92 // nothing 93 } 94 95 /** 96 * Sets object representing some additional information about layout. Can be used to hold any information 97 */ 98 public void setLayoutInformation(Object layoutInformation) { 99 this.layoutInformation = layoutInformation; 100 } 101 102 /** 103 * Required by {@link LayoutRelationship}. Always returns null 104 * 105 * @return null 106 */ 107 public Object getGraphData() { 108 return this; 109 } 110 111 /** 112 * Required by {@link LayoutRelationship}. Does big nothing. 113 */ 114 public void setGraphData(Object o) { 115 // nothing 116 } 117 118 }