use of com.archimatetool.canvas.model.ICanvasModelSticky in project archi by archimatetool.
the class CanvasModelFactory method getNewObject.
public Object getNewObject() {
// Create the instance from the registered factory in case of extensions
Object object = fTemplate.getEPackage().getEFactoryInstance().create(fTemplate);
// Sticky
if (object instanceof ICanvasModelSticky) {
ICanvasModelSticky sticky = (ICanvasModelSticky) object;
sticky.setTextPosition(ITextPosition.TEXT_POSITION_CENTRE);
sticky.setTextAlignment(ITextAlignment.TEXT_ALIGNMENT_CENTER);
if (fParam instanceof Color) {
String color = ColorFactory.convertColorToString((Color) fParam);
sticky.setFillColor(color);
}
// $NON-NLS-1$
sticky.setBorderColor("#C0C0C0");
} else // Block
if (object instanceof ICanvasModelBlock) {
ICanvasModelBlock block = (ICanvasModelBlock) object;
block.setTextPosition(ITextPosition.TEXT_POSITION_TOP);
block.setTextAlignment(ITextAlignment.TEXT_ALIGNMENT_LEFT);
// $NON-NLS-1$
block.setBorderColor("#000000");
} else // Image
if (object instanceof ICanvasModelImage) {
ICanvasModelImage image = (ICanvasModelImage) object;
// $NON-NLS-1$
image.setBorderColor("#000000");
} else // Canvas Connection
if (object instanceof ICanvasModelConnection) {
ICanvasModelConnection connection = (ICanvasModelConnection) object;
if (fParam instanceof Integer) {
connection.setType((Integer) fParam);
}
}
return object;
}
use of com.archimatetool.canvas.model.ICanvasModelSticky in project archi by archimatetool.
the class CanvasModelFactoryTests method testGetNewObjectCanvasSticky.
@Test
public void testGetNewObjectCanvasSticky() {
ICreationFactory factory = new CanvasModelFactory(ICanvasPackage.eINSTANCE.getCanvasModelSticky(), ColorFactory.get(201, 231, 183));
ICanvasModelSticky sticky = (ICanvasModelSticky) factory.getNewObject();
assertEquals(ColorFactory.convertColorToString(ColorFactory.get(201, 231, 183)), sticky.getFillColor());
assertEquals("#C0C0C0", sticky.getBorderColor());
}
use of com.archimatetool.canvas.model.ICanvasModelSticky in project archi by archimatetool.
the class CanvasModelEditPartFactoryTests method testCanvasStickyEditPart.
@Test
public void testCanvasStickyEditPart() {
ICanvasModelSticky sticky = ICanvasFactory.eINSTANCE.createCanvasModelSticky();
EditPart editPart = editPartFactory.createEditPart(null, sticky);
assertTrue(editPart instanceof CanvasStickyEditPart);
assertEquals(sticky, editPart.getModel());
}
Aggregations