Skip to content

Commit

Permalink
Add "None" line style
Browse files Browse the repository at this point in the history
- Canvas Block, Canvas Image, and Note already have a none border type so these are unnecessary
  • Loading branch information
Phillipus committed Dec 14, 2024
1 parent ba07da5 commit ce8b8b5
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.archimatetool.editor.diagram.figures.TextPositionDelegate;
import com.archimatetool.editor.ui.ColorFactory;
import com.archimatetool.editor.utils.StringUtils;
import com.archimatetool.model.IDiagramModelObject;


/**
Expand Down Expand Up @@ -171,7 +172,7 @@ private void drawFigure(Graphics graphics, Color background) {
drawIconImage(graphics, bounds);

// Border
if(getBorderColor() != null) {
if(getBorderColor() != null && getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getBorderColor());
graphics.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
Expand Down
Binary file added com.archimatetool.editor/img/line-none.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public DiagramModelObjectLineStyleCommand(IDiagramModelObject dmo, int style) {

@Override
public boolean canExecute() {
return super.canExecute() && style >= IDiagramModelObject.LINE_STYLE_SOLID && style <= IDiagramModelObject.LINE_STYLE_DOTTED;
return super.canExecute() && style >= IDiagramModelObject.LINE_STYLE_SOLID && style <= IDiagramModelObject.LINE_STYLE_NONE;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ protected void setLineWidth(Graphics graphics, int lineWidth, Rectangle bounds)
getOwner().setLineWidth(graphics, lineWidth, bounds);
}

protected int getLineStyle() {
return getOwner().getLineStyle();
}

/**
* Set line style
* @param graphics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Pattern;

import com.archimatetool.model.IDiagramModelObject;



/**
Expand Down Expand Up @@ -51,9 +53,11 @@ public void drawFigure(Graphics graphics) {
disposeGradientPattern(graphics, gradient);

// Outline
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawOval(bounds);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawOval(bounds);
}

// Image Icon
Rectangle imageArea = new Rectangle(bounds.x + (bounds.width / 6), bounds.y + (bounds.height / 6),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Pattern;

import com.archimatetool.model.IDiagramModelObject;



/**
Expand Down Expand Up @@ -52,9 +54,11 @@ public void drawFigure(Graphics graphics) {
disposeGradientPattern(graphics, gradient);

// Outline
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawRectangle(bounds);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawRectangle(bounds);
}

// Icon
// getOwner().drawIconImage(graphics, bounds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Pattern;

import com.archimatetool.model.IDiagramModelObject;




Expand Down Expand Up @@ -57,9 +59,11 @@ public void drawFigure(Graphics graphics) {
disposeGradientPattern(graphics, gradient);

// Outline
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawRoundRectangle(bounds, fArc.width, fArc.height);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawRoundRectangle(bounds, fArc.width, fArc.height);
}

// Image Icon
Rectangle imageArea = new Rectangle(bounds.x + 2, bounds.y + 2, bounds.width - 4, bounds.height - 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.archimatetool.editor.ui.IArchiImages;
import com.archimatetool.editor.ui.ImageFactory;
import com.archimatetool.model.IDiagramModelImage;
import com.archimatetool.model.IDiagramModelObject;


/**
Expand Down Expand Up @@ -130,7 +131,7 @@ protected void paintFigure(Graphics graphics) {
}

// Border
if(getBorderColor() != null) {
if(getBorderColor() != null && getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getDiagramModelObject().getLineAlpha());
graphics.setForegroundColor(getBorderColor());
graphics.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,20 @@ protected void drawFigure(Graphics graphics) {
}

// Line
graphics.setForegroundColor(getLineColor());
graphics.setAlpha(getLineAlpha());

Path path = new Path(null);
path.moveTo(bounds.x, bounds.y + tabHeight);
path.lineTo(bounds.x, bounds.y);
path.lineTo(bounds.x + tabWidth, bounds.y);
path.lineTo(bounds.x + tabWidth, bounds.y + tabHeight);
graphics.drawPath(path);
path.dispose();

graphics.drawRectangle(bounds.x, bounds.y + tabHeight, bounds.width, bounds.height - tabHeight);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setForegroundColor(getLineColor());
graphics.setAlpha(getLineAlpha());

Path path = new Path(null);
path.moveTo(bounds.x, bounds.y + tabHeight);
path.lineTo(bounds.x, bounds.y);
path.lineTo(bounds.x + tabWidth, bounds.y);
path.lineTo(bounds.x + tabWidth, bounds.y + tabHeight);
graphics.drawPath(path);
path.dispose();

graphics.drawRectangle(bounds.x, bounds.y + tabHeight, bounds.width, bounds.height - tabHeight);
}
}
else {
graphics.setBackgroundColor(getFillColor());
Expand All @@ -139,9 +141,11 @@ protected void drawFigure(Graphics graphics) {
}

// Line
graphics.setForegroundColor(getLineColor());
graphics.setAlpha(getLineAlpha());
graphics.drawRectangle(bounds);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setForegroundColor(getLineColor());
graphics.setAlpha(getLineAlpha());
graphics.drawRectangle(bounds);
}
}

graphics.popState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.archimatetool.editor.diagram.figures.TextPositionDelegate;
import com.archimatetool.editor.ui.textrender.TextRenderer;
import com.archimatetool.model.IDiagramModelNote;
import com.archimatetool.model.IDiagramModelObject;


/**
Expand Down Expand Up @@ -151,7 +152,7 @@ protected void paintFigure(Graphics graphics) {
// Icon
drawIconImage(graphics, bounds);

if(getDiagramModelObject().getBorderType() != IDiagramModelNote.BORDER_NONE) {
if(getDiagramModelObject().getBorderType() != IDiagramModelNote.BORDER_NONE && 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
Expand Up @@ -13,6 +13,7 @@

import com.archimatetool.editor.diagram.figures.AbstractTextControlContainerFigure;
import com.archimatetool.editor.diagram.figures.FigureUtils;
import com.archimatetool.model.IDiagramModelObject;


/**
Expand Down Expand Up @@ -76,9 +77,11 @@ protected void drawFigure(Graphics graphics) {
disposeGradientPattern(graphics, gradient);

// Line
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawPolygon(points);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawPolygon(points);
}

// Image Icon
Rectangle imageArea = new Rectangle(bounds.x + FLANGE / 2, bounds.y + FLANGE / 2, bounds.width - FLANGE, bounds.height - FLANGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.archimatetool.editor.diagram.figures.AbstractTextControlContainerFigure;
import com.archimatetool.editor.diagram.figures.FigureUtils;
import com.archimatetool.model.IDiagramModelObject;
import com.archimatetool.model.ITextAlignment;
import com.archimatetool.model.ITextPosition;

Expand Down Expand Up @@ -131,17 +132,21 @@ protected void drawFigure(Graphics graphics) {
drawIconImage(graphics, bounds);
}

graphics.setAlpha(getLineAlpha());
graphics.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + tabHeight);
graphics.drawLine(bounds.x, bounds.y, bounds.x + tabWidth, bounds.y);
graphics.drawLine(bounds.x + tabWidth, bounds.y, bounds.x + tabWidth, bounds.y + tabHeight);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + tabHeight);
graphics.drawLine(bounds.x, bounds.y, bounds.x + tabWidth, bounds.y);
graphics.drawLine(bounds.x + tabWidth, bounds.y, bounds.x + tabWidth, bounds.y + tabHeight);
}
}

disposeGradientPattern(graphics, gradient);

// Outlines
graphics.setAlpha(getLineAlpha());
graphics.drawPolygon(mainRectangle);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.drawPolygon(mainRectangle);
}

graphics.popState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.archimatetool.editor.diagram.figures.AbstractTextControlContainerFigure;
import com.archimatetool.editor.utils.StringUtils;
import com.archimatetool.model.IDiagramModelObject;
import com.archimatetool.model.ISketchModelSticky;


Expand Down Expand Up @@ -65,9 +66,11 @@ protected void drawFigure(Graphics graphics) {
drawIconImage(graphics, bounds);

// Outline
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
if(getLineStyle() != IDiagramModelObject.LINE_STYLE_NONE) {
graphics.setAlpha(getLineAlpha());
graphics.setForegroundColor(getLineColor());
graphics.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
}

graphics.popState();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private void createControls(Composite parent) {
menuManager.add(createAction(Messages.LineStyleComposite_1, IDiagramModelObject.LINE_STYLE_SOLID, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.LINE_SOLID)));
menuManager.add(createAction(Messages.LineStyleComposite_2, IDiagramModelObject.LINE_STYLE_DASHED, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.LINE_DASHED)));
menuManager.add(createAction(Messages.LineStyleComposite_3, IDiagramModelObject.LINE_STYLE_DOTTED, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.LINE_DOTTED)));
menuManager.add(createAction(Messages.LineStyleComposite_4, IDiagramModelObject.LINE_STYLE_NONE, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.LINE_NONE)));

Menu menu = menuManager.createContextMenu(button.getShell());
Rectangle buttonBounds = button.getBounds();
Expand Down Expand Up @@ -133,6 +134,9 @@ void updateControl() {
case IDiagramModelObject.LINE_STYLE_DOTTED:
button.setImage(IArchiImages.ImageFactory.getImage(IArchiImages.LINE_DOTTED));
break;
case IDiagramModelObject.LINE_STYLE_NONE:
button.setImage(IArchiImages.ImageFactory.getImage(IArchiImages.LINE_NONE));
break;
}

button.setEnabled(!section.isLocked(dmo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ public class Messages extends NLS {

public static String LineStyleComposite_3;

public static String LineStyleComposite_4;

public static String LineWidthSection_0;

public static String LineWidthSection_1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ LineStyleComposite_0=Line Style:
LineStyleComposite_1=Solid
LineStyleComposite_2=Dashed
LineStyleComposite_3=Dotted
LineStyleComposite_4=None
LineWidthSection_0=Line Width:
LineWidthSection_1=Normal
LineWidthSection_2=Medium
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public interface IArchiImages {
String LINE_SOLID = IMGPATH + "line-solid.png";
String LINE_DASHED = IMGPATH + "line-dashed.png";
String LINE_DOTTED = IMGPATH + "line-dotted.png";
String LINE_NONE = IMGPATH + "line-none.png";

String ARROW_SOURCE_FILL = IMGPATH + "arrow-source-fill.png";
String ARROW_TARGET_FILL = IMGPATH + "arrow-target-fill.png";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h2>Canvas Block</h2>
</tr>
<tr>
<td><strong>Line Style:</strong></td>
<td>Set the line style of the figure. Options are "Solid", "Dashed" and "Dotted".</td>
<td>Set the line style of the figure. Options are "Solid", "Dashed", "Dotted" and "None".</td>
</tr>
<tr>
<td><strong>Text Alignment:</strong></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h2>Canvas Image</h2>
</tr>
<tr>
<td><strong>Line Style:</strong></td>
<td>Set the line style of the figure. Options are "Solid", "Dashed" and "Dotted".</td>
<td>Set the line style of the figure. Options are "Solid", "Dashed", "Dotted" and "None".</td>
</tr>
</table>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2>Element Appearance Properties</h2>
</tr>
<tr>
<td><strong>Line Style:</strong></td>
<td>Set the line style of the figure. Options are "Solid", "Dashed" and "Dotted".</td>
<td>Set the line style of the figure. Options are "Solid", "Dashed", "Dotted" and "None".</td>
</tr>
<tr>
<td><strong>Icon Colour:</strong></td>
Expand Down
2 changes: 1 addition & 1 deletion com.archimatetool.help/help/Text/properties_group.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h2>Group Properties</h2>
</tr>
<tr>
<td><strong>Line Style:</strong></td>
<td>Set the line style of the figure. Options are "Solid", "Dashed" and "Dotted".</td>
<td>Set the line style of the figure. Options are "Solid", "Dashed", "Dotted" and "None".</td>
</tr>
<tr>
<td><strong>Border:</strong></td>
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 @@ -66,7 +66,7 @@ <h2>Note Properties</h2>
</tr>
<tr>
<td><strong>Line Style:</strong></td>
<td>Set the line style of the figure. Options are "Solid", "Dashed" and "Dotted".</td>
<td>Set the line style of the figure. Options are "Solid", "Dashed", "Dotted" and "None".</td>
</tr>
<tr>
<td><strong>Border:</strong></td>
Expand Down
2 changes: 1 addition & 1 deletion com.archimatetool.help/help/Text/properties_viewref.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h2>View Reference Properties</h2>
</tr>
<tr>
<td><strong>Line Style:</strong></td>
<td>Set the line style of the figure. Options are "Solid", "Dashed" and "Dotted".</td>
<td>Set the line style of the figure. Options are "Solid", "Dashed", "Dotted" and "None".</td>
</tr>
<tr>
<td><strong>Text Alignment:</strong></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public interface IDiagramModelObject extends IConnectable, IFontAttribute, ILine
int LINE_STYLE_SOLID = 0;
int LINE_STYLE_DASHED = 1;
int LINE_STYLE_DOTTED = 2;
int LINE_STYLE_NONE = 3;
int FEATURE_LINE_STYLE_DEFAULT = LINE_STYLE_DEFAULT;

/**
Expand Down

0 comments on commit ce8b8b5

Please sign in to comment.