Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 255553 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gmf/runtime/diagram/ui/editparts/ResizableCompartmentEditPart.java (-2 / +33 lines)
Lines 1-5 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 * Copyright (c) 2002, 2006 IBM Corporation and others.
2
 * Copyright (c) 2002, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-17 Link Here
11
11
12
package org.eclipse.gmf.runtime.diagram.ui.editparts;
12
package org.eclipse.gmf.runtime.diagram.ui.editparts;
13
13
14
import org.eclipse.draw2d.Border;
14
import org.eclipse.draw2d.IFigure;
15
import org.eclipse.draw2d.IFigure;
16
import org.eclipse.draw2d.LineBorder;
15
import org.eclipse.emf.common.notify.Notification;
17
import org.eclipse.emf.common.notify.Notification;
16
import org.eclipse.emf.ecore.EObject;
18
import org.eclipse.emf.ecore.EObject;
17
import org.eclipse.gef.ExposeHelper;
19
import org.eclipse.gef.ExposeHelper;
Lines 70-75 Link Here
70
		refreshShowCompartmentTitle();
72
		refreshShowCompartmentTitle();
71
		refreshCollapsed();
73
		refreshCollapsed();
72
		refreshRatio();
74
		refreshRatio();
75
		refreshLineWidth();
76
		refreshLineType();		
73
	}
77
	}
74
78
75
	/**
79
	/**
Lines 138-144 Link Here
138
                NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
142
                NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
139
                NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
143
                NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
140
			refreshFont();
144
			refreshFont();
141
		} else
145
        } else if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)){
146
			refreshLineWidth();
147
		} else if (NotationPackage.eINSTANCE.getLineTypeStyle_LineType().equals(feature)) {
148
			refreshLineType();
149
		} else 
142
			super.handleNotificationEvent(event);
150
			super.handleNotificationEvent(event);
143
	}
151
	}
144
		
152
		
Lines 229-234 Link Here
229
		if (getCompartmentFigure()!=null)
237
		if (getCompartmentFigure()!=null)
230
			getCompartmentFigure().setFontColor(color);
238
			getCompartmentFigure().setFontColor(color);
231
	}
239
	}
240
	
241
	/**
242
	 * Sets the line width for the shape's border
243
	 * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#setLineWidth(int)
244
	 */
245
	protected void setLineWidth(int width) {
246
		Border border = getFigure().getBorder();
247
		if (border instanceof LineBorder) {
248
			((LineBorder) border).setWidth(getMapMode().DPtoLP(width));
249
			getFigure().revalidate();
250
		}		
251
	}
252
	
253
	/**
254
	 * Sets the line type for the shape's border
255
	 * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#setLineType(int)
256
	 */
257
	protected void setLineType(int type) {
258
		Border border = getFigure().getBorder();
259
		if (border instanceof LineBorder) {
260
			((LineBorder) border).setStyle(type);
261
		}
262
	}	
232
263
233
	/**
264
	/**
234
	 * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#addNotationalListeners()
265
	 * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#addNotationalListeners()
(-)src/org/eclipse/gmf/runtime/draw2d/ui/figures/OneLineBorder.java (-4 / +16 lines)
Lines 1-5 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 * Copyright (c) 2002, 2003 IBM Corporation and others.
2
 * Copyright (c) 2002, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 117-135 Link Here
117
			tempRect.width--;
117
			tempRect.width--;
118
			tempRect.height--;
118
			tempRect.height--;
119
		}
119
		}
120
		tempRect.shrink(getWidth() / 2, getWidth() / 2);
121
		graphics.setLineWidth(getWidth());
120
		graphics.setLineWidth(getWidth());
121
		graphics.setLineStyle(getStyle());
122
		switch (position) {
122
		switch (position) {
123
			case PositionConstants.TOP :
123
			case PositionConstants.TOP :
124
				graphics.drawLine(tempRect.getTopLeft(), tempRect.getTopRight());
124
				// move down by width/2 to ensure the border will fit;
125
				// no need to change x
126
				tempRect.y += getWidth() / 2;				
127
				graphics.drawLine(tempRect.getTopLeft(), tempRect.getTopRight());				
125
				break;
128
				break;
126
			case PositionConstants.BOTTOM :
129
			case PositionConstants.BOTTOM :	
130
				// move up by width/2 to ensure the border will fit;
131
				// no need to change x			
132
				tempRect.y -= getWidth() / 2;
127
				graphics.drawLine(tempRect.getBottomLeft(), tempRect.getBottomRight());
133
				graphics.drawLine(tempRect.getBottomLeft(), tempRect.getBottomRight());
128
				break;
134
				break;
129
			case PositionConstants.LEFT :
135
			case PositionConstants.LEFT :
136
				// move right by width/2 to ensure the border will fit;
137
				// no need to change y			
138
				tempRect.x += getWidth() / 2;
130
				graphics.drawLine(tempRect.getTopLeft(), tempRect.getBottomLeft());
139
				graphics.drawLine(tempRect.getTopLeft(), tempRect.getBottomLeft());
131
				break;
140
				break;
132
			case PositionConstants.RIGHT :
141
			case PositionConstants.RIGHT :
142
				// move left by width/2 to ensure the border will fit;
143
				// no need to change y						
144
				tempRect.x -= getWidth() / 2;
133
				graphics.drawLine(tempRect.getTopRight(), tempRect.getBottomRight());
145
				graphics.drawLine(tempRect.getTopRight(), tempRect.getBottomRight());
134
				break;
146
				break;
135
		}
147
		}
(-)src/org/eclipse/gmf/runtime/draw2d/ui/figures/RectangularDropShadowLineBorder.java (-1 / +3 lines)
Lines 158-163 Link Here
158
			tempRect.setBounds(getPaintRectangle(figure, insets));
158
			tempRect.setBounds(getPaintRectangle(figure, insets));
159
			tempRect.shrink(getWidth()/2, getWidth()/2);
159
			tempRect.shrink(getWidth()/2, getWidth()/2);
160
			g.setLineWidth(getWidth());
160
			g.setLineWidth(getWidth());
161
			g.setLineStyle(getStyle());
161
			g.drawRectangle(tempRect);			
162
			g.drawRectangle(tempRect);			
162
		}
163
		}
163
	}
164
	}
Lines 183-189 Link Here
183
			tempRect.width -= mm.DPtoLP(getShadowWidth());
184
			tempRect.width -= mm.DPtoLP(getShadowWidth());
184
			tempRect.height -= mm.DPtoLP(getShadowHeight());
185
			tempRect.height -= mm.DPtoLP(getShadowHeight());
185
			tempRect.shrink(getWidth() / 2, getWidth() / 2);
186
			tempRect.shrink(getWidth() / 2, getWidth() / 2);
186
			g.setLineWidth(getWidth());			
187
			g.setLineWidth(getWidth());	
188
			g.setLineStyle(getStyle());
187
189
188
			if (getColor() != null) {
190
			if (getColor() != null) {
189
				g.setForegroundColor(getColor());
191
				g.setForegroundColor(getColor());
(-)src/org/eclipse/gmf/runtime/draw2d/ui/internal/figures/LineBorderEx.java (-8 / +8 lines)
Lines 1-5 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 * Copyright (c) 2002, 2004 IBM Corporation and others.
2
 * Copyright (c) 2002, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 16-21 Link Here
16
import org.eclipse.draw2d.IFigure;
16
import org.eclipse.draw2d.IFigure;
17
import org.eclipse.draw2d.LineBorder;
17
import org.eclipse.draw2d.LineBorder;
18
import org.eclipse.draw2d.geometry.Insets;
18
import org.eclipse.draw2d.geometry.Insets;
19
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
19
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
20
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
20
import org.eclipse.swt.graphics.Color;
21
import org.eclipse.swt.graphics.Color;
21
22
Lines 70-83 Link Here
70
	 */
71
	 */
71
	public void paint(IFigure figure, Graphics graphics, Insets insets) {
72
	public void paint(IFigure figure, Graphics graphics, Insets insets) {
72
		tempRect.setBounds(getPaintRectangle(figure, insets));
73
		tempRect.setBounds(getPaintRectangle(figure, insets));
73
		if (getWidth() % 2 == 1) {
74
		IMapMode mm = MapModeUtil.getMapMode(figure);
74
			tempRect.width -= MapModeUtil.getMapMode(figure).DPtoLP(1);
75
		// width is in pixels (as stated in constructors), convert it
75
			tempRect.height -= MapModeUtil.getMapMode(figure).DPtoLP(1);
76
		int lpWidth = mm.DPtoLP(getWidth());
76
		}
77
		tempRect.shrink(lpWidth / 2, lpWidth / 2);
77
		int shrinkWidth = MapModeUtil.getMapMode(figure).DPtoLP( getWidth() / 2 );
78
		tempRect.shrink(shrinkWidth, shrinkWidth);
79
78
80
		graphics.setLineWidth(getWidth());
79
		graphics.setLineWidth(lpWidth);
80
		graphics.setLineStyle(getStyle());
81
		if (getColor() != null)
81
		if (getColor() != null)
82
			graphics.setForegroundColor(getColor());
82
			graphics.setForegroundColor(getColor());
83
83
(-)src/org/eclipse/gmf/runtime/diagram/ui/geoshapes/internal/draw2d/figures/GeoShapeLineStyleBorder.java (-23 / +2 lines)
Lines 1-5 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 * Copyright (c) 2002, 2004 IBM Corporation and others.
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 18-32 Link Here
18
import org.eclipse.draw2d.geometry.Rectangle;
18
import org.eclipse.draw2d.geometry.Rectangle;
19
19
20
/**
20
/**
21
 * Extends {@link org.eclipse.draw2d.LineBorder} to support line style.
21
 * Extends {@link org.eclipse.draw2d.LineBorder} to customize painting.
22
 * 
22
 * 
23
 * @author Anthony Hunter
23
 * @author Anthony Hunter
24
 * @since 2.1
24
 * @since 2.1
25
 */
25
 */
26
public class GeoShapeLineStyleBorder extends LineBorder {
26
public class GeoShapeLineStyleBorder extends LineBorder {
27
27
28
	private int style = Graphics.LINE_SOLID;
29
30
	/**
28
	/**
31
	 * Constructs a default black LineBorder with a width of one pixel.
29
	 * Constructs a default black LineBorder with a width of one pixel.
32
	 * 
30
	 * 
Lines 36-60 Link Here
36
		super();
34
		super();
37
	}
35
	}
38
36
39
	/**
40
	 * Get the line style of this border.
41
	 * 
42
	 * @return The line style of this border.
43
	 */
44
	public int getStyle() {
45
		return style;
46
	}
47
48
	/**
49
	 * Set the line style of this border.
50
	 * 
51
	 * @param style
52
	 *            The line style of this border.
53
	 */
54
	public void setStyle(int style) {
55
		this.style = style;
56
	}
57
58
	/*
37
	/*
59
	 * @see org.eclipse.draw2d.LineBorder#paint(org.eclipse.draw2d.IFigure,
38
	 * @see org.eclipse.draw2d.LineBorder#paint(org.eclipse.draw2d.IFigure,
60
	 *      org.eclipse.draw2d.Graphics, org.eclipse.draw2d.geometry.Insets)
39
	 *      org.eclipse.draw2d.Graphics, org.eclipse.draw2d.geometry.Insets)
(-)src/org/eclipse/gmf/runtime/diagram/ui/geoshapes/internal/editparts/ShadowRectangleEditPart.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
 * Copyright (c) 2003, 2005 IBM Corporation and others.
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 57-61 Link Here
57
		((RectangularDropShadowLineBorder)getFigure().getBorder()).setWidth(getMapMode().DPtoLP(width));
57
		((RectangularDropShadowLineBorder)getFigure().getBorder()).setWidth(getMapMode().DPtoLP(width));
58
		getFigure().revalidate();
58
		getFigure().revalidate();
59
	}
59
	}
60
	
61
	/**
62
	 * @see org.eclipse.gmf.runtime.diagram.ui.geoshapes.internal.editparts.GeoShapeEditPart#setLineType(int)
63
	 */
64
	protected void setLineType(int lineType) {
65
		super.setLineType(lineType);
66
		((RectangularDropShadowLineBorder)getFigure().getBorder()).setStyle(lineType);
67
	}	
60
68
61
}
69
}

Return to bug 255553