use of org.cristalise.kernel.graph.model.GraphPoint in project kernel by cristal-ise.
the class ImportAggregation method create.
public org.cristalise.kernel.collection.Aggregation create() throws InvalidCollectionModification, ObjectNotFoundException, ObjectAlreadyExistsException {
Aggregation newAgg = isDescription ? new AggregationDescription(name) : new AggregationInstance(name);
if (version != null)
newAgg.setVersion(version);
for (ImportAggregationMember thisMem : aggregationMemberList) {
StringBuffer classProps = new StringBuffer();
ItemPath itemPath = null;
if (thisMem.itemDescriptionPath != null && thisMem.itemDescriptionPath.length() > 0) {
try {
itemPath = new ItemPath(thisMem.itemDescriptionPath);
} catch (InvalidItemPathException ex) {
itemPath = new DomainPath(thisMem.itemDescriptionPath).getItemPath();
}
String descVer = thisMem.itemDescriptionVersion == null ? "last" : thisMem.itemDescriptionVersion;
PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(itemPath, descVer, null);
for (PropertyDescription pd : propList.list) {
thisMem.props.put(pd.getName(), pd.getDefaultValue());
if (pd.getIsClassIdentifier())
classProps.append((classProps.length() > 0 ? "," : "")).append(pd.getName());
}
}
if (thisMem.itemPath != null && thisMem.itemPath.length() > 0) {
try {
itemPath = new ItemPath(thisMem.itemPath);
} catch (InvalidItemPathException ex) {
itemPath = new DomainPath(thisMem.itemPath).getItemPath();
}
}
newAgg.addMember(itemPath, thisMem.props, classProps.toString(), new GraphPoint(thisMem.geometry.x, thisMem.geometry.y), thisMem.geometry.width, thisMem.geometry.height);
}
return newAgg;
}
use of org.cristalise.kernel.graph.model.GraphPoint in project kernel by cristal-ise.
the class DefaultVertexRenderer method drawOutlineRect.
/**
* Fills the outline as rectangle. It draws the border of the outline if linePaint is not null
*
* @param g2d the canvas
* @param vertex the vertex to be drawn
* @param fillPaint the fill color
* @param linePaint the color of the line, can be null
*/
public void drawOutlineRect(Graphics2D g2d, Vertex vertex, Paint fillPaint, Paint linePaint) {
GraphPoint centrePoint = vertex.getCentrePoint();
g2d.setPaint(fillPaint);
g2d.fillRect(centrePoint.x - vertex.getWidth() / 2, centrePoint.y - vertex.getHeight() / 2, vertex.getWidth(), vertex.getHeight());
if (linePaint != null) {
g2d.setPaint(linePaint);
g2d.drawRect(centrePoint.x - vertex.getWidth() / 2, centrePoint.y - vertex.getHeight() / 2, vertex.getWidth(), vertex.getHeight());
}
}
use of org.cristalise.kernel.graph.model.GraphPoint in project kernel by cristal-ise.
the class Aggregation method addSlot.
public AggregationMember addSlot(CastorHashMap props, String classProps, GraphPoint location, int w, int h) {
// Default geometry if not present
if (location == null)
location = new GraphPoint(100, 100 * getCounter());
if (w < 0)
w = 20;
if (h < 0)
h = 20;
// Create new member object
AggregationMember aggMem = new AggregationMember();
aggMem.setProperties(props);
aggMem.setClassProps(classProps);
// create vertex
Vertex vertex = new Vertex();
vertex.setHeight(h);
vertex.setWidth(w);
mLayout.addVertexAndCreateId(vertex, location);
aggMem.setCollection(this);
aggMem.setID(vertex.getID());
aggMem.setIsLayoutable(true);
mMembers.list.add(aggMem);
Logger.msg(8, "AggregationDescription::addSlot new slot linked to vertexid " + vertex.getID());
return aggMem;
}
use of org.cristalise.kernel.graph.model.GraphPoint in project kernel by cristal-ise.
the class LifecycleRenderer method drawEdgeHighlight.
// Draws the highlight of the specified edge
protected void drawEdgeHighlight(Graphics2D g2d, DirectedEdge edge) {
GraphPoint originPoint = edge.getOriginPoint();
GraphPoint terminusPoint = edge.getTerminusPoint();
int midX = originPoint.x + (terminusPoint.x - originPoint.x) / 2;
int midY = originPoint.y + (terminusPoint.y - originPoint.y) / 2;
int minX = midX - 10;
int minY = midY - 10;
int maxX = midX + 10;
int maxY = midY + 10;
g2d.drawLine(minX, minY, maxX, minY);
g2d.drawLine(maxX, minY, maxX, maxY);
g2d.drawLine(maxX, maxY, minX, maxY);
g2d.drawLine(minX, maxY, minX, minY);
}
use of org.cristalise.kernel.graph.model.GraphPoint in project kernel by cristal-ise.
the class ServerPredefinedStepContainer method serverPredInit.
public void serverPredInit(String alias, String Description, PredefinedStep act) {
act.setName(alias);
act.setType(alias);
act.getProperties().put("Description", Description);
act.getProperties().put("Agent Role", "Admin");
act.setCentrePoint(new GraphPoint());
act.setIsPredefined(true);
addChild(act, new GraphPoint(100, 75 * ++num));
}
Aggregations