Skip to content
Snippets Groups Projects
Commit 38400bcc authored by tpylak's avatar tpylak
Browse files

LMS-1882 show better well tooltip, minor refactorings

SVN: 18870
parent 95330b38
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,12 @@ public final class RealNumberRenderer implements GridCellRenderer<BaseEntityMode ...@@ -26,6 +26,12 @@ public final class RealNumberRenderer implements GridCellRenderer<BaseEntityMode
public static String render(String value, public static String render(String value,
RealNumberFormatingParameters realNumberFormatingParameters) RealNumberFormatingParameters realNumberFormatingParameters)
{
return render(value, realNumberFormatingParameters, true);
}
public static String render(String value,
RealNumberFormatingParameters realNumberFormatingParameters, boolean withTooltip)
{ {
if (realNumberFormatingParameters.isFormatingEnabled() == false || value.length() == 0) if (realNumberFormatingParameters.isFormatingEnabled() == false || value.length() == 0)
{ {
...@@ -48,7 +54,13 @@ public final class RealNumberRenderer implements GridCellRenderer<BaseEntityMode ...@@ -48,7 +54,13 @@ public final class RealNumberRenderer implements GridCellRenderer<BaseEntityMode
formattedValue = formattedValue =
NumberFormat.getFormat(format + EXPONENT_FORMAT).format(doubleValue); NumberFormat.getFormat(format + EXPONENT_FORMAT).format(doubleValue);
} }
return MultilineHTML.wrapUpInDivWithTooltip(formattedValue, value); if (withTooltip)
{
return MultilineHTML.wrapUpInDivWithTooltip(formattedValue, value);
} else
{
return formattedValue;
}
} catch (NumberFormatException ex) } catch (NumberFormatException ex)
{ {
return value; return value;
...@@ -64,7 +76,7 @@ public final class RealNumberRenderer implements GridCellRenderer<BaseEntityMode ...@@ -64,7 +76,7 @@ public final class RealNumberRenderer implements GridCellRenderer<BaseEntityMode
public String render(float value) public String render(float value)
{ {
return render("" + value, realNumberFormatingParameters); return render("" + value, realNumberFormatingParameters, false);
} }
public Object render(BaseEntityModel<?> model, String property, ColumnData config, public Object render(BaseEntityModel<?> model, String property, ColumnData config,
......
...@@ -92,7 +92,7 @@ class HeatmapPresenter ...@@ -92,7 +92,7 @@ class HeatmapPresenter
Color color = renderer.getColor(wellData); Color color = renderer.getColor(wellData);
String tooltipOrNull = String tooltipOrNull =
WellTooltipGenerator.tryGenerateTooltip(model, rowIx, colIx, WellTooltipGenerator.tryGenerateTooltip(model, rowIx, colIx,
featureIndexOrNull); featureIndexOrNull, realNumberRenderer);
viewManipulations.refreshWellStyle(rowIx, colIx, color, tooltipOrNull); viewManipulations.refreshWellStyle(rowIx, colIx, color, tooltipOrNull);
} }
} }
...@@ -249,7 +249,7 @@ class HeatmapPresenter ...@@ -249,7 +249,7 @@ class HeatmapPresenter
{ {
private static final String NEWLINE = "\n"; private static final String NEWLINE = "\n";
private static final int MAX_DESCRIBED_FEATURES = 7; private static final int MAX_DESCRIBED_FEATURES = 30;
/** /**
* Generates a short description of the well, which can be used as e.g. a tooltip * Generates a short description of the well, which can be used as e.g. a tooltip
...@@ -258,17 +258,21 @@ class HeatmapPresenter ...@@ -258,17 +258,21 @@ class HeatmapPresenter
* distinguished. * distinguished.
*/ */
public static String tryGenerateTooltip(PlateLayouterModel model, int rowIx, int colIx, public static String tryGenerateTooltip(PlateLayouterModel model, int rowIx, int colIx,
Integer featureIndexOrNull) Integer featureIndexOrNull, IRealNumberRenderer realNumberRenderer)
{ {
return new WellTooltipGenerator(model).tryGenerateShortDescription(rowIx, colIx, return new WellTooltipGenerator(model, realNumberRenderer).tryGenerateShortDescription(
featureIndexOrNull); rowIx, colIx, featureIndexOrNull);
} }
private final PlateLayouterModel model; private final PlateLayouterModel model;
private WellTooltipGenerator(PlateLayouterModel model) private final IRealNumberRenderer realNumberRenderer;
private WellTooltipGenerator(PlateLayouterModel model,
IRealNumberRenderer realNumberRenderer)
{ {
this.model = model; this.model = model;
this.realNumberRenderer = realNumberRenderer;
} }
private String tryGenerateShortDescription(int rowIx, int colIx, Integer featureIndexOrNull) private String tryGenerateShortDescription(int rowIx, int colIx, Integer featureIndexOrNull)
...@@ -327,7 +331,7 @@ class HeatmapPresenter ...@@ -327,7 +331,7 @@ class HeatmapPresenter
{ {
return ""; return "";
} }
String textValue = (value == null ? "" : "" + value); String textValue = (value == null ? "" : "" + renderFloat(value));
if (distinguished) if (distinguished)
{ {
textValue = "<b>" + textValue + "</b>"; textValue = "<b>" + textValue + "</b>";
...@@ -335,6 +339,11 @@ class HeatmapPresenter ...@@ -335,6 +339,11 @@ class HeatmapPresenter
return featureLabels.get(featureIndex) + ": " + textValue + NEWLINE; return featureLabels.get(featureIndex) + ": " + textValue + NEWLINE;
} }
private String renderFloat(float value)
{
return realNumberRenderer.render(value);
}
private static String generateMetadataDescription(WellData wellData) private static String generateMetadataDescription(WellData wellData)
{ {
WellMetadata metadata = wellData.tryGetMetadata(); WellMetadata metadata = wellData.tryGetMetadata();
......
...@@ -166,6 +166,7 @@ public class PlateLayouter ...@@ -166,6 +166,7 @@ public class PlateLayouter
SimpleModelComboBox<Integer> heatmapKindChooser, LayoutContainer legendContainer) SimpleModelComboBox<Integer> heatmapKindChooser, LayoutContainer legendContainer)
{ {
LayoutContainer container = new LayoutContainer(); LayoutContainer container = new LayoutContainer();
container.setScrollMode(Scroll.AUTO);
container.setLayout(new RowLayout()); container.setLayout(new RowLayout());
container.add(new Text( container.add(new Text(
"Hold the mouse cursor over a well or click on it to get the details."), "Hold the mouse cursor over a well or click on it to get the details."),
...@@ -191,7 +192,6 @@ public class PlateLayouter ...@@ -191,7 +192,6 @@ public class PlateLayouter
private static LayoutContainer renderPlateLayout(Component[][] renderedWells) private static LayoutContainer renderPlateLayout(Component[][] renderedWells)
{ {
LayoutContainer plateMatrix = new LayoutContainer(); LayoutContainer plateMatrix = new LayoutContainer();
plateMatrix.setScrollMode(Scroll.AUTO);
TableLayout layout = new TableLayout(getColumnsNum(renderedWells) + 1); TableLayout layout = new TableLayout(getColumnsNum(renderedWells) + 1);
layout.setCellSpacing(2); layout.setCellSpacing(2);
plateMatrix.setLayout(layout); plateMatrix.setLayout(layout);
......
...@@ -18,12 +18,15 @@ package ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto; ...@@ -18,12 +18,15 @@ package ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto;
import com.google.gwt.user.client.rpc.IsSerializable; import com.google.gwt.user.client.rpc.IsSerializable;
import ch.systemsx.cisd.openbis.generic.shared.basic.annotation.DoNotEscape;
/** /**
* Bean for one feature vector of the well. Contains data set code, well position and array of * Bean for one feature vector of the well. Contains data set code, well position and array of
* feature values. Float.NaN is used for unknown feature value in this array. * feature values. Float.NaN is used for unknown feature value in this array.
* *
* @author Tomasz Pylak * @author Tomasz Pylak
*/ */
@DoNotEscape
public class FeatureVectorValues implements IsSerializable public class FeatureVectorValues implements IsSerializable
{ {
private WellFeatureVectorReference featureVectorReference; private WellFeatureVectorReference featureVectorReference;
......
...@@ -25,6 +25,7 @@ import java.util.List; ...@@ -25,6 +25,7 @@ import java.util.List;
import org.testng.AssertJUnit; import org.testng.AssertJUnit;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.IRealNumberRenderer;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
...@@ -72,7 +73,19 @@ public class WellTooltipGeneratorTest extends AssertJUnit ...@@ -72,7 +73,19 @@ public class WellTooltipGeneratorTest extends AssertJUnit
private static String tryGenerateShortDescription(PlateLayouterModel model, int rowIx, private static String tryGenerateShortDescription(PlateLayouterModel model, int rowIx,
int colIx, Integer featureIndexOrNull) int colIx, Integer featureIndexOrNull)
{ {
return WellTooltipGenerator.tryGenerateTooltip(model, rowIx, colIx, featureIndexOrNull); return WellTooltipGenerator.tryGenerateTooltip(model, rowIx, colIx, featureIndexOrNull,
createDummyRealNumberRenderer());
}
private static IRealNumberRenderer createDummyRealNumberRenderer()
{
return new IRealNumberRenderer()
{
public String render(float value)
{
return "" + value;
}
};
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment