Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/quicklook portal #2

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d15a807
Fixes for 'mvn clean install'
declandunne Mar 11, 2018
6414181
Initial quicklook support in Calvalus portal
declandunne Mar 11, 2018
e0bd555
Configurable quicklook support in Calvalus portal
declandunne Apr 16, 2018
31f3c91
Remove redundant code
declandunne Apr 30, 2018
550bf89
Reformat and rearrange code
declandunne Apr 30, 2018
4ea67ac
Band name - add processor variables selection list
declandunne Apr 30, 2018
0110169
Add color palette drop-down list
declandunne May 17, 2018
6e1c9c7
Merge branch 'master' into develop
declandunne Jun 20, 2018
f293913
Fixes for 'mvn clean install'
declandunne Jun 20, 2018
b44f1ad
Update seadas-reader version in maven POM
declandunne Jun 26, 2018
f35a6b9
Merge branch 'develop' into feature/quicklook-portal
declandunne Jul 2, 2018
f3450b0
Redesign backend for configuring color palettes
declandunne Jul 16, 2018
ad0981c
Bug fix for resetting colour table drop-down list
declandunne Jul 17, 2018
f3b3d6c
New logic for enabling/disabling band name field
declandunne Jul 17, 2018
f7a8e91
Use text names for colour palette drop-down list
declandunne Jul 17, 2018
8f7381e
Change the spelling of color to colour
declandunne Jul 17, 2018
d772358
Add production type for creating quicklook images
declandunne Aug 23, 2018
f3a7733
Add default color-palettes.properties file
declandunne Aug 30, 2018
493383f
Improve quicklook UI form's layout and handling
declandunne Sep 26, 2018
fb103a6
Merge branch 'master' into develop
declandunne Nov 1, 2018
08f7928
Fixes for 'mvn clean install'
declandunne Nov 1, 2018
4ff656d
Merge branch 'develop' into feature/quicklook-portal
declandunne Nov 1, 2018
a0462d4
Add GeoTiff support to quicklook generation
declandunne Nov 28, 2018
12483ea
Fix bug in GeoTiff quicklook generation
declandunne Nov 29, 2018
89aba1e
Support upload of quicklook images to GeoServer
declandunne Jan 25, 2019
adcf582
Bug fix for updating a layer's style in GeoServer
declandunne Jan 25, 2019
7451c1e
Fix filename bug for PNG, JPEG and TIFF quicklook
declandunne Feb 21, 2019
80369b5
Merge branch 'master' into develop
declandunne Feb 21, 2019
7f7019b
Merge branch 'master' into develop
declandunne Feb 22, 2019
20275a0
Fixes for 'mvn clean install'
declandunne Feb 22, 2019
f9fab90
Fixes for 'mvn clean install'
declandunne Feb 22, 2019
cecadff
Merge branch 'develop' into feature/quicklook-portal
declandunne Feb 22, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.bc.calvalus.portal.shared.ContextRetrievalServiceAsync;
import com.bc.calvalus.portal.shared.DtoAggregatorDescriptor;
import com.bc.calvalus.portal.shared.DtoCalvalusConfig;
import com.bc.calvalus.portal.shared.DtoColorPalette;
import com.bc.calvalus.portal.shared.DtoProcessorDescriptor;
import com.bc.calvalus.portal.shared.DtoProductSet;
import com.bc.calvalus.portal.shared.DtoProduction;
Expand Down Expand Up @@ -60,6 +61,7 @@ public class CalvalusPortal implements EntryPoint, PortalContext {
"vicariousCalibrationView",
"matchupComparisonView",
"l2ToL3ComparisonView",
"qlView",
"regionsView",
"requestsView",
"bundlesView",
Expand All @@ -74,6 +76,7 @@ public class CalvalusPortal implements EntryPoint, PortalContext {
// Data provided by various external services
private ListDataProvider<Region> regions;
private DtoProductSet[] productSets;
private DtoColorPalette[] colorPalettes;
private DtoProcessorDescriptor[] systemProcessors;
private DtoProcessorDescriptor[] userProcessors;
private DtoProcessorDescriptor[] allUserProcessors;
Expand Down Expand Up @@ -128,6 +131,7 @@ public void onModuleLoad() {
Runnable runnable = new Runnable() {
public void run() {
backendService.loadRegions(NO_FILTER, new InitRegionsCallback());
backendService.loadColorPalettes(NO_FILTER, new InitColorPaletteSetsCallback());
backendService.getProductSets(NO_FILTER, new InitProductSetsCallback());

final BundleFilter systemFilter = new BundleFilter();
Expand Down Expand Up @@ -182,6 +186,11 @@ public DtoProductSet[] getProductSets() {
return productSets;
}

@Override
public DtoColorPalette[] getColorPalettes() {
return colorPalettes;
}

@Override
public DtoProcessorDescriptor[] getProcessors(String filter) {
if (filter.equals(BundleFilter.PROVIDER_SYSTEM)) {
Expand Down Expand Up @@ -285,6 +294,8 @@ private PortalView createViewOf(String name) {
return new OrderMACProductionView(this);
case "l2ToL3ComparisonView":
return new OrderL2toL3ProductionView(this);
case "qlView":
return new OrderQLProductionView(this);
case "regionsView":
return new ManageRegionsView(this);
case "bundlesView":
Expand Down Expand Up @@ -482,6 +493,22 @@ public void onFailure(Throwable caught) {
}
}

private class InitColorPaletteSetsCallback implements AsyncCallback<DtoColorPalette[]> {

@Override
public void onSuccess(DtoColorPalette[] dtoColorPalettes) {
CalvalusPortal.this.colorPalettes = dtoColorPalettes;
maybeInitFrontend();
}

@Override
public void onFailure(Throwable caught) {
caught.printStackTrace(System.err);
Dialog.error("Server-side Error", caught.getMessage());
CalvalusPortal.this.colorPalettes = new DtoColorPalette[0];
}
}

private class InitProcessorsCallback implements AsyncCallback<DtoProcessorDescriptor[]> {

private final String filter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.bc.calvalus.portal.shared.DtoInputSelection;
import com.bc.calvalus.portal.shared.DtoProcessorDescriptor;
import com.bc.calvalus.portal.shared.DtoProcessorVariable;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Anchor;
Expand All @@ -44,6 +45,7 @@ public class OrderL2ProductionView extends OrderProductionView {
private ProductsFromCatalogueForm productsFromCatalogueForm;
private L2ConfigForm l2ConfigForm;
private OutputParametersForm outputParametersForm;
private QuicklookParametersForm quicklookParametersForm;
private Widget widget;

public OrderL2ProductionView(PortalContext portalContext) {
Expand Down Expand Up @@ -77,6 +79,7 @@ public void onClearSelectionClick() {
}

outputParametersForm = new OutputParametersForm(portalContext);
quicklookParametersForm = new QuicklookParametersForm(portalContext);
l2ConfigForm.setProductSet(productSetSelectionForm.getSelectedProductSet());
handleProcessorChanged();

Expand All @@ -89,6 +92,7 @@ public void onClearSelectionClick() {
}
panel.add(l2ConfigForm);
panel.add(outputParametersForm);
panel.add(quicklookParametersForm);
Anchor l2Help = new Anchor("Show Help");
l2Help.getElement().getStyle().setProperty("textDecoration", "none");
l2Help.addStyleName("anchor");
Expand Down Expand Up @@ -168,6 +172,7 @@ protected HashMap<String, String> getProductionParameters() {
}
parameters.putAll(l2ConfigForm.getValueMap());
parameters.putAll(outputParametersForm.getValueMap());
parameters.putAll(quicklookParametersForm.getValueMap());
return parameters;
}

Expand All @@ -185,6 +190,7 @@ public void setProductionParameters(Map<String, String> parameters) {
}
l2ConfigForm.setValues(parameters);
outputParametersForm.setValues(parameters);
quicklookParametersForm.setValues(parameters);
}

private class InputSelectionCallback implements AsyncCallback<DtoInputSelection> {
Expand Down Expand Up @@ -216,6 +222,13 @@ private void handleProcessorChanged() {
add("BigGeoTiff", outputFormats);
}
outputParametersForm.setAvailableOutputFormats(outputFormats.toArray(new String[0]));

List<String> processorVariables = new ArrayList<>();
DtoProcessorVariable[] dtoProcessorVariables = processorDescriptor.getProcessorVariables();
for (DtoProcessorVariable dtoProcessorVariable : dtoProcessorVariables) {
processorVariables.add(dtoProcessorVariable.getName());
}
quicklookParametersForm.setBandNames(processorVariables.toArray(new String[0]));
}
}

Expand All @@ -224,4 +237,4 @@ private static void add(String format, List<String> outputFormats) {
outputFormats.add(format);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
/*
* Copyright (C) 2013 Brockmann Consult GmbH ([email protected])
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see http://www.gnu.org/licenses/
*/

package com.bc.calvalus.portal.client;

import com.bc.calvalus.portal.shared.DtoInputSelection;
import com.bc.calvalus.portal.shared.DtoProcessorDescriptor;
import com.bc.calvalus.portal.shared.DtoProcessorVariable;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Demo view that lets users submit a new L2 production.
*
* @author Norman
*/
public class OrderQLProductionView extends OrderProductionView {

public static final String ID = OrderQLProductionView.class.getName();

private ProductSetSelectionForm productSetSelectionForm;
private ProductSetFilterForm productSetFilterForm;
private ProductsFromCatalogueForm productsFromCatalogueForm;
private OutputParametersForm outputParametersForm;
private QuicklookParametersForm quicklookParametersForm;
private Widget widget;

public OrderQLProductionView(PortalContext portalContext) {
super(portalContext);

productSetSelectionForm = new ProductSetSelectionForm(getPortal());
productSetFilterForm = new ProductSetFilterForm(portalContext);
productSetFilterForm.setProductSet(productSetSelectionForm.getSelectedProductSet());

if (getPortal().withPortalFeature(INPUT_FILES_PANEL)) {
productsFromCatalogueForm = new ProductsFromCatalogueForm(getPortal());
productsFromCatalogueForm.addInputSelectionHandler(new ProductsFromCatalogueForm.InputSelectionHandler() {
@Override
public AsyncCallback<DtoInputSelection> getInputSelectionChangedCallback() {
return new InputSelectionCallback();
}

@Override
public void onClearSelectionClick() {
productsFromCatalogueForm.removeSelections();
}
});
}

outputParametersForm = new OutputParametersForm(portalContext);
outputParametersForm.showFormatSelectionPanel(false);
outputParametersForm.setAvailableOutputFormats("Image");

quicklookParametersForm = new QuicklookParametersForm(portalContext);
quicklookParametersForm.setBandNames();

VerticalPanel panel = new VerticalPanel();
panel.setWidth("100%");
panel.add(productSetSelectionForm);
panel.add(productSetFilterForm);
if (getPortal().withPortalFeature(INPUT_FILES_PANEL)){
panel.add(productsFromCatalogueForm);
}
panel.add(outputParametersForm);
panel.add(quicklookParametersForm);
Anchor l2Help = new Anchor("Show Help");
l2Help.getElement().getStyle().setProperty("textDecoration", "none");
l2Help.addStyleName("anchor");
panel.add(l2Help);
HelpSystem.addClickHandler(l2Help, "l2Processing");
//panel.add(new HTML("<br/>"));
panel.add(createOrderPanel());

this.widget = panel;
}

@Override
public Widget asWidget() {
return widget;
}

@Override
public String getViewId() {
return ID;
}

@Override
public String getTitle() {
return "Quicklook generation";
}

@Override
protected String getProductionType() {
return "QL";
}

@Override
public void onShowing() {
// make sure #triggerResize is called after the new view is shown
Scheduler.get().scheduleFinally(() -> {
// See http://code.google.com/p/gwt-google-apis/issues/detail?id=127
productSetFilterForm.getRegionMap().getMapWidget().triggerResize();
});
}

@Override
protected boolean validateForm() {
try {
productSetSelectionForm.validateForm();
productSetFilterForm.validateForm();
if (productsFromCatalogueForm != null) {
productsFromCatalogueForm.validateForm(productSetSelectionForm.getSelectedProductSet().getName());
}
outputParametersForm.validateForm();


if (!getPortal().withPortalFeature("unlimitedJobSize")) {
try {
final int numDaysValue = Integer.parseInt(productSetFilterForm.numDays.getValue());
if (numDaysValue > 365 + 366) {
throw new ValidationException(productSetFilterForm.numDays, "time range larger than allowed");
}
} catch (NumberFormatException e) {
// ignore
}
}
return true;
} catch (ValidationException e) {
e.handle();
return false;
}
}

@Override
protected HashMap<String, String> getProductionParameters() {
HashMap<String, String> parameters = new HashMap<>();
parameters.putAll(productSetSelectionForm.getValueMap());
parameters.putAll(productSetFilterForm.getValueMap());
if (productsFromCatalogueForm != null) {
parameters.putAll(productsFromCatalogueForm.getValueMap());
}
parameters.putAll(outputParametersForm.getValueMap());
parameters.putAll(quicklookParametersForm.getValueMap());
return parameters;
}

@Override
public boolean isRestoringRequestPossible() {
return true;
}

@Override
public void setProductionParameters(Map<String, String> parameters) {
productSetSelectionForm.setValues(parameters);
productSetFilterForm.setValues(parameters);
if (productsFromCatalogueForm != null) {
productsFromCatalogueForm.setValues(parameters);
}
outputParametersForm.setValues(parameters);
quicklookParametersForm.setValues(parameters);
}

private class InputSelectionCallback implements AsyncCallback<DtoInputSelection> {

@Override
public void onSuccess(DtoInputSelection inputSelection) {
Map<String, String> inputSelectionMap = UIUtils.parseParametersFromContext(inputSelection);
productsFromCatalogueForm.setValues(inputSelectionMap);
productSetSelectionForm.setValues(inputSelectionMap);
productSetFilterForm.setValues(inputSelectionMap);
}

@Override
public void onFailure(Throwable caught) {
Dialog.error("Error in retrieving input selection", caught.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.bc.calvalus.portal.shared.BackendServiceAsync;
import com.bc.calvalus.portal.shared.ContextRetrievalServiceAsync;
import com.bc.calvalus.portal.shared.DtoAggregatorDescriptor;
import com.bc.calvalus.portal.shared.DtoColorPalette;
import com.bc.calvalus.portal.shared.DtoProcessorDescriptor;
import com.bc.calvalus.portal.shared.DtoProductSet;
import com.bc.calvalus.portal.shared.DtoProduction;
Expand All @@ -27,6 +28,8 @@ public interface PortalContext {
// make this return ListDataProvider<GsProductSet>
DtoProductSet[] getProductSets();

DtoColorPalette[] getColorPalettes();

// make this return ListDataProvider<GsProcessorDescriptor>
DtoProcessorDescriptor[] getProcessors(String filter);
DtoAggregatorDescriptor[] getAggregators(String filter);
Expand Down
Loading