]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/solver/SpreadsheetStyle.java
Adopt spreadsheet changes made in Balas development
[simantics/platform.git] / bundles / org.simantics.spreadsheet / src / org / simantics / spreadsheet / solver / SpreadsheetStyle.java
similarity index 81%
rename from bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetStyle.java
rename to bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/solver/SpreadsheetStyle.java
index ecd22175ede1f53603ffa5dd4fe9805fef9e646b..33dd5347be710a204d283ea1d703568838483642 100644 (file)
@@ -1,66 +1,70 @@
-package org.simantics.spreadsheet.graph;
+package org.simantics.spreadsheet.solver;
 
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 import java.util.Optional;
 
+import org.simantics.databoard.Bindings;
+import org.simantics.databoard.binding.Binding;
 import org.simantics.datatypes.literal.Font;
 import org.simantics.datatypes.literal.RGB;
+import org.simantics.spreadsheet.SpreadsheetVisitor;
 
+@SuppressWarnings("rawtypes")
 public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<SpreadsheetStyle, SpreadsheetStyle> {
 
-//    public static final Binding BINDING = Bindings.getBindingUnchecked(SpreadsheetStyle.class);
-    
+    public static final Binding BINDING = Bindings.getBindingUnchecked(SpreadsheetStyle.class);
+
     private static final SpreadsheetStyle EMPTY = SpreadsheetStyle.newInstace().name("Style_E").build();
-    
+
     private static final long serialVersionUID = -4969920277489585741L;
-    
+
     public final String name;
-       public final int border;
-       public final int align;
-       public final Font font;
-       public final RGB.Integer foreground;
-       public final RGB.Integer background;
-       public final boolean locked;
-       public final int rowSpan;
-       public final int columnSpan;
-
-       private transient int synchronizationId;
+    public final int border;
+    public final int align;
+    public final Font font;
+    public final RGB.Integer foreground;
+    public final RGB.Integer background;
+    public final boolean locked;
+    public final int rowSpan;
+    public final int columnSpan;
+
+    private transient int synchronizationId;
     private transient final int hashCode;
 
     public final String formatString;
     public final int formatIndex;
-       
-       public SpreadsheetStyle(String name, int border, int align2, Font font2, RGB.Integer foreground2, RGB.Integer background2, boolean locked2, int rowSpan2, int columnSpan2, String formatString, short formatIndex) {
-           this.name = name;
-           this.border = border;
-           this.align = align2;
-           this.font = font2;
-           this.foreground = foreground2;
-           this.background = background2;
-           this.locked = locked2;
-           this.rowSpan = rowSpan2;
-           this.columnSpan = columnSpan2;
-           
-           this.formatString = formatString;
-           this.formatIndex = formatIndex;
-           
-           
-           this.hashCode = hashCode();
+
+    public SpreadsheetStyle(String name, int border, int align2, Font font2, RGB.Integer foreground2, RGB.Integer background2, boolean locked2, int rowSpan2, int columnSpan2, String formatString, short formatIndex) {
+        this.name = name;
+        this.border = border;
+        this.align = align2;
+        this.font = font2;
+        this.foreground = foreground2;
+        this.background = background2;
+        this.locked = locked2;
+        this.rowSpan = rowSpan2;
+        this.columnSpan = columnSpan2;
+
+        this.formatString = formatString;
+        this.formatIndex = formatIndex;
+
+
+        this.hashCode = hashCode();
+    }
+
+    public int getId() {
+        return synchronizationId;
+    }
+
+    public int getStyleId() {
+        return hashCode();
     }
-       
-       public int getId() {
-           return synchronizationId;
-       }
-       
-       public int getStyleId() {
-           return hashCode();
-       }
 
     @Override
     public void accept(SpreadsheetVisitor v) {
-        
+
     }
 
     @Override
@@ -75,7 +79,7 @@ public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<Spr
 
     @Override
     public void remove(SpreadsheetStyle child) {
-        
+
     }
 
     @Override
@@ -97,7 +101,7 @@ public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<Spr
     public int hashCode() {
         if (hashCode != 0)
             return hashCode;
-        
+
         final int prime = 31;
         int result = 1;
         result = prime * result + align;
@@ -110,7 +114,7 @@ public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<Spr
         result = prime * result + ((foreground == null) ? 0 : foreground.hashCode());
         result = prime * result + (locked ? 1231 : 1237);
         result = prime * result + rowSpan;
-        
+
         return result;
     }
 
@@ -159,17 +163,17 @@ public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<Spr
             return false;
         return true;
     }
-    
+
     public static SpreadsheetStyleBuilder newInstace() {
         return new SpreadsheetStyleBuilder();
     }
-    
+
     public static SpreadsheetStyle empty() {
         return EMPTY;
     }
-    
+
     public static class SpreadsheetStyleBuilder {
-        
+
         private String name;
         private RGB.Integer foreground;
         private RGB.Integer background;
@@ -183,52 +187,52 @@ public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<Spr
         private short formatIndex;
 
         private SpreadsheetStyleBuilder() {}
-        
+
         public SpreadsheetStyleBuilder name(String name) {
             this.name = name;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder foreground(RGB.Integer foreground) {
             this.foreground = foreground;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder background(RGB.Integer background) {
             this.background = background;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder border(Integer border) {
             this.border = border == null ? 0 : border;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder align(Integer align) {
             this.align = align == null ? 0 : align;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder font(Font font) {
             this.font = font;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder locked(boolean locked) {
             this.locked = locked;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder rowSpan(int rowSpan) {
             this.rowSpan = rowSpan;
             return this;
         }
-        
+
         public SpreadsheetStyleBuilder font(int columnSpan) {
             this.columnSpan = columnSpan;
             return this;
         }
-        
+
         public SpreadsheetStyle build() {
             SpreadsheetStyle style = new SpreadsheetStyle(name, border, align, font, foreground, background, locked, rowSpan, columnSpan, formatString, formatIndex);
             return style;
@@ -253,5 +257,5 @@ public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<Spr
     public void setSynchronizationId(int newId) {
         this.synchronizationId = newId;
     }
-    
+
 }