diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetReportColumnDefinition.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetReportColumnDefinition.java index dc1b0d496174657209b39fd918e5cc7b2d428dba..783e724324c79602654d151ae2cf5acfed170020 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetReportColumnDefinition.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/data/DataSetReportColumnDefinition.java @@ -21,8 +21,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IColumnDefinition; import ch.systemsx.cisd.openbis.generic.shared.basic.URLMethodWithParameters; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ISerializableComparable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ImageTableCell; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelColumnHeader; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRow; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel.TableModelColumnHeader; /** * Definition of dataset report table columns. @@ -76,6 +76,11 @@ public class DataSetReportColumnDefinition implements IColumnDefinition<TableMod + imageURL + "' alt='" + cell.toString() + "'/></a></div>"; } + public boolean isNumeric() + { + return columnHeader.isNumeric(); + } + private ISerializableComparable getCellValue(GridRowModel<TableModelRow> rowModel) { int index = columnHeader.getIndex(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java index 707de4385273dd0c681e5deef947e9ae5846397c..d0628574bc6094ea98ef4a0d0d5fdf38ef9a37fc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java @@ -41,8 +41,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.GridRowModel; import ch.systemsx.cisd.openbis.generic.shared.basic.IColumnDefinition; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatastoreServiceDescription; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelColumnHeader; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRow; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel.TableModelColumnHeader; /** * Grid displaying dataset reporting results. This grid is special comparing to other grids, because @@ -97,11 +97,6 @@ public class DataSetReporterGrid extends return isHidden; } - public boolean isNumeric() - { - return false; - } - // GWT only @SuppressWarnings("unused") private DatasetReportColumnUI() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/TableModelReference.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/TableModelReference.java index 5a9acc2a3fe7fd52fb7dc8add06ceefc6a501d12..aabba599c978db1f5e37e7600c73462129d79012 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/TableModelReference.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/TableModelReference.java @@ -20,7 +20,7 @@ import java.util.List; import com.google.gwt.user.client.rpc.IsSerializable; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel.TableModelColumnHeader; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelColumnHeader; /** * Stores:<br> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java new file mode 100644 index 0000000000000000000000000000000000000000..b3bd7f1ec35576bec21dd7c8733d224eb3921993 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java @@ -0,0 +1,90 @@ +/* + * 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.generic.shared.basic.dto; + +import java.util.Date; + +/** + * Table cell wrapping a {@link Date}. + * + * @author Franz-Josef Elmer + */ +public class DateTableCell implements ISerializableComparable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private long dateTime; + + public DateTableCell(long dateTime) + { + this.dateTime = dateTime; + } + + public DateTableCell(Date date) + { + dateTime = date.getTime(); + } + + public Date getDateTime() + { + return new Date(dateTime); + } + + public int compareTo(ISerializableComparable o) + { + if (o instanceof DateTableCell) + { + DateTableCell cell = (DateTableCell) o; + return dateTime < cell.dateTime ? -1 : (dateTime > cell.dateTime ? 1 : 0); + } + return toString().compareTo(o.toString()); + } + + @Override + public boolean equals(Object obj) + { + return this == obj + || (obj instanceof DateTableCell && dateTime == ((DateTableCell) obj).dateTime); + } + + @Override + public int hashCode() + { + return (int) dateTime; + } + + @Override + public String toString() + { + return new Date(dateTime).toString(); + } + // --------------------------- + + // GWT only + @SuppressWarnings("unused") + private DateTableCell() + { + } + + // GWT only + @SuppressWarnings("unused") + private void setDateTime(long dateTime) + { + this.dateTime = dateTime; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java index b02ce24ecd45a1526af2613acaf92c6686af3db1..4177880930675a9f8ce745b0e433d625509601e6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java @@ -51,7 +51,6 @@ public class ImageTableCell implements ISerializableComparable public ImageTableCell(String path, int maxThumbnailWidth, int maxThumbnailHeight) { - System.out.println("path:"+path); this.path = path; this.maxThumbnailWidth = maxThumbnailWidth; this.maxThumbnailHeight = maxThumbnailHeight; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NumberTableCell.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NumberTableCell.java index 3019098b7a6b69d9ab02d486121e072432e7ec43..358f66bf31a186a338ef78021c014c5deb22b563 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NumberTableCell.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NumberTableCell.java @@ -17,7 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * Table cell wrapping an integer. + * Table cell wrapping a number of type double. * * @author Franz-Josef Elmer */ @@ -25,42 +25,47 @@ public class NumberTableCell implements ISerializableComparable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - private Number integer; + private double number; - public NumberTableCell(Number integer) + public NumberTableCell(double doubleValue) { - this.integer = integer; + this.number = doubleValue; } - + + public double getNumber() + { + return number; + } + public int compareTo(ISerializableComparable o) { if (o instanceof NumberTableCell) { - double v1 = integer.doubleValue(); + double v1 = number; NumberTableCell numberTableCell = (NumberTableCell) o; - double v2 = numberTableCell.integer.doubleValue(); + double v2 = numberTableCell.number; return v1 < v2 ? -1 : (v1 > v2 ? 1 : 0); } - return integer.toString().compareTo(o.toString()); + return toString().compareTo(o.toString()); } @Override public boolean equals(Object obj) { return this == obj - || (obj instanceof NumberTableCell && integer.equals(((NumberTableCell) obj).integer)); - } - + || (obj instanceof NumberTableCell && number == ((NumberTableCell) obj).number); + } + @Override public int hashCode() { - return integer.hashCode(); + return (int) number; } - + @Override public String toString() { - return integer.toString(); + return Double.toString(number); } // --------------------------- @@ -73,9 +78,9 @@ public class NumberTableCell implements ISerializableComparable // GWT only @SuppressWarnings("unused") - private void setNumber(Number number) + private void setNumber(double number) { - this.integer = number; + this.number = number; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModel.java index 1351453aab19d4f7db63f2a2cfcf57a7b4581237..0b653bf852d7e5a742fca582b5568ea3f80c2c0e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModel.java @@ -79,50 +79,4 @@ public class TableModel implements IsSerializable, Serializable { this.header = header; } - - public static class TableModelColumnHeader implements IsSerializable, Serializable - { - private static final long serialVersionUID = ServiceVersionHolder.VERSION; - - private String title; - - // allows to fetch the value for this column from the row content - private int index; - - public TableModelColumnHeader(String title, int index) - { - this.title = title; - this.index = index; - } - - public String getTitle() - { - return title; - } - - public int getIndex() - { - return index; - } - - // GWT only - @SuppressWarnings("unused") - private TableModelColumnHeader() - { - } - - // GWT only - @SuppressWarnings("unused") - private void setTitle(String title) - { - this.title = title; - } - - // GWT only - @SuppressWarnings("unused") - private void setIndex(int index) - { - this.index = index; - } - } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModelColumnHeader.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModelColumnHeader.java new file mode 100644 index 0000000000000000000000000000000000000000..c493136c0b58127d36725a335b05b47b10d07af3 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TableModelColumnHeader.java @@ -0,0 +1,92 @@ +/* + * 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.generic.shared.basic.dto; + +import java.io.Serializable; + +import com.google.gwt.user.client.rpc.IsSerializable; + +/** + * Column header for {@link TableModel}. + * + * @author Tomasz Pylak + */ +public class TableModelColumnHeader implements IsSerializable, Serializable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private String title; + + // allows to fetch the value for this column from the row content + private int index; + + private boolean numeric; + + public TableModelColumnHeader(String title, int index) + { + this(title, index, false); + } + + public TableModelColumnHeader(String title, int index, boolean numeric) + { + this.title = title; + this.index = index; + this.numeric = numeric; + } + + public String getTitle() + { + return title; + } + + public int getIndex() + { + return index; + } + + public boolean isNumeric() + { + return numeric; + } + + // GWT only + @SuppressWarnings("unused") + private TableModelColumnHeader() + { + } + + // GWT only + @SuppressWarnings("unused") + private void setTitle(String title) + { + this.title = title; + } + + // GWT only + @SuppressWarnings("unused") + private void setIndex(int index) + { + this.index = index; + } + + // GWT only + @SuppressWarnings("unused") + private void setNumeric(boolean numeric) + { + this.numeric = numeric; + } +} \ No newline at end of file