Skip to content
Snippets Groups Projects
Commit 968aa2a5 authored by buczekp's avatar buczekp
Browse files

[LMS-2354] minor refactorization

SVN: 21956
parent 9740c86a
No related branches found
No related tags found
No related merge requests found
......@@ -83,9 +83,6 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
public static final String PROPERTIES_ID_PREFIX = GenericConstants.ID_PREFIX
+ "generic-sample-properties-viewer_";
public static final String SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX =
"-show_only_directly_connected_checkbox";
private final IViewContext<?> viewContext;
protected final TechId sampleId;
......@@ -209,10 +206,8 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
parentSamplesSection = new ParentSamplesSection(viewContext, generator);
container.addSection(parentSamplesSection);
// Data Sets
CheckBox showOnlyDirectlyConnectedCheckBox = createShowOnlyDirectlyConnectedCheckBox();
dataSetSection =
new SampleDataSetsSection(viewContext, showOnlyDirectlyConnectedCheckBox, sampleId,
generator.getSampleType());
new SampleDataSetsSection(viewContext, sampleId, generator.getSampleType());
container.addSection(dataSetSection);
// Attachments
......@@ -237,15 +232,6 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
return new ArrayList<TabContent>();
}
private CheckBox createShowOnlyDirectlyConnectedCheckBox()
{
CheckBox result = new CheckBox();
result.setId(getId() + SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX);
result.setBoxLabel(viewContext.getMessage(Dict.SHOW_ONLY_DIRECTLY_CONNECTED));
result.setValue(true);
return result;
}
private AttachmentVersionsSection createAttachmentsSection(final Sample sample)
{
return new AttachmentVersionsSection(viewContext.getCommonViewContext(), sample);
......
......@@ -37,21 +37,33 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.sam
*/
public class SampleDataSetsSection extends AbstractDataSetsSection
{
public static final String SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX =
"-show_only_directly_connected_checkbox";
private final CheckBox showOnlyDirectlyConnectedCheckBox;
private final TechId sampleId;
private final SampleType sampleType;
public SampleDataSetsSection(final IViewContext<?> viewContext,
final CheckBox showOnlyDirectlyConnectedCheckBox, TechId sampleId, SampleType sampleType)
public SampleDataSetsSection(final IViewContext<?> viewContext, TechId sampleId,
SampleType sampleType)
{
super(viewContext.getMessage(Dict.EXTERNAL_DATA_HEADING), viewContext, sampleId);
this.showOnlyDirectlyConnectedCheckBox = showOnlyDirectlyConnectedCheckBox;
this.showOnlyDirectlyConnectedCheckBox = createShowOnlyDirectlyConnectedCheckBox();
this.sampleId = sampleId;
this.sampleType = sampleType;
}
private CheckBox createShowOnlyDirectlyConnectedCheckBox()
{
CheckBox result = new CheckBox();
result.setId(getId() + SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX);
result.setBoxLabel(viewContext.getMessage(Dict.SHOW_ONLY_DIRECTLY_CONNECTED));
result.setValue(true);
return result;
}
@Override
protected void initWidgets(AbstractExternalDataGrid browser)
{
......
......@@ -99,11 +99,11 @@ public class GenericSampleViewerTest extends AbstractGWTTestCase
checkSample.createComponentsTableCheck().expectedSize(2);
final String sampleSubcodeFieldIdent = SampleGridColumnIDs.SUBCODE;
checkComponentsTable.expectedRow(new SampleRow(CONTROL_LAYOUT_EXAMPLE + ":A01", "WELL")
.identifier("CISD", "CISD").partOfContainer(CONTROL_LAYOUT_EXAMPLE_ID).withCell(
sampleSubcodeFieldIdent, "A01"));
.identifier("CISD", "CISD").partOfContainer(CONTROL_LAYOUT_EXAMPLE_ID)
.withCell(sampleSubcodeFieldIdent, "A01"));
checkComponentsTable.expectedRow(new SampleRow(CONTROL_LAYOUT_EXAMPLE + ":A03", "WELL")
.identifier("CISD", "CISD").partOfContainer(CONTROL_LAYOUT_EXAMPLE_ID).withCell(
sampleSubcodeFieldIdent, "A03"));
.identifier("CISD", "CISD").partOfContainer(CONTROL_LAYOUT_EXAMPLE_ID)
.withCell(sampleSubcodeFieldIdent, "A03"));
remoteConsole.prepare(checkComponentsTable);
activateTab(createSectionsTabPanelId(),
......@@ -196,7 +196,7 @@ public class GenericSampleViewerTest extends AbstractGWTTestCase
{
String showOnlyDirectlyConnectedCheckBoxId =
GenericSampleViewer.createId(WILDCARD_ID)
+ GenericSampleViewer.SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX;
+ SampleDataSetsSection.SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX;
GWTTestUtil.clickCheckBoxWithID(showOnlyDirectlyConnectedCheckBoxId);
}
});
......@@ -205,9 +205,10 @@ public class GenericSampleViewerTest extends AbstractGWTTestCase
final CheckTableCommand checkIndirectlyConnectedDataTable =
new CheckTableCommand(SampleDataSetBrowser.createGridId(WILDCARD_ID));
checkIndirectlyConnectedDataTable.expectedSize(6);
checkIndirectlyConnectedDataTable.expectedRow(new DataSetRow(
DIRECTLY_CONNECTED_DATA_SET_CODE).invalid().withFileFormatType("TIFF").withSample(
CELL_PLATE_EXAMPLE_ID).withExperiment(CELL_PLATE_EXAMPLE_EXPERIMENT_ID));
checkIndirectlyConnectedDataTable
.expectedRow(new DataSetRow(DIRECTLY_CONNECTED_DATA_SET_CODE).invalid()
.withFileFormatType("TIFF").withSample(CELL_PLATE_EXAMPLE_ID)
.withExperiment(CELL_PLATE_EXAMPLE_EXPERIMENT_ID));
checkIndirectlyConnectedDataTable.expectedRow(new DataSetRow(
INDIRECTLY_CONNECTED_DATA_SET_CODE).valid().withLocation("analysis/result")
.withSample("").withExperiment(CELL_PLATE_EXAMPLE_EXPERIMENT_ID));
......
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