Added code to show on top the legend for the synoptic table

[Task #17247] Add numbers to correlation charts


git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/performfish-analytics-portlet@181300 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-07-24 12:26:03 +00:00
parent f101ec3ecd
commit 6ce5550ba8
11 changed files with 529 additions and 401 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/performfish-analytics-portlet-0.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/performfish-analytics-portlet-0.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/performfish-analytics-portlet-0.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/performfish-analytics-portlet-0.2.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/performfish-analytics-portlet-0.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
lastWarOutDir=/home/francesco-mangiacrapa/eclipse-workspace/performfish-analytics-portlet-TRUNK/target/performfish-analytics-portlet-0.2.0-SNAPSHOT lastWarOutDir=/home/francesco-mangiacrapa/eclipse-workspace/performfish-analytics-portlet-TRUNK/target/performfish-analytics-portlet-0.3.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="performfish-analytics-portlet-0.2.0-SNAPSHOT"> <wb-module deploy-name="performfish-analytics-portlet-0.3.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="performfish-analytics-portlet"/> <property name="context-root" value="performfish-analytics-portlet"/>
<property name="java-output-path" value="/performfish-analytics-portlet/target/performfish-analytics-portlet-0.2.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/performfish-analytics-portlet/target/performfish-analytics-portlet-0.3.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module> </wb-module>
</project-modules> </project-modules>

View File

@ -87,6 +87,8 @@ public class PerformFishAnnualAnalyticsController {
private Map<Integer,FlexTable> boxPlotOrderBy = new HashMap<Integer,FlexTable>(); private Map<Integer,FlexTable> boxPlotOrderBy = new HashMap<Integer,FlexTable>();
private Map<Integer,FlexTable> synopticOrderBy = new HashMap<Integer,FlexTable>();
/** /**
* Instantiates a new perform fish analytics controller. * Instantiates a new perform fish analytics controller.
@ -846,8 +848,14 @@ public class PerformFishAnnualAnalyticsController {
case DEA_CHART: case DEA_CHART:
break; break;
case PERFORMFISH_SYNOPTIC_TABLE_FARM: case PERFORMFISH_SYNOPTIC_TABLE_FARM:
cssTableStyle = "synoptictable-farm"; if(!result.getFileName().contains("legend")) {
break; cssTableStyle = "synoptictable-farm";
}
ShowResult showResultSin = new ShowResult(title);
showResultSin.showCSVFile(result, cssTableStyle);
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container, showResultSin);
return;
} }
ShowResult showResult = new ShowResult(title); ShowResult showResult = new ShowResult(title);
@ -865,7 +873,42 @@ public class PerformFishAnnualAnalyticsController {
} }
/**
* Displaying ordered synoptic table.
*
* @param dmResponse the dm response
* @param fileName the file name
* @param container the container
* @param showResult the show result
*/
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName, final Panel container, ShowResult showResult) {
int hashcode = dmResponse.hashCode();
GWT.log("The hascode is: "+hashcode);
FlexTable flex = synopticOrderBy.get(hashcode);
if(flex==null) {
GWT.log("The flextable is null");
flex = new FlexTable();
synopticOrderBy.put(hashcode, flex);
container.add(flex);
}
if(fileName.toLowerCase().contains("legend")) {
flex.setWidget(0, 0, showResult);
}else {
flex.setWidget(flex.getRowCount()+1,0,showResult);
}
}
/**
* Displaying ordered box plot.
*
* @param dmResponse the dm response
* @param title the title
* @param container the container
* @param showResult the show result
*/
private void displayingOrderedBoxPlot(final DataMinerResponse dmResponse, String title, final Panel container, ShowResult showResult) { private void displayingOrderedBoxPlot(final DataMinerResponse dmResponse, String title, final Panel container, ShowResult showResult) {
int hashcode = dmResponse.hashCode(); int hashcode = dmResponse.hashCode();
GWT.log("The hascode is: "+hashcode); GWT.log("The hascode is: "+hashcode);

View File

@ -84,6 +84,8 @@ public class PerformFishAnalyticsController {
private Map<Integer,FlexTable> boxPlotOrderBy = new HashMap<Integer,FlexTable>(); private Map<Integer,FlexTable> boxPlotOrderBy = new HashMap<Integer,FlexTable>();
private Map<Integer,FlexTable> synopticOrderBy = new HashMap<Integer,FlexTable>();
/** /**
* Instantiates a new perform fish analytics controller. * Instantiates a new perform fish analytics controller.
@ -753,6 +755,7 @@ public class PerformFishAnalyticsController {
String title = toTitle; String title = toTitle;
switch (chartType) { switch (chartType) {
case BOXPLOT: case BOXPLOT:
if(result.getFileName().contains("_user")){ if(result.getFileName().contains("_user")){
title = "My Batch(es)"; title = "My Batch(es)";
}else{ }else{
@ -764,7 +767,9 @@ public class PerformFishAnalyticsController {
ShowResult showResult = new ShowResult(title); ShowResult showResult = new ShowResult(title);
showResult.showCSVFile(result, cssTableStyle); showResult.showCSVFile(result, cssTableStyle);
displayingOrderedBoxPlot(dmResponse, title, container, showResult); displayingOrderedBoxPlot(dmResponse, title, container, showResult);
return; return;
case CORRELATION: case CORRELATION:
break; break;
case DEA_ANALYSIS: case DEA_ANALYSIS:
@ -776,10 +781,17 @@ public class PerformFishAnalyticsController {
case DEA_CHART: case DEA_CHART:
break; break;
case PERFORMFISH_SYNOPTICTABLE_BATCH: case PERFORMFISH_SYNOPTICTABLE_BATCH:
cssTableStyle = "synoptictable-batch";
break;
}
if(!result.getFileName().contains("legend")) {
cssTableStyle = "synoptictable-batch";
}
ShowResult showResultSin = new ShowResult(title);
showResultSin.showCSVFile(result, cssTableStyle);
displayingOrderedSynopticTable(dmResponse, result.getFileName(), container, showResultSin);
return;
}
//ALL OTHER CASES
ShowResult showResult = new ShowResult(title); ShowResult showResult = new ShowResult(title);
showResult.showCSVFile(result, cssTableStyle); showResult.showCSVFile(result, cssTableStyle);
container.add(showResult); container.add(showResult);
@ -815,4 +827,23 @@ public class PerformFishAnalyticsController {
flex.setWidget(0, 2, showResult); flex.setWidget(0, 2, showResult);
} }
} }
private void displayingOrderedSynopticTable(final DataMinerResponse dmResponse, String fileName, final Panel container, ShowResult showResult) {
int hashcode = dmResponse.hashCode();
GWT.log("The hascode is: "+hashcode);
FlexTable flex = synopticOrderBy.get(hashcode);
if(flex==null) {
GWT.log("The flextable is null");
flex = new FlexTable();
synopticOrderBy.put(hashcode, flex);
container.add(flex);
}
if(fileName.toLowerCase().contains("legend")) {
flex.setWidget(0, 0, showResult);
}else {
flex.setWidget(flex.getRowCount()+1,0,showResult);
}
}
} }

View File

@ -16,6 +16,7 @@ import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEv
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon; import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.view.util.CorrelationValueToColourUtil; import org.gcube.portlets.user.performfishanalytics.client.view.util.CorrelationValueToColourUtil;
import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult; import org.gcube.portlets.user.performfishanalytics.client.viewbinder.ShowResult;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI; import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile; import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile; import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -158,6 +159,8 @@ public class AnalyticsAnnualPanelResult extends Composite {
private HandlerManager theEventBus; private HandlerManager theEventBus;
private Map<String, CSVFile> csvGenerated = new HashMap<String, CSVFile>();
/** /**
* Because this class has a default constructor, it can * Because this class has a default constructor, it can
* be used as a binder template. In other words, it can be used in other * be used as a binder template. In other words, it can be used in other
@ -344,7 +347,11 @@ public class AnalyticsAnnualPanelResult extends Composite {
public KPI getKPIForName(String name){ public KPI getKPIForName(String name){
GWT.log("Searching KPI name: "+name); GWT.log("Searching KPI name: "+name+ " into: ");
for (KPI kpi : selectedKPIs) {
GWT.log("selected: "+kpi.getName());
}
KPI foundKPI = null; KPI foundKPI = null;
String purgedName = name.trim(); String purgedName = name.trim();
for (KPI kpi : selectedKPIs) { for (KPI kpi : selectedKPIs) {
@ -446,32 +453,12 @@ public class AnalyticsAnnualPanelResult extends Composite {
* @param dmResponse the dm response * @param dmResponse the dm response
*/ */
public void addResults(DataMinerResponse dmResponse) { public void addResults(DataMinerResponse dmResponse) {
this.dmResponse = dmResponse; this.dmResponse = dmResponse;
for (final OutputFile outputFile : dmResponse.getListOutput()) { for (final OutputFile outputFile : dmResponse.getListOutput()) {
switch (outputFile.getDataType()) { if(outputFile.getDataType().equals(FileContentType.CSV)){
case IMAGE:
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
showAlert(caught.getMessage(), AlertType.ERROR, true, uib_vp_correlation_results_container);
}
@Override
public void onSuccess(String base64Content) {
ShowResult showResult = new ShowResult(outputFile.getName());
showResult.showImage(base64Content);
uib_vp_correlation_results_container.add(showResult);
}
});
break;
case CSV:
//CORRELATION MATRIX
PerformFishAnalyticsServiceAsync.Util.getInstance().getCSVFile(outputFile, true, new AsyncCallback<CSVFile>() { PerformFishAnalyticsServiceAsync.Util.getInstance().getCSVFile(outputFile, true, new AsyncCallback<CSVFile>() {
@Override @Override
@ -483,31 +470,62 @@ public class AnalyticsAnnualPanelResult extends Composite {
@Override @Override
public void onSuccess(CSVFile result) { public void onSuccess(CSVFile result) {
GWT.log("Displaying: "+result); csvGenerated.put(result.getFileName(), result);
HorizontalPanel hp = new HorizontalPanel(); fillCorrelationMatrix();
final FlexTable flexTable = new FlexTable(); }
flexTable.setStyleName("fixedtable"); });
flexTable.getElement().getStyle().setMarginBottom(10, Unit.PX); }
flexTable.setWidget(0, 0,new Label("")); }
}
// for (KPI kpi : selectedKPIs) {
// GWT.log("Selected KPIs are: "+kpi);
// }
CSVRow headerRow = result.getHeaderRow(); /**
//HEADER * Fill correlation matrix.
for (int i=1; i<headerRow.getListValues().size(); i++) { */
private void fillCorrelationMatrix() {
final String headerValue = headerRow.getListValues().get(i); if(csvGenerated.size()<2)
return;
String corrIndexFilename = null;
String corrFilename = null;
for (String fileName : csvGenerated.keySet()) {
if(fileName.contains("index")) {
corrIndexFilename = fileName;
}else {
corrFilename = fileName;
}
}
GWT.log("Correlation Matrix Index File: "+corrIndexFilename);
GWT.log("Correlation Matrix File: "+corrFilename);
CSVFile corrIndexCsvFile = csvGenerated.get(corrIndexFilename);
CSVFile corrCsvFile = csvGenerated.get(corrFilename);
GWT.log("Correlation Matrix Index CSV: "+corrIndexCsvFile);
GWT.log("Correlation Matrix CSV: "+corrCsvFile);
HorizontalPanel hp = new HorizontalPanel();
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("fixedtable");
flexTable.getElement().getStyle().setMarginBottom(10, Unit.PX);
flexTable.setWidget(0, 0,new Label(""));
CSVRow headerRow = corrIndexCsvFile.getHeaderRow();
//HEADER
for (int i=1; i<headerRow.getListValues().size(); i++) {
final String headerValue = headerRow.getListValues().get(i);
// final Button button = new Button(headerValue); // final Button button = new Button(headerValue);
// button.setType(ButtonType.LINK); // button.setType(ButtonType.LINK);
HTML label = new HTML(headerValue); HTML label = new HTML(headerValue);
label.getElement().getStyle().setFontSize(16, Unit.PX); label.getElement().getStyle().setFontSize(16, Unit.PX);
final int columnIndex = i; final int columnIndex = i;
KPI kpi = getKPIForName(headerValue); KPI kpi = getKPIForName(headerValue);
fillKPIReferenceForIndex(0, columnIndex, Arrays.asList(kpi)); fillKPIReferenceForIndex(0, columnIndex, Arrays.asList(kpi));
// button.addClickHandler(new ClickHandler() { // button.addClickHandler(new ClickHandler() {
// //
// @Override // @Override
@ -517,28 +535,34 @@ public class AnalyticsAnnualPanelResult extends Composite {
// //
// } // }
// }); // });
flexTable.setWidget(0, i,label); flexTable.setWidget(0, i,label);
} }
//DATA //DATA
for (int i=0; i<result.getValueRows().size(); i++) { for (int i=0; i<corrIndexCsvFile.getValueRows().size(); i++) {
CSVRow row = result.getValueRows().get(i); CSVRow row = corrIndexCsvFile.getValueRows().get(i);
final int rowIndex = i+1; //adding +1 for header row CSVRow rowMatrixColor = corrCsvFile.getValueRows().get(i);
for (int j=0; j<row.getListValues().size(); j++) { final int rowIndex = i+1; //adding +1 for header row
final String rowValue = row.getListValues().get(j); for (int j=0; j<row.getListValues().size(); j++) {
final String theColor = CorrelationValueToColourUtil.getRGBColor(rowValue); final String rowValue = row.getListValues().get(j);
final int columnIndex = j; final String rowMatrixColorValue = rowMatrixColor.getListValues().get(j);
final Button button = new Button(rowValue); final String theColor = CorrelationValueToColourUtil.getRGBColor(rowMatrixColorValue);
final int columnIndex = j;
//final Button button = new Button(rowValue);
final HTML buttonHTML = new HTML(rowValue);
buttonHTML.addStyleName("my-active-html");
// button.setType(ButtonType.LINK);
// button.setSize(ButtonSize.LARGE);
//only the first column //only the first column
if(j==0){ if(j==0){
HTML label = new HTML(rowValue); HTML label = new HTML(rowValue);
label.getElement().getStyle().setFontSize(16, Unit.PX); label.getElement().getStyle().setFontSize(16, Unit.PX);
flexTable.setWidget(rowIndex, j,label); flexTable.setWidget(rowIndex, j,label);
//rowValue is a KPI name //rowValue is a KPI name
KPI kpi = getKPIForName(rowValue); KPI kpi = getKPIForName(rowValue);
fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi)); fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi));
continue; continue;
//rowValue is a KPI name //rowValue is a KPI name
// KPI kpi = getKPIForName(rowValue); // KPI kpi = getKPIForName(rowValue);
// fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi)); // fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi));
// button.addClickHandler(new ClickHandler() { // button.addClickHandler(new ClickHandler() {
@ -550,92 +574,86 @@ public class AnalyticsAnnualPanelResult extends Composite {
// //
// } // }
// }); // });
} }
//diagonal //diagonal
else if(rowIndex==j){ else if(rowIndex==j){
HTML dg = new HTML("1"); //rowValue should be 1
dg.getElement().getStyle().setFontSize(18, Unit.PX); //HTML dg = new HTML("1");
flexTable.setWidget(rowIndex, j,dg); HTML dg = new HTML(rowValue);
continue; dg.getElement().getStyle().setFontSize(18, Unit.PX);
//j > 0 flexTable.setWidget(rowIndex, j,dg);
}else{ continue;
KPI columnKPI = getKPIForName(headerRow.getListValues().get(columnIndex)); //j > 0
//Here the first index is the KPI name }else{
KPI rowKPI = getKPIForName(row.getListValues().get(0)); KPI columnKPI = getKPIForName(headerRow.getListValues().get(columnIndex));
fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(columnKPI, rowKPI)); //Here the first index is the KPI name
button.setText(" "); KPI rowKPI = getKPIForName(row.getListValues().get(0));
button.setIcon(IconType.COMPASS); fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(columnKPI, rowKPI));
button.setSize(ButtonSize.LARGE); //button.setText(" ");
//button.setIcon(IconType.COMPASS);
//button.setSize(ButtonSize.LARGE);
button.addClickHandler(new ClickHandler() { buttonHTML.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
//callScatterAndDeaChart(rowIndex, columnIndex, button);
callScatter(rowIndex, columnIndex, button);
}
});
}
button.setType(ButtonType.LINK);
//APPLYING STYLE ONLY ON INTERNAL VALUES OF CSV
if(j>0)
button.getElement().getStyle().setColor("#000");
button.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if(theColor.startsWith("#")){
GWT.log("Setting backgrounf color: "+theColor);
button.getElement().getParentElement().getStyle().setBackgroundColor(theColor);
}
}
});
flexTable.setWidget(rowIndex, j,button);
}
//callScatterAndDeaChart(rowIndex, columnIndex, button);
callScatter(rowIndex, columnIndex, buttonHTML);
} }
});
}
hp.add(flexTable); //button.setType(ButtonType.LINK);
//APPLYING STYLE ONLY ON INTERNAL VALUES OF CSV
if(j>0)
buttonHTML.getElement().getStyle().setColor("#000");
final FlexTable flexLegend = new FlexTable(); buttonHTML.addAttachHandler(new AttachEvent.Handler() {
flexLegend.setStyleName("simpletable");
//flexLegend.getElement().getStyle().setBorderWidth(0, Unit.PX);
Map<String, String> map = CorrelationValueToColourUtil.getMap();
flexLegend.setWidget(0, 0, new Label("Legend"));
flexLegend.setWidget(0, 1, new HTML(""));
int i = 1;
for (String key : map.keySet()) {
final String rgbColor = map.get(key);
final HTML theLegendColor = new HTML("");
flexLegend.setWidget(i, 0, theLegendColor);
flexLegend.setWidget(i, 1, new HTML(key));
theLegendColor.addAttachHandler(new AttachEvent.Handler() {
@Override @Override
public void onAttachOrDetach(AttachEvent event) { public void onAttachOrDetach(AttachEvent event) {
theLegendColor.getElement().getParentElement().getStyle().setBackgroundColor(rgbColor); if(theColor.startsWith("#")){
} GWT.log("Setting backgrounf color: "+theColor);
}); buttonHTML.getElement().getParentElement().getStyle().setBackgroundColor(theColor);
}
i++; }
}
flexLegend.getElement().getStyle().setMarginLeft(15, Unit.PX);
hp.add(flexLegend);
uib_vp_correlation_results_container.insert(hp,0);
}
}); });
break;
default: flexTable.setWidget(rowIndex, j,buttonHTML);
break;
} }
} }
hp.add(flexTable);
final FlexTable flexLegend = new FlexTable();
flexLegend.setStyleName("simpletable");
//flexLegend.getElement().getStyle().setBorderWidth(0, Unit.PX);
Map<String, String> map = CorrelationValueToColourUtil.getMap();
flexLegend.setWidget(0, 0, new Label("Legend"));
flexLegend.setWidget(0, 1, new HTML(""));
int i = 1;
for (String key : map.keySet()) {
final String rgbColor = map.get(key);
final HTML theLegendColor = new HTML("");
flexLegend.setWidget(i, 0, theLegendColor);
flexLegend.setWidget(i, 1, new HTML(key));
theLegendColor.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
theLegendColor.getElement().getParentElement().getStyle().setBackgroundColor(rgbColor);
}
});
i++;
}
flexLegend.getElement().getStyle().setMarginLeft(15, Unit.PX);
hp.add(flexLegend);
uib_vp_correlation_results_container.insert(hp,0);
} }
/** /**
@ -785,9 +803,9 @@ public class AnalyticsAnnualPanelResult extends Composite {
* *
* @param rowIndex the row index * @param rowIndex the row index
* @param columnIndex the column index * @param columnIndex the column index
* @param button the button * @param buttonHTML the button
*/ */
private void callScatter(int rowIndex, int columnIndex, Button button){ private void callScatter(int rowIndex, int columnIndex, HTML buttonHTML){
String focusID = checkValidFocusID(); String focusID = checkValidFocusID();

View File

@ -16,6 +16,7 @@ import org.gcube.portlets.user.performfishanalytics.client.controllers.PerformFi
import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEvent; import org.gcube.portlets.user.performfishanalytics.client.event.CallAlgorithmEvent;
import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon; import org.gcube.portlets.user.performfishanalytics.client.view.LoaderIcon;
import org.gcube.portlets.user.performfishanalytics.client.view.util.CorrelationValueToColourUtil; import org.gcube.portlets.user.performfishanalytics.client.view.util.CorrelationValueToColourUtil;
import org.gcube.portlets.user.performfishanalytics.shared.FileContentType;
import org.gcube.portlets.user.performfishanalytics.shared.KPI; import org.gcube.portlets.user.performfishanalytics.shared.KPI;
import org.gcube.portlets.user.performfishanalytics.shared.OutputFile; import org.gcube.portlets.user.performfishanalytics.shared.OutputFile;
import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile; import org.gcube.portlets.user.performfishanalytics.shared.csv.CSVFile;
@ -28,10 +29,7 @@ import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ControlGroup; import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ListBox; import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType; import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.resources.ButtonSize;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
@ -155,6 +153,8 @@ public class AnalyticsPanelResult extends Composite {
private List<String> selectedAreas; private List<String> selectedAreas;
private Map<String, CSVFile> csvGenerated = new HashMap<String, CSVFile>();
/** /**
* Because this class has a default constructor, it can * Because this class has a default constructor, it can
* be used as a binder template. In other words, it can be used in other * be used as a binder template. In other words, it can be used in other
@ -192,7 +192,7 @@ public class AnalyticsPanelResult extends Composite {
List<String> inputKPINames = getSelected(list_dea_input_kpi); List<String> inputKPINames = getSelected(list_dea_input_kpi);
List<String> outputKPINames = getSelected(list_dea_output_kpi); List<String> outputKPINames = getSelected(list_dea_output_kpi);
callDeaAnalysis(inputKPINames, outputKPINames, button_dea_analys_request); //callDeaAnalysis(inputKPINames, outputKPINames, button_dea_analys_request);
} }
}); });
@ -450,28 +450,7 @@ public class AnalyticsPanelResult extends Composite {
for (final OutputFile outputFile : dmResponse.getListOutput()) { for (final OutputFile outputFile : dmResponse.getListOutput()) {
switch (outputFile.getDataType()) { if(outputFile.getDataType().equals(FileContentType.CSV)){
case IMAGE:
PerformFishAnalyticsServiceAsync.Util.getInstance().getImageFile(outputFile, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
showAlert(caught.getMessage(), AlertType.ERROR, true, uib_vp_correlation_results_container);
}
@Override
public void onSuccess(String base64Content) {
ShowResult showResult = new ShowResult(outputFile.getName());
showResult.showImage(base64Content);
uib_vp_correlation_results_container.add(showResult);
}
});
break;
case CSV:
//CORRELATION MATRIX
PerformFishAnalyticsServiceAsync.Util.getInstance().getCSVFile(outputFile, true, new AsyncCallback<CSVFile>() { PerformFishAnalyticsServiceAsync.Util.getInstance().getCSVFile(outputFile, true, new AsyncCallback<CSVFile>() {
@Override @Override
@ -483,31 +462,58 @@ public class AnalyticsPanelResult extends Composite {
@Override @Override
public void onSuccess(CSVFile result) { public void onSuccess(CSVFile result) {
GWT.log("Displaying: "+result); csvGenerated.put(result.getFileName(), result);
HorizontalPanel hp = new HorizontalPanel(); fillCorrelationMatrix();
final FlexTable flexTable = new FlexTable(); }
flexTable.setStyleName("fixedtable"); });
flexTable.getElement().getStyle().setMarginBottom(10, Unit.PX); }
flexTable.setWidget(0, 0,new Label("")); }
}
// for (KPI kpi : selectedKPIs) { private void fillCorrelationMatrix() {
// GWT.log("Selected KPIs are: "+kpi);
// }
CSVRow headerRow = result.getHeaderRow(); if(csvGenerated.size()<2)
//HEADER return;
for (int i=1; i<headerRow.getListValues().size(); i++) {
final String headerValue = headerRow.getListValues().get(i); String corrIndexFilename = null;
String corrFilename = null;
for (String fileName : csvGenerated.keySet()) {
if(fileName.contains("index")) {
corrIndexFilename = fileName;
}else {
corrFilename = fileName;
}
}
GWT.log("Correlation Matrix Index File: "+corrIndexFilename);
GWT.log("Correlation Matrix File: "+corrFilename);
CSVFile corrIndexCsvFile = csvGenerated.get(corrIndexFilename);
CSVFile corrCsvFile = csvGenerated.get(corrFilename);
GWT.log("Correlation Matrix Index CSV: "+corrIndexCsvFile);
GWT.log("Correlation Matrix CSV: "+corrCsvFile);
HorizontalPanel hp = new HorizontalPanel();
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("fixedtable");
flexTable.getElement().getStyle().setMarginBottom(10, Unit.PX);
flexTable.setWidget(0, 0,new Label(""));
CSVRow headerRow = corrIndexCsvFile.getHeaderRow();
//HEADER
for (int i=1; i<headerRow.getListValues().size(); i++) {
final String headerValue = headerRow.getListValues().get(i);
// final Button button = new Button(headerValue); // final Button button = new Button(headerValue);
// button.setType(ButtonType.LINK); // button.setType(ButtonType.LINK);
HTML label = new HTML(headerValue); HTML label = new HTML(headerValue);
label.getElement().getStyle().setFontSize(16, Unit.PX); label.getElement().getStyle().setFontSize(16, Unit.PX);
final int columnIndex = i; final int columnIndex = i;
KPI kpi = getKPIForName(headerValue); KPI kpi = getKPIForName(headerValue);
fillKPIReferenceForIndex(0, columnIndex, Arrays.asList(kpi)); fillKPIReferenceForIndex(0, columnIndex, Arrays.asList(kpi));
// button.addClickHandler(new ClickHandler() { // button.addClickHandler(new ClickHandler() {
// //
// @Override // @Override
@ -517,28 +523,34 @@ public class AnalyticsPanelResult extends Composite {
// //
// } // }
// }); // });
flexTable.setWidget(0, i,label); flexTable.setWidget(0, i,label);
} }
//DATA //DATA
for (int i=0; i<result.getValueRows().size(); i++) { for (int i=0; i<corrIndexCsvFile.getValueRows().size(); i++) {
CSVRow row = result.getValueRows().get(i); CSVRow row = corrIndexCsvFile.getValueRows().get(i);
final int rowIndex = i+1; //adding +1 for header row CSVRow rowMatrixColor = corrCsvFile.getValueRows().get(i);
for (int j=0; j<row.getListValues().size(); j++) { final int rowIndex = i+1; //adding +1 for header row
final String rowValue = row.getListValues().get(j); for (int j=0; j<row.getListValues().size(); j++) {
final String theColor = CorrelationValueToColourUtil.getRGBColor(rowValue); final String rowValue = row.getListValues().get(j);
final int columnIndex = j; final String rowMatrixColorValue = rowMatrixColor.getListValues().get(j);
final Button button = new Button(rowValue); final String theColor = CorrelationValueToColourUtil.getRGBColor(rowMatrixColorValue);
final int columnIndex = j;
//final Button button = new Button(rowValue);
final HTML buttonHTML = new HTML(rowValue);
buttonHTML.addStyleName("my-active-html");
// button.setType(ButtonType.LINK);
// button.setSize(ButtonSize.LARGE);
//only the first column //only the first column
if(j==0){ if(j==0){
HTML label = new HTML(rowValue); HTML label = new HTML(rowValue);
label.getElement().getStyle().setFontSize(16, Unit.PX); label.getElement().getStyle().setFontSize(16, Unit.PX);
flexTable.setWidget(rowIndex, j,label); flexTable.setWidget(rowIndex, j,label);
//rowValue is a KPI name //rowValue is a KPI name
KPI kpi = getKPIForName(rowValue); KPI kpi = getKPIForName(rowValue);
fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi)); fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi));
continue; continue;
//rowValue is a KPI name //rowValue is a KPI name
// KPI kpi = getKPIForName(rowValue); // KPI kpi = getKPIForName(rowValue);
// fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi)); // fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(kpi));
// button.addClickHandler(new ClickHandler() { // button.addClickHandler(new ClickHandler() {
@ -550,92 +562,86 @@ public class AnalyticsPanelResult extends Composite {
// //
// } // }
// }); // });
} }
//diagonal //diagonal
else if(rowIndex==j){ else if(rowIndex==j){
HTML dg = new HTML("1"); //rowValue should be 1
dg.getElement().getStyle().setFontSize(18, Unit.PX); //HTML dg = new HTML("1");
flexTable.setWidget(rowIndex, j,dg); HTML dg = new HTML(rowValue);
continue; dg.getElement().getStyle().setFontSize(18, Unit.PX);
//j > 0 flexTable.setWidget(rowIndex, j,dg);
}else{ continue;
KPI columnKPI = getKPIForName(headerRow.getListValues().get(columnIndex)); //j > 0
//Here the first index is the KPI name }else{
KPI rowKPI = getKPIForName(row.getListValues().get(0)); KPI columnKPI = getKPIForName(headerRow.getListValues().get(columnIndex));
fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(columnKPI, rowKPI)); //Here the first index is the KPI name
button.setText(" "); KPI rowKPI = getKPIForName(row.getListValues().get(0));
button.setIcon(IconType.COMPASS); fillKPIReferenceForIndex(rowIndex, columnIndex, Arrays.asList(columnKPI, rowKPI));
button.setSize(ButtonSize.LARGE); //button.setText(" ");
//button.setIcon(IconType.COMPASS);
//button.setSize(ButtonSize.LARGE);
button.addClickHandler(new ClickHandler() { buttonHTML.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
//callScatterAndDeaChart(rowIndex, columnIndex, button);
callScatter(rowIndex, columnIndex, button);
}
});
}
button.setType(ButtonType.LINK);
//APPLYING STYLE ONLY ON INTERNAL VALUES OF CSV
if(j>0)
button.getElement().getStyle().setColor("#000");
button.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if(theColor.startsWith("#")){
GWT.log("Setting backgrounf color: "+theColor);
button.getElement().getParentElement().getStyle().setBackgroundColor(theColor);
}
}
});
flexTable.setWidget(rowIndex, j,button);
}
//callScatterAndDeaChart(rowIndex, columnIndex, button);
callScatter(rowIndex, columnIndex, buttonHTML);
} }
});
}
hp.add(flexTable); //button.setType(ButtonType.LINK);
//APPLYING STYLE ONLY ON INTERNAL VALUES OF CSV
if(j>0)
buttonHTML.getElement().getStyle().setColor("#000");
final FlexTable flexLegend = new FlexTable(); buttonHTML.addAttachHandler(new AttachEvent.Handler() {
flexLegend.setStyleName("simpletable");
//flexLegend.getElement().getStyle().setBorderWidth(0, Unit.PX);
Map<String, String> map = CorrelationValueToColourUtil.getMap();
flexLegend.setWidget(0, 0, new Label("Legend"));
flexLegend.setWidget(0, 1, new HTML(""));
int i = 1;
for (String key : map.keySet()) {
final String rgbColor = map.get(key);
final HTML theLegendColor = new HTML("");
flexLegend.setWidget(i, 0, theLegendColor);
flexLegend.setWidget(i, 1, new HTML(key));
theLegendColor.addAttachHandler(new AttachEvent.Handler() {
@Override @Override
public void onAttachOrDetach(AttachEvent event) { public void onAttachOrDetach(AttachEvent event) {
theLegendColor.getElement().getParentElement().getStyle().setBackgroundColor(rgbColor); if(theColor.startsWith("#")){
} GWT.log("Setting backgrounf color: "+theColor);
}); buttonHTML.getElement().getParentElement().getStyle().setBackgroundColor(theColor);
}
i++; }
}
flexLegend.getElement().getStyle().setMarginLeft(15, Unit.PX);
hp.add(flexLegend);
uib_vp_correlation_results_container.insert(hp,0);
}
}); });
break;
default: flexTable.setWidget(rowIndex, j,buttonHTML);
break;
} }
} }
hp.add(flexTable);
final FlexTable flexLegend = new FlexTable();
flexLegend.setStyleName("simpletable");
//flexLegend.getElement().getStyle().setBorderWidth(0, Unit.PX);
Map<String, String> map = CorrelationValueToColourUtil.getMap();
flexLegend.setWidget(0, 0, new Label("Legend"));
flexLegend.setWidget(0, 1, new HTML(""));
int i = 1;
for (String key : map.keySet()) {
final String rgbColor = map.get(key);
final HTML theLegendColor = new HTML("");
flexLegend.setWidget(i, 0, theLegendColor);
flexLegend.setWidget(i, 1, new HTML(key));
theLegendColor.addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
theLegendColor.getElement().getParentElement().getStyle().setBackgroundColor(rgbColor);
}
});
i++;
}
flexLegend.getElement().getStyle().setMarginLeft(15, Unit.PX);
hp.add(flexLegend);
uib_vp_correlation_results_container.insert(hp,0);
} }
/** /**
@ -691,36 +697,36 @@ public class AnalyticsPanelResult extends Composite {
} }
/** // /**
* Call box plot and speedo meter. // * Call box plot and speedo meter.
* // *
* @param rowIndex the row index // * @param rowIndex the row index
* @param columnIndex the column index // * @param columnIndex the column index
* @param button the button // * @param button the button
*/ // */
private void callBoxPlotAndSpeedoMeter(int rowIndex, int columnIndex, Button button){ // private void callBoxPlotAndSpeedoMeter(int rowIndex, int columnIndex, Button button){
//
String focusID = checkValidFocusID(); // String focusID = checkValidFocusID();
//
if(focusID==null) // if(focusID==null)
return; // return;
//
GWT.log("Called BoxPlotAndSpeedoMeter at rowIndex: "+rowIndex +", columnIndex: "+columnIndex); // GWT.log("Called BoxPlotAndSpeedoMeter at rowIndex: "+rowIndex +", columnIndex: "+columnIndex);
HorizontalPanel hp = new HorizontalPanel(); // HorizontalPanel hp = new HorizontalPanel();
hp.getElement().addClassName("ext-horizontal-panel"); // hp.getElement().addClassName("ext-horizontal-panel");
HorizontalPanel boxPlot = new HorizontalPanel(); // HorizontalPanel boxPlot = new HorizontalPanel();
HorizontalPanel speedometer = new HorizontalPanel(); // HorizontalPanel speedometer = new HorizontalPanel();
hp.add(boxPlot); // hp.add(boxPlot);
hp.add(speedometer); // hp.add(speedometer);
//hp.getElement().addClassName("ext-horizontal-panel"); // //hp.getElement().addClassName("ext-horizontal-panel");
field_unary_algorithm_container.add(hp); // field_unary_algorithm_container.add(hp);
//KPI selectKPI = getKPIForName(button.getText()); // //KPI selectKPI = getKPIForName(button.getText());
List<KPI> selectedKPI = getKPIForIndexes(rowIndex, columnIndex); // List<KPI> selectedKPI = getKPIForIndexes(rowIndex, columnIndex);
GWT.log("Selected KPI: "+selectedKPI); // GWT.log("Selected KPI: "+selectedKPI);
field_unary_algorithm.setVisible(true); // field_unary_algorithm.setVisible(true);
callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.BOXPLOT, focusID, boxPlot); // callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.BOXPLOT, focusID, boxPlot);
callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.SPEEDOMETER, focusID, speedometer); // callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.SPEEDOMETER, focusID, speedometer);
} // }
/** /**
@ -754,35 +760,35 @@ public class AnalyticsPanelResult extends Composite {
} }
/** // /**
* Call scatter and dea chart. // * Call scatter and dea chart.
* // *
* @param rowIndex the row index // * @param rowIndex the row index
* @param columnIndex the column index // * @param columnIndex the column index
* @param button the button // * @param button the button
*/ // */
private void callScatterAndDeaChart(int rowIndex, int columnIndex, Button button){ // private void callScatterAndDeaChart(int rowIndex, int columnIndex, Button button){
//
String focusID = checkValidFocusID(); // String focusID = checkValidFocusID();
//
if(focusID==null) // if(focusID==null)
return; // return;
//
GWT.log("Called ScatterAndDeaChart at rowIndex: "+rowIndex +", columnIndex: "+columnIndex); // GWT.log("Called ScatterAndDeaChart at rowIndex: "+rowIndex +", columnIndex: "+columnIndex);
HorizontalPanel hp = new HorizontalPanel(); // HorizontalPanel hp = new HorizontalPanel();
hp.getElement().addClassName("ext-horizontal-panel"); // hp.getElement().addClassName("ext-horizontal-panel");
HorizontalPanel scatter = new HorizontalPanel(); // HorizontalPanel scatter = new HorizontalPanel();
HorizontalPanel deaChart = new HorizontalPanel(); // HorizontalPanel deaChart = new HorizontalPanel();
hp.add(scatter); // hp.add(scatter);
hp.add(deaChart); // hp.add(deaChart);
//hp.getElement().addClassName("ext-horizontal-panel"); // //hp.getElement().addClassName("ext-horizontal-panel");
field_binary_algorithm_container.add(hp); // field_binary_algorithm_container.add(hp);
List<KPI> selectedKPI = getKPIForIndexes(rowIndex, columnIndex); // List<KPI> selectedKPI = getKPIForIndexes(rowIndex, columnIndex);
GWT.log("Selected KPI: "+selectedKPI); // GWT.log("Selected KPI: "+selectedKPI);
field_binary_algorithm.setVisible(true); // field_binary_algorithm.setVisible(true);
callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.SCATTER, focusID, scatter); // callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.SCATTER, focusID, scatter);
callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.DEA_CHART, focusID, deaChart); // callDataMinerServiceForChart(dataInputParameters, selectedKPI, null, DataMinerAlgorithms.DEA_CHART, focusID, deaChart);
} // }
/** /**
@ -792,7 +798,7 @@ public class AnalyticsPanelResult extends Composite {
* @param columnIndex the column index * @param columnIndex the column index
* @param button the button * @param button the button
*/ */
private void callScatter(int rowIndex, int columnIndex, Button button){ private void callScatter(int rowIndex, int columnIndex, HTML button){
String focusID = checkValidFocusID(); String focusID = checkValidFocusID();
@ -806,37 +812,37 @@ public class AnalyticsPanelResult extends Composite {
} }
/** // /**
* Call dea analysis. // * Call dea analysis.
* // *
* @param inputKPINames the input kpi names // * @param inputKPINames the input kpi names
* @param outputKPINames the output kpi names // * @param outputKPINames the output kpi names
* @param button the button // * @param button the button
*/ // */
private void callDeaAnalysis(List<String> inputKPINames, List<String> outputKPINames, Button button){ // private void callDeaAnalysis(List<String> inputKPINames, List<String> outputKPINames, Button button){
//
HorizontalPanel hp = new HorizontalPanel(); // HorizontalPanel hp = new HorizontalPanel();
hp.getElement().addClassName("ext-horizontal-panel"); // hp.getElement().addClassName("ext-horizontal-panel");
HorizontalPanel deaAnalysis = new HorizontalPanel(); // HorizontalPanel deaAnalysis = new HorizontalPanel();
hp.add(deaAnalysis); // hp.add(deaAnalysis);
//hp.getElement().addClassName("ext-horizontal-panel"); // //hp.getElement().addClassName("ext-horizontal-panel");
uib_vp_deanalanlysis_algorithm_container.add(hp); // uib_vp_deanalanlysis_algorithm_container.add(hp);
//
List<KPI> inputKPI = new ArrayList<KPI>(); // List<KPI> inputKPI = new ArrayList<KPI>();
for (String kpiName : inputKPINames) { // for (String kpiName : inputKPINames) {
inputKPI.add(getKPIForName(kpiName)); // inputKPI.add(getKPIForName(kpiName));
} // }
//
List<KPI> outputKPI = new ArrayList<KPI>(); // List<KPI> outputKPI = new ArrayList<KPI>();
for (String kpiName : outputKPINames) { // for (String kpiName : outputKPINames) {
outputKPI.add(getKPIForName(kpiName)); // outputKPI.add(getKPIForName(kpiName));
} // }
//
//
GWT.log("Calling Dea Analysys... with input: "+inputKPI+" and output: "+outputKPI); // GWT.log("Calling Dea Analysys... with input: "+inputKPI+" and output: "+outputKPI);
uib_vp_deanalanlysis_algorithm.setVisible(true); // uib_vp_deanalanlysis_algorithm.setVisible(true);
callDataMinerServiceForChart(dataInputParameters, inputKPI, outputKPI, DataMinerAlgorithms.DEA_ANALYSIS, "ID", deaAnalysis); // callDataMinerServiceForChart(dataInputParameters, inputKPI, outputKPI, DataMinerAlgorithms.DEA_ANALYSIS, "ID", deaAnalysis);
} // }
/** /**

View File

@ -77,7 +77,10 @@ public class ShowResult extends Composite {
public void showCSVFile(CSVFile csvFile, String cssStyleName){ public void showCSVFile(CSVFile csvFile, String cssStyleName){
final FlexTable flexTable = new FlexTable(); final FlexTable flexTable = new FlexTable();
flexTable.setStyleName(cssStyleName);
if(cssStyleName!=null && !cssStyleName.isEmpty())
flexTable.setStyleName(cssStyleName);
flexTable.getElement().getStyle().setMarginLeft(30, Unit.PX); flexTable.getElement().getStyle().setMarginLeft(30, Unit.PX);
flexTable.getElement().getStyle().setMarginRight(30, Unit.PX); flexTable.getElement().getStyle().setMarginRight(30, Unit.PX);

View File

@ -721,11 +721,12 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
*/ */
public List<OutputFile> manageOutputsForPerformFishAnalysis(List<OutputFile> output) { public List<OutputFile> manageOutputsForPerformFishAnalysis(List<OutputFile> output) {
OutputFile theOutputFile = null; List<OutputFile> newOutputFiles = new ArrayList<OutputFile>();
try { try {
Map<String, List<String>> theLegendMap = new HashMap<String, List<String>>(); Map<String, List<String>> theLegendMap = new HashMap<String, List<String>>();
//FINDING THE FILE WIHT THE LEGEND
for (OutputFile outputFile : output) { for (OutputFile outputFile : output) {
log.trace("outputFile: {}", outputFile.getName()); log.trace("outputFile: {}", outputFile.getName());
if(outputFile.getName().toLowerCase().contains("legend") && outputFile.getDataType().equals(FileContentType.CSV)){ if(outputFile.getName().toLowerCase().contains("legend") && outputFile.getDataType().equals(FileContentType.CSV)){
@ -744,24 +745,39 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
if(theLegendMap.size()>0){ if(theLegendMap.size()>0){
log.info("Legend created as {}", theLegendMap.toString()); log.info("Legend created as {}", theLegendMap.toString());
for (OutputFile outputFile : output) { for (OutputFile outputFile : output) {
//THE FILE MUST NOT CONTAINT *_legend_* IN THE NAME OutputFile theOutputFile = outputFile;
if(!outputFile.getName().toLowerCase().contains("legend") && outputFile.getDataType().equals(FileContentType.CSV)){ String toNameLower = outputFile.getName().toLowerCase();
CSVFile theCorrelationFile = getCSVFile(outputFile, true);
//SKIPPING THE LEGEND
if(toNameLower.contains("legend")) {
continue;
}
if(outputFile.getDataType().equals(FileContentType.CSV)) {
//FINDING THE FILE *index* TO CREATE A NEW CSV REPLACING THE LABELS 'A','B','C', etc. WITH THE NAMES (THE KPI NAMES) CONTAINED IN THE LEGEND
if(toNameLower.contains("index")){
CSVFile theCorrelationMatrixIndexCSVFile = getCSVFile(outputFile, true);
try{ try{
theOutputFile = createCSVWithLegendValues(theCorrelationFile, theLegendMap); theOutputFile = createCSVWithLegendValues(theCorrelationMatrixIndexCSVFile, theLegendMap);
}catch(Exception e){ }catch(Exception e){
log.warn("Error thrown creating the CSV File with legend returning the original output file {}", outputFile); log.warn("Error thrown creating the CSV File with legend returning the original output file {}", outputFile);
theOutputFile = outputFile; theOutputFile = outputFile;
} }
break; //break;
} }
} }
//RETURNING ALSO THE file correlation_matrix.csv for applying the COLORS
newOutputFiles.add(theOutputFile);
}
}else{ }else{
log.warn("The Legend file not found returning the original output files {}", output); log.warn("The Legend file not found returning the original output files {}", output);
return output; return output;
} }
return Arrays.asList(theOutputFile); return newOutputFiles;
}catch (Exception e) { }catch (Exception e) {
log.warn("Error occured managing the CSV File returing the original files extracted form .zip {}", output); log.warn("Error occured managing the CSV File returing the original files extracted form .zip {}", output);
@ -895,7 +911,7 @@ public class PerformFishAnalyticsServiceImpl extends RemoteServiceServlet
//delete the file; //delete the file;
if(theFile!=null && deleteAfter){ if(theFile!=null && deleteAfter){
try{ try{
Files.deleteIfExists(theFile.toPath()); //Files.deleteIfExists(theFile.toPath());
}catch(Exception e){ }catch(Exception e){
//silent //silent
} }

View File

@ -1,8 +1,8 @@
KPI CODE,KPI NAME - LEVEL 1,KPI NAME LEVEL 2,KPI NAME - LEVEL 3 KPI CODE,KPI NAME - LEVEL 1,KPI NAME LEVEL 2,KPI NAME - LEVEL 3
,Dependency on treatments KPIs,, ,Dependency on treatments KPIs,,
,,Number of therapeutic treatments, ,,Number of therapeutic treatments,
G9,,,Total number of antiparasitic treatments (n) G9,,,Total number of antiparasitic treatments (n)
G10,,,Total number of antibiotic treatments (n) G10,,,Total number of antibiotic treatments (n)
,Productivity KPIs,, ,Productivity KPIs,,
G20,,Biomass produced per number of FTE employees (fish/FTE), G20,,Biomass produced per number of FTE employees (fish/FTE),
G21,,Biomass produced per volumes of sea water used (ton produced/m^3), G21,,Biomass produced per volumes of sea water used (ton produced/m^3),

1 KPI CODE KPI NAME - LEVEL 1 KPI NAME – LEVEL 2 KPI NAME - LEVEL 3
2 Dependency on treatments KPIs
3 Number of therapeutic treatments
4 G9 Total number of antiparasitic treatments (n) Total number of antiparasitic treatments (n)
5 G10 Total number of antibiotic treatments (n) Total number of antibiotic treatments (n)
6 Productivity KPIs
7 G20 Biomass produced per number of FTE employees (fish/FTE)
8 G21 Biomass produced per volumes of sea water used (ton produced/m^3)

View File

@ -293,3 +293,14 @@ table.synoptictable-farm td:first-child {
table.synoptictable-farm td:last-child { table.synoptictable-farm td:last-child {
border-right: none; border-right: none;
} }
.my-active-html {
cursor: pointer;
font-size: 18px;
color: #0066cc !important;
/* text-decoration: underline; */
}
.my-active-html:hover{
color: #000 !important;
}