@Override public void selectContainer(final String serverTemplateId, final String id) { select(serverTemplateId, id, containerItems); }
public void removeTemplate() { view.confirmRemove( new Command() { @Override public void execute() { specManagementService.call( new RemoteCallback<Void>() { @Override public void callback( final Void aVoid ) { serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh() ); } }, new ErrorCallback<Object>() { @Override public boolean error( final Object o, final Throwable throwable ) { notification.fire( new NotificationEvent( view.getRemoveTemplateErrorMessage(), NotificationEvent.NotificationType.ERROR ) ); serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh() ); return false; } } ).deleteServerTemplate( serverTemplate.getId() ); } } ); }
@PostConstruct public void init() { view.init( this ); }
@Test public void testSetupCapabilities() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateKeyId", "ServerTemplateKeyName" ); serverTemplate.getCapabilities().add( Capability.PROCESS.toString() ); serverTemplate.getCapabilities().add( Capability.PLANNING.toString() ); serverTemplate.getCapabilities().add( Capability.RULE.toString() ); presenter.setup( serverTemplate, null ); assertEquals( serverTemplate, presenter.getCurrentServerTemplate() ); verify( view ).clear(); verify( view ).setTemplate( serverTemplate.getId(), serverTemplate.getName() ); verify( view ).setProcessCapability( true ); verify( view ).setRulesCapability( true ); verify( view ).setPlanningCapability( true ); }
@Override public void init(final ServerTemplatePresenter presenter) { this.presenter = presenter; ruleEnabled.setText(getRuleCheckBoxText()); ruleEnabled.setEnabled(false); processEnabled.setText(getProcessCheckBoxText()); processEnabled.setEnabled(false); planningEnabled.setText(getPlanningCheckBoxText()); planningEnabled.setEnabled(false); }
@Test public void testOnServerInstanceUpdatedWithoutCurrentServer() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); final ServerInstance serverInstance = new ServerInstance( serverTemplate.getId(), "serverName", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList() ); presenter.onServerInstanceUpdated( new ServerInstanceUpdated( serverInstance ) ); verify(view, never()).addServerInstance( anyString(), anyString(), anyString(), any(Command.class)); }
@Test public void testOnServerInstanceSelect() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverInstanceKeyId", "serverName", "serverInstanceId", "url" ); presenter.onServerInstanceSelect( new ServerInstanceSelected( serverInstanceKey ) ); verify( view ).selectServerInstance( serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId() ); }
@Test public void testOnContainerSelect() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final ContainerSpecKey containerSpecKey = new ContainerSpecKey( "containerId", "containerName", serverTemplateKey ); presenter.onContainerSelect( new ContainerSpecSelected( containerSpecKey ) ); verify( view ).selectContainer( serverTemplateKey.getId(), containerSpecKey.getId() ); }
@EventHandler("add-new-container") public void addNewContainer(final ClickEvent event) { presenter.addNewContainer(); }
@EventHandler("remove-current-server-template") public void removeTemplate(final ClickEvent event) { presenter.removeTemplate(); }
@EventHandler("copy-current-server-template") public void copyTemplate(final ClickEvent event) { presenter.copyTemplate(); }
@Override public void confirmRemove(final Command command) { final YesNoCancelPopup result = YesNoCancelPopup.newYesNoCancelPopup(getTemplateRemovePopupTitle(), getTemplateRemovePopupText(), command, new Command() { @Override public void execute() { } }, null); result.clearScrollHeight(); result.show(); }
private void addServerInstance( final ServerInstanceKey serverInstanceKey ) { serverInstances.add( serverInstanceKey.getServerInstanceId() ); view.addServerInstance( serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId(), serverInstanceKey.getServerName(), new Command() { @Override public void execute() { serverInstanceSelectedEvent.fire( new ServerInstanceSelected( serverInstanceKey ) ); } } ); }
private void addContainer( final ContainerSpec containerSpec ) { view.addContainer( containerSpec.getServerTemplateKey().getId(), containerSpec.getId(), containerSpec.getContainerName(), new Command() { @Override public void execute() { containerSpecSelectedEvent.fire( new ContainerSpecSelected( containerSpec ) ); } } ); }
public void onServerInstanceSelect( @Observes final ServerInstanceSelected serverInstanceSelected ) { if ( serverInstanceSelected != null && serverInstanceSelected.getServerInstanceKey() != null && serverInstanceSelected.getServerInstanceKey().getServerTemplateId() != null && serverInstanceSelected.getServerInstanceKey().getServerInstanceId() != null ) { view.selectServerInstance( serverInstanceSelected.getServerInstanceKey().getServerTemplateId(), serverInstanceSelected.getServerInstanceKey().getServerInstanceId() ); } else { logger.warn( "Illegal event argument." ); } }
public void onContainerSelect( @Observes final ContainerSpecSelected containerSpecSelected ) { if ( containerSpecSelected != null && containerSpecSelected.getContainerSpecKey() != null && containerSpecSelected.getContainerSpecKey().getServerTemplateKey() != null && containerSpecSelected.getContainerSpecKey().getServerTemplateKey().getId() != null && containerSpecSelected.getContainerSpecKey().getId() != null ) { view.selectContainer( containerSpecSelected.getContainerSpecKey().getServerTemplateKey().getId(), containerSpecSelected.getContainerSpecKey().getId() ); } else { logger.warn( "Illegal event argument." ); } }
@Override public void setServerTemplate( final ServerTemplatePresenter.View view ) { content.getElement().removeClassName( "col-md-10" ); content.getElement().removeClassName( "col-sm-9" ); content.getElement().addClassName( "col-md-8" ); content.getElement().addClassName( "col-sm-6" ); if ( secondLevalNavigation.getParent() == null || !secondLevalNavigation.getParent().equals( container ) ) { boolean isEmpty = container.getWidgetCount() == 2; if ( isEmpty ) { container.remove( 1 ); } container.add( secondLevalNavigation ); if ( isEmpty ) { container.add( content ); } } secondLevalNavigation.clear(); secondLevalNavigation.add( view.asWidget() ); }
@Test public void testAddNewContainer() { presenter.addNewContainer(); verify( addNewContainerEvent ).fire( any( AddNewContainer.class ) ); }
@Override public void selectServerInstance(final String serverTemplateId, final String id) { select(serverTemplateId, id, serverInstanceItems); }