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.diagram.synchronization.graph.layer;
14 import java.util.Collection;
17 import org.simantics.db.Resource;
18 import org.simantics.db.exception.DatabaseException;
19 import org.simantics.db.function.DbConsumer;
20 import org.simantics.g2d.layers.ILayer;
21 import org.simantics.g2d.layers.SimpleLayer;
24 * @author Tuukka Lehtonen
26 public class GraphLayer {
28 public static final String PROP_VISIBLE = "PROP_VISIBLE";
29 public static final String PROP_FOCUSABLE = "PROP_FOCUSABLE";
31 private final String name;
33 private final Resource layer;
35 private final Map<String, Resource> tags;
37 public GraphLayer(String name, Resource layer, Map<String, Resource> tags) {
43 public GraphLayer withName(String name) {
44 return new GraphLayer(name, layer, tags);
47 public String getName() {
51 public Resource getLayer() {
55 public Resource getVisible() {
56 return tags.get(PROP_VISIBLE);
59 public Resource getFocusable() {
60 return tags.get(PROP_FOCUSABLE);
63 public ILayer getILayer() {
64 return new SimpleLayer(name);
67 public Collection<Resource> getTags() {
71 public void forEachTag(DbConsumer<Resource> consumer) throws DatabaseException {
72 for (Resource r : tags.values())