Package com.biglybt.core.tag.impl
Class TagTypeBase
- java.lang.Object
-
- com.biglybt.core.tag.impl.TagTypeBase
-
- All Implemented Interfaces:
TagListener
,TagType
- Direct Known Subclasses:
CategoryManagerImpl
,OpenTorrentOptionsWindow.DiscoveredTag.TagTypeDiscovery
,TagTypeWithState
public abstract class TagTypeBase extends java.lang.Object implements TagType, TagListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TagTypeBase.TagGroupImpl
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
AT_COLOR_ID
private static TagManagerImpl
manager
private java.util.Map<java.lang.String,TagTypeBase.TagGroupImpl>
tag_groups
private java.util.Map<Taggable,java.util.List<TagListener>>
tag_listeners
private int
tag_type
private int
tag_type_features
private java.lang.String
tag_type_name
private ListenerManager<TagTypeListener>
tt_listeners
private static int
TTL_ADD
private static int
TTL_ATTENTION_REQUESTED
private static int
TTL_REMOVE
private static int
TTL_TAG_MEMBERHIP_CHANGE
private static int
TTL_TAG_METADATA_CHANGE
private static int
TTL_TYPE_CHANGE
-
Fields inherited from interface com.biglybt.core.tag.TagType
TT_DOWNLOAD_CATEGORY, TT_DOWNLOAD_INTERNAL, TT_DOWNLOAD_MANUAL, TT_DOWNLOAD_STATE, TT_PEER_IPSET, TT_TAG_SUGGESTION
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TagTypeBase(int _tag_type, int _tag_features, java.lang.String _tag_name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTag(Tag t)
void
addTagListener(Taggable taggable, TagListener listener)
taggable-specific listneer for this tag-typeprotected void
addTagType()
void
addTagTypeListener(TagTypeListener listener, boolean fire_for_existing)
protected void
closing()
Tag
createTag(java.lang.String name, boolean auto_add)
protected void
fireChanged()
protected void
fireMembershipChanged(Tag t)
protected void
fireMetadataChanged(Tag t)
void
generate(IndentWriter writer)
protected void
generateConfig(IndentWriter writer, TagBase tag)
int[]
getColorDefault()
protected TaggableResolver
getResolver()
Tag
getTag(int tag_id)
Tag
getTag(java.lang.String tag_name, boolean is_localized)
protected TagGroup
getTagGroup(java.lang.String name)
TagManagerImpl
getTagManager()
java.util.List<Tag>
getTagsForTaggable(Taggable taggable)
int
getTagType()
Unique type denoting this species of taglong
getTagTypeFeatures()
java.lang.String
getTagTypeName(boolean localize)
boolean
hasTagTypeFeature(long feature)
boolean
isTagTypeAuto()
boolean
isTagTypePersistent()
protected java.lang.Boolean
readBooleanAttribute(TagBase tag, java.lang.String attr, java.lang.Boolean def)
protected java.lang.Long
readLongAttribute(TagBase tag, java.lang.String attr, java.lang.Long def)
protected long[]
readLongListAttribute(TagBase tag, java.lang.String attr, long[] def)
protected java.util.Map<java.lang.String,java.lang.Object>
readMapAttribute(TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> def)
protected java.lang.String
readStringAttribute(TagBase tag, java.lang.String attr, java.lang.String def)
protected java.lang.String[]
readStringListAttribute(TagBase tag, java.lang.String attr, java.lang.String[] def)
void
removeTag(Tag t)
protected void
removeTaggable(TaggableResolver resolver, Taggable taggable)
void
removeTagListener(Taggable taggable, TagListener listener)
void
removeTagType()
void
removeTagTypeListener(TagTypeListener listener)
void
requestAttention(Tag t)
protected Taggable
resolveTaggable(java.lang.String id)
protected void
setTagGroup(Tag tag, java.lang.String old_name, java.lang.String new_name)
protected void
sync()
void
taggableAdded(Tag tag, Taggable tagged)
void
taggableRemoved(Tag tag, Taggable tagged)
void
taggableSync(Tag tag)
protected boolean
writeBooleanAttribute(TagBase tag, java.lang.String attr, java.lang.Boolean value)
protected boolean
writeLongAttribute(TagBase tag, java.lang.String attr, java.lang.Long value)
protected boolean
writeLongListAttribute(TagBase tag, java.lang.String attr, long[] value)
protected void
writeMapAttribute(TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> value)
protected boolean
writeStringAttribute(TagBase tag, java.lang.String attr, java.lang.String value)
protected boolean
writeStringListAttribute(TagBase tag, java.lang.String attr, java.lang.String[] value)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.core.tag.TagType
getTagCount, getTags
-
-
-
-
Field Detail
-
AT_COLOR_ID
protected static final java.lang.String AT_COLOR_ID
- See Also:
- Constant Field Values
-
tag_type
private final int tag_type
-
tag_type_features
private final int tag_type_features
-
tag_type_name
private final java.lang.String tag_type_name
-
TTL_ADD
private static final int TTL_ADD
- See Also:
- Constant Field Values
-
TTL_TAG_MEMBERHIP_CHANGE
private static final int TTL_TAG_MEMBERHIP_CHANGE
- See Also:
- Constant Field Values
-
TTL_TAG_METADATA_CHANGE
private static final int TTL_TAG_METADATA_CHANGE
- See Also:
- Constant Field Values
-
TTL_REMOVE
private static final int TTL_REMOVE
- See Also:
- Constant Field Values
-
TTL_TYPE_CHANGE
private static final int TTL_TYPE_CHANGE
- See Also:
- Constant Field Values
-
TTL_ATTENTION_REQUESTED
private static final int TTL_ATTENTION_REQUESTED
- See Also:
- Constant Field Values
-
manager
private static final TagManagerImpl manager
-
tt_listeners
private final ListenerManager<TagTypeListener> tt_listeners
-
tag_listeners
private final java.util.Map<Taggable,java.util.List<TagListener>> tag_listeners
-
tag_groups
private java.util.Map<java.lang.String,TagTypeBase.TagGroupImpl> tag_groups
-
-
Method Detail
-
addTagType
protected void addTagType()
-
getTagManager
public TagManagerImpl getTagManager()
- Specified by:
getTagManager
in interfaceTagType
-
getResolver
protected TaggableResolver getResolver()
-
resolveTaggable
protected Taggable resolveTaggable(java.lang.String id)
-
removeTaggable
protected void removeTaggable(TaggableResolver resolver, Taggable taggable)
-
getTagType
public int getTagType()
Description copied from interface:TagType
Unique type denoting this species of tag- Specified by:
getTagType
in interfaceTagType
- Returns:
-
getTagTypeName
public java.lang.String getTagTypeName(boolean localize)
- Specified by:
getTagTypeName
in interfaceTagType
-
isTagTypeAuto
public boolean isTagTypeAuto()
- Specified by:
isTagTypeAuto
in interfaceTagType
-
isTagTypePersistent
public boolean isTagTypePersistent()
- Specified by:
isTagTypePersistent
in interfaceTagType
-
getTagTypeFeatures
public long getTagTypeFeatures()
- Specified by:
getTagTypeFeatures
in interfaceTagType
-
hasTagTypeFeature
public boolean hasTagTypeFeature(long feature)
- Specified by:
hasTagTypeFeature
in interfaceTagType
-
fireChanged
protected void fireChanged()
-
createTag
public Tag createTag(java.lang.String name, boolean auto_add) throws TagException
- Specified by:
createTag
in interfaceTagType
- Throws:
TagException
-
requestAttention
public void requestAttention(Tag t)
-
getColorDefault
public int[] getColorDefault()
- Specified by:
getColorDefault
in interfaceTagType
-
sync
protected void sync()
-
closing
protected void closing()
-
getTag
public Tag getTag(java.lang.String tag_name, boolean is_localized)
-
getTagsForTaggable
public java.util.List<Tag> getTagsForTaggable(Taggable taggable)
- Specified by:
getTagsForTaggable
in interfaceTagType
-
fireMembershipChanged
protected void fireMembershipChanged(Tag t)
-
fireMetadataChanged
protected void fireMetadataChanged(Tag t)
-
removeTagType
public void removeTagType()
- Specified by:
removeTagType
in interfaceTagType
-
addTagTypeListener
public void addTagTypeListener(TagTypeListener listener, boolean fire_for_existing)
- Specified by:
addTagTypeListener
in interfaceTagType
-
removeTagTypeListener
public void removeTagTypeListener(TagTypeListener listener)
- Specified by:
removeTagTypeListener
in interfaceTagType
-
taggableAdded
public void taggableAdded(Tag tag, Taggable tagged)
- Specified by:
taggableAdded
in interfaceTagListener
-
taggableSync
public void taggableSync(Tag tag)
- Specified by:
taggableSync
in interfaceTagListener
-
taggableRemoved
public void taggableRemoved(Tag tag, Taggable tagged)
- Specified by:
taggableRemoved
in interfaceTagListener
-
addTagListener
public void addTagListener(Taggable taggable, TagListener listener)
Description copied from interface:TagType
taggable-specific listneer for this tag-type- Specified by:
addTagListener
in interfaceTagType
-
removeTagListener
public void removeTagListener(Taggable taggable, TagListener listener)
- Specified by:
removeTagListener
in interfaceTagType
-
readBooleanAttribute
protected java.lang.Boolean readBooleanAttribute(TagBase tag, java.lang.String attr, java.lang.Boolean def)
-
writeBooleanAttribute
protected boolean writeBooleanAttribute(TagBase tag, java.lang.String attr, java.lang.Boolean value)
-
readLongAttribute
protected java.lang.Long readLongAttribute(TagBase tag, java.lang.String attr, java.lang.Long def)
-
writeLongAttribute
protected boolean writeLongAttribute(TagBase tag, java.lang.String attr, java.lang.Long value)
-
readStringAttribute
protected java.lang.String readStringAttribute(TagBase tag, java.lang.String attr, java.lang.String def)
-
writeStringAttribute
protected boolean writeStringAttribute(TagBase tag, java.lang.String attr, java.lang.String value)
- Returns:
- Whether attribute was changed from existing value
-
readMapAttribute
protected java.util.Map<java.lang.String,java.lang.Object> readMapAttribute(TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> def)
-
writeMapAttribute
protected void writeMapAttribute(TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> value)
-
readStringListAttribute
protected java.lang.String[] readStringListAttribute(TagBase tag, java.lang.String attr, java.lang.String[] def)
-
writeStringListAttribute
protected boolean writeStringListAttribute(TagBase tag, java.lang.String attr, java.lang.String[] value)
-
readLongListAttribute
protected long[] readLongListAttribute(TagBase tag, java.lang.String attr, long[] def)
-
writeLongListAttribute
protected boolean writeLongListAttribute(TagBase tag, java.lang.String attr, long[] value)
-
setTagGroup
protected void setTagGroup(Tag tag, java.lang.String old_name, java.lang.String new_name)
-
getTagGroup
protected TagGroup getTagGroup(java.lang.String name)
-
generate
public void generate(IndentWriter writer)
-
generateConfig
protected void generateConfig(IndentWriter writer, TagBase tag)
-
-