1 /*******************************************************************************
\r
2 * Copyright (c) 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * Semantum Oy - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.properties.widgets.sensitivity;
\r
14 import java.util.HashMap;
\r
15 import java.util.Map;
\r
17 import org.simantics.browsing.ui.common.ColumnKeys;
\r
18 import org.simantics.browsing.ui.model.labels.LabelRule;
\r
19 import org.simantics.db.ReadGraph;
\r
20 import org.simantics.db.Resource;
\r
21 import org.simantics.db.exception.DatabaseException;
\r
22 import org.simantics.sysdyn.SysdynResource;
\r
24 public class ParameterLabelRule implements LabelRule {
\r
27 public boolean isCompatible(Class<?> contentType) {
\r
28 return contentType.equals(Resource.class);
\r
32 public Map<String, String> getLabel(ReadGraph graph, Object content) throws DatabaseException {
\r
33 HashMap<String, String> result = new HashMap<String, String>();
\r
35 String variable = graph.getPossibleRelatedValue((Resource)content, SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_variable);
\r
36 Integer n = graph.getPossibleRelatedValue((Resource)content, SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_numberOfValues);
\r
38 StringBuilder sb = new StringBuilder();
\r
40 if(variable != null)
\r
41 sb.append(variable);
\r
43 sb.append("No variable");
\r
50 sb.append("undefined");
\r
54 result.put(ColumnKeys.SINGLE, sb.toString()) ;
\r