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();
16 if ( presence == "always" )
18 if ( presence == "onTagMatch" )
20 if ( presence == "withCategory" )
25 public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
26 return forCategory == null || forCategory == editor.category;
33 import net.systemeD.halcyon.connection.*;
34 import net.systemeD.potlatch2.mapfeatures.*;
36 class OnTagMatch extends Presence {
37 public function OnTagMatch() {}
39 override public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
40 return (forCategory == null || forCategory == editor.category) &&
41 editor.areTagsMatching(forEntity);
45 class WithCategory extends Presence {
46 public function WithCategory() {}
48 override public function isEditorPresent(editor:EditorFactory, forEntity:Entity, forCategory:String):Boolean {
49 return forCategory == editor.category &&
50 editor.areTagsMatching(forEntity);