1 package org.simantics.spreadsheet.graph;
\r
3 import java.util.Collections;
\r
4 import java.util.Map;
\r
6 import org.simantics.databoard.binding.mutable.Variant;
\r
8 public class SpreadsheetCellEditable implements SheetNode {
\r
10 public final SpreadsheetCell cell;
\r
12 public SpreadsheetCellEditable(SpreadsheetCell spreadsheetCell) {
\r
13 this.cell = spreadsheetCell;
\r
17 public String getName() {
\r
22 public Map getChildren() {
\r
23 return Collections.emptyMap();
\r
27 public Map getProperties() {
\r
28 return Collections.emptyMap();
\r
32 public int hashCode() {
\r
33 final int prime = 31;
\r
35 result = prime * result + ((cell == null) ? 0 : cell.hashCode());
\r
40 public boolean equals(Object obj) {
\r
45 if (getClass() != obj.getClass())
\r
47 SpreadsheetCellEditable other = (SpreadsheetCellEditable) obj;
\r
49 if (other.cell != null)
\r
51 } else if (!cell.equals(other.cell))
\r
56 public boolean editable() {
\r
57 if (cell.content == null || cell.content instanceof SpreadsheetFormula || cell.content instanceof SpreadsheetSCLConstant)
\r
59 if (cell.content instanceof String) {
\r
60 String content = (String) cell.content;
\r
61 if (content.isEmpty())
\r
64 if (cell.content instanceof Variant) {
\r
65 Variant content = (Variant) cell.content;
\r
66 if (content.getValue() == null)
\r
68 if (content.getValue() instanceof String) {
\r
69 String actualContent = (String) content.getValue();
\r
70 if (actualContent.isEmpty())
\r
74 // System.out.println("content is " + cell.content);
\r