use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class OrganizationalUnitPopUpPresenter method saveCreation.
void saveCreation(final String name, final String defaultGroupId, final String owner) {
final Command saveCommand = () -> {
final Collection<Repository> repositories = new ArrayList<>();
final List<String> contributors = contributorsManagementPresenter.getSelectedContributorsUserNames();
final RemoteCallback<OrganizationalUnit> successCallback = (OrganizationalUnit newOrganizationalUnit) -> {
afterCreateOrganizationalUnitEvent.fire(new AfterCreateOrganizationalUnitEvent(newOrganizationalUnit));
view.hideBusyIndicator();
notificationEvent.fire(new NotificationEvent(view.getSaveSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
view.hide();
};
final HasBusyIndicatorDefaultErrorCallback errorCallback = new HasBusyIndicatorDefaultErrorCallback(view);
organizationalUnitService.call(successCallback, errorCallback).createOrganizationalUnit(name, owner, defaultGroupId, repositories, contributors);
};
validateDuplicatedOrganizationalUnit(name, saveCommand);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class AddProjectPopUpPresenter method validateFields.
private void validateFields(final String name, final String groupId, final String artifactId, final String version, final Command successCallback) {
final Command validateVersion = () -> validateVersion(version, successCallback);
final Command validateArtifactId = () -> validateArtifactId(artifactId, validateVersion);
final Command validateGroupId = () -> validateGroupId(groupId, validateArtifactId);
validateName(name, view.isAdvancedOptionsSelected() ? validateGroupId : successCallback);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class EmptyAssetsScreenTest method setUp.
@Before
public void setUp() {
this.emptyAssetsScreen = spy(new EmptyAssetsScreen(this.view, this.newFileUploader, this.newResourcePresenter, this.projectController, this.libraryPlaces));
Command command = mock(Command.class);
doNothing().when(command).execute();
when(this.newFileUploader.getCommand(any())).thenReturn(command);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class DataObjectBrowser method openDataObject.
private void openDataObject(final DataObject dataObject) {
final Path objectPath = getContext().getDataObjectPath(dataObject.getClassName());
if (objectPath != null) {
view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Loading());
modelerService.call(new RemoteCallback<Boolean>() {
@Override
public void callback(Boolean exists) {
view.hideBusyIndicator();
if (Boolean.TRUE.equals(exists)) {
placeManager.goTo(new PathPlaceRequest(objectPath));
} else {
view.showYesNoCancelPopup(CommonConstants.INSTANCE.Warning(), Constants.INSTANCE.objectBrowser_message_file_not_exists_or_renamed(objectPath.toURI()), new Command() {
@Override
public void execute() {
// do nothing.
}
}, CommonConstants.INSTANCE.Close(), ButtonType.WARNING, null, null, null, null, null, null);
}
}
}, new DataModelerErrorCallback(CommonConstants.INSTANCE.ExceptionNoSuchFile0(objectPath.toURI()))).exists(objectPath);
}
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class JPADataObjectEditor method onEntityFieldChange.
@Override
public void onEntityFieldChange(String newValue) {
if (getDataObject() != null) {
final Boolean doAdd = Boolean.parseBoolean(newValue);
if (doAdd) {
if (!hasIdField(getDataObject())) {
List<ObjectProperty> configurableFields = persistenceConfigurableFields(getDataObject());
String message = buildOnSetPersistableRefactoringMessage(false, configurableFields);
view.showYesNoCancelPopup(CommonConstants.INSTANCE.Warning(), message, new Command() {
@Override
public void execute() {
doEntityFieldChange(doAdd, true);
}
}, Constants.INSTANCE.persistence_domain_objectEditor_add_identifier_action(), ButtonType.PRIMARY, new Command() {
@Override
public void execute() {
doEntityFieldChange(doAdd, false);
}
}, Constants.INSTANCE.persistence_domain_objectEditor_dont_add_identifier_action(), ButtonType.DANGER, new Command() {
@Override
public void execute() {
updateEntityField(null);
loadPropertyEditor();
}
}, CommonConstants.INSTANCE.Cancel(), ButtonType.DEFAULT);
} else {
doEntityFieldChange(doAdd, false);
}
} else {
doEntityFieldChange(doAdd, false);
}
}
}
Aggregations