FileDocCategorySizeDatePackage
ElementFigure.javaAPI DocAndroid 1.5 API2122Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.layout.parts

ElementFigure

public class ElementFigure extends org.eclipse.draw2d.Figure
The figure used to draw basic elements.

The figure is totally empty and transparent except for the selection border.

Fields Summary
private boolean
mIsSelected
private org.eclipse.draw2d.geometry.Rectangle
mInnerBounds
Constructors Summary
public ElementFigure()

        setOpaque(false);
    
Methods Summary
public org.eclipse.draw2d.geometry.RectanglegetInnerBounds()

        return mInnerBounds;
    
protected voidpaintBorder(org.eclipse.draw2d.Graphics graphics)

        super.paintBorder(graphics);

        if (mIsSelected) {
            graphics.setLineWidth(1);
            graphics.setLineStyle(SWT.LINE_SOLID);
            graphics.setForegroundColor(ColorConstants.red);
            graphics.drawRectangle(getInnerBounds());
        }
    
public voidsetBounds(org.eclipse.draw2d.geometry.Rectangle rect)

        super.setBounds(rect);
        
        mInnerBounds = getBounds().getCopy();
        if (mInnerBounds.width > 0) {
            mInnerBounds.width--;
        }
        if (mInnerBounds.height > 0) {
            mInnerBounds.height--;
        }
    
public voidsetSelected(boolean isSelected)

        if (isSelected != mIsSelected) {
            mIsSelected = isSelected;
            repaint();
        }