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