本文整理汇总了Java中org.uberfire.workbench.model.impl.PartDefinitionImpl类的典型用法代码示例。如果您正苦于以下问题:Java PartDefinitionImpl类的具体用法?Java PartDefinitionImpl怎么用?Java PartDefinitionImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PartDefinitionImpl类属于org.uberfire.workbench.model.impl包,在下文中一共展示了PartDefinitionImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPerspective
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Perspective
public PerspectiveDefinition buildPerspective() {
final PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
perspective.setName(translationService.getTranslation(AppConstants.AdministrationPerspective_AdministrationPerspective));
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;
}
示例2: buildParts
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
private void buildParts(final PanelDefinition panel,
final JsArray<JSPartDefinition> parts) {
if (parts != null) {
for (int i = 0; i < parts.length(); i++) {
final JSPartDefinition part = parts.get(i);
final PlaceRequest placeRequest = new DefaultPlaceRequest(part.getPlaceName());
if (part.getParameters() != null) {
final JSONObject json = new JSONObject(part.getParameters());
for (final String key : json.keySet()) {
placeRequest.addParameter(key,
json.get(key).isString().stringValue());
}
}
final PartDefinition partDefinition = new PartDefinitionImpl(placeRequest);
partDefinition.setContextDisplayMode(JSNativePerspective.this.getContextDisplayMode(part.getContextDisplayModeAsString(),
ContextDisplayMode.SHOW));
if (part.getContextId() != null) {
partDefinition.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(part.getContextId())));
}
panel.addPart(partDefinition);
}
}
}
示例3: getFirstUnselectablePartTest
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Test
public void getFirstUnselectablePartTest() {
PartDefinition part1 = new PartDefinitionImpl(mock(PlaceRequest.class));
part1.setSelectable(false);
PartDefinition part2 = new PartDefinitionImpl(mock(PlaceRequest.class));
part2.setSelectable(true);
PartDefinition part3 = new PartDefinitionImpl(mock(PlaceRequest.class));
part3.setSelectable(false);
LinkedHashSet<PartDefinition> parts = new LinkedHashSet<>();
parts.add(part1);
parts.add(part2);
parts.add(part3);
doReturn(parts).when(listBar).getUnselectedParts();
assertSame(part2, listBar.getNextPart(part1));
assertSame(part1, listBar.getNextPart(part2));
assertSame(part2, listBar.getNextPart(part3));
}
示例4: createPartDefinitions
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
private void createPartDefinitions() {
partDefinitionsRoot = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest("part1")),
new PartDefinitionImpl(new DefaultPlaceRequest("part2")));
partDefinitionRootChild1 = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest("part1-rootChild1")),
new PartDefinitionImpl(new DefaultPlaceRequest("part2-rootChild1")),
new PartDefinitionImpl(new DefaultPlaceRequest("part3-rootChild1")));
partDefinitionRootChild2 = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest("part1-rootChild2")),
new PartDefinitionImpl(new DefaultPlaceRequest("part2-rootChild2")),
new PartDefinitionImpl(new DefaultPlaceRequest("part3-rootChild2")));
partDefinitionRootChild2Child = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest("part1-rootChild2Child")),
new PartDefinitionImpl(new DefaultPlaceRequest("part2-rootChild2Child")),
new PartDefinitionImpl(new DefaultPlaceRequest("part3-rootChild2Child")),
new PartDefinitionImpl(new DefaultPlaceRequest("part4-rootChild2Child")));
}
示例5: removeContainedPart
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Test
public void removeContainedPart() {
WorkbenchPartPresenter mockPresenter = mock(WorkbenchPartPresenter.class);
WorkbenchPartPresenter.View mockPartView = mock(WorkbenchPartPresenter.View.class);
PartDefinition mockPartDefinition = new PartDefinitionImpl(new DefaultPlaceRequest("mockPlace"));
when(mockPartView.getPresenter()).thenReturn(mockPresenter);
when(mockPresenter.getDefinition()).thenReturn(mockPartDefinition);
when(view.panel.getPartView()).thenReturn(null);
view.addPart(mockPartView);
when(view.panel.getPartView()).thenReturn(mockPartView);
boolean removed = view.removePart(mockPartDefinition);
assertTrue(removed);
verify(panel).clear();
}
示例6: removeNonContainedPart
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Test
public void removeNonContainedPart() {
WorkbenchPartPresenter mockPresenter = mock(WorkbenchPartPresenter.class);
WorkbenchPartPresenter.View mockPartView = mock(WorkbenchPartPresenter.View.class);
PartDefinition mockPartDefinition = new PartDefinitionImpl(new DefaultPlaceRequest("mock1"));
when(mockPartView.getPresenter()).thenReturn(mockPresenter);
when(mockPresenter.getDefinition()).thenReturn(mockPartDefinition);
WorkbenchPartPresenter mockPresenter2 = mock(WorkbenchPartPresenter.class);
WorkbenchPartPresenter.View mockPartView2 = mock(WorkbenchPartPresenter.View.class);
PartDefinition mockPartDefinition2 = new PartDefinitionImpl(new DefaultPlaceRequest("mock2"));
when(mockPartView2.getPresenter()).thenReturn(mockPresenter2);
when(mockPresenter2.getDefinition()).thenReturn(mockPartDefinition2);
when(view.panel.getPartView()).thenReturn(null);
view.addPart(mockPartView);
when(view.panel.getPartView()).thenReturn(mockPartView);
boolean removed = view.removePart(mockPartDefinition2);
assertFalse(removed);
verify(panel,
never()).clear();
}
示例7: unknownPartsShouldResolveToPanelContextWhenThereIsOne
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
/**
* If there is a panel context, it overrides the perspective context.
*/
@Test
public void unknownPartsShouldResolveToPanelContextWhenThereIsOne() throws Exception {
AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();
ContextDefinition panelContextDefinition = new ContextDefinitionImpl(new DefaultPlaceRequest("panelDefinition"));
ContextActivity panelContextActivity = mock(ContextActivity.class);
when(mockActivityManager.getActivity(ContextActivity.class,
new DefaultPlaceRequest("panelDefinition"))).thenReturn(panelContextActivity);
panelPresenterPanelDefinition.setContextDefinition(panelContextDefinition);
presenter.setDefinition(panelPresenterPanelDefinition);
final ContextActivity resolvedContextActivity = presenter.resolveContext(new PartDefinitionImpl(new DefaultPlaceRequest("randomUnknownPlace")));
assertSame(panelContextActivity,
resolvedContextActivity);
}
示例8: getPerspective
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@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;
}
示例9: getPerspective
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@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;
}
示例10: buildPerspective
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Perspective
public PerspectiveDefinition buildPerspective() {
final PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
perspective.setName(AppConstants.INSTANCE.AdministrationPerspectiveName());
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;
}
示例11: setupLibraryPerspective
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
private void setupLibraryPerspective() {
OrganizationalUnit activeOu = projectContext.getActiveOrganizationalUnit()
.orElseThrow(() -> new IllegalStateException("Cannot setup library perspective without active organizational unit."));
PortablePreconditions.checkNotNull("libraryPerspective",
libraryPerspective);
final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.LIBRARY_SCREEN);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
if (!projectContext.getActiveWorkspaceProject().isPresent()) {
projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(activeOu));
}
closeLibraryPlaces();
placeManager.goTo(part,
libraryPerspective.getRootPanel());
setupLibraryBreadCrumbsWithoutProject();
hideDocks();
}
示例12: goToImportProjects
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
public void goToImportProjects(final String repositoryUrl) {
if (closeAllPlacesOrNothing()) {
Map<String, String> params = new HashMap<>();
params.put("title",
ts.getTranslation(LibraryConstants.ImportProjects));
if (repositoryUrl != null) {
params.put("repositoryUrl",
repositoryUrl);
}
final DefaultPlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.IMPORT_PROJECTS_SCREEN,
params);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
placeManager.goTo(part,
libraryPerspective.getRootPanel());
setupLibraryBreadCrumbsForImportProjects(repositoryUrl);
}
}
示例13: goToPreferences
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
public void goToPreferences() {
final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy = projectScopedResolutionStrategySupplier.get();
final PreferencesCentralInitializationEvent initEvent = new PreferencesCentralInitializationEvent("ProjectPreferences",
customScopeResolutionStrategy,
null);
final DefaultPlaceRequest placeRequest = new DefaultPlaceRequest(PreferencesRootScreen.IDENTIFIER);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
placeManager.goTo(part,
libraryPerspective.getRootPanel());
preferencesCentralInitializationEvent.fire(initEvent);
setupLibraryBreadCrumbsForPreferences();
}
示例14: goToOrganizationalUnitsTest
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Test
public void goToOrganizationalUnitsTest() {
final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.ORGANIZATIONAL_UNITS_SCREEN);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
libraryPlaces.goToOrganizationalUnits();
verify(projectContextChangeEvent).fire(projectContextChangeEventArgumentCaptor.capture());
assertNull(projectContextChangeEventArgumentCaptor.getValue().getOrganizationalUnit());
final ArgumentCaptor<WorkspaceProjectContextChangeEvent> eventArgumentCaptor = ArgumentCaptor.forClass(WorkspaceProjectContextChangeEvent.class);
verify(projectContextChangeEvent).fire(eventArgumentCaptor.capture());
final WorkspaceProjectContextChangeEvent event = eventArgumentCaptor.getValue();
assertNull(event.getOrganizationalUnit());
assertNull(event.getWorkspaceProject());
verify(placeManager).closeAllPlacesOrNothing();
verify(placeManager).goTo(eq(part),
any(PanelDefinition.class));
verify(libraryPlaces).setupLibraryBreadCrumbs();
}
示例15: goToLibraryWithDefaultOrganizationalUnitTest
import org.uberfire.workbench.model.impl.PartDefinitionImpl; //导入依赖的package包/类
@Test
public void goToLibraryWithDefaultOrganizationalUnitTest() {
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty())
.thenReturn(Optional.of(mock(OrganizationalUnit.class)));
doReturn(Optional.empty()).when(projectContext).getActiveWorkspaceProject();
doReturn(Optional.empty()).when(projectContext).getActiveModule();
final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.LIBRARY_SCREEN);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
libraryPlaces.goToLibrary();
verify(libraryPlaces).closeLibraryPlaces();
verify(placeManager).goTo(eq(part),
any(PanelDefinition.class));
verify(libraryPlaces).setupLibraryBreadCrumbsWithoutProject();
verify(projectContextChangeEvent,
times(2)).fire(any(WorkspaceProjectContextChangeEvent.class));
}