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    
008    import de.deepamehta.core.Topic;
009    import de.deepamehta.core.model.CompositeValueModel;
010    import de.deepamehta.core.service.ClientState;
011    import de.deepamehta.core.service.PluginService;
012    
013    
014    
015    public interface TopicmapsService extends PluginService {
016    
017        /**
018         * @param   fetchComposite  if true the topics contained in the topicmap will include their child topics.
019         */
020        TopicmapViewmodel getTopicmap(long topicmapId, boolean fetchComposite);
021    
022        // ---
023    
024        Topic createTopicmap(String name,             String topicmapRendererUri, ClientState clientState);
025        Topic createTopicmap(String name, String uri, String topicmapRendererUri, ClientState clientState);
026    
027        // ---
028    
029        void addTopicToTopicmap(long topicmapId, long topicId, CompositeValueModel viewProps);
030    
031        /**
032         * Convenience method to add a topic with the standard view properties.
033         */
034        void addTopicToTopicmap(long topicmapId, long topicId, int x, int y, boolean visibility);
035    
036        void addAssociationToTopicmap(long topicmapId, long assocId);
037    
038        // ---
039    
040        boolean isTopicInTopicmap(long topicmapId, long topicId);
041    
042        // ---
043    
044        void setViewProperties(long topicmapId, long topicId, CompositeValueModel viewProps);
045    
046        /**
047         * Convenience method to update the "dm4.topicmaps.x" and "dm4.topicmaps.y" standard view properties.
048         */
049        void setTopicPosition(long topicmapId, long topicId, int x, int y);
050    
051        /**
052         * Convenience method to update the "dm4.topicmaps.visibility" standard view property.
053         */
054        void setTopicVisibility(long topicmapId, long topicId, boolean visibility);
055    
056        void removeAssociationFromTopicmap(long topicmapId, long assocId);
057    
058        // ---
059    
060        void setClusterPosition(long topicmapId, ClusterCoords coords);
061    
062        void setTopicmapTranslation(long topicmapId, int trans_x, int trans_y);
063    
064        // ---
065    
066        void registerTopicmapRenderer(TopicmapRenderer renderer);
067        // ### TODO: unregister needed? Might a renderer hold a stale dms instance?
068    
069        void registerViewmodelCustomizer(ViewmodelCustomizer customizer);
070        void unregisterViewmodelCustomizer(ViewmodelCustomizer customizer);
071    }