Search in sources :

Example 1 with ISketchModelActor

use of com.archimatetool.model.ISketchModelActor in project archi by archimatetool.

the class SketchEditPartFactoryTests method testSketchActorEditPart.

@Test
public void testSketchActorEditPart() {
    ISketchModelActor actor = IArchimateFactory.eINSTANCE.createSketchModelActor();
    EditPart editPart = editPartFactory.createEditPart(null, actor);
    assertTrue(editPart instanceof SketchActorEditPart);
    assertEquals(actor, editPart.getModel());
}
Also used : ISketchModelActor(com.archimatetool.model.ISketchModelActor) DiagramConnectionEditPart(com.archimatetool.editor.diagram.editparts.DiagramConnectionEditPart) EditPart(org.eclipse.gef.EditPart) EmptyEditPart(com.archimatetool.editor.diagram.editparts.diagram.EmptyEditPart) Test(org.junit.Test)

Example 2 with ISketchModelActor

use of com.archimatetool.model.ISketchModelActor in project archi by archimatetool.

the class SketchModelFactory method getNewObject.

public Object getNewObject() {
    Object object = IArchimateFactory.eINSTANCE.create(fTemplate);
    // Actor
    if (object instanceof ISketchModelActor) {
        ((ISketchModelActor) object).setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
    } else // Sticky
    if (object instanceof ISketchModelSticky) {
        ISketchModelSticky sticky = (ISketchModelSticky) object;
        sticky.setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
        sticky.setTextPosition(ITextPosition.TEXT_POSITION_TOP);
        sticky.setTextAlignment(ITextAlignment.TEXT_ALIGNMENT_LEFT);
        if (fParam instanceof Color) {
            String color = ColorFactory.convertColorToString((Color) fParam);
            sticky.setFillColor(color);
            Color lineColor = ColorFactory.getDefaultLineColor(sticky);
            if (lineColor != null) {
                sticky.setLineColor(ColorFactory.convertColorToString(lineColor));
            }
        }
    } else // Group
    if (object instanceof IDiagramModelGroup) {
        IDiagramModelGroup group = (IDiagramModelGroup) object;
        group.setName(ArchiLabelProvider.INSTANCE.getDefaultName(fTemplate));
        ColorFactory.setDefaultColors(group);
    } else // Connection
    if (object instanceof IDiagramModelConnection) {
        IDiagramModelConnection connection = (IDiagramModelConnection) object;
        if (fParam instanceof Integer) {
            connection.setType((Integer) fParam);
        }
        ColorFactory.setDefaultColors(connection);
    }
    return object;
}
Also used : ISketchModelActor(com.archimatetool.model.ISketchModelActor) Color(org.eclipse.swt.graphics.Color) IDiagramModelConnection(com.archimatetool.model.IDiagramModelConnection) ISketchModelSticky(com.archimatetool.model.ISketchModelSticky) IDiagramModelGroup(com.archimatetool.model.IDiagramModelGroup)

Example 3 with ISketchModelActor

use of com.archimatetool.model.ISketchModelActor in project archi by archimatetool.

the class SketchModelFactoryTests method testGetNewObjectActor.

@Test
public void testGetNewObjectActor() {
    ICreationFactory factory = new SketchModelFactory(IArchimatePackage.eINSTANCE.getSketchModelActor());
    ISketchModelActor actor = (ISketchModelActor) factory.getNewObject();
    assertEquals("Actor", actor.getName());
}
Also used : ISketchModelActor(com.archimatetool.model.ISketchModelActor) ICreationFactory(com.archimatetool.editor.diagram.ICreationFactory) Test(org.junit.Test)

Example 4 with ISketchModelActor

use of com.archimatetool.model.ISketchModelActor in project archi by archimatetool.

the class SketchModelActorTests method testGetCopy.

@Override
@Test
public void testGetCopy() {
    super.testGetCopy();
    actor.getProperties().add(IArchimateFactory.eINSTANCE.createProperty());
    ISketchModelActor copy = (ISketchModelActor) actor.getCopy();
    assertNotSame(actor, copy);
    assertNotSame(actor.getProperties(), copy.getProperties());
    assertEquals(actor.getProperties().size(), copy.getProperties().size());
}
Also used : ISketchModelActor(com.archimatetool.model.ISketchModelActor) Test(org.junit.Test)

Aggregations

ISketchModelActor (com.archimatetool.model.ISketchModelActor)4 Test (org.junit.Test)3 ICreationFactory (com.archimatetool.editor.diagram.ICreationFactory)1 DiagramConnectionEditPart (com.archimatetool.editor.diagram.editparts.DiagramConnectionEditPart)1 EmptyEditPart (com.archimatetool.editor.diagram.editparts.diagram.EmptyEditPart)1 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)1 IDiagramModelGroup (com.archimatetool.model.IDiagramModelGroup)1 ISketchModelSticky (com.archimatetool.model.ISketchModelSticky)1 EditPart (org.eclipse.gef.EditPart)1 Color (org.eclipse.swt.graphics.Color)1