Visual Edit

This commit is contained in:
Alexander Lobas
2013-01-31 19:35:12 +04:00
parent 98949ba96c
commit 69f8e74aa8
2 changed files with 14 additions and 10 deletions
@@ -19,6 +19,7 @@ import com.intellij.designer.designSurface.AbstractEditOperation;
import com.intellij.designer.designSurface.FeedbackTreeLayer;
import com.intellij.designer.designSurface.OperationContext;
import com.intellij.designer.model.RadComponent;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
@@ -66,13 +67,8 @@ public abstract class TreeEditOperation extends AbstractEditOperation {
}
}
private boolean isChildren(RadComponent component) {
for (Object child : myContainer.getTreeChildren()) {
if (child == component) {
return true;
}
}
return false;
protected final boolean isChildren(RadComponent component) {
return ArrayUtil.indexOf(myContainer.getTreeChildren(), component) != -1;
}
@Override
@@ -21,6 +21,8 @@ import java.awt.*;
* @author Alexander Lobas
*/
public class RoundRectangleFeedback extends RectangleFeedback {
private static final BasicStroke STROKE = new BasicStroke(2);
private final int myRadius;
public RoundRectangleFeedback(Color color, int line, int radius) {
@@ -30,9 +32,15 @@ public class RoundRectangleFeedback extends RectangleFeedback {
@Override
protected void paintFeedback(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(STROKE);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Dimension size = getSize();
for (int i = 0; i < myLine; i++) {
g.drawRoundRect(i, i, size.width - i - i - 1, size.height - i - i - 1, myRadius, myRadius);
}
g.drawRoundRect(0, 0, size.width - 1, size.height - 1, myRadius, myRadius);
g2d.setStroke(oldStroke);
}
}