]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetStyle.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / SpreadsheetStyle.java
index 5f28d38a3fc785bf0bd1bb48f1050a7e2c0d124c..ecd22175ede1f53603ffa5dd4fe9805fef9e646b 100644 (file)
-package org.simantics.spreadsheet.graph;\r
-\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.Map;\r
-import java.util.Optional;\r
-\r
-import org.simantics.datatypes.literal.Font;\r
-import org.simantics.datatypes.literal.RGB;\r
-\r
-public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<SpreadsheetStyle, SpreadsheetStyle> {\r
-\r
-//    public static final Binding BINDING = Bindings.getBindingUnchecked(SpreadsheetStyle.class);\r
-    \r
-    private static final SpreadsheetStyle EMPTY = SpreadsheetStyle.newInstace().name("Style_E").build();\r
-    \r
-    private static final long serialVersionUID = -4969920277489585741L;\r
-    \r
-    public final String name;\r
-       public final int border;\r
-       public final int align;\r
-       public final Font font;\r
-       public final RGB.Integer foreground;\r
-       public final RGB.Integer background;\r
-       public final boolean locked;\r
-       public final int rowSpan;\r
-       public final int columnSpan;\r
-\r
-       private transient int synchronizationId;\r
-    private transient final int hashCode;\r
-\r
-    public final String formatString;\r
-    public final int formatIndex;\r
-       \r
-       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) {\r
-           this.name = name;\r
-           this.border = border;\r
-           this.align = align2;\r
-           this.font = font2;\r
-           this.foreground = foreground2;\r
-           this.background = background2;\r
-           this.locked = locked2;\r
-           this.rowSpan = rowSpan2;\r
-           this.columnSpan = columnSpan2;\r
-           \r
-           this.formatString = formatString;\r
-           this.formatIndex = formatIndex;\r
-           \r
-           \r
-           this.hashCode = hashCode();\r
-    }\r
-       \r
-       public int getId() {\r
-           return synchronizationId;\r
-       }\r
-       \r
-       public int getStyleId() {\r
-           return hashCode();\r
-       }\r
-\r
-    @Override\r
-    public void accept(SpreadsheetVisitor v) {\r
-        \r
-    }\r
-\r
-    @Override\r
-    public Optional<SpreadsheetStyle> getParent() {\r
-        return Optional.empty();\r
-    }\r
-\r
-    @Override\r
-    public Collection<SpreadsheetStyle> getSpreadsheetChildren() {\r
-        return Collections.emptyList();\r
-    }\r
-\r
-    @Override\r
-    public void remove(SpreadsheetStyle child) {\r
-        \r
-    }\r
-\r
-    @Override\r
-    public String getName() {\r
-        return "style";\r
-    }\r
-\r
-    @Override\r
-    public Map<?, ?> getChildren() {\r
-        return Collections.emptyMap();\r
-    }\r
-\r
-    @Override\r
-    public Map<?, ?> getProperties() {\r
-        return Collections.emptyMap();\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        if (hashCode != 0)\r
-            return hashCode;\r
-        \r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result + align;\r
-        result = prime * result + ((formatString == null) ? 0 : formatString.hashCode());\r
-        result = prime * result + ((background == null) ? 0 : background.hashCode());\r
-        result = prime * result + border;\r
-        result = prime * result + formatIndex;\r
-        result = prime * result + columnSpan;\r
-        result = prime * result + ((font == null) ? 0 : font.hashCode());\r
-        result = prime * result + ((foreground == null) ? 0 : foreground.hashCode());\r
-        result = prime * result + (locked ? 1231 : 1237);\r
-        result = prime * result + rowSpan;\r
-        \r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (obj == null)\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        SpreadsheetStyle other = (SpreadsheetStyle) obj;\r
-        if (align != other.align)\r
-            return false;\r
-        if (background == null) {\r
-            if (other.background != null)\r
-                return false;\r
-        } else if (!background.equals(other.background))\r
-            return false;\r
-        if (border != other.border)\r
-            return false;\r
-        if (columnSpan != other.columnSpan)\r
-            return false;\r
-        if (font == null) {\r
-            if (other.font != null)\r
-                return false;\r
-        } else if (!font.equals(other.font))\r
-            return false;\r
-        if (foreground == null) {\r
-            if (other.foreground != null)\r
-                return false;\r
-        } else if (!foreground.equals(other.foreground))\r
-            return false;\r
-        if (locked != other.locked)\r
-            return false;\r
-        if (rowSpan != other.rowSpan)\r
-            return false;\r
-        if (synchronizationId != other.synchronizationId)\r
-            return false;\r
-        if (formatIndex != other.formatIndex)\r
-            return false;\r
-        if (formatString == null) {\r
-            if (other.formatString != null)\r
-                return false;\r
-        } else if (!formatString.equals(other.formatString))\r
-            return false;\r
-        return true;\r
-    }\r
-    \r
-    public static SpreadsheetStyleBuilder newInstace() {\r
-        return new SpreadsheetStyleBuilder();\r
-    }\r
-    \r
-    public static SpreadsheetStyle empty() {\r
-        return EMPTY;\r
-    }\r
-    \r
-    public static class SpreadsheetStyleBuilder {\r
-        \r
-        private String name;\r
-        private RGB.Integer foreground;\r
-        private RGB.Integer background;\r
-        private int border;\r
-        private int align;\r
-        private Font font;\r
-        private boolean locked;\r
-        private int rowSpan = 1;\r
-        private int columnSpan = 1;\r
-        private String formatString;\r
-        private short formatIndex;\r
-\r
-        private SpreadsheetStyleBuilder() {}\r
-        \r
-        public SpreadsheetStyleBuilder name(String name) {\r
-            this.name = name;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder foreground(RGB.Integer foreground) {\r
-            this.foreground = foreground;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder background(RGB.Integer background) {\r
-            this.background = background;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder border(Integer border) {\r
-            this.border = border == null ? 0 : border;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder align(Integer align) {\r
-            this.align = align == null ? 0 : align;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder font(Font font) {\r
-            this.font = font;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder locked(boolean locked) {\r
-            this.locked = locked;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder rowSpan(int rowSpan) {\r
-            this.rowSpan = rowSpan;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyleBuilder font(int columnSpan) {\r
-            this.columnSpan = columnSpan;\r
-            return this;\r
-        }\r
-        \r
-        public SpreadsheetStyle build() {\r
-            SpreadsheetStyle style = new SpreadsheetStyle(name, border, align, font, foreground, background, locked, rowSpan, columnSpan, formatString, formatIndex);\r
-            return style;\r
-        }\r
-\r
-        public SpreadsheetStyleBuilder formatString(String formatString) {\r
-            this.formatString = formatString;\r
-            return this;\r
-        }\r
-\r
-        public SpreadsheetStyleBuilder formatIndex(short formatIndex) {\r
-            this.formatIndex = formatIndex;\r
-            return this;\r
-        }\r
-\r
-        public SpreadsheetStyleBuilder columnSpan(int columnSpan2) {\r
-            this.columnSpan = columnSpan2;\r
-            return this;\r
-        }\r
-    }\r
-\r
-    public void setSynchronizationId(int newId) {\r
-        this.synchronizationId = newId;\r
-    }\r
-    \r
-}\r
+package org.simantics.spreadsheet.graph;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+
+import org.simantics.datatypes.literal.Font;
+import org.simantics.datatypes.literal.RGB;
+
+public final class SpreadsheetStyle implements SheetNode, SpreadsheetElement<SpreadsheetStyle, SpreadsheetStyle> {
+
+//    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;
+    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 int getId() {
+           return synchronizationId;
+       }
+       
+       public int getStyleId() {
+           return hashCode();
+       }
+
+    @Override
+    public void accept(SpreadsheetVisitor v) {
+        
+    }
+
+    @Override
+    public Optional<SpreadsheetStyle> getParent() {
+        return Optional.empty();
+    }
+
+    @Override
+    public Collection<SpreadsheetStyle> getSpreadsheetChildren() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public void remove(SpreadsheetStyle child) {
+        
+    }
+
+    @Override
+    public String getName() {
+        return "style";
+    }
+
+    @Override
+    public Map<?, ?> getChildren() {
+        return Collections.emptyMap();
+    }
+
+    @Override
+    public Map<?, ?> getProperties() {
+        return Collections.emptyMap();
+    }
+
+    @Override
+    public int hashCode() {
+        if (hashCode != 0)
+            return hashCode;
+        
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + align;
+        result = prime * result + ((formatString == null) ? 0 : formatString.hashCode());
+        result = prime * result + ((background == null) ? 0 : background.hashCode());
+        result = prime * result + border;
+        result = prime * result + formatIndex;
+        result = prime * result + columnSpan;
+        result = prime * result + ((font == null) ? 0 : font.hashCode());
+        result = prime * result + ((foreground == null) ? 0 : foreground.hashCode());
+        result = prime * result + (locked ? 1231 : 1237);
+        result = prime * result + rowSpan;
+        
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        SpreadsheetStyle other = (SpreadsheetStyle) obj;
+        if (align != other.align)
+            return false;
+        if (background == null) {
+            if (other.background != null)
+                return false;
+        } else if (!background.equals(other.background))
+            return false;
+        if (border != other.border)
+            return false;
+        if (columnSpan != other.columnSpan)
+            return false;
+        if (font == null) {
+            if (other.font != null)
+                return false;
+        } else if (!font.equals(other.font))
+            return false;
+        if (foreground == null) {
+            if (other.foreground != null)
+                return false;
+        } else if (!foreground.equals(other.foreground))
+            return false;
+        if (locked != other.locked)
+            return false;
+        if (rowSpan != other.rowSpan)
+            return false;
+        if (synchronizationId != other.synchronizationId)
+            return false;
+        if (formatIndex != other.formatIndex)
+            return false;
+        if (formatString == null) {
+            if (other.formatString != null)
+                return false;
+        } else if (!formatString.equals(other.formatString))
+            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;
+        private int border;
+        private int align;
+        private Font font;
+        private boolean locked;
+        private int rowSpan = 1;
+        private int columnSpan = 1;
+        private String formatString;
+        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;
+        }
+
+        public SpreadsheetStyleBuilder formatString(String formatString) {
+            this.formatString = formatString;
+            return this;
+        }
+
+        public SpreadsheetStyleBuilder formatIndex(short formatIndex) {
+            this.formatIndex = formatIndex;
+            return this;
+        }
+
+        public SpreadsheetStyleBuilder columnSpan(int columnSpan2) {
+            this.columnSpan = columnSpan2;
+            return this;
+        }
+    }
+
+    public void setSynchronizationId(int newId) {
+        this.synchronizationId = newId;
+    }
+    
+}