diff --git a/gui/src/main/java/org/jboss/as/console/client/domain/groups/deployment/ServerGroupDeploymentBrowser.java b/gui/src/main/java/org/jboss/as/console/client/domain/groups/deployment/ServerGroupDeploymentBrowser.java index 18d8a5bbb..dce9735ee 100644 --- a/gui/src/main/java/org/jboss/as/console/client/domain/groups/deployment/ServerGroupDeploymentBrowser.java +++ b/gui/src/main/java/org/jboss/as/console/client/domain/groups/deployment/ServerGroupDeploymentBrowser.java @@ -22,8 +22,6 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Widget; import com.google.gwt.view.client.SingleSelectionModel; -import com.google.inject.Inject; - import org.jboss.as.console.client.Console; import org.jboss.as.console.client.core.FeatureSet; import org.jboss.as.console.client.domain.model.HostInformationStore; @@ -58,6 +56,9 @@ public class ServerGroupDeploymentBrowser private ServerGroupRecord currentServerGroup; private DeploymentBrowser deploymentBrowser; private FeatureSet featureSet; + private ToolButton assign; + private ToolButton remove; + private ToolButton enableDisable; public ServerGroupDeploymentBrowser(final DomainDeploymentPresenter presenter, @@ -76,45 +77,40 @@ Widget asWidget() keyProvider); ToolStrip tools = new ToolStrip(); - tools.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_assign(), new - ClickHandler() - { + assign = new ToolButton(Console.CONSTANTS.common_label_assign(), new + ClickHandler() { @Override - public void onClick(ClickEvent clickEvent) - { + public void onClick(ClickEvent clickEvent) { presenter.launchAssignDeploymentToGroupWizard(currentServerGroup); } - })); - tools.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_remove(), new + }); + tools.addToolButtonRight(assign); + remove = new ToolButton(Console.CONSTANTS.common_label_remove(), new - ClickHandler() - { + ClickHandler() { @Override - public void onClick(ClickEvent clickEvent) - { + public void onClick(ClickEvent clickEvent) { DeploymentRecord selection = selectionModel.getSelectedObject(); - if (selection != null) - { + if (selection != null) { presenter.onRemoveDeploymentInGroup(selection); } } - })); - tools.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_enOrDisable(), new + }); + tools.addToolButtonRight(remove); + enableDisable = new ToolButton(Console.CONSTANTS.common_label_enOrDisable(), new - ClickHandler() - { + ClickHandler() { @Override - public void onClick(ClickEvent clickEvent) - { + public void onClick(ClickEvent clickEvent) { DeploymentRecord selection = selectionModel.getSelectedObject(); - if (selection != null) - { + if (selection != null) { presenter.onDisableDeploymentInGroup(selection); } } - })); + }); + tools.addToolButtonRight(enableDisable); deploymentBrowser = new DeploymentBrowser(deploymentStore, selectionModel, featureSet); @@ -149,6 +145,13 @@ public void updateGroup(final ServerGroupRecord serverGroup, final List>() { @Override @@ -182,6 +185,17 @@ public void onSuccess(final List result) { Console.warning("No active server in this group.", "Unable to retrieve deployment subsystem information. "); } + assign.setEnabled(assignEnabled); + remove.setEnabled(removeEnabled); + enableDisable.setEnabled(enableDisableEnabled); + } + + @Override + public void onFailure(final Throwable caught) { + super.onFailure(caught); + assign.setEnabled(assignEnabled); + remove.setEnabled(removeEnabled); + enableDisable.setEnabled(enableDisableEnabled); } ServerInstance matchingServer(ServerInstance server)