just changed labels https://support.d4science.org/issues/13323#note-15
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@178534 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1c80354d80
commit
bdad35257d
|
@ -40,7 +40,7 @@ public interface PerformFishAnalyticsService extends RemoteService {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
PerformFishInitParameter decryptAndValidParameters(
|
||||
PerformFishInitParameter validParameters(
|
||||
PerformFishInitParameter initParams)
|
||||
throws Exception;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface PerformFishAnalyticsServiceAsync
|
|||
String populationTypeId, AsyncCallback<PopulationType> callback);
|
||||
|
||||
|
||||
void decryptAndValidParameters(
|
||||
void validParameters(
|
||||
PerformFishInitParameter initParams,
|
||||
AsyncCallback<PerformFishInitParameter> callback);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public class PerformFishAnalyticsController {
|
|||
performFishInitParams.addParameter(PerformFishAnalyticsConstant.BATCHTYPE_PARAM, batchtypeParam);
|
||||
performFishInitParams.addParameter(PerformFishAnalyticsConstant.FARMID_PARAM, farmidParam);
|
||||
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().decryptAndValidParameters(performFishInitParams, new AsyncCallback<PerformFishInitParameter>() {
|
||||
PerformFishAnalyticsServiceAsync.Util.getInstance().validParameters(performFishInitParams, new AsyncCallback<PerformFishInitParameter>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(PerformFishInitParameter result) {
|
||||
|
@ -260,7 +260,7 @@ public class PerformFishAnalyticsController {
|
|||
//viewController.resetBatchIdStatus();
|
||||
viewController.setBatchIdStatus(ControlGroupType.INFO);
|
||||
viewController.enableLoadBatches(true);
|
||||
viewController.showAlertForLoadBatches("Please load the batch(es) by clicking on 'Load Batches' button", AlertType.INFO, false);
|
||||
viewController.showAlertForLoadBatches("Please load your batches corresponding to the selected options, by pressing the 'Load Batches' button", AlertType.INFO, false);
|
||||
viewController.enableAllAlgorithmsForSubmit(false);
|
||||
|
||||
}else {
|
||||
|
|
|
@ -1,308 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
package org.gcube.portlets.user.performfishanalytics.client.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.view.util.ExtendedCheckboxCell;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
|
||||
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.cell.client.Cell;
|
||||
import com.google.gwt.cell.client.CompositeCell;
|
||||
import com.google.gwt.cell.client.FieldUpdater;
|
||||
import com.google.gwt.cell.client.HasCell;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.MultiSelectionModel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.TreeViewModel;
|
||||
|
||||
/**
|
||||
* The model that defines the nodes in the tree.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
* Feb 28, 2019
|
||||
*/
|
||||
public class CopyOfCustomTreeModel implements TreeViewModel {
|
||||
|
||||
// private final List<PopulationType> kpis = new
|
||||
// ArrayList<PopulationType>();
|
||||
/**
|
||||
* This selection model is shared across all leaf nodes. A selection model
|
||||
* can also be shared across all nodes in the tree, or each set of child
|
||||
* nodes can have its own instance. This gives you flexibility to determine
|
||||
* how nodes are selected.
|
||||
*/
|
||||
|
||||
private ListDataProvider<KPI> populationTypeProvider = new ListDataProvider<KPI>();
|
||||
private ListDataProvider<KPI> kpiProvider = new ListDataProvider<KPI>();
|
||||
private MultiSelectionModel<KPI> multiSelectionModel = new MultiSelectionModel<KPI>(kpiProvider);
|
||||
private List<CompositeCell<KPI>> listKPIAdded = new ArrayList<CompositeCell<KPI>>();
|
||||
private Map<String, ExtendedCheckboxCell> mapCheckBoxCell = new HashMap<String, ExtendedCheckboxCell>();
|
||||
//private List<HasCell<KPI, ?>> hasCells;
|
||||
//private ListDataProvider<KPI> kpiProvider;
|
||||
//private Cell<KPI> kpiCell;
|
||||
|
||||
|
||||
// private ListDataProvider<KPI> dataProvider = new ListDataProvider<KPI>();
|
||||
/**
|
||||
* Instantiates a new custom tree model.
|
||||
*/
|
||||
public CopyOfCustomTreeModel() {
|
||||
//init();
|
||||
multiSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
|
||||
GWT.log("Selected: " + multiSelectionModel.getSelectedSet());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resync.
|
||||
*
|
||||
* @param selectedKPI the selected kpi
|
||||
*/
|
||||
public void resync(List<KPI> selectedKPI){
|
||||
|
||||
for (KPI kpi : selectedKPI) {
|
||||
|
||||
ExtendedCheckboxCell checkBoxCell = mapCheckBoxCell.get(kpi.getId());
|
||||
GWT.log("Checkbox is: "+checkBoxCell);
|
||||
if(checkBoxCell!=null){
|
||||
GWT.log("Resetting checked");
|
||||
checkBoxCell.setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the kpi cell.
|
||||
*
|
||||
* @return the composite cell
|
||||
*/
|
||||
public CompositeCell<KPI> buildKPICell() {
|
||||
|
||||
// Construct a composite cell for contacts that includes a checkbox.
|
||||
ArrayList<HasCell<KPI, ?>> hasCells = new ArrayList<HasCell<KPI, ?>>();
|
||||
|
||||
HasCell<KPI, Boolean> checkBoxCell = new HasCell<KPI, Boolean>() {
|
||||
|
||||
private ExtendedCheckboxCell cell = new ExtendedCheckboxCell(true, true);
|
||||
|
||||
public Cell<Boolean> getCell() {
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
public FieldUpdater<KPI, Boolean> getFieldUpdater() {
|
||||
|
||||
return new FieldUpdater<KPI, Boolean>() {
|
||||
|
||||
@Override
|
||||
public void update(int index, KPI object, Boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
GWT.log("Checked: "+object.getName() + " value: "+value);
|
||||
PerformFishAnalyticsController.eventBus.fireEvent(new SelectedKPIEvent(null, object, value));
|
||||
if(value.booleanValue())
|
||||
mapCheckBoxCell.put(object.getId(), cell);
|
||||
else
|
||||
mapCheckBoxCell.remove(object.getId());
|
||||
// cell.set(value);
|
||||
// dataGrid.redraw();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Boolean getValue(KPI object) {
|
||||
|
||||
return multiSelectionModel.isSelected(object);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
hasCells.add(checkBoxCell);
|
||||
|
||||
hasCells.add(new HasCell<KPI, KPI>() {
|
||||
|
||||
private KPICell cell = new KPICell(null);
|
||||
|
||||
public Cell<KPI> getCell() {
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
public FieldUpdater<KPI, KPI> getFieldUpdater() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public KPI getValue(KPI object) {
|
||||
|
||||
return object;
|
||||
}
|
||||
});
|
||||
|
||||
CompositeCell<KPI> kpiCell = new CompositeCell<KPI>(hasCells) {
|
||||
|
||||
@Override
|
||||
public void render(Context context, KPI value, SafeHtmlBuilder sb) {
|
||||
|
||||
if(value.isLeaf()){
|
||||
sb.appendHtmlConstant("<table style=\"color:#0066cc;\"><tbody><tr>");
|
||||
super.render(context, value, sb);
|
||||
sb.appendHtmlConstant("</tr></tbody></table>");
|
||||
}else{
|
||||
sb.appendHtmlConstant("<table><tbody><tr>");
|
||||
sb.appendHtmlConstant(value.getName());
|
||||
sb.appendHtmlConstant("</tr></tbody></table>");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Element getContainerElement(Element parent) {
|
||||
|
||||
// Return the first TR element in the table.
|
||||
if(parent!=null){
|
||||
if(parent.getFirstChildElement()!=null){
|
||||
if(parent.getFirstChildElement().getFirstChildElement()!=null){
|
||||
return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X> void render(
|
||||
Context context, KPI value, SafeHtmlBuilder sb,
|
||||
HasCell<KPI, X> hasCell) {
|
||||
|
||||
Cell<X> cell = hasCell.getCell();
|
||||
sb.appendHtmlConstant("<td>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</td>");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
return kpiCell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the new batch type.
|
||||
*
|
||||
* @param populationType the new new batch type
|
||||
*/
|
||||
public void setNewBatchType(PopulationType populationType) {
|
||||
|
||||
//GWT.log("Displayng KPI for: " + populationType.toString());
|
||||
if (this.populationTypeProvider != null) {
|
||||
//removing all data from base data provider
|
||||
this.populationTypeProvider.getList().clear();
|
||||
this.populationTypeProvider.getList().addAll(populationType.getListKPI());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link NodeInfo} that provides the children of the specified
|
||||
* value.
|
||||
*
|
||||
* @param <T> the generic type
|
||||
* @param value the value
|
||||
* @return the node info
|
||||
*/
|
||||
public <T> NodeInfo<?> getNodeInfo(T value) {
|
||||
|
||||
GWT.log("Get Node Info fired: " + value);
|
||||
|
||||
if (value == null) {
|
||||
// LEVEL 0.
|
||||
// We passed null as the root value. Create a fake root KPIs
|
||||
PopulationType rootKPI = new PopulationType("", "KPIs", "", "", null);
|
||||
rootKPI.setListKPI(rootKPI.getListKPI());
|
||||
ListDataProvider<PopulationType> rootProvider = new ListDataProvider<PopulationType>();
|
||||
rootProvider.getList().add(rootKPI);
|
||||
Cell<PopulationType> cell = new AbstractCell<PopulationType>() {
|
||||
|
||||
@Override
|
||||
public void render(
|
||||
com.google.gwt.cell.client.Cell.Context context,
|
||||
PopulationType value, SafeHtmlBuilder sb) {
|
||||
|
||||
GWT.log("Rendering Root: " + value + " KPIs: " +
|
||||
value.getListKPI());
|
||||
// sb.appendHtmlConstant(" ROOT ");
|
||||
sb.appendEscaped(value.getName());
|
||||
}
|
||||
};
|
||||
// Return a node info that pairs the data provider and the cell.
|
||||
return new DefaultNodeInfo<PopulationType>(rootProvider, cell);
|
||||
}
|
||||
else if (value instanceof PopulationType) {
|
||||
// LEVEL 1.
|
||||
// We want the children of PopulationType. Getting its list of KPI.
|
||||
// List<KPI> listOfKpi = ((PopulationType) value).getListKPI();
|
||||
GWT.log("PopulationType listOfKpi: " + populationTypeProvider.getList());
|
||||
//return new DefaultNodeInfo<KPI>(populationTypeProvider, kpiCell, multiSelectionModel, null);
|
||||
CompositeCell<KPI> kpiCell = buildKPICell();
|
||||
listKPIAdded.add(kpiCell);
|
||||
return new DefaultNodeInfo<KPI>(populationTypeProvider, kpiCell);
|
||||
|
||||
}
|
||||
else if (value instanceof KPI) {
|
||||
// LEVEL 2 - LEAF.
|
||||
// We want the children of the KPI. Return them.
|
||||
List<KPI> listOfKpi = ((KPI) value).getListKPI();
|
||||
GWT.log("KPI type listOfKpi: " + listOfKpi.toString());
|
||||
ListDataProvider<KPI> localProvider = new ListDataProvider<KPI>(listOfKpi);
|
||||
|
||||
kpiProvider.getList().addAll(listOfKpi);
|
||||
// kpiProvider.
|
||||
// multiSelectionModel.
|
||||
CompositeCell<KPI> kpiCell = buildKPICell();
|
||||
listKPIAdded.add(kpiCell);
|
||||
return new DefaultNodeInfo<KPI>(localProvider, kpiCell);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified value represents a leaf node. Leaf nodes cannot be
|
||||
* opened.
|
||||
*
|
||||
* @param value the value
|
||||
* @return true, if is leaf
|
||||
*/
|
||||
public boolean isLeaf(Object value) {
|
||||
|
||||
if(value==null)
|
||||
return false;
|
||||
|
||||
// The leaf nodes are the songs, which are Strings.
|
||||
if (value instanceof KPI) {
|
||||
KPI toKPI = (KPI) value;
|
||||
return toKPI.isLeaf();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,281 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
package org.gcube.portlets.user.performfishanalytics.client.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFishAnalyticsController;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedKPIEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
|
||||
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.cell.client.Cell;
|
||||
import com.google.gwt.cell.client.CheckboxCell;
|
||||
import com.google.gwt.cell.client.CompositeCell;
|
||||
import com.google.gwt.cell.client.FieldUpdater;
|
||||
import com.google.gwt.cell.client.HasCell;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.MultiSelectionModel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.TreeViewModel;
|
||||
|
||||
/**
|
||||
* The model that defines the nodes in the tree.
|
||||
*/
|
||||
public class Copy_2_of_CustomTreeModel implements TreeViewModel {
|
||||
|
||||
// private final List<PopulationType> kpis = new
|
||||
// ArrayList<PopulationType>();
|
||||
/**
|
||||
* This selection model is shared across all leaf nodes. A selection model
|
||||
* can also be shared across all nodes in the tree, or each set of child
|
||||
* nodes can have its own instance. This gives you flexibility to determine
|
||||
* how nodes are selected.
|
||||
*/
|
||||
private final MultiSelectionModel<KPI> multiSelectionModel =
|
||||
new MultiSelectionModel<KPI>();
|
||||
private ListDataProvider<PopulationType> rootProvider =
|
||||
new ListDataProvider<PopulationType>();
|
||||
private ListDataProvider<KPI> populationTypeProvider =
|
||||
new ListDataProvider<KPI>();
|
||||
private ListDataProvider<KPI> kpiProvider = new ListDataProvider<KPI>();
|
||||
|
||||
private Cell<KPI> kpiCell;
|
||||
|
||||
// private ListDataProvider<KPI> dataProvider = new ListDataProvider<KPI>();
|
||||
public Copy_2_of_CustomTreeModel() {
|
||||
init();
|
||||
|
||||
multiSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
|
||||
GWT.log("Selected: " + multiSelectionModel.getSelectedSet());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
||||
// Construct a composite cell for contacts that includes a checkbox.
|
||||
final List<HasCell<KPI, ?>> hasCells = new ArrayList<HasCell<KPI, ?>>();
|
||||
hasCells.add(new HasCell<KPI, Boolean>() {
|
||||
|
||||
private CheckboxCell cell = new CheckboxCell(true, false);
|
||||
|
||||
public Cell<Boolean> getCell() {
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
public FieldUpdater<KPI, Boolean> getFieldUpdater() {
|
||||
|
||||
return new FieldUpdater<KPI, Boolean>() {
|
||||
|
||||
@Override
|
||||
public void update(int index, KPI object, Boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
GWT.log("Checked: "+object.getName() + " value: "+value);
|
||||
PerformFishAnalyticsController.eventBus.fireEvent(new SelectedKPIEvent(null, object, value));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Boolean getValue(KPI object) {
|
||||
|
||||
return multiSelectionModel.isSelected(object);
|
||||
}
|
||||
});
|
||||
|
||||
hasCells.add(new HasCell<KPI, KPI>() {
|
||||
|
||||
private KPICell cell = new KPICell(null);
|
||||
|
||||
public Cell<KPI> getCell() {
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
public FieldUpdater<KPI, KPI> getFieldUpdater() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public KPI getValue(KPI object) {
|
||||
|
||||
return object;
|
||||
}
|
||||
});
|
||||
|
||||
kpiCell = new CompositeCell<KPI>(hasCells) {
|
||||
|
||||
@Override
|
||||
public void render(Context context, KPI value, SafeHtmlBuilder sb) {
|
||||
|
||||
sb.appendHtmlConstant("<table><tbody><tr>");
|
||||
super.render(context, value, sb);
|
||||
sb.appendHtmlConstant("</tr></tbody></table>");
|
||||
|
||||
/*if(value.isLeaf()){
|
||||
sb.appendHtmlConstant("<table style=\"color:#0066cc;\"><tbody><tr>");
|
||||
//hasCells.get(0).getCell().render(context, value.getClass(), sb);
|
||||
//super.render(context, value, sb);
|
||||
sb.appendHtmlConstant("</tr></tbody></table>");
|
||||
}else{
|
||||
sb.appendHtmlConstant("<table><tbody><tr>");
|
||||
//sb.appendHtmlConstant(value.getName());
|
||||
//superrender(context, value, sb);
|
||||
sb.appendHtmlConstant("</tr></tbody></table>");
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Element getContainerElement(Element parent) {
|
||||
|
||||
// Return the first TR element in the table.
|
||||
return parent.getFirstChildElement().getFirstChildElement().getFirstChildElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X> void render(
|
||||
Context context, KPI value, SafeHtmlBuilder sb,
|
||||
HasCell<KPI, X> hasCell) {
|
||||
|
||||
Cell<X> cell = hasCell.getCell();
|
||||
sb.appendHtmlConstant("<td>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</td>");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setNewPopulationType(PopulationType populationType) {
|
||||
|
||||
GWT.log("Displayng KPI for: " + populationType.toString());
|
||||
// dataProvider.getList().clear();
|
||||
// dataProvider.setList(list);
|
||||
// dataProvider.refresh();
|
||||
if (this.populationTypeProvider != null) {
|
||||
// this.kpis.clear();
|
||||
this.populationTypeProvider.getList().clear();
|
||||
this.populationTypeProvider.getList().addAll(
|
||||
populationType.getListKPI());
|
||||
}
|
||||
// fillFirstRootLevel(populationType.getListKPI());
|
||||
//
|
||||
// this.getNodeInfo(populationType);
|
||||
}
|
||||
|
||||
// private void fillFirstRootLevel(List<KPI> listKPI){
|
||||
// kpis.clear();
|
||||
// PopulationType rootKPI = new PopulationType("", "KPIs","","",null);
|
||||
// rootKPI.setListKPI(rootKPI.getListKPI());
|
||||
// kpis.add(rootKPI);
|
||||
// //rootProvider.refresh();
|
||||
// }
|
||||
/**
|
||||
* Get the {@link NodeInfo} that provides the children of the specified
|
||||
* value.
|
||||
*/
|
||||
public <T> NodeInfo<?> getNodeInfo(T value) {
|
||||
|
||||
GWT.log("Get Node Info fired: " + value);
|
||||
if (value == null) {
|
||||
// LEVEL 0.
|
||||
// We passed null as the root value. Return the composers.
|
||||
// Create a data provider that contains the list of composers.
|
||||
// PopulationType root = fillFirstRootLevel(null);
|
||||
// Create a cell to display a composer.
|
||||
PopulationType rootKPI =
|
||||
new PopulationType("", "KPIs", "", "", null);
|
||||
rootKPI.setListKPI(rootKPI.getListKPI());
|
||||
rootProvider.getList().add(rootKPI);
|
||||
Cell<PopulationType> cell = new AbstractCell<PopulationType>() {
|
||||
|
||||
@Override
|
||||
public void render(
|
||||
com.google.gwt.cell.client.Cell.Context context,
|
||||
PopulationType value, SafeHtmlBuilder sb) {
|
||||
|
||||
GWT.log("Rendering Root: " + value + " KPIs: " +
|
||||
value.getListKPI());
|
||||
// sb.appendHtmlConstant(" ROOT ");
|
||||
sb.appendEscaped(value.getName());
|
||||
}
|
||||
};
|
||||
// Return a node info that pairs the data provider and the cell.
|
||||
return new DefaultNodeInfo<PopulationType>(rootProvider, cell);
|
||||
}
|
||||
else if (value instanceof PopulationType) {
|
||||
// LEVEL 1.
|
||||
// We want the children of PopulationType. Getting its list of KPI.
|
||||
// List<KPI> listOfKpi = ((PopulationType) value).getListKPI();
|
||||
GWT.log("PopulationType listOfKpi: " + populationTypeProvider.getList());
|
||||
// populationTypeProvider = new ListDataProvider<KPI>(listOfKpi);
|
||||
// Cell<KPI> cell = new AbstractCell<KPI>() {
|
||||
//
|
||||
// @Override
|
||||
// public void render(
|
||||
// com.google.gwt.cell.client.Cell.Context context, KPI value,
|
||||
// SafeHtmlBuilder sb) {
|
||||
//
|
||||
// GWT.log("Rendering PopulationType: " + value);
|
||||
// if (value != null) {
|
||||
// sb.appendHtmlConstant(" ");
|
||||
// sb.appendEscaped(value.getName());
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
return new DefaultNodeInfo<KPI>(populationTypeProvider, kpiCell);
|
||||
}
|
||||
else if (value instanceof KPI) {
|
||||
// LEVEL 2 - LEAF.
|
||||
// We want the children of the KPI. Return them.
|
||||
List<KPI> listOfKpi = ((KPI) value).getListKPI();
|
||||
if (listOfKpi != null) {
|
||||
GWT.log("KPI type listOfKpi: " + listOfKpi.toString());
|
||||
kpiProvider = new ListDataProvider<KPI>(((KPI) value).getListKPI());
|
||||
// Cell<KPI> cell = new AbstractCell<KPI>() {
|
||||
//
|
||||
// @Override
|
||||
// public void render(
|
||||
// com.google.gwt.cell.client.Cell.Context context,
|
||||
// KPI value, SafeHtmlBuilder sb) {
|
||||
//
|
||||
// GWT.log("Rendering KPI: " + value);
|
||||
// if (value != null) {
|
||||
// sb.appendHtmlConstant(" ---- ");
|
||||
// sb.appendEscaped(value.getName());
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
return new DefaultNodeInfo<KPI>(
|
||||
kpiProvider, kpiCell, multiSelectionModel, null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified value represents a leaf node. Leaf nodes cannot be
|
||||
* opened.
|
||||
*/
|
||||
public boolean isLeaf(Object value) {
|
||||
|
||||
// The leaf nodes are the songs, which are Strings.
|
||||
if (value instanceof KPI) {
|
||||
KPI toKPI = (KPI) value;
|
||||
return toKPI.isLeaf();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@
|
|||
package org.gcube.portlets.user.performfishanalytics.client.viewbinder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -12,7 +11,6 @@ import org.gcube.portlets.user.performfishanalytics.client.event.LoadPopulationT
|
|||
import org.gcube.portlets.user.performfishanalytics.client.event.PerformFishFieldFormChangedEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.client.event.SelectedPopulationTypeEvent;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.Area;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.KPI;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.Period;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.Population;
|
||||
import org.gcube.portlets.user.performfishanalytics.shared.PopulationType;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
</ui:style>
|
||||
<b:TabPanel tabPosition="above" ui:field="field_base_tabpanel">
|
||||
<b:Tab heading="Create Analitycs Request" active="true"
|
||||
<b:Tab heading="Create Analytics Request" active="true"
|
||||
ui:field="field_create_analytics_request" icon="TASKS">
|
||||
</b:Tab>
|
||||
</b:TabPanel>
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -60,6 +59,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
*
|
||||
|
@ -70,9 +70,11 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|||
public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
||||
implements PerformFishAnalyticsService {
|
||||
|
||||
/** The log. */
|
||||
protected static Logger log = LoggerFactory.getLogger(PerformFishAnalyticsServiceImpl.class);
|
||||
|
||||
|
||||
/** The date format. */
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy 'at' HH:mm:ss-SSS z");
|
||||
|
||||
/**
|
||||
|
@ -319,46 +321,14 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt and valid parameters.
|
||||
*
|
||||
* @param initParams the init params
|
||||
* @return the perform fish init parameter
|
||||
* @throws Exception the exception
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.performfishanalytics.client.PerformFishAnalyticsService#validParameters(org.gcube.portlets.user.performfishanalytics.shared.performfishservice.PerformFishInitParameter)
|
||||
*/
|
||||
@Override
|
||||
public PerformFishInitParameter decryptAndValidParameters(PerformFishInitParameter initParams) throws Exception{
|
||||
public PerformFishInitParameter validParameters(PerformFishInitParameter initParams) throws Exception{
|
||||
|
||||
Map<String, String> inputParameters = initParams.getParameters();
|
||||
|
||||
try{
|
||||
//PortalContext pContext = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
log.info("Decrypting init parameters: "+inputParameters +" user: "+PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest()));
|
||||
Set<String> keyParameters = inputParameters.keySet();
|
||||
PerformFishInitParameter decrypted = new PerformFishInitParameter();
|
||||
|
||||
|
||||
//TODO UNCOMMENT THIS FOR RELEASE
|
||||
/*if(!ContextUtil.isWithinPortal()){
|
||||
return initParams;
|
||||
}
|
||||
|
||||
for (String key : keyParameters) {
|
||||
String decParam = StringEncrypter.getEncrypter().decrypt(initParams.getParameters().get(key));
|
||||
decrypted.addParameter(key, decParam);
|
||||
}
|
||||
|
||||
//HERE WE CAN VALIDATE THE FARM_ID
|
||||
PortalContextInfo pContext = ContextUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
pContext.getUsername();
|
||||
|
||||
log.info("Returning decrypted params: "+decrypted.toString());
|
||||
return decrypted;*/
|
||||
}catch(Exception e){
|
||||
log.error("Error on decripting your init parameters: "+initParams.toString(), e);
|
||||
throw new Exception("Error on decripting your init parameters: "+initParams.toString());
|
||||
}
|
||||
|
||||
String farmID = inputParameters.get(PerformFishAnalyticsConstant.FARMID_PARAM);
|
||||
boolean grantAccess = checkGrantToAccessFarmID(farmID);
|
||||
if(!grantAccess)
|
||||
|
|
Loading…
Reference in New Issue