1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.spreadsheet.common.cell;
14 import java.util.Collection;
15 import java.util.Collections;
17 import org.simantics.databoard.binding.mutable.Variant;
18 import org.simantics.db.layer0.variable.VariableSpaceManipulator.PropertyCreationData;
19 import org.simantics.layer0.Layer0;
20 import org.simantics.spreadsheet.resource.SpreadsheetResource;
22 public class Parsers {
24 final public static String LABEL_PROPERTY = Layer0.URIs.HasLabel;
25 final public static String CONTENT_PROPERTY = SpreadsheetResource.URIs.Cell_content;
26 final public static String EXPRESSION_PROPERTY = "e";
27 final public static String RESOURCE_PATH_PROPERTY = "r";
29 final public static StringCellParser TEXT_PARSER = new TextStringCellParser();
31 final public static StringCellParser RESOURCE_ARRAY_PARSER = new StringCellParser() {
34 public Collection<PropertyCreationData> parse(String text) {
35 if(text.startsWith("=")) {
36 return Collections.singletonList(PropertyCreationData.build(Parsers.RESOURCE_PATH_PROPERTY, Variant.ofInstance(text)));
43 public String getType() {
49 final public static StringCellParser EXPRESSION_PARSER = new ExpressionStringCellParser();
51 final public static StringCellParser COMMAND_PARSER = new CommandStringCellParser();
53 final public static StringCellParser MATRIX_PARSER = new MatrixStringCellParser();