Skip to content

Commit

Permalink
Remove the "None" border style for Notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipus committed Dec 14, 2024
1 parent de781cb commit c5ed373
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 11 deletions.
4 changes: 4 additions & 0 deletions com.archimatetool.editor/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@
class="com.archimatetool.editor.model.compatibility.handlers.Archimate32Handler"
id="com.archimatetool.editor.compatibility.archimate32converter">
</compatibilityHandler>
<compatibilityHandler
class="com.archimatetool.editor.model.compatibility.handlers.NoteBorderStyleHandler"
id="com.archimatetool.editor.noteBorderStyle">
</compatibilityHandler>
</extension>
<extension
point="com.archimatetool.editor.imageExportProvider">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ protected void paintFigure(Graphics graphics) {
bounds.height--;

// Set line width here so that the whole figure is constrained, otherwise SVG graphics will have overspill
if(getDiagramModelObject().getBorderType() != IDiagramModelNote.BORDER_NONE) {
setLineWidth(graphics, bounds);
setLineStyle(graphics);
}
setLineWidth(graphics, bounds);

setLineStyle(graphics);

// Fill
PointList points = new PointList();
Expand Down Expand Up @@ -152,7 +151,7 @@ protected void paintFigure(Graphics graphics) {
// Icon
drawIconImage(graphics, bounds);

if(getDiagramModelObject().getBorderType() != IDiagramModelNote.BORDER_NONE && getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawPolygon(points);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* This program and the accompanying materials
* are made available under the terms of the License
* which accompanies this distribution in the file LICENSE.txt
*/
package com.archimatetool.editor.model.compatibility.handlers;

import java.util.Iterator;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;

import com.archimatetool.editor.model.compatibility.CompatibilityHandlerException;
import com.archimatetool.editor.model.compatibility.ICompatibilityHandler;
import com.archimatetool.model.IArchimateModel;
import com.archimatetool.model.IDiagramModelNote;
import com.archimatetool.model.IDiagramModelObject;



/**
* Change a Note's border type from "None" to "Rectangle" and set its line style to "None" instead
*
* @author Phillip Beauvoir
*/
public class NoteBorderStyleHandler implements ICompatibilityHandler {

@Override
public void fixCompatibility(Resource resource) throws CompatibilityHandlerException {
IArchimateModel model = (IArchimateModel)resource.getContents().get(0);
convertNoteBorders(model);
}

private void convertNoteBorders(IArchimateModel model) {
for(Iterator<EObject> iter = model.eAllContents(); iter.hasNext();) {
EObject eObject = iter.next();

if((eObject instanceof IDiagramModelNote note && note.getBorderType() == IDiagramModelNote.BORDER_NONE)) {
note.setBorderType(IDiagramModelNote.BORDER_RECTANGLE);
note.setLineStyle(IDiagramModelObject.LINE_STYLE_NONE);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ public class Messages extends NLS {

public static String NoteBorderTypeSection_1;

public static String NoteBorderTypeSection_2;

public static String PropertiesLabelProvider_0;

public static String SketchElementSection_0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public class NoteBorderTypeSection extends BorderTypeSection {

private static final String[] noteComboItems = {
Messages.NoteBorderTypeSection_0,
Messages.NoteBorderTypeSection_1,
Messages.NoteBorderTypeSection_2
Messages.NoteBorderTypeSection_1
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ LockedSection_0=Locked:
NameSection_0=Add a name here
NoteBorderTypeSection_0=Dog Ear
NoteBorderTypeSection_1=Rectangle
NoteBorderTypeSection_2=None

PropertiesLabelProvider_0=(Multiple Selection)

Expand Down
2 changes: 1 addition & 1 deletion com.archimatetool.help/help/Text/properties_note.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2>Note Properties</h2>
</tr>
<tr>
<td><strong>Border:</strong></td>
<td>Sets the border type. Can be either "Dog Ear", "Rectangle" or "None".</td>
<td>Sets the border type. Can be either "Dog Ear" or "Rectangle".</td>
</tr>
<tr>
<td><strong>Text Alignment:</strong></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public interface IDiagramModelNote extends IDiagramModelObject, ITextContent, IT

int BORDER_DOGEAR = 0; // Default
int BORDER_RECTANGLE = 1;

// TODO: Remove this
int BORDER_NONE = 2;

} // IDiagramModelNote

0 comments on commit c5ed373

Please sign in to comment.