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