1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 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.browsing.ui.model.modifiers;
14 import org.simantics.browsing.ui.common.ColumnKeys;
15 import org.simantics.browsing.ui.content.Labeler.Modifier;
16 import org.simantics.db.ReadGraph;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.db.layer0.variable.Variable;
21 * @author Tuukka Lehtonen
23 public class VariablePropertyModifierRule implements ModifierRule {
27 public VariablePropertyModifierRule(ReadGraph graph, String propertyName) throws DatabaseException {
28 this.propertyName = propertyName;
32 public boolean isCompatible(Class<?> contentType) {
33 return contentType.equals(Variable.class);
37 public Modifier getModifier(ReadGraph graph, Object content,
38 String columnKey) throws DatabaseException {
39 if(!ColumnKeys.SINGLE.equals(columnKey))
41 if(!(content instanceof Variable))
43 Variable variable = (Variable)content;
44 Variable propertyVariable = variable.getProperty(graph, propertyName);
45 return new VariableModifier2(graph, propertyVariable);