import ilog.views.graphic.composite.* ;
IlvCompositeGraphic composite = new IlvCompositeGraphic();
import ilog.views.graphic.composite.layout.*;
IlvAttachmentLayout layout = new IlvAttachmentLayout(); composite.setLayout(layout);
IlvRectangle rectangle = new IlvRectangle(new IlvRect(0,0,40,40),true,true); composite.setChildren(0,rectangle)
IlvText text = new IlvText(); text.setLabel("Composite Graphic"); composite.setChildren(1,text);
composite.setConstraints(1, new IlvAttachmentConstraint(IlvAttachmentLocation.TopCenter, IlvAttachmentLocation.BottomCenter));
rectangles
to hold the three small rectangles. Its
role will be to align these rectangles horizontally. IlvCompositeGraphic rectangles = new IlvCompositeGraphic();
IlvStackerLayout stacker = new IlvStackerLayout(SwingConstants.RIGHT,SwingConstants.BOTTOM,3); rectangles.setLayout(stacker);
rectangles
composite graphic. IlvRectangle r1 = new IlvRectangle(new IlvRect(0,0,5,5),true,true); r1.setBackground(Color.red); rectangles.setChildren(0,r1); IlvRectangle r2 = new IlvRectangle(new IlvRect(0,0,5,5),true,true); r2.setBackground(Color.yellow); rectangles.setChildren(1,r2); IlvRectangle r3 = new IlvRectangle(new IlvRect(0,0,5,5),true,true); r3.setBackground(Color.green); rectangles.setChildren(2,r3);
rectangles
composite
graphic as a child graphic of the main composite graphic built in
the previous stages. composite.setChildren(2,rectangles); composite.setConstraints(2,new IlvAttachmentConstraint(IlvAttachmentLocation.BottomLeft,IlvAttachmentLocation.TopRight));
IlvCompositeGraphic balloon = new IlvCompositeGraphic(); IlvCenteredLayout centered = new IlvCenteredLayout(new Insets(5,5,5,5)); balloon.setLayout(centered);
IlvEllipse ellipse = new IlvEllipse(); ellipse.setFillOn(true); ellipse.setBackground(Color.yellow); balloon.setChildren(0,ellipse);
IlvText balloonText = new IlvText(new IlvPoint(0,0),"Balloon"); balloon.setChildren(1,balloonText);
composite.setChildren(3,balloon); composite.setConstraints(3,new IlvAttachmentConstraint(IlvAttachmentLocation.BottomCenter,IlvAttachmentLocation.TopLeft));