mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
Visual Edit
This commit is contained in:
+3
-7
@@ -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
|
||||
|
||||
+11
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user