當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleDoubleProperty.addListener方法代碼示例

本文整理匯總了Java中javafx.beans.property.SimpleDoubleProperty.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleDoubleProperty.addListener方法的具體用法?Java SimpleDoubleProperty.addListener怎麽用?Java SimpleDoubleProperty.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.beans.property.SimpleDoubleProperty的用法示例。


在下文中一共展示了SimpleDoubleProperty.addListener方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GraphVisualizer

import javafx.beans.property.SimpleDoubleProperty; //導入方法依賴的package包/類
/**
 * Create a new {@link GraphVisualizer} instance.
 * <p>
 * The passed {@link GraphStore} is observed by this class. If the {@link GraphStore}
 * {@link org.dnacronym.hygene.parser.GfaFile} is updated, it will prompt a redraw. Changing the properties of this
 * class will also prompt a redraw if the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} is not
 * {@code null}.
 *
 * @param graphDimensionsCalculator {@link GraphDimensionsCalculator} used to calculate node positions
 * @param query                     the {@link Query} used to get the currently queried nodes
 * @param bookmarkStore             the {@link BookmarkStore} used to draw bookmark indications
 * @param graphAnnotation           the {@link GraphAnnotation} used to draw annotations
 */
@Inject
public GraphVisualizer(final GraphDimensionsCalculator graphDimensionsCalculator, final Query query,
                       final BookmarkStore bookmarkStore, final GraphAnnotation graphAnnotation,
                       final GraphStore graphStore) {
    HygeneEventBus.getInstance().register(this);
    this.graphDimensionsCalculator = graphDimensionsCalculator;
    this.query = query;
    this.bookmarkStore = bookmarkStore;
    this.colorRoulette = new ColorRoulette();
    this.graphAnnotation = graphAnnotation;
    this.graphStore = graphStore;

    selectedSegmentProperty = new SimpleObjectProperty<>();
    selectedSegmentProperty.addListener((observable, oldValue, newValue) -> draw());

    hoveredSegmentProperty = new SimpleObjectProperty<>();
    hoveredSegmentProperty.addListener((observable, oldValue, newValue) -> draw());

    genomePaths = FXCollections.observableArrayList(new HashSet<>());
    selectedGenomePaths = FXCollections.observableHashMap();
    selectedGenomePaths.addListener((MapChangeListener<String, Color>) change -> draw());

    edgeColorProperty = new SimpleObjectProperty<>(DEFAULT_EDGE_COLOR);
    nodeHeightProperty = new SimpleDoubleProperty(DEFAULT_NODE_HEIGHT);
    graphDimensionsCalculator.getNodeHeightProperty().bind(nodeHeightProperty);

    edgeColorProperty.addListener((observable, oldValue, newValue) -> draw());
    nodeHeightProperty.addListener((observable, oldValue, newValue) -> draw());
    Node.setColorScheme(BasicSettingsViewController.NODE_COLOR_SCHEMES.get(0).getValue());

    displayLaneBordersProperty = new SimpleBooleanProperty();
    displayLaneBordersProperty.addListener((observable, oldValue, newValue) -> draw());

    graphDimensionsCalculator.getGraphProperty()
            .addListener((observable, oldValue, newValue) -> setGraph(newValue));

    graphDimensionsCalculator.getObservableQueryNodes()
            .addListener((ListChangeListener<Node>) change -> draw());

    query.getQueriedNodes().addListener((ListChangeListener<Integer>) observable -> draw());

    segmentDrawingToolkit = new SegmentDrawingToolkit();
    snpDrawingToolkit = new SnpDrawingToolkit();
    edgeDrawingToolkit = new EdgeDrawingToolkit();
    graphAnnotationVisualizer = new GraphAnnotationVisualizer(graphDimensionsCalculator);
    graphAnnotation.indexBuiltProperty().addListener((observable, oldValue, newValue) -> draw());

    nodeHeightProperty.addListener((observable, oldValue, newValue) -> {
        segmentDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
        snpDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
        draw();
    });

    segmentDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
    snpDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:70,代碼來源:GraphVisualizer.java


注:本文中的javafx.beans.property.SimpleDoubleProperty.addListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。