
Crop two shapes to visible bounds
Hello,
I have to create a shape with an icon and following text. -> No Problem
But if the activity is longer than one day and I choosed in the day view the second day, only the text will be displayed.
I have used the BeanDemo and seted the folowing shape to the topDayArea.
In this example I used two TextAShapes with the same behavior, only the second text will be displayed at the second day.
Code:
public static RootAShape createDarkGrayShape()
{
TextAShape textAShape = new TextAShape();
textAShape.setAttribute(AShape.A_TEXT, "Test");
textAShape.setAttribute(TextAShape.A_FONT, new Font("SansSerif", Font.PLAIN, 11));
textAShape.setAttribute(TextAShape.A_PAINT, Color.BLACK);
textAShape.setAttribute(AShape.A_CLIP_TYPE, AShape.CLIP_PARENT_BOUNDS);
TextAShape textAShape2 = new TextAShape();
textAShape2.setAttribute(AShape.A_TEXT, "blabla");
textAShape2.setAttribute(TextAShape.A_FONT, new Font("SansSerif", Font.PLAIN, 11));
textAShape2.setAttribute(TextAShape.A_PAINT, Color.BLACK);
textAShape2.setAttribute(AShape.A_CLIP_TYPE, AShape.CLIP_PARENT_BOUNDS);
FillAShape background = new FillAShape();
background.setAttribute(AShape.A_PAINT, Color.GREEN);
background.setAttribute(AShape.A_SHAPE, new RoundRectangle(0, 0, 1, 1, 5, 5));
background.setAttribute(AShape.A_CROP_TO_VISIBILITY_BOUNDS, Boolean.TRUE);
AtRefNumber[] hSizes = new AtRefNumber[] {new AtFixed(30f), new AtFraction(1), new AtFixed(12)};
RowAShapeLayout vRowLayout = new RowAShapeLayout(SwingConstants.HORIZONTAL, hSizes);
background.setAttribute(AShape.A_LAYOUT, vRowLayout);
ContainerAShape container = new ContainerAShape();
background.addSubShape(textAShape);
background.addSubShape(textAShape2);
container.addSubShape(background);
RootAShape root = new RootAShape(container);
return root;
}