SimpleBookmarkStore.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:hygene 作者:
/**
 * Create an instance of a {@link SimpleBookmarkStore}.
 * <p>
 * If it observed that the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} has changed, it will
 * clear all current {@link SimpleBookmark}s and load the {@link Bookmark}s associated with the new
 * {@link org.dnacronym.hygene.parser.GfaFile}.
 * <p>
 * It uses the {@link GraphDimensionsCalculator} as a reference for each internal {@link SimpleBookmark}.
 *
 * @param graphStore                the {@link GraphStore} to be observed by this class
 * @param graphVisualizer           the {@link GraphVisualizer} to be used by this class
 * @param graphDimensionsCalculator the {@link GraphDimensionsCalculator} to be used by this class
 * @param sequenceVisualizer        the {@link SequenceVisualizer} to be used by this class
 * @see SimpleBookmark
 */
@Inject
public SimpleBookmarkStore(final GraphStore graphStore, final GraphVisualizer graphVisualizer,
                           final GraphDimensionsCalculator graphDimensionsCalculator,
                           final SequenceVisualizer sequenceVisualizer) {
    this.graphDimensionsCalculator = graphDimensionsCalculator;
    this.graphVisualizer = graphVisualizer;
    this.sequenceVisualizer = sequenceVisualizer;

    simpleBookmarks = new ArrayList<>();
    observableSimpleBookmarks = FXCollections.observableList(simpleBookmarks);
    observableSimpleBookmarks.addListener((ListChangeListener<SimpleBookmark>) listener -> graphVisualizer.draw());

    graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> {
        try {
            fileBookmarks = new FileBookmarks(new FileDatabase(newValue.getFileName()));

            simpleBookmarks.clear();
            addBookmarks(fileBookmarks.getAll());
        } catch (final SQLException | IOException e) {
            LOGGER.error("Unable to load bookmarks from file.", e);
        }
    });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号