]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
diff --git a/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/ClientModel.java b/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/ClientModel.java
new file mode 100644 (file)
index 0000000..d3ea0c3
--- /dev/null
@@ -0,0 +1,129 @@
+/*******************************************************************************\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.spreadsheet;\r
+\r
+import java.awt.Rectangle;\r
+import java.util.Collection;\r
+import java.util.List;\r
+\r
+import org.simantics.utils.datastructures.Pair;\r
+\r
+\r
+public interface ClientModel extends CellModifier {\r
+    \r
+    public enum OperationMode {\r
+        OPERATION,\r
+        EDIT_MODE\r
+    }\r
+\r
+       public interface ClientModelListener {\r
+               \r
+               public void rows(int amount);\r
+               public void columns(int amount);\r
+\r
+               public void columnLabels(String[] labels);\r
+               public void rowLabels(String[] labels);\r
+               public void columnWidths(int[] widths);\r
+               \r
+               public void sources(String[] available, String current);\r
+               \r
+               public void propertyChange(String location, String property, Object value);\r
+               public void cleared(String location);\r
+               public void flush();\r
+               \r
+       }\r
+\r
+       public static final String EXCEL = "Excel";\r
+       public static final String EXCEL_VISIBLE = "Visible";\r
+\r
+       /**\r
+        * The location argument to use for setting header properties.\r
+        * @see #HEADERS_COL_LABELS\r
+        * @see #HEADERS_COL_WIDTHS\r
+        * @see #HEADERS_ROW_HEIGHTS\r
+        * @see #HEADERS_ROW_LABELS\r
+        */\r
+       public static final String HEADERS = "Headers";\r
+       public static final String HEADERS_COL_WIDTHS = "columnWidths";\r
+       public static final String HEADERS_ROW_HEIGHTS = "rowHeights";\r
+       public static final String HEADERS_COL_LABELS = "columnLabels";\r
+       public static final String HEADERS_ROW_LABELS = "rowLabels";\r
+       \r
+       /**\r
+        * The location argument to use for setting dimension properties.\r
+        * @see #DIMENSIONS_COL_COUNT\r
+        * @see #DIMENSIONS_FIT_COLS\r
+        * @see #DIMENSIONS_FIT_ROWS\r
+        * @see #DIMENSIONS_ROW_COUNT\r
+        */\r
+       public static final String DIMENSIONS = "Dimensions";\r
+       public static final String DIMENSIONS_FIT_ROWS = "fitRows";\r
+       public static final String DIMENSIONS_FIT_COLS = "fitColumns";\r
+       public static final String DIMENSIONS_COL_COUNT = "columnCount";\r
+       public static final String DIMENSIONS_ROW_COUNT = "rowCount";\r
+\r
+       public static final String SOURCES = "Sources";\r
+       public static final String SOURCES_AVAILABLE = "available";\r
+       public static final String SOURCES_CURRENT = "current";\r
+\r
+       public static final String SHEETS = "Sheets";\r
+       public static final String SHEETS_AVAILABLE = "available";\r
+       public static final String SHEETS_CURRENT = "current";\r
+       \r
+       public static final String CONTEXT = "Context";\r
+       public static final String CONTEXT_CURRENT = "current";\r
+       \r
+       public static final String MODE = "Mode";\r
+       public static final String MODE_CURRENT = "current";\r
+       \r
+       public static final String STATES = "States";\r
+       public static final String STATES_AVAILABLE = "available";\r
+       public static final String STATES_CURRENT = "current";\r
+\r
+       public static final String FONT = "font";\r
+       public static final String FOREGROUND = "foreground";\r
+       public static final String BACKGROUND = "background";\r
+       public static final String BORDER = "border";\r
+       public static final String ALIGN = "align";\r
+       public static final String LABEL = "label";\r
+       public static final String CONTENT = "content";\r
+       public static final String CONTENT_EXPRESSION = "content#expression";\r
+       public static final String COMPUTED = "Computed";\r
+       public static final String LOCKED = "locked";\r
+       public static final String ROW_SPAN = "rowSpan";\r
+       public static final String COLUMN_SPAN = "columnSpan";\r
+       \r
+    public static final String ITERATION_ENABLED = "iterationEnabled";\r
+       \r
+    void addListener(ClientModelListener listener);\r
+    void removeListener(ClientModelListener listener);\r
+    <T> T getPropertyAt(String location, String property);\r
+    <T> T getPossiblePropertyAt(String location, String property);\r
+    \r
+    int[] getColumnWidths();\r
+    int[] getRowHeights();\r
+    \r
+    int getRows();\r
+    int getColumns();\r
+\r
+       public Collection<Pair<String, Object>> listAll(String property);\r
+       \r
+       /*\r
+        * Returns a copy of the span. Null if not found.\r
+        */\r
+       public Rectangle getSpan(int row, int column);\r
+\r
+       /*\r
+        * Returns a copy of the span list.\r
+        */     \r
+       public List<Rectangle> getSpans();\r
+       \r
+}\r