Only call resizing if really necessary

This commit is contained in:
RobinFleige
2018-09-10 13:38:30 +02:00
parent f43a21f36a
commit a239bc37bc
3 changed files with 21 additions and 17 deletions
@@ -299,22 +299,27 @@ public class ImagesListComposite extends Composite {
}
protected void callResizingService(ImageResizingTaskDTO resizingTask, ImageDTO originalImage) {
sailingService.resizeImage(resizingTask, new AsyncCallback<ImageDTO[]>() {
@Override
public void onFailure(Throwable caught) {
Notification.notify(stringMessages.resizeUnsuccessfull(), NotificationType.ERROR);
}
@Override
public void onSuccess(ImageDTO[] result) {
for (int i = 0; i < result.length; i++) {
imageListDataProvider.getList().add(result[i]);
if (resizingTask.getResizingTask().size() != 0) {
sailingService.resizeImage(resizingTask, new AsyncCallback<ImageDTO[]>() {
@Override
public void onFailure(Throwable caught) {
Notification.notify(stringMessages.resizeUnsuccessfull(), NotificationType.ERROR);
}
imageListDataProvider.getList().remove(originalImage);
updateTableVisisbilty();
Notification.notify(stringMessages.resizeSuccessfull(), NotificationType.SUCCESS);
}
});
@Override
public void onSuccess(ImageDTO[] result) {
for (int i = 0; i < result.length; i++) {
imageListDataProvider.getList().add(result[i]);
}
imageListDataProvider.getList().remove(originalImage);
updateTableVisisbilty();
Notification.notify(stringMessages.resizeSuccessfull(), NotificationType.SUCCESS);
}
});
} else {
imageListDataProvider.getList().remove(originalImage);
imageListDataProvider.getList().add(resizingTask.getImage());
}
}
private void updateTableVisisbilty() {
@@ -6,8 +6,6 @@ import java.util.List;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasValue;
import com.sap.sse.common.Util;
@@ -14,6 +14,7 @@ We distinguish two cases: adding a 3rd-party bundle to the target platform and a
* Go to directory 'java/com.sap.sailing.targetplatform/scripts'
* Rebuild the base target platform by running the script 'createLocalBaseP2repository.sh'
* Generate the target definition for this local repository by running the script 'createLocalTargetDef.sh'
* Currently this scripts work for the cygwin shell and the git bash, if the path to your files in the target definition is incorrect, this may be the reason.
* Test the new overall target platform
* by setting the race-analysis-p2-local.target as target platform in the IDE
* by running the local maven build via ''buildAndUpdateProduct.sh -v build'' (the ''-v'' switch builds and uses the local p2 repository)