Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ protected void paintChildren(Graphics graphics) {
graphics.clipRect(childBounds);
if (childFigure instanceof Figure f && f.useLocalCoordinates()) {
graphics.translate(childBounds.x, childBounds.y);
} else {
System.out.println(childFigure);
}
childFigure.paint(graphics);
graphics.restoreState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.gef.part.box;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.internal.swing.gef.policy.component.box.GlueSelectionEditPolicy;
import org.eclipse.wb.internal.swing.model.component.ComponentInfo;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
Expand Down Expand Up @@ -60,12 +60,13 @@ protected void createEditPolicies() {
protected IFigure createFigure() {
return new Figure() {
@Override
protected void paintClientArea(Graphics graphics) {
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r = getClientArea();
int x = (r.width - SPRING_SIZE) / 2;
int y = (r.height - SPRING_SIZE) / 2;
BoxGlueHorizontalEditPart.draw(graphics, new Rectangle(0, y, r.width, SPRING_SIZE));
BoxGlueVerticalEditPart.draw(graphics, new Rectangle(x, 0, SPRING_SIZE, r.height));
int x = r.x + (r.width - SPRING_SIZE) / 2;
int y = r.y + (r.height - SPRING_SIZE) / 2;
BoxGlueHorizontalEditPart.draw(graphics, new Rectangle(r.x, y, r.width, SPRING_SIZE));
BoxGlueVerticalEditPart.draw(graphics, new Rectangle(x, r.y, SPRING_SIZE, r.height));
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.gef.part.box;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.internal.swing.gef.policy.component.box.GlueSelectionEditPolicy;
import org.eclipse.wb.internal.swing.model.component.ComponentInfo;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
Expand Down Expand Up @@ -60,7 +60,8 @@ protected void createEditPolicies() {
protected IFigure createFigure() {
return new Figure() {
@Override
protected void paintClientArea(Graphics graphics) {
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r = getClientArea();
draw(graphics, r);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.gef.part.box;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.internal.swing.gef.policy.component.box.GlueSelectionEditPolicy;
import org.eclipse.wb.internal.swing.model.component.ComponentInfo;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
Expand Down Expand Up @@ -60,7 +60,8 @@ protected void createEditPolicies() {
protected IFigure createFigure() {
return new Figure() {
@Override
protected void paintClientArea(Graphics graphics) {
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r = getClientArea();
draw(graphics, r);
}
Expand All @@ -77,8 +78,8 @@ static void draw(Graphics graphics, Rectangle r) {
// draw spring
{
graphics.setForegroundColor(COLOR_SPRING);
int y = r.y;
while (y < r.bottom()) {
int y = 0;
while (y < r.height) {
Comment on lines +81 to +82
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why the coordinates are calculated like this for the vertical, but not the horizontal edit part. But this calculation is factually wrong.
The graphics instance is translated so that (0, 0) is the top left corner of this figure. So y = r.y paints outside the client area unless y = 0.

graphics.drawLine(3, y, 3 + 5, y + 2);
y += 2;
graphics.drawLine(3 + 5, y, 3, y + 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.gef.part.box;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.internal.swing.gef.policy.component.box.StrutDirectRigidEditPolicy;
import org.eclipse.wb.internal.swing.gef.policy.component.box.StrutSelectionRigidEditPolicy;
import org.eclipse.wb.internal.swing.model.component.ComponentInfo;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
Expand Down Expand Up @@ -62,7 +62,8 @@ protected void createEditPolicies() {
protected IFigure createFigure() {
return new Figure() {
@Override
protected void paintClientArea(Graphics graphics) {
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r = getClientArea();
BoxStrutHorizontalEditPart.draw(graphics, r);
BoxStrutVerticalEditPart.draw(graphics, r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.gef.part.box;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.internal.swing.gef.policy.component.box.StrutDirectHorizontalEditPolicy;
import org.eclipse.wb.internal.swing.gef.policy.component.box.StrutSelectionHorizontalEditPolicy;
import org.eclipse.wb.internal.swing.model.component.ComponentInfo;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
Expand Down Expand Up @@ -64,7 +64,8 @@ protected void createEditPolicies() {
protected IFigure createFigure() {
return new Figure() {
@Override
protected void paintClientArea(Graphics graphics) {
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r = getClientArea();
draw(graphics, r);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
*******************************************************************************/
package org.eclipse.wb.internal.swing.gef.part.box;

import org.eclipse.wb.draw2d.Figure;
import org.eclipse.wb.gef.core.EditPart;
import org.eclipse.wb.internal.swing.gef.policy.component.box.StrutDirectVerticalEditPolicy;
import org.eclipse.wb.internal.swing.gef.policy.component.box.StrutSelectionVerticalEditPolicy;
import org.eclipse.wb.internal.swing.model.component.ComponentInfo;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
Expand Down Expand Up @@ -62,7 +62,8 @@ protected void createEditPolicies() {
protected IFigure createFigure() {
return new Figure() {
@Override
protected void paintClientArea(Graphics graphics) {
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r = getClientArea();
draw(graphics, r);
}
Expand Down
Loading