diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java index 12b90fac7bf1439ca042aa639dbe7b9edb5efc18..b00ad140cb5af1dcbd2e87dc0639b47495cf17c7 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java @@ -73,16 +73,18 @@ public interface IPhosphoNetXClientService extends IClientService public ProteinByExperiment getProteinByExperiment(TechId experimentID, TechId proteinReferenceID) throws UserFailureException; - public ResultSet<ProteinSequence> listSequencesByProteinReference( + public TypedTableResultSet<ProteinSequence> listSequencesByProteinReference( ListProteinSequenceCriteria criteria) throws UserFailureException; - public String prepareExportProteinSequences(TableExportCriteria<ProteinSequence> exportCriteria) + public String prepareExportProteinSequences( + TableExportCriteria<TableModelRowWithObject<ProteinSequence>> exportCriteria) throws UserFailureException; - public ResultSet<DataSetProtein> listProteinsByExperimentAndReference( + public TypedTableResultSet<DataSetProtein> listProteinsByExperimentAndReference( ListProteinByExperimentAndReferenceCriteria criteria) throws UserFailureException; - public String prepareExportDataSetProteins(TableExportCriteria<DataSetProtein> exportCriteria) + public String prepareExportDataSetProteins( + TableExportCriteria<TableModelRowWithObject<DataSetProtein>> exportCriteria) throws UserFailureException; public ResultSet<SampleWithPropertiesAndAbundance> listSamplesWithAbundanceByProtein( diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java index 2c65ff3e2b6073cf30cfdb60fc1cf3e8ca5b6933..091d210db1faf453b956939d8fd547fa0c128b3c 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java @@ -81,19 +81,20 @@ public interface IPhosphoNetXClientServiceAsync extends IClientServiceAsync /** @see IPhosphoNetXClientService#listSequencesByProteinReference(ListProteinSequenceCriteria) */ public void listSequencesByProteinReference(ListProteinSequenceCriteria criteria, - AsyncCallback<ResultSet<ProteinSequence>> callback); + AsyncCallback<TypedTableResultSet<ProteinSequence>> callback); /** @see IPhosphoNetXClientService#prepareExportProteinSequences(TableExportCriteria) */ - public void prepareExportProteinSequences(TableExportCriteria<ProteinSequence> exportCriteria, + public void prepareExportProteinSequences( + TableExportCriteria<TableModelRowWithObject<ProteinSequence>> exportCriteria, AsyncCallback<String> callback); /** @see IPhosphoNetXClientService#listProteinsByExperimentAndReference(ListProteinByExperimentAndReferenceCriteria) */ public void listProteinsByExperimentAndReference( ListProteinByExperimentAndReferenceCriteria criteria, - AsyncCallback<ResultSet<DataSetProtein>> callback); + AsyncCallback<TypedTableResultSet<DataSetProtein>> callback); /** @see IPhosphoNetXClientService#prepareExportDataSetProteins(TableExportCriteria) */ - public void prepareExportDataSetProteins(TableExportCriteria<DataSetProtein> exportCriteria, + public void prepareExportDataSetProteins(TableExportCriteria<TableModelRowWithObject<DataSetProtein>> exportCriteria, AsyncCallback<String> callback); /** @see IPhosphoNetXClientService#listSamplesWithAbundanceByProtein(ListSampleAbundanceByProteinCriteria) */ diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/DataSetProteinGrid.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/DataSetProteinGrid.java index 6878b43c1a89a211811970eb9f56ece90c393a8a..ff35302d9cc50ecd4d4dda0428979e8aab335547 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/DataSetProteinGrid.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/DataSetProteinGrid.java @@ -16,36 +16,38 @@ package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application; +import java.util.Arrays; import java.util.List; +import com.google.gwt.user.client.rpc.AsyncCallback; + import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.AbstractSimpleBrowserGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.TypedTableGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; -import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; -import ch.systemsx.cisd.openbis.generic.shared.basic.IColumnDefinition; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TypedTableResultSet; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.columns.DataSetProteinColDefKind; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.DataSetProteinGridColumnIDs; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinByExperimentAndReferenceCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.DataSetProtein; /** * @author Franz-Josef Elmer */ -class DataSetProteinGrid extends AbstractSimpleBrowserGrid<DataSetProtein> +class DataSetProteinGrid extends TypedTableGrid<DataSetProtein> { private static final String PREFIX = GenericConstants.ID_PREFIX + "data-set-protein-browser"; public static final String BROWSER_ID = PREFIX + "_main"; - public static final String GRID_ID = PREFIX + "_grid"; + public static final String GRID_ID = PREFIX + TypedTableGrid.GRID_POSTFIX; static IDisposableComponent create(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, IIdAndCodeHolder experimentIdOrNull, TechId proteinReferenceID) @@ -68,7 +70,6 @@ class DataSetProteinGrid extends AbstractSimpleBrowserGrid<DataSetProtein> IIdAndCodeHolder experimentIdOrNull, TechId proteinReferenceID) { super(viewContext.getCommonViewContext(), BROWSER_ID - + createWidgetID(experimentIdOrNull, proteinReferenceID), GRID_ID + createWidgetID(experimentIdOrNull, proteinReferenceID), true, PhosphoNetXDisplayTypeIDGenerator.DATA_SET_PROTEIN_BROWSER_GRID); specificViewContext = viewContext; @@ -81,32 +82,36 @@ class DataSetProteinGrid extends AbstractSimpleBrowserGrid<DataSetProtein> } @Override - protected IColumnDefinitionKind<DataSetProtein>[] getStaticColumnsDefinition() + protected String translateColumnIdToDictionaryKey(String columnID) { - return DataSetProteinColDefKind.values(); + return DataSetProteinGridColumnIDs.FDR.equals(columnID) ? "false_discovery_rate_column" + : columnID.toLowerCase(); } - + @Override - protected List<IColumnDefinition<DataSetProtein>> getInitialFilters() + protected List<String> getColumnIdsOfFilters() { - return asColumnFilters(new DataSetProteinColDefKind[] {}); + return Arrays.asList(); } - + @Override - protected void listEntities(DefaultResultSetConfig<String, DataSetProtein> resultSetConfig, - AbstractAsyncCallback<ResultSet<DataSetProtein>> callback) + protected void listTableRows( + DefaultResultSetConfig<String, TableModelRowWithObject<DataSetProtein>> resultSetConfig, + AsyncCallback<TypedTableResultSet<DataSetProtein>> callback) { criteria.copyPagingConfig(resultSetConfig); specificViewContext.getService().listProteinsByExperimentAndReference(criteria, callback); } @Override - protected void prepareExportEntities(TableExportCriteria<DataSetProtein> exportCriteria, + protected void prepareExportEntities( + TableExportCriteria<TableModelRowWithObject<DataSetProtein>> exportCriteria, AbstractAsyncCallback<String> callback) { specificViewContext.getService().prepareExportDataSetProteins(exportCriteria, callback); } + @Override public DatabaseModificationKind[] getRelevantModifications() { return new DatabaseModificationKind[0]; diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java index d22e11aacdb1a8a8c09073b0347c6c04c909310c..0cff5f4920619e97fb7b22f03211a212cb22f7c3 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinSequenceGrid.java @@ -16,35 +16,36 @@ package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application; +import java.util.Arrays; import java.util.List; +import com.google.gwt.user.client.rpc.AsyncCallback; + import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.AbstractSimpleBrowserGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.TypedTableGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; -import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; -import ch.systemsx.cisd.openbis.generic.shared.basic.IColumnDefinition; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TypedTableResultSet; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.columns.ProteinSequenceColDefKind; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSequenceCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; /** * @author Franz-Josef Elmer */ -public class ProteinSequenceGrid extends AbstractSimpleBrowserGrid<ProteinSequence> +public class ProteinSequenceGrid extends TypedTableGrid<ProteinSequence> { private static final String PREFIX = GenericConstants.ID_PREFIX + "protein-sequence-browser"; public static final String BROWSER_ID = PREFIX + "_main"; - public static final String GRID_ID = PREFIX + "_grid"; + public static final String GRID_ID = PREFIX + TypedTableGrid.GRID_POSTFIX; static IDisposableComponent create(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, TechId proteinReferenceID) @@ -60,8 +61,7 @@ public class ProteinSequenceGrid extends AbstractSimpleBrowserGrid<ProteinSequen private ProteinSequenceGrid(IViewContext<IPhosphoNetXClientServiceAsync> viewContext, TechId proteinReferenceID) { - super(viewContext.getCommonViewContext(), BROWSER_ID + proteinReferenceID, GRID_ID - + proteinReferenceID, true, + super(viewContext.getCommonViewContext(), BROWSER_ID + proteinReferenceID, true, PhosphoNetXDisplayTypeIDGenerator.PROTEIN_SEQUENCE_BROWSER_GRID); specificViewContext = viewContext; criteria = new ListProteinSequenceCriteria(); @@ -69,32 +69,35 @@ public class ProteinSequenceGrid extends AbstractSimpleBrowserGrid<ProteinSequen } @Override - protected IColumnDefinitionKind<ProteinSequence>[] getStaticColumnsDefinition() + protected String translateColumnIdToDictionaryKey(String columnID) { - return ProteinSequenceColDefKind.values(); + return columnID.toLowerCase(); } - + @Override - protected List<IColumnDefinition<ProteinSequence>> getInitialFilters() + protected List<String> getColumnIdsOfFilters() { - return asColumnFilters(new ProteinSequenceColDefKind[] {}); + return Arrays.asList(); } - + @Override - protected void listEntities(DefaultResultSetConfig<String, ProteinSequence> resultSetConfig, - AbstractAsyncCallback<ResultSet<ProteinSequence>> callback) + protected void listTableRows( + DefaultResultSetConfig<String, TableModelRowWithObject<ProteinSequence>> resultSetConfig, + AsyncCallback<TypedTableResultSet<ProteinSequence>> callback) { criteria.copyPagingConfig(resultSetConfig); specificViewContext.getService().listSequencesByProteinReference(criteria, callback); } @Override - protected void prepareExportEntities(TableExportCriteria<ProteinSequence> exportCriteria, + protected void prepareExportEntities( + TableExportCriteria<TableModelRowWithObject<ProteinSequence>> exportCriteria, AbstractAsyncCallback<String> callback) { specificViewContext.getService().prepareExportProteinSequences(exportCriteria, callback); } + @Override public DatabaseModificationKind[] getRelevantModifications() { return new DatabaseModificationKind[0]; diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java index 06690dea0ca07fa1aebefe28ad0273a4b5ad8150..c2ffd574f5b59bccbc928d15e914779b5b40bb3a 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/ProteinViewer.java @@ -268,6 +268,8 @@ public class ProteinViewer extends AbstractViewerWithVerticalSplit<IEntityInform }; add(proteinsSection, createBorderLayoutData(LayoutRegion.SOUTH)); layout(); + sequencesSection.setContentVisible(true); + proteinsSection.setContentVisible(true); } private ContentPanel createPropertyPanel(ProteinByExperiment protein) diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/DataSetProteinColDefKind.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/DataSetProteinColDefKind.java deleted file mode 100644 index 23ff802599fc0d50fc1f9203c0a7ae6b525109f4..0000000000000000000000000000000000000000 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/DataSetProteinColDefKind.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2009 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.columns; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.AbstractColumnDefinitionKind; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.GridRowModel; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.DataSetProtein; - -/** - * @author Franz-Josef Elmer - */ -public enum DataSetProteinColDefKind implements IColumnDefinitionKind<DataSetProtein> -{ - DATA_SET_PERM_ID(new AbstractColumnDefinitionKind<DataSetProtein>(Dict.DATA_SET_PERM_ID, 200) - { - @Override - public String tryGetValue(DataSetProtein entity) - { - return entity.getDataSetPermID(); - } - }), - - SEQUENCE_NAME(new AbstractColumnDefinitionKind<DataSetProtein>(Dict.SEQUENCE_NAME, 80) - { - @Override - public String tryGetValue(DataSetProtein entity) - { - return entity.getSequenceName(); - } - }), - - PEPTIDE_COUNT(new AbstractColumnDefinitionKind<DataSetProtein>(Dict.PEPTIDE_COUNT, 80) - { - @Override - public String tryGetValue(DataSetProtein entity) - { - return Integer.toString(entity.getPeptideCount()); - } - - @Override - public Comparable<?> getComparableValue(GridRowModel<DataSetProtein> entity) - { - return entity.getOriginalObject().getPeptideCount(); - } - }), - - FDR(new AbstractColumnDefinitionKind<DataSetProtein>(Dict.FDR, 80) - { - @Override - public String tryGetValue(DataSetProtein entity) - { - int perMille = (int) (1000 * entity.getFalseDiscoveryRate() + 0.5); - return (perMille / 10) + "." + (perMille % 10) + " %"; - } - - @Override - public Comparable<?> getComparableValue(GridRowModel<DataSetProtein> entity) - { - return entity.getOriginalObject().getFalseDiscoveryRate(); - } - }), - - ; - - private final AbstractColumnDefinitionKind<DataSetProtein> columnDefinitionKind; - - private DataSetProteinColDefKind( - AbstractColumnDefinitionKind<DataSetProtein> columnDefinitionKind) - { - this.columnDefinitionKind = columnDefinitionKind; - } - - public String id() - { - return name(); - } - - public AbstractColumnDefinitionKind<DataSetProtein> getDescriptor() - { - return columnDefinitionKind; - } - -} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/ProteinSequenceColDefKind.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/ProteinSequenceColDefKind.java deleted file mode 100644 index c5f814a3220459f0f265df817bac4180ebd80a0d..0000000000000000000000000000000000000000 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/columns/ProteinSequenceColDefKind.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2009 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.columns; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.AbstractColumnDefinitionKind; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; - -/** - * - * - * @author Franz-Josef Elmer - */ -public enum ProteinSequenceColDefKind implements IColumnDefinitionKind<ProteinSequence> -{ - SHORT_NAME(new AbstractColumnDefinitionKind<ProteinSequence>(Dict.SEQUENCE_SHORT_NAME, 20) - { - @Override - public String tryGetValue(ProteinSequence entity) - { - return entity.getShortName(); - } - }), - DATABASE(new AbstractColumnDefinitionKind<ProteinSequence>(Dict.DATABASE_NAME_AND_VERSION) - { - @Override - public String tryGetValue(ProteinSequence entity) - { - return entity.getDatabaseNameAndVersion(); - } - }), - SEQUENCE(new AbstractColumnDefinitionKind<ProteinSequence>(Dict.SEQUENCE, 400) - { - @Override - public String tryGetValue(ProteinSequence entity) - { - return entity.getSequence(); - } - }), - ; - - private final AbstractColumnDefinitionKind<ProteinSequence> columnDefinitionKind; - - private ProteinSequenceColDefKind(AbstractColumnDefinitionKind<ProteinSequence> columnDefinitionKind) - { - this.columnDefinitionKind = columnDefinitionKind; - } - - public String id() - { - return name(); - } - - public AbstractColumnDefinitionKind<ProteinSequence> getDescriptor() - { - return columnDefinitionKind; - } - -} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/DataSetProteinGridColumnIDs.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/DataSetProteinGridColumnIDs.java new file mode 100644 index 0000000000000000000000000000000000000000..71ab1ab770c6075c812d01f8b086bec8e2123482 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/DataSetProteinGridColumnIDs.java @@ -0,0 +1,30 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto; + +/** + * Column IDs for data set protein grid. + * + * @author Franz-Josef Elmer + */ +public class DataSetProteinGridColumnIDs +{ + public static final String DATA_SET_PERM_ID = "DATA_SET_PERM_ID"; + public static final String SEQUENCE_NAME = "SEQUENCE_NAME"; + public static final String PEPTIDE_COUNT = "PEPTIDE_COUNT"; + public static final String FDR = "FDR"; +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinByExperimentAndReferenceCriteria.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinByExperimentAndReferenceCriteria.java index e297544d3df1ed2ccd0357ffda9fecfc66bfd56a..897f0804dbe103a7081df26fe9ccb74cfa500f21 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinByExperimentAndReferenceCriteria.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinByExperimentAndReferenceCriteria.java @@ -20,6 +20,7 @@ import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.DataSetProtein; /** @@ -28,7 +29,7 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.DataSetProte * @author Franz-Josef Elmer */ public class ListProteinByExperimentAndReferenceCriteria extends - DefaultResultSetConfig<String, DataSetProtein> implements IsSerializable + DefaultResultSetConfig<String, TableModelRowWithObject<DataSetProtein>> implements IsSerializable { private TechId experimentID; private TechId proteinReferenceID; diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java index 7795c66738b0055e74ed1ed53bf0cfeb297c8540..f81734d8378fce067cb9139b1f049c914d892053 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ListProteinSequenceCriteria.java @@ -20,15 +20,17 @@ import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; /** - * + * Criteria for listing {@link ProteinSequence} instances. * * @author Franz-Josef Elmer */ public class ListProteinSequenceCriteria extends - DefaultResultSetConfig<String, ProteinSequence> implements IsSerializable + DefaultResultSetConfig<String, TableModelRowWithObject<ProteinSequence>> implements + IsSerializable { private TechId proteinReferenceID; diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ProteinSequenceGridColumnIDs.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ProteinSequenceGridColumnIDs.java new file mode 100644 index 0000000000000000000000000000000000000000..e8b638353c27bcfc36906b9ae8e29e18ce57ba25 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/dto/ProteinSequenceGridColumnIDs.java @@ -0,0 +1,31 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto; + +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.ProteinSequenceGrid; + +/** + * Column IDs of {@link ProteinSequenceGrid}. + * + * @author Franz-Josef Elmer + */ +public class ProteinSequenceGridColumnIDs +{ + public static final String SEQUENCE_SHORT_NAME = "SEQUENCE_SHORT_NAME"; + public static final String DATABASE_NAME_AND_VERSION = "DATABASE_NAME_AND_VERSION"; + public static final String SEQUENCE = "SEQUENCE"; +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js index 8439dec48cc12d07282fafecfe8a1951fd7f0ae6..b37959b010673e2f3643abfdb6bd1541f1742776 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js @@ -18,7 +18,7 @@ var phosphonetx = { proteins_section: "Proteins", protein_in_experiment_tab_label: "{0} in {1}", experiment_label: "Experiment", - sequence_short_name: "", + sequence_short_name: "Sequence Reference", protein_browser: "Proteins", protein_summary: "Protein/Peptide Counts", database_name_and_version: "Database", @@ -31,7 +31,7 @@ var phosphonetx = { protein_count: "Proteins", peptide_count: "Peptides", peptides: "Peptides ({0})", - sequence_name: "Sequence", + sequence_name: "Sequence Reference", false_discovery_rate_column: "FDR (Protein Prophet)", protein_probability: "Probability (Protein Prophet)", diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListDataSetProteinDataProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListDataSetProteinDataProvider.java deleted file mode 100644 index b40ba0c3dfefd45264670ea458a86956e317bbef..0000000000000000000000000000000000000000 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListDataSetProteinDataProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2009 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server; - -import java.util.List; - -import ch.systemsx.cisd.common.exceptions.UserFailureException; -import ch.systemsx.cisd.openbis.generic.client.web.server.AbstractOriginalDataProviderWithoutHeaders; -import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.DataSetProtein; - -/** - * @author Franz-Josef Elmer - */ -public class ListDataSetProteinDataProvider extends AbstractOriginalDataProviderWithoutHeaders<DataSetProtein> -{ - private final IPhosphoNetXServer server; - - private final String sessionToken; - - private final TechId experimentID; - - private final TechId proteinReferenceID; - - ListDataSetProteinDataProvider(IPhosphoNetXServer server, String sessionToken, - TechId experimentID, TechId proteinReferenceID) - { - this.server = server; - this.sessionToken = sessionToken; - this.experimentID = experimentID; - this.proteinReferenceID = proteinReferenceID; - } - - @Override - public List<DataSetProtein> getFullOriginalData() throws UserFailureException - { - return server.listProteinsByExperimentAndReference(sessionToken, experimentID, - proteinReferenceID); - } - -} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListProteinSequenceDataProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListProteinSequenceDataProvider.java deleted file mode 100644 index 65eff52485668bf5e3e08f4034359531cf14edb3..0000000000000000000000000000000000000000 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/ListProteinSequenceDataProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2009 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server; - -import java.util.List; - -import ch.systemsx.cisd.common.exceptions.UserFailureException; -import ch.systemsx.cisd.openbis.generic.client.web.server.AbstractOriginalDataProviderWithoutHeaders; -import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; -import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; - -/** - * - * - * @author Franz-Josef Elmer - */ -class ListProteinSequenceDataProvider extends AbstractOriginalDataProviderWithoutHeaders<ProteinSequence> -{ - private final IPhosphoNetXServer server; - private final String sessionToken; - private final TechId proteinReferenceID; - - ListProteinSequenceDataProvider(IPhosphoNetXServer server, String sessionToken, - TechId proteinReferenceID) - { - this.server = server; - this.sessionToken = sessionToken; - this.proteinReferenceID = proteinReferenceID; - } - - @Override - public List<ProteinSequence> getFullOriginalData() throws UserFailureException - { - return server.listProteinSequencesByProteinReference(sessionToken, proteinReferenceID); - } -} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java index 7007847255b9f4ab194b5afd73dc4e5de3bd35f9..516ebbf6b0f7a9086712670caa61bcae4eb23954 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java @@ -62,6 +62,8 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListPro import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSequenceCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListProteinSummaryByExperimentCriteria; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ListSampleAbundanceByProteinCriteria; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server.resultset.DataSetProteinProvider; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server.resultset.ProteinSequenceProvider; import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server.resultset.ProteinSummaryProvider; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.CacheData; import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; @@ -235,28 +237,32 @@ public class PhosphoNetXClientService extends AbstractClientService implements } } - public ResultSet<ProteinSequence> listSequencesByProteinReference( + public TypedTableResultSet<ProteinSequence> listSequencesByProteinReference( ListProteinSequenceCriteria criteria) { final String sessionToken = getSessionToken(); - return listEntities(criteria, new ListProteinSequenceDataProvider(server, sessionToken, - criteria.getProteinReferenceID())); + return listEntities( + new ProteinSequenceProvider(server, sessionToken, criteria.getProteinReferenceID()), + criteria); } - public String prepareExportProteinSequences(TableExportCriteria<ProteinSequence> exportCriteria) + public String prepareExportProteinSequences( + TableExportCriteria<TableModelRowWithObject<ProteinSequence>> exportCriteria) { return prepareExportEntities(exportCriteria); } - public ResultSet<DataSetProtein> listProteinsByExperimentAndReference( + public TypedTableResultSet<DataSetProtein> listProteinsByExperimentAndReference( ListProteinByExperimentAndReferenceCriteria criteria) { final String sessionToken = getSessionToken(); - return listEntities(criteria, new ListDataSetProteinDataProvider(server, sessionToken, - criteria.getExperimentID(), criteria.getProteinReferenceID())); + return listEntities( + new DataSetProteinProvider(server, sessionToken, criteria.getExperimentID(), + criteria.getProteinReferenceID()), criteria); } - public String prepareExportDataSetProteins(TableExportCriteria<DataSetProtein> exportCriteria) + public String prepareExportDataSetProteins( + TableExportCriteria<TableModelRowWithObject<DataSetProtein>> exportCriteria) { return prepareExportEntities(exportCriteria); } diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/DataSetProteinProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/DataSetProteinProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..2520b00ae5b5cfa5214ae6db90892b4819650588 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/DataSetProteinProvider.java @@ -0,0 +1,82 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server.resultset; + +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.DataSetProteinGridColumnIDs.DATA_SET_PERM_ID; +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.DataSetProteinGridColumnIDs.FDR; +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.DataSetProteinGridColumnIDs.PEPTIDE_COUNT; +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.DataSetProteinGridColumnIDs.SEQUENCE_NAME; + +import java.util.List; + +import ch.systemsx.cisd.openbis.generic.client.web.server.resultset.AbstractTableModelProvider; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TypedTableModel; +import ch.systemsx.cisd.openbis.generic.shared.util.TypedTableModelBuilder; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.DataSetProtein; + +/** + * Provider of {@link DataSetProtein} instances. + * + * @author Franz-Josef Elmer + */ +public class DataSetProteinProvider extends AbstractTableModelProvider<DataSetProtein> +{ + private final IPhosphoNetXServer server; + + private final String sessionToken; + + private final TechId experimentID; + + private final TechId proteinReferenceID; + + public DataSetProteinProvider(IPhosphoNetXServer server, String sessionToken, + TechId experimentID, TechId proteinReferenceID) + { + this.server = server; + this.sessionToken = sessionToken; + this.experimentID = experimentID; + this.proteinReferenceID = proteinReferenceID; + } + + @Override + protected TypedTableModel<DataSetProtein> createTableModel(int maxSize) + { + List<DataSetProtein> proteins = + server.listProteinsByExperimentAndReference(sessionToken, experimentID, + proteinReferenceID); + TypedTableModelBuilder<DataSetProtein> builder = + new TypedTableModelBuilder<DataSetProtein>(); + builder.addColumn(DATA_SET_PERM_ID).withDefaultWidth(200); + builder.addColumn(SEQUENCE_NAME).withDefaultWidth(80); + builder.addColumn(PEPTIDE_COUNT).withDataType(DataTypeCode.INTEGER).withDefaultWidth(80); + builder.addColumn(FDR).withDefaultWidth(80); + for (DataSetProtein protein : proteins) + { + builder.addRow(protein); + builder.column(DATA_SET_PERM_ID).addString(protein.getDataSetPermID()); + builder.column(SEQUENCE_NAME).addString(protein.getSequenceName()); + builder.column(PEPTIDE_COUNT).addInteger((long) protein.getPeptideCount()); + int perMille = (int) (1000 * protein.getFalseDiscoveryRate() + 0.5); + builder.column(FDR).addString((perMille / 10) + "." + (perMille % 10) + " %"); + } + return builder.getModel(); + } + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ProteinSequenceProvider.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ProteinSequenceProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..8ff0de653fc7006393fe902838c230278fe8b5c0 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ProteinSequenceProvider.java @@ -0,0 +1,72 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server.resultset; + +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinSequenceGridColumnIDs.DATABASE_NAME_AND_VERSION; +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinSequenceGridColumnIDs.SEQUENCE; +import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.dto.ProteinSequenceGridColumnIDs.SEQUENCE_SHORT_NAME; + +import java.util.List; + +import ch.systemsx.cisd.openbis.generic.client.web.server.resultset.AbstractTableModelProvider; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TypedTableModel; +import ch.systemsx.cisd.openbis.generic.shared.util.TypedTableModelBuilder; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; + +/** + * Provider of {@link ProteinSequence} instances. + * + * @author Franz-Josef Elmer + */ +public class ProteinSequenceProvider extends AbstractTableModelProvider<ProteinSequence> +{ + private final IPhosphoNetXServer server; + private final String sessionToken; + private final TechId proteinReferenceID; + + public ProteinSequenceProvider(IPhosphoNetXServer server, String sessionToken, + TechId proteinReferenceID) + { + this.server = server; + this.sessionToken = sessionToken; + this.proteinReferenceID = proteinReferenceID; + } + + @Override + protected TypedTableModel<ProteinSequence> createTableModel(int maxSize) + { + List<ProteinSequence> sequences = + server.listProteinSequencesByProteinReference(sessionToken, proteinReferenceID); + TypedTableModelBuilder<ProteinSequence> builder = + new TypedTableModelBuilder<ProteinSequence>(); + builder.addColumn(SEQUENCE_SHORT_NAME).withDefaultWidth(20); + builder.addColumn(DATABASE_NAME_AND_VERSION); + builder.addColumn(SEQUENCE).withDefaultWidth(400); + for (ProteinSequence sequence : sequences) + { + builder.addRow(sequence); + builder.column(SEQUENCE_SHORT_NAME).addString(sequence.getShortName()); + builder.column(DATABASE_NAME_AND_VERSION).addString( + sequence.getDatabaseNameAndVersion()); + builder.column(SEQUENCE).addString(sequence.getSequence()); + } + return builder.getModel(); + } + +} diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ProteinSequenceProviderTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ProteinSequenceProviderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..04459e7915b657476a7efcc62cddaa8aa3c81fca --- /dev/null +++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/resultset/ProteinSequenceProviderTest.java @@ -0,0 +1,66 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.server.resultset; + +import java.util.Arrays; + +import org.jmock.Expectations; +import org.testng.annotations.Test; + +import ch.systemsx.cisd.openbis.generic.client.web.server.resultset.AbstractProviderTest; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TypedTableModel; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.basic.dto.ProteinSequence; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class ProteinSequenceProviderTest extends AbstractProviderTest +{ + @Test + public void test() + { + final ProteinSequence ps = new ProteinSequence(); + ps.setShortName("short-name"); + ps.setDatabaseNameAndVersion("db-version"); + ps.setSequence("ABC"); + final IPhosphoNetXServer phosphonetxServer = context.mock(IPhosphoNetXServer.class); + context.checking(new Expectations() + { + { + one(phosphonetxServer).listProteinSequencesByProteinReference(SESSION_TOKEN, new TechId(42)); + will(returnValue(Arrays.asList(ps))); + } + }); + ProteinSequenceProvider provider = + new ProteinSequenceProvider(phosphonetxServer, SESSION_TOKEN, new TechId(42)); + + TypedTableModel<ProteinSequence> model = provider.createTableModel(10); + + assertEquals("[SEQUENCE_SHORT_NAME, DATABASE_NAME_AND_VERSION, SEQUENCE]", getHeaderIDs(model).toString()); + assertEquals("[VARCHAR, VARCHAR, VARCHAR]", getHeaderDataTypes(model).toString()); + assertEquals("[null, null, null]", getHeaderEntityKinds(model).toString()); + assertSame(ps, model.getRows().get(0).getObjectOrNull()); + assertEquals("[short-name, db-version, ABC]", model.getRows().get(0).getValues().toString()); + assertEquals(1, model.getRows().size()); + context.assertIsSatisfied(); + } + +}