robot = BasicRobot.robotWithCurrentAwtHierarchy();
manifestationInfo = new MCTViewManifestationInfoImpl();
manifestationInfo.addInfoProperty(ControlAreaFormattingConstants.PANEL_ORDER,"0");
Mockito.when(mockComponent.getViewInfos(ViewType.TITLE)).thenReturn(Collections.singleton(new ViewInfo(MockTitleManifestation.class,"", ViewType.TITLE)));
Mockito.when(mockComponent.getDisplayName()).thenReturn("test comp");
Mockito.when(mockComponent.getComponents()).thenReturn(
Collections.<AbstractComponent> emptyList());
Mockito.when(mockPlatform.getPolicyManager())
.thenReturn(mockPolicyManager);
Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.<PolicyContext> any()))
.thenReturn(new ExecutionResult(null, false, null)); // Nothing is locked
GuiActionRunner.execute(new GuiTask() {
@SuppressWarnings("serial")
@Override
protected void executeInEDT() throws Throwable {
frame = new JFrame(TITLE);
frame.setName(TITLE);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final ExtendedProperties viewProps = new ExtendedProperties();
canvasManifestation = new TestCanvasManifestation(mockComponent, new ViewInfo(CanvasManifestation.class, "", ViewType.CENTER)) {
@Override
public ExtendedProperties getViewProperties() {
return viewProps;
}
};
canvasManifestation.setPreferredSize(new Dimension(PANEL_SIZE * 3, PANEL_SIZE * 3));
frame.getContentPane().add(canvasManifestation);
frame.setLocation(PANEL_SIZE, PANEL_SIZE);
frame.getContentPane().setSize(new Dimension(PANEL_SIZE * 3, PANEL_SIZE * 3));
frame.setSize(new Dimension(PANEL_SIZE * 3, PANEL_SIZE * 3));
panelManifestation = new MockManifestation(mockComponent, new ViewInfo(CanvasManifestation.class, "", ViewType.OBJECT));
MCTViewManifestationInfoImpl info = new MCTViewManifestationInfoImpl();
panelManifestation.putClientProperty(CanvasManifestation.MANIFEST_INFO, info);
testPanel = canvasManifestation.createPanel(panelManifestation, 0,
canvasManifestation);