]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/labelers/LabelerStub.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui.common / src / org / simantics / browsing / ui / common / labelers / LabelerStub.java
diff --git a/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/labelers/LabelerStub.java b/bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/labelers/LabelerStub.java
new file mode 100644 (file)
index 0000000..122c9ed
--- /dev/null
@@ -0,0 +1,67 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\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.browsing.ui.common.labelers;\r
+\r
+import java.util.Map;\r
+\r
+import org.simantics.browsing.ui.GraphExplorer.ModificationContext;\r
+import org.simantics.browsing.ui.content.Labeler;\r
+\r
+/**\r
+ * A stub implementation of Labeler.\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class LabelerStub implements Labeler {\r
+\r
+    protected LabelerContent content = LabelerContent.NO_CONTENT;\r
+\r
+    public LabelerStub() {\r
+    }\r
+\r
+    public LabelerStub(LabelerContent content) {\r
+        if (content == null)\r
+            throw new NullPointerException(this + " tried to initialize with null content");\r
+        this.content = content;\r
+    }\r
+\r
+    public void setContent(LabelerContent content) {\r
+        if (content == null)\r
+            throw new NullPointerException(this + " tried to set null content");\r
+        this.content = content;\r
+    }\r
+\r
+    @Override\r
+    public Map<String, String> getLabels() {\r
+        return content.labels;\r
+    }\r
+\r
+    @Override\r
+    public Map<String, String> getRuntimeLabels() {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public int getCategory() {\r
+        return content.category;\r
+    }\r
+\r
+    @Override\r
+    public Modifier getModifier(ModificationContext context, String key) {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public void setListener(LabelerListener listener) {\r
+    }\r
+\r
+}\r