001    package de.deepamehta.plugins.topicmaps.service;
002    
003    import de.deepamehta.plugins.topicmaps.ClusterCoords;
004    import de.deepamehta.plugins.topicmaps.TopicmapRenderer;
005    import de.deepamehta.plugins.topicmaps.ViewmodelCustomizer;
006    import de.deepamehta.plugins.topicmaps.model.TopicmapViewmodel;
007    import de.deepamehta.plugins.topicmaps.model.ViewProperties;
008    
009    import de.deepamehta.core.Topic;
010    import de.deepamehta.core.service.PluginService;
011    
012    
013    
014    public interface TopicmapsService extends PluginService {
015    
016        // ------------------------------------------------------------------------------------------------------- Constants
017    
018        static final String DEFAULT_TOPICMAP_NAME     = "untitled";
019        static final String DEFAULT_TOPICMAP_RENDERER = "dm4.webclient.default_topicmap_renderer";
020    
021        // -------------------------------------------------------------------------------------------------- Public Methods
022    
023        Topic createTopicmap(String name, String topicmapRendererUri);
024    
025        // ---
026    
027        /**
028         * @param   includeChilds   if true the topics contained in the topicmap will include their child topics.
029         */
030        TopicmapViewmodel getTopicmap(long topicmapId, boolean includeChilds);
031    
032        boolean isTopicInTopicmap(long topicmapId, long topicId);
033    
034        boolean isAssociationInTopicmap(long topicmapId, long assocId);
035    
036        // ---
037    
038        /**
039         * Adds a topic to a topicmap. If the topic is added already an exception is thrown.
040         */
041        void addTopicToTopicmap(long topicmapId, long topicId, ViewProperties viewProps);
042    
043        /**
044         * Convenience method to add a topic with the standard view properties.
045         */
046        void addTopicToTopicmap(long topicmapId, long topicId, int x, int y, boolean visibility);
047    
048        /**
049         * Adds an association to a topicmap. If the association is added already an exception is thrown.
050         */
051        void addAssociationToTopicmap(long topicmapId, long assocId);
052    
053        // ---
054    
055        void setViewProperties(long topicmapId, long topicId, ViewProperties viewProps);
056    
057        /**
058         * Convenience method to update the "dm4.topicmaps.x" and "dm4.topicmaps.y" standard view properties.
059         */
060        void setTopicPosition(long topicmapId, long topicId, int x, int y);
061    
062        /**
063         * Convenience method to update the "dm4.topicmaps.visibility" standard view property.
064         */
065        void setTopicVisibility(long topicmapId, long topicId, boolean visibility);
066    
067        void removeAssociationFromTopicmap(long topicmapId, long assocId);
068    
069        // ---
070    
071        void setClusterPosition(long topicmapId, ClusterCoords coords);
072    
073        void setTopicmapTranslation(long topicmapId, int trans_x, int trans_y);
074    
075        // ---
076    
077        void registerTopicmapRenderer(TopicmapRenderer renderer);
078    
079        // ### TODO: unregister needed? Might a renderer hold a stale dms instance?
080    
081        // ---
082    
083        void registerViewmodelCustomizer(ViewmodelCustomizer customizer);
084    
085        void unregisterViewmodelCustomizer(ViewmodelCustomizer customizer);
086    }