1 package net.systemeD.potlatch2.mapfeatures {
3 import net.systemeD.halcyon.connection.*;
6 public class Presence {
7 private static var ALWAYS:Presence;
8 private static var ON_TAG_MATCH:Presence;
9 private static var WITH_CATEGORY:Presence;
11 public static function getPresence(presence:String):Presence {
12 if ( ALWAYS == null ) {
13 ALWAYS = new Presence();
14 ON_TAG_MATCH = new OnTagMatch();
15 WITH_CATEGORY = new WithCategory();
17 if ( presence == "always" )
19 if ( presence == "onTagMatch" )
21 if ( presence == "withCategory" )
26 public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
27 return forCategory == null || forCategory == editor.category;
34 import net.systemeD.halcyon.connection.*;
35 import net.systemeD.potlatch2.mapfeatures.*;
37 class OnTagMatch extends Presence {
38 public function OnTagMatch() {}
40 override public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
41 return (forCategory == null || forCategory == editor.category) &&
42 editor.areTagsMatching(forEntity);
46 class WithCategory extends Presence {
47 public function WithCategory() {}
49 override public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
50 return forCategory == editor.category &&
51 editor.areTagsMatching(forEntity);