//
// Bounds Property
//
////////////////////////////////////////////////////////////////////////////
private Property getBoundsProperty(CanvasInfo canvas) {
ComplexProperty boundsProperty = (ComplexProperty) canvas.getArbitraryValue(this);
if (boundsProperty == null) {
boundsProperty = new ComplexProperty("Bounds", null);
boundsProperty.setCategory(PropertyCategory.system(5));
boundsProperty.setModified(true);
canvas.putArbitraryValue(this, boundsProperty);
// x
BoundsProperty<?> xProperty = new BoundsProperty<CanvasInfo>(canvas, "x") {
@Override
public void setValue2(int value, Rectangle modelBounds) throws Exception {
command_BOUNDS(m_component, new Point(value, modelBounds.y), null);
}
};
// y
BoundsProperty<?> yProperty = new BoundsProperty<CanvasInfo>(canvas, "y") {
@Override
public void setValue2(int value, Rectangle modelBounds) throws Exception {
command_BOUNDS(m_component, new Point(modelBounds.x, value), null);
}
};
// width
BoundsProperty<?> widthProperty = new BoundsProperty<CanvasInfo>(canvas, "width") {
@Override
public void setValue2(int value, Rectangle modelBounds) throws Exception {
command_BOUNDS(m_component, null, new Dimension(value, modelBounds.height));
}
};
// height
BoundsProperty<?> heightProperty = new BoundsProperty<CanvasInfo>(canvas, "height") {
@Override
public void setValue2(int value, Rectangle modelBounds) throws Exception {
command_BOUNDS(m_component, null, new Dimension(modelBounds.width, value));
}
};
boundsProperty.setProperties(new Property[]{
xProperty,
yProperty,
widthProperty,
heightProperty});
}
// apply current bounds
Rectangle modelBounds = canvas.getModelBounds();
if (modelBounds != null) {
boundsProperty.setText("("
+ modelBounds.x
+ ", "
+ modelBounds.y
+ ", "
+ modelBounds.width