private void addChildren(final PanelDefinition panel) { Set<PartDefinition> parts = panel.getParts(); for (PartDefinition part : parts) { final PlaceRequest place = clonePlaceAndMergeParameters(part.getPlace()); part.setPlace(place); placeManager.goTo(part, panel); } buildPerspective(panel); }
// Initialise Workbench state to that of the provided perspective private void initialisePerspective(final PerspectiveDefinition perspective) { panelManager.setPerspective(perspective); Set<PartDefinition> parts = panelManager.getRoot().getParts(); for (PartDefinition part : parts) { final PlaceRequest place = clonePlaceAndMergeParameters(part.getPlace()); part.setPlace(place); placeManager.goTo(part, panelManager.getRoot()); } buildPerspective(panelManager.getRoot()); onOpen(); }
public void registerPart(PartDefinition partDef, Widget w) { if (widgets.containsKey(partDef)) throw new IllegalArgumentException( "Part already registered: " + partDef.getPlace().getIdentifier()); widgets.put(partDef, w); }
public Widget selectPart(PartDefinition partDef) { if (!hasPart(partDef)) throw new IllegalArgumentException("Unknown part: " + partDef.getPlace().getIdentifier()); final Widget w = widgets.get(partDef); activePart = new Pair<PartDefinition, Widget>(partDef, w); return activePart.getK2(); }
@Test public void checkPerspectiveDefinition() { final ServerManagementPerspective perspective = new ServerManagementPerspective(); final PerspectiveDefinition definition = perspective.buildPerspective(); assertNotNull(definition); assertEquals("ServerManagementPerspective", definition.getName()); assertEquals( SimpleWorkbenchPanelPresenter.class.getName(), definition.getRoot().getPanelType()); assertEquals(1, definition.getRoot().getParts().size()); final PartDefinition partDefinition = definition.getRoot().getParts().iterator().next(); assertTrue(partDefinition.getPlace() instanceof DefaultPlaceRequest); assertEquals("ServerManagementBrowser", partDefinition.getPlace().getIdentifier()); }
public void removePart(PartDefinition partDef) { /* TODO (hbraun): revisit panel managers with single parts if(partDef.equals(activePart.getK1())) throw new IllegalArgumentException("Cannot remove active part: "+ partDef.getPlace().getIdentifier()); */ if (partDef.equals(activePart)) activePart = null; widgets.remove(partDef); }