]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/ClientModel.java
Adopt spreadsheet changes made in Balas development
[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 interface ClientModelListener {
23
24         public void rows(int amount);
25         public void columns(int amount);
26
27         public void columnLabels(String[] labels);
28         public void rowLabels(String[] labels);
29         public void columnWidths(int[] widths);
30
31         public void sources(String[] available, String current);
32
33         public void propertyChange(String location, String property, Object value);
34         public void cleared(String location);
35         public void flush();
36
37     }
38
39     public static final String EXCEL = "Excel";
40     public static final String EXCEL_VISIBLE = "Visible";
41
42     /**
43      * The location argument to use for setting header properties.
44      * @see #HEADERS_COL_LABELS
45      * @see #HEADERS_COL_WIDTHS
46      * @see #HEADERS_ROW_HEIGHTS
47      * @see #HEADERS_ROW_LABELS
48      */
49     public static final String HEADERS = "Headers";
50     public static final String HEADERS_COL_WIDTHS = "columnWidths";
51     public static final String HEADERS_ROW_HEIGHTS = "rowHeights";
52     public static final String HEADERS_COL_LABELS = "columnLabels";
53     public static final String HEADERS_ROW_LABELS = "rowLabels";
54
55     /**
56      * The location argument to use for setting dimension properties.
57      * @see #DIMENSIONS_COL_COUNT
58      * @see #DIMENSIONS_FIT_COLS
59      * @see #DIMENSIONS_FIT_ROWS
60      * @see #DIMENSIONS_ROW_COUNT
61      */
62     public static final String DIMENSIONS = "Dimensions";
63     public static final String DIMENSIONS_FIT_ROWS = "fitRows";
64     public static final String DIMENSIONS_FIT_COLS = "fitColumns";
65     public static final String DIMENSIONS_COL_COUNT = "columnCount";
66     public static final String DIMENSIONS_ROW_COUNT = "rowCount";
67
68     public static final String SOURCES = "Sources";
69     public static final String SOURCES_AVAILABLE = "available";
70     public static final String SOURCES_CURRENT = "current";
71
72     public static final String SHEETS = "Sheets";
73     public static final String SHEETS_AVAILABLE = "available";
74     public static final String SHEETS_CURRENT = "current";
75
76     public static final String CONTEXT = "Context";
77     public static final String CONTEXT_CURRENT = "current";
78
79     public static final String MODE = "Mode";
80     public static final String MODE_CURRENT = "current";
81
82     public static final String STATES = "States";
83     public static final String STATES_AVAILABLE = "available";
84     public static final String STATES_CURRENT = "current";
85
86     public static final String FONT = "font";
87     public static final String FOREGROUND = "foreground";
88     public static final String BACKGROUND = "background";
89     public static final String BORDER = "border";
90     public static final String ALIGN = "align";
91     public static final String LABEL = "label";
92     public static final String CONTENT = "content";
93     public static final String CONTENT_EXPRESSION = "content#expression";
94     public static final String COMPUTED = "Computed";
95     public static final String LOCKED = "locked";
96     public static final String ROW_SPAN = "rowSpan";
97     public static final String COLUMN_SPAN = "columnSpan";
98
99     public static final String ITERATION_ENABLED = "iterationEnabled";
100
101     void addListener(ClientModelListener listener);
102     void removeListener(ClientModelListener listener);
103     <T> T getPropertyAt(String location, String property);
104     <T> T getPossiblePropertyAt(String location, String property);
105
106     int[] getColumnWidths();
107     int[] getRowHeights();
108
109     int getRows();
110     int getColumns();
111
112     public Collection<Pair<String, Object>> listAll(String property);
113
114     /*
115      * Returns a copy of the span. Null if not found.
116      */
117     public Rectangle getSpan(int row, int column);
118
119     /*
120      * Returns a copy of the span list.
121      */ 
122     public List<Rectangle> getSpans();
123
124 }