Search in sources :

Example 1 with GraphPoint

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;
}
Also used : Aggregation(org.cristalise.kernel.collection.Aggregation) PropertyDescription(org.cristalise.kernel.property.PropertyDescription) InvalidItemPathException(org.cristalise.kernel.lookup.InvalidItemPathException) DomainPath(org.cristalise.kernel.lookup.DomainPath) AggregationDescription(org.cristalise.kernel.collection.AggregationDescription) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint) AggregationInstance(org.cristalise.kernel.collection.AggregationInstance) PropertyDescriptionList(org.cristalise.kernel.property.PropertyDescriptionList) ItemPath(org.cristalise.kernel.lookup.ItemPath)

Example 2 with GraphPoint

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());
    }
}
Also used : GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Example 3 with GraphPoint

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;
}
Also used : Vertex(org.cristalise.kernel.graph.model.Vertex) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Example 4 with GraphPoint

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);
}
Also used : GraphPoint(org.cristalise.kernel.graph.model.GraphPoint) GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Example 5 with GraphPoint

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));
}
Also used : GraphPoint(org.cristalise.kernel.graph.model.GraphPoint)

Aggregations

GraphPoint (org.cristalise.kernel.graph.model.GraphPoint)25 AffineTransform (java.awt.geom.AffineTransform)4 FontMetrics (java.awt.FontMetrics)3 Vertex (org.cristalise.kernel.graph.model.Vertex)3 Paint (java.awt.Paint)2 Aggregation (org.cristalise.kernel.collection.Aggregation)1 AggregationDescription (org.cristalise.kernel.collection.AggregationDescription)1 AggregationInstance (org.cristalise.kernel.collection.AggregationInstance)1 AggregationMember (org.cristalise.kernel.collection.AggregationMember)1 InvalidDataException (org.cristalise.kernel.common.InvalidDataException)1 PersistencyException (org.cristalise.kernel.common.PersistencyException)1 DirectedEdge (org.cristalise.kernel.graph.model.DirectedEdge)1 GraphableEdge (org.cristalise.kernel.graph.model.GraphableEdge)1 Activity (org.cristalise.kernel.lifecycle.instance.Activity)1 CompositeActivity (org.cristalise.kernel.lifecycle.instance.CompositeActivity)1 Next (org.cristalise.kernel.lifecycle.instance.Next)1 Workflow (org.cristalise.kernel.lifecycle.instance.Workflow)1 DomainPath (org.cristalise.kernel.lookup.DomainPath)1 InvalidItemPathException (org.cristalise.kernel.lookup.InvalidItemPathException)1 ItemPath (org.cristalise.kernel.lookup.ItemPath)1