Skip to content
Snippets Groups Projects
Commit 9d0cbf74 authored by tpylak's avatar tpylak
Browse files

LMS-757, LMS-781 bugfixes: change experiment chooser title, remove empty text...

LMS-757, LMS-781 bugfixes: change experiment chooser title, remove empty text for experiment and material choosers

SVN: 10284
parent a6a7581e
No related branches found
No related tags found
No related merge requests found
......@@ -459,6 +459,8 @@ public abstract class Dict
public static final String INCORRECT_MATERIAL_SYNTAX = "incorrect_material_syntax";
public static final String TITLE_CHOOSE_EXPERIMENT = "TITLE_CHOOSE_EXPERIMENT";
//
// Unclassified
//
......
......@@ -52,10 +52,10 @@ class EntityChooserDialog<T> extends SimpleDialog
}
public EntityChooserDialog(DisposableEntityChooser<T> entityBrowser,
ChosenEntitySetter<T> chosenEntitySetter, IMessageProvider messageProvider)
ChosenEntitySetter<T> chosenEntitySetter, String title, IMessageProvider messageProvider)
{
super(entityBrowser.getComponent(), messageProvider.getMessage(Dict.TITLE_CHOOSE_MATERIAL),
messageProvider.getMessage(Dict.BUTTON_CHOOSE), messageProvider);
super(entityBrowser.getComponent(), title, messageProvider.getMessage(Dict.BUTTON_CHOOSE),
messageProvider);
this.entityBrowser = entityBrowser;
this.onAcceptAction = createAcceptAction(chosenEntitySetter, entityBrowser);
this.onCancelAction = createCancelAction(chosenEntitySetter, entityBrowser);
......
......@@ -32,7 +32,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.experim
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.EntityChooserDialog.ChosenEntitySetter;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableEntityChooser;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.FieldUtil;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Experiment;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ExperimentIdentifier;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Group;
......@@ -111,7 +110,9 @@ public final class ExperimentChooserField extends TextField<String> implements
{
DisposableEntityChooser<Experiment> browser =
ExperimentBrowserGrid.createChooser(viewContext, group);
new EntityChooserDialog<Experiment>(browser, chosenMaterialField, viewContext).show();
String title = viewContext.getMessage(Dict.TITLE_CHOOSE_EXPERIMENT);
new EntityChooserDialog<Experiment>(browser, chosenMaterialField, title, viewContext)
.show();
}
// ------------------
......@@ -163,18 +164,10 @@ public final class ExperimentChooserField extends TextField<String> implements
if (initialValueOrNull != null)
{
setValue(initialValueOrNull);
} else
{
setEmptyText(createEmptyText(viewContext));
}
FieldUtil.setMandatoryFlag(this, mandatory);
}
private static String createEmptyText(IMessageProvider messageProvider)
{
return messageProvider.getMessage(Dict.BUTTON_CHOOSE, "an experiment");
}
@Override
protected boolean validateValue(String val)
{
......
......@@ -32,7 +32,6 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.E
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableEntityChooser;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.material.MaterialBrowserGrid;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.FieldUtil;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.Material;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType;
......@@ -71,7 +70,9 @@ public final class MaterialChooserField extends TextField<String> implements
{
DisposableEntityChooser<Material> materialBrowser =
MaterialBrowserGrid.create(viewContext, materialTypeOrNull);
new EntityChooserDialog<Material>(materialBrowser, chosenMaterialField, viewContext).show();
String title = viewContext.getMessage(Dict.TITLE_CHOOSE_MATERIAL);
new EntityChooserDialog<Material>(materialBrowser, chosenMaterialField, title, viewContext)
.show();
}
// ------------------
......@@ -112,25 +113,10 @@ public final class MaterialChooserField extends TextField<String> implements
if (initialValueOrNull != null)
{
setValue(initialValueOrNull);
} else
{
setEmptyText(createEmptyText(materialTypeOrNull, viewContext));
}
FieldUtil.setMandatoryFlag(this, mandatory);
}
private static String createEmptyText(MaterialType materialTypeOrNull,
IMessageProvider messageProvider)
{
if (materialTypeOrNull == null)
{
return messageProvider.getMessage(Dict.CHOOSE_ANY_MATERIAL);
} else
{
return messageProvider.getMessage(Dict.COMBO_BOX_CHOOSE, materialTypeOrNull.getCode());
}
}
@Override
protected boolean validateValue(String val)
{
......
......@@ -302,6 +302,7 @@ var common = {
title_choose_material: "Choose a Material",
choose_any_material: "Choose Any Material...",
incorrect_material_syntax: "Incorrect material specification. Please provide the material code followed by the type in brackets: 'code (type)'.",
TITLE_CHOOSE_EXPERIMENT: "Choose an Experiment",
// LAST LINE: KEEP IT AT THE END
lastline: "" // we need a line without a comma
......
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