]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/CellValue.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.spreadsheet.ui / src / org / simantics / spreadsheet / ui / CellValue.java
1 package org.simantics.spreadsheet.ui;
2
3 import java.awt.Color;
4 import java.awt.Font;
5
6 import javax.swing.border.Border;
7
8 public class CellValue {
9     
10     public boolean editable = false;
11     
12         public String label;
13         public int border;
14         public int align;
15         public Font font;
16         public Color foreground;
17         public Color background;
18         public CellValue(String label, Font font, Color foreground, Color background, int border, int align, boolean editable) {
19             this.editable = editable;
20                 this.label = label;
21                 this.font = font;
22                 this.foreground = foreground;
23                 
24                 if (editable) {
25                     this.background = background;
26                 } else {
27                     this.background = new Color(220, 220, 220, 100);
28                 }
29                 this.border = border;
30                 this.align = align;
31         }
32         
33         final SheetBorder BORDER0 = new SheetBorder(1,1,1,1,false, false); 
34         final SheetBorder BORDER1 = new SheetBorder(1,1,1,1,false, true); 
35         final SheetBorder BORDER2 = new SheetBorder(1,1,1,1,true, false); 
36         final SheetBorder BORDER3 = new SheetBorder(1,1,1,1,true, true);
37         
38         /*
39          * 1 = right
40          * 2 = bottom
41          */
42         public Border getBorder() {
43                 switch(border) {
44                 case 0: return BORDER0;
45                 case 1: return BORDER1;
46                 case 2: return BORDER2;
47                 case 3: return BORDER3;
48                 }
49                 return BORDER0;
50         }
51         
52 }