Ejemplo n.º 1
0
 @Perspective
 public PerspectiveDefinition getPerspective() {
   final PerspectiveDefinition p =
       new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
   p.setName("Jobs");
   p.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest("Requests List")));
   return p;
 }
 @Perspective
 public PerspectiveDefinition buildPerspective() {
   final PerspectiveDefinition p =
       new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
   p.setName("Simple Perspective No Context");
   p.getRoot().addPart("welcome");
   return p;
 }
  @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());
  }
  @Perspective
  public PerspectiveDefinition getPerspective() {
    final PerspectiveDefinition perspective =
        new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
    perspective.setName(constants.Administration());

    perspective
        .getRoot()
        .addPart(new PartDefinitionImpl(new DefaultPlaceRequest("RepositoriesEditor")));

    final PanelDefinition west =
        new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());
    west.setWidth(300);
    west.setMinWidth(200);
    west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest("FileExplorer")));

    perspective.getRoot().insertChild(CompassPosition.WEST, west);

    return perspective;
  }
  PerspectiveDefinition buildPerspective() {
    PerspectiveDefinition perspective =
        new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
    perspective.setName("Preferences");

    final PanelDefinition actionsBar =
        new PanelDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());
    actionsBar.setHeight(80);
    actionsBar.addPart(
        new PartDefinitionImpl(
            new DefaultPlaceRequest(PreferencesCentralActionsScreen.IDENTIFIER)));

    perspective.getRoot().insertChild(CompassPosition.SOUTH, actionsBar);

    return perspective;
  }