Search in sources :

Example 6 with PaintFormat

use of com.archimatetool.editor.diagram.tools.FormatPainterInfo.PaintFormat in project archi by archimatetool.

the class FormatPainterToolTests method testCreateCommandForDiagramModelArchimateConnection.

@Test
public void testCreateCommandForDiagramModelArchimateConnection() throws Exception {
    // Source component
    IDiagramModelArchimateConnection sourceComponent = ArchimateTestModel.createDiagramModelArchimateConnection(IArchimateFactory.eINSTANCE.createAccessRelationship());
    // Target component
    IDiagramModelArchimateConnection targetComponent = ArchimateTestModel.createDiagramModelArchimateConnection(IArchimateFactory.eINSTANCE.createAccessRelationship());
    // Set FormatPainterInfo to Source component
    FormatPainterInfo.INSTANCE.updatePaintFormat(sourceComponent);
    PaintFormat pf = FormatPainterInfo.INSTANCE.getPaintFormat();
    // Execute command
    FormatPainterTool tool = new FormatPainterTool();
    CompoundCommand compoundCmd = tool.createCommand(pf, targetComponent);
    // Should be no commands
    assertEquals(0, compoundCmd.getCommands().size());
    // Now change some properties on the source component
    sourceComponent.setFont("Consolas");
    sourceComponent.setFontColor("#eeeeee");
    sourceComponent.setLineColor("#eeeeee");
    sourceComponent.setLineWidth(3);
    sourceComponent.setTextPosition(3);
    compoundCmd = tool.createCommand(pf, targetComponent);
    assertEquals(5, compoundCmd.getCommands().size());
}
Also used : PaintFormat(com.archimatetool.editor.diagram.tools.FormatPainterInfo.PaintFormat) IDiagramModelArchimateConnection(com.archimatetool.model.IDiagramModelArchimateConnection) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) Test(org.junit.Test)

Aggregations

PaintFormat (com.archimatetool.editor.diagram.tools.FormatPainterInfo.PaintFormat)6 Test (org.junit.Test)5 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)4 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)3 FillColorCommand (com.archimatetool.editor.diagram.commands.FillColorCommand)2 Command (org.eclipse.gef.commands.Command)2 BorderColorCommand (com.archimatetool.editor.diagram.commands.BorderColorCommand)1 ConnectionTextPositionCommand (com.archimatetool.editor.diagram.commands.ConnectionTextPositionCommand)1 DiagramModelObjectAlphaCommand (com.archimatetool.editor.diagram.commands.DiagramModelObjectAlphaCommand)1 FontColorCommand (com.archimatetool.editor.diagram.commands.FontColorCommand)1 FontStyleCommand (com.archimatetool.editor.diagram.commands.FontStyleCommand)1 LineColorCommand (com.archimatetool.editor.diagram.commands.LineColorCommand)1 LineWidthCommand (com.archimatetool.editor.diagram.commands.LineWidthCommand)1 TextAlignmentCommand (com.archimatetool.editor.diagram.commands.TextAlignmentCommand)1 TextPositionCommand (com.archimatetool.editor.diagram.commands.TextPositionCommand)1 IBorderObject (com.archimatetool.model.IBorderObject)1 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)1 IDiagramModelComponent (com.archimatetool.model.IDiagramModelComponent)1 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)1 ILineObject (com.archimatetool.model.ILineObject)1