]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/ClientModel.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.spreadsheet / src / org / simantics / spreadsheet / ClientModel.java
1 /*******************************************************************************\r
2  * in Industry THTH ry.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.spreadsheet;\r
12 \r
13 import java.awt.Rectangle;\r
14 import java.util.Collection;\r
15 import java.util.List;\r
16 \r
17 import org.simantics.utils.datastructures.Pair;\r
18 \r
19 \r
20 public interface ClientModel extends CellModifier {\r
21     \r
22     public enum OperationMode {\r
23         OPERATION,\r
24         EDIT_MODE\r
25     }\r
26 \r
27         public interface ClientModelListener {\r
28                 \r
29                 public void rows(int amount);\r
30                 public void columns(int amount);\r
31 \r
32                 public void columnLabels(String[] labels);\r
33                 public void rowLabels(String[] labels);\r
34                 public void columnWidths(int[] widths);\r
35                 \r
36                 public void sources(String[] available, String current);\r
37                 \r
38                 public void propertyChange(String location, String property, Object value);\r
39                 public void cleared(String location);\r
40                 public void flush();\r
41                 \r
42         }\r
43 \r
44         public static final String EXCEL = "Excel";\r
45         public static final String EXCEL_VISIBLE = "Visible";\r
46 \r
47         /**\r
48          * The location argument to use for setting header properties.\r
49          * @see #HEADERS_COL_LABELS\r
50          * @see #HEADERS_COL_WIDTHS\r
51          * @see #HEADERS_ROW_HEIGHTS\r
52          * @see #HEADERS_ROW_LABELS\r
53          */\r
54         public static final String HEADERS = "Headers";\r
55         public static final String HEADERS_COL_WIDTHS = "columnWidths";\r
56         public static final String HEADERS_ROW_HEIGHTS = "rowHeights";\r
57         public static final String HEADERS_COL_LABELS = "columnLabels";\r
58         public static final String HEADERS_ROW_LABELS = "rowLabels";\r
59         \r
60         /**\r
61          * The location argument to use for setting dimension properties.\r
62          * @see #DIMENSIONS_COL_COUNT\r
63          * @see #DIMENSIONS_FIT_COLS\r
64          * @see #DIMENSIONS_FIT_ROWS\r
65          * @see #DIMENSIONS_ROW_COUNT\r
66          */\r
67         public static final String DIMENSIONS = "Dimensions";\r
68         public static final String DIMENSIONS_FIT_ROWS = "fitRows";\r
69         public static final String DIMENSIONS_FIT_COLS = "fitColumns";\r
70         public static final String DIMENSIONS_COL_COUNT = "columnCount";\r
71         public static final String DIMENSIONS_ROW_COUNT = "rowCount";\r
72 \r
73         public static final String SOURCES = "Sources";\r
74         public static final String SOURCES_AVAILABLE = "available";\r
75         public static final String SOURCES_CURRENT = "current";\r
76 \r
77         public static final String SHEETS = "Sheets";\r
78         public static final String SHEETS_AVAILABLE = "available";\r
79         public static final String SHEETS_CURRENT = "current";\r
80         \r
81         public static final String CONTEXT = "Context";\r
82         public static final String CONTEXT_CURRENT = "current";\r
83         \r
84         public static final String MODE = "Mode";\r
85         public static final String MODE_CURRENT = "current";\r
86         \r
87         public static final String STATES = "States";\r
88         public static final String STATES_AVAILABLE = "available";\r
89         public static final String STATES_CURRENT = "current";\r
90 \r
91         public static final String FONT = "font";\r
92         public static final String FOREGROUND = "foreground";\r
93         public static final String BACKGROUND = "background";\r
94         public static final String BORDER = "border";\r
95         public static final String ALIGN = "align";\r
96         public static final String LABEL = "label";\r
97         public static final String CONTENT = "content";\r
98         public static final String CONTENT_EXPRESSION = "content#expression";\r
99         public static final String COMPUTED = "Computed";\r
100         public static final String LOCKED = "locked";\r
101         public static final String ROW_SPAN = "rowSpan";\r
102         public static final String COLUMN_SPAN = "columnSpan";\r
103         \r
104     public static final String ITERATION_ENABLED = "iterationEnabled";\r
105         \r
106     void addListener(ClientModelListener listener);\r
107     void removeListener(ClientModelListener listener);\r
108     <T> T getPropertyAt(String location, String property);\r
109     <T> T getPossiblePropertyAt(String location, String property);\r
110     \r
111     int[] getColumnWidths();\r
112     int[] getRowHeights();\r
113     \r
114     int getRows();\r
115     int getColumns();\r
116 \r
117         public Collection<Pair<String, Object>> listAll(String property);\r
118         \r
119         /*\r
120          * Returns a copy of the span. Null if not found.\r
121          */\r
122         public Rectangle getSpan(int row, int column);\r
123 \r
124         /*\r
125          * Returns a copy of the span list.\r
126          */     \r
127         public List<Rectangle> getSpans();\r
128         \r
129 }\r