public void test(final Node parent) {
YUI.Use(new String[]{"graphics", "dd-drag"}, new YUICallback() {
@Override
public void ready(final YuiContext Y) {
Graphic g1 = Y.newGraphic(GraphicConfig.create().render(parent));
//move the graphic to parent's position
g1.x(parent.getX()).y(parent.getY());
Shape rect1 = g1.addShape(ShapeConfig.createRect().
width(200).height(120).x(100).y(50).
fill(Fill.create().color("red").opacity(0.7))
);
Shape circle1 = g1.addShape(ShapeConfig.createCircle().
x(100).y(50).radius(70).
fill(Fill.create().color("blue").opacity(0.5))
);
Shape ellipse1 = g1.addShape(ShapeConfig.createEllipse().
x(0).y(0).height(70).width(220).
fill(Fill.create().
type(Fill.TYPE_LINEAR).
rotation(271).stops(new FillStop[]{
FillStop.create("#ff6666").opacity(0.8).offset(0),
FillStop.create("#00ffff").opacity(0.8).offset(0.5),
FillStop.create("#000000").opacity(0.6).offset(1)
})
)
);
//make the ellipse draggable
Drag mydrag = Y.newDDDrag(DragConfig.create().node(ellipse1));
//draw a path
Shape diamond1 = g1.addShape(ShapeConfig.createPath().
fill(Fill.create().color("blue").opacity(0.5))
);
diamond1.moveTo(60, 60);
diamond1.lineTo(80, 40);
diamond1.lineTo(100, 60);