Skip to content

Commit

Permalink
fixed date representation issue; set version to 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjoconnor committed Jan 28, 2022
1 parent a882d92 commit fed1f6d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ To build and install this plugin you must have the following items installed:
+ [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
+ A tool for checking out a [Git](http://git-scm.com/) repository
+ Apache's [Maven](http://maven.apache.org/index.html)
+ A Protégé (5.0.0 Beta 21 or higher) distribution. Download [here](http://protege.stanford.edu/products.php#desktop-protege).
+ A Protégé 5.0.0 or higher distribution. Download [here](http://protege.stanford.edu/products.php#desktop-protege).

Get a copy of the latest code:

Expand All @@ -68,7 +68,7 @@ On build completion the ```target``` directory will contain a cellfie-${version}
The JAR is generated in the OSGi bundle format required by Protégé's plugin-in mechanism.

To install in your local Protégé, copy this JAR file to the ```plugins``` subdirectory of your Protégé installation (e.g.,
/Applications/Protege-5.0.0/plugins/).
/Applications/Protege-5.5.0/plugins/).

### Questions

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-editor-core</artifactId>
<version>5.2.0</version>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>protege-editor-owl</artifactId>
<version>5.2.0</version>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>mapping-master</artifactId>
<version>1.7</version>
<version>2.1.1</version>
</dependency>
</dependencies>

Expand Down
47 changes: 27 additions & 20 deletions src/main/java/org/mm/cellfie/ui/view/SheetPanel.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
package org.mm.cellfie.ui.view;

import static com.google.common.base.Preconditions.checkNotNull;

import java.awt.BorderLayout;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.mm.ss.SpreadSheetUtil;

import javax.annotation.Nonnull;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.mm.ss.SpreadSheetUtil;
import static com.google.common.base.Preconditions.checkNotNull;

/**
* @author Josef Hardi <[email protected]> <br>
Expand All @@ -42,6 +40,8 @@ public class SheetPanel extends JPanel {
private int endColumnIndex = START_INDEX;
private int endRowIndex = END_INDEX;

private final DataFormatter dataFormatter = new DataFormatter();

private Point startMousePt;
private Point endMousePt;

Expand Down Expand Up @@ -95,6 +95,11 @@ private void setSelectionRange(int startColumnIndex, int startRowIndex, int endC
this.endRowIndex = endRowIndex;
}

private boolean isDateFormatted(Cell cell)
{
return DateUtil.isCellDateFormatted(cell);
}

/**
* Returns the array of the cell selection from this UI panel. The array is composed by
* { startColumnIndex, startRowIndex, endColumnIndex, endRowIndex }
Expand Down Expand Up @@ -151,13 +156,15 @@ public Object getValueAt(int row, int column) {
return "";
case Cell.CELL_TYPE_STRING :
return cell.getStringCellValue();
case Cell.CELL_TYPE_NUMERIC :
// Check if the numeric is double or integer
if (isInteger(cell.getNumericCellValue())) {
return (int) cell.getNumericCellValue();
} else {
return cell.getNumericCellValue();
}
case Cell.CELL_TYPE_NUMERIC :
// Check if the numeric is an integer or double or a date
if (isDateFormatted(cell)) {
return dataFormatter.formatCellValue(cell);
} else if (isInteger(cell.getNumericCellValue())) {
return Integer.toString((int)cell.getNumericCellValue());
} else {
return Double.toString(cell.getNumericCellValue());
}
case Cell.CELL_TYPE_BOOLEAN :
return cell.getBooleanCellValue();
case Cell.CELL_TYPE_FORMULA :
Expand Down
10 changes: 2 additions & 8 deletions src/main/java/org/mm/cellfie/ui/view/SheetTable.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package org.mm.cellfie.ui.view;

import java.awt.Color;
import java.awt.Component;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.*;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ListSelectionEvent;
Expand All @@ -16,6 +9,7 @@
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import java.awt.*;

public class SheetTable extends JTable
{
Expand Down

0 comments on commit fed1f6d

Please sign in to comment.