< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/chart/Chart.java

Print this page




 111         @Override protected void invalidated() {
 112             titleLabel.setText(get());
 113         }
 114 
 115         @Override
 116         public Object getBean() {
 117             return Chart.this;
 118         }
 119 
 120         @Override
 121         public String getName() {
 122             return "title";
 123         }
 124     };
 125     public final String getTitle() { return title.get(); }
 126     public final void setTitle(String value) { title.set(value); }
 127     public final StringProperty titleProperty() { return title; }
 128 
 129     /**
 130      * The side of the chart where the title is displayed
 131      * @default Side.TOP
 132      */
 133     private ObjectProperty<Side> titleSide = new StyleableObjectProperty<Side>(Side.TOP) {
 134         @Override protected void invalidated() {
 135             requestLayout();
 136         }
 137 
 138         @Override
 139         public CssMetaData<Chart,Side> getCssMetaData() {
 140             return StyleableProperties.TITLE_SIDE;
 141         }
 142 
 143         @Override
 144         public Object getBean() {
 145             return Chart.this;
 146         }
 147 
 148         @Override
 149         public String getName() {
 150             return "titleSide";
 151         }


 292      */
 293     void animate(KeyFrame...keyFrames) { animator.animate(keyFrames); }
 294 
 295     /**
 296      * Play the given animation on every frame of the animation the chart will be relayed out until the animation
 297      * finishes. So to add a animation to a chart, create a animation on data model, during layoutChartContent() map
 298      * data model to nodes then call this method with the animation.
 299      *
 300      * @param animation The animation to play
 301      */
 302     protected void animate(Animation animation) { animator.animate(animation); }
 303 
 304     /** Call this when you know something has changed that needs the chart to be relayed out. */
 305     protected void requestChartLayout() {
 306         chartContent.requestLayout();
 307     }
 308 
 309     /**
 310      * This is used to check if any given animation should run. It returns true if animation is enabled and the node
 311      * is visible and in a scene.

 312      */
 313     protected final boolean shouldAnimate(){
 314         return getAnimated() && NodeHelper.isTreeShowing(this);
 315     }
 316 
 317     /**
 318      * Called to update and layout the chart children available from getChartChildren()
 319      *
 320      * @param top The top offset from the origin to account for any padding on the chart content
 321      * @param left The left offset from the origin to account for any padding on the chart content
 322      * @param width The width of the area to layout the chart within
 323      * @param height The height of the area to layout the chart within
 324      */
 325     protected abstract void layoutChartChildren(double top, double left, double width, double height);
 326 
 327     /**
 328      * Invoked during the layout pass to layout this chart and all its content.
 329      */
 330     @Override protected void layoutChildren() {
 331         double top = snappedTopInset();




 111         @Override protected void invalidated() {
 112             titleLabel.setText(get());
 113         }
 114 
 115         @Override
 116         public Object getBean() {
 117             return Chart.this;
 118         }
 119 
 120         @Override
 121         public String getName() {
 122             return "title";
 123         }
 124     };
 125     public final String getTitle() { return title.get(); }
 126     public final void setTitle(String value) { title.set(value); }
 127     public final StringProperty titleProperty() { return title; }
 128 
 129     /**
 130      * The side of the chart where the title is displayed
 131      * @defaultValue Side.TOP
 132      */
 133     private ObjectProperty<Side> titleSide = new StyleableObjectProperty<Side>(Side.TOP) {
 134         @Override protected void invalidated() {
 135             requestLayout();
 136         }
 137 
 138         @Override
 139         public CssMetaData<Chart,Side> getCssMetaData() {
 140             return StyleableProperties.TITLE_SIDE;
 141         }
 142 
 143         @Override
 144         public Object getBean() {
 145             return Chart.this;
 146         }
 147 
 148         @Override
 149         public String getName() {
 150             return "titleSide";
 151         }


 292      */
 293     void animate(KeyFrame...keyFrames) { animator.animate(keyFrames); }
 294 
 295     /**
 296      * Play the given animation on every frame of the animation the chart will be relayed out until the animation
 297      * finishes. So to add a animation to a chart, create a animation on data model, during layoutChartContent() map
 298      * data model to nodes then call this method with the animation.
 299      *
 300      * @param animation The animation to play
 301      */
 302     protected void animate(Animation animation) { animator.animate(animation); }
 303 
 304     /** Call this when you know something has changed that needs the chart to be relayed out. */
 305     protected void requestChartLayout() {
 306         chartContent.requestLayout();
 307     }
 308 
 309     /**
 310      * This is used to check if any given animation should run. It returns true if animation is enabled and the node
 311      * is visible and in a scene.
 312      * @return true if animation is enabled and the node is visible and in a scene
 313      */
 314     protected final boolean shouldAnimate(){
 315         return getAnimated() && NodeHelper.isTreeShowing(this);
 316     }
 317 
 318     /**
 319      * Called to update and layout the chart children available from getChartChildren()
 320      *
 321      * @param top The top offset from the origin to account for any padding on the chart content
 322      * @param left The left offset from the origin to account for any padding on the chart content
 323      * @param width The width of the area to layout the chart within
 324      * @param height The height of the area to layout the chart within
 325      */
 326     protected abstract void layoutChartChildren(double top, double left, double width, double height);
 327 
 328     /**
 329      * Invoked during the layout pass to layout this chart and all its content.
 330      */
 331     @Override protected void layoutChildren() {
 332         double top = snappedTopInset();


< prev index next >