8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.scene.control.skin;
27
28 import java.lang.ref.WeakReference;
29 import java.util.ArrayList;
30 import java.util.Collections;
31 import java.util.List;
32
33 import javafx.animation.Timeline;
34 import javafx.animation.Transition;
35 import javafx.beans.binding.When;
36 import javafx.beans.property.BooleanProperty;
37 import javafx.beans.property.DoubleProperty;
38 import javafx.beans.value.WritableValue;
39 import javafx.css.CssMetaData;
40 import javafx.css.StyleableBooleanProperty;
41 import javafx.css.StyleableDoubleProperty;
42 import javafx.css.StyleableProperty;
43 import javafx.scene.Node;
44 import javafx.scene.control.Control;
45 import javafx.scene.control.ProgressBar;
46 import javafx.scene.control.ProgressIndicator;
47 import javafx.scene.control.SkinBase;
280
281 /** {@inheritDoc} */
282 @Override protected void layoutChildren(final double x, final double y,
283 final double w, final double h) {
284
285 final ProgressIndicator control = getSkinnable();
286 boolean isIndeterminate = control.isIndeterminate();
287
288 // resize clip
289 clipRegion.resizeRelocate(0, 0, w, h);
290
291 track.resizeRelocate(x, y, w, h);
292 bar.resizeRelocate(x, y, isIndeterminate ? getIndeterminateBarLength() : barWidth, h);
293
294 // things should be invisible only when well below minimum length
295 track.setVisible(true);
296
297 // width might have changed so recreate our animation if needed
298 if (isIndeterminate) {
299 createIndeterminateTimeline();
300 if (getSkinnable().impl_isTreeVisible()) {
301 indeterminateTransition.play();
302 }
303
304 // apply clip
305 bar.setClip(clipRegion);
306 } else if (indeterminateTransition != null) {
307 indeterminateTransition.stop();
308 indeterminateTransition = null;
309
310 // remove clip
311 bar.setClip(null);
312 bar.setScaleX(1);
313 bar.setTranslateX(0);
314 clipRegion.translateXProperty().unbind();
315 }
316 }
317
318
319
320 /***************************************************************************
|
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.scene.control.skin;
27
28 import com.sun.javafx.scene.NodeHelper;
29 import java.lang.ref.WeakReference;
30 import java.util.ArrayList;
31 import java.util.Collections;
32 import java.util.List;
33
34 import javafx.animation.Timeline;
35 import javafx.animation.Transition;
36 import javafx.beans.binding.When;
37 import javafx.beans.property.BooleanProperty;
38 import javafx.beans.property.DoubleProperty;
39 import javafx.beans.value.WritableValue;
40 import javafx.css.CssMetaData;
41 import javafx.css.StyleableBooleanProperty;
42 import javafx.css.StyleableDoubleProperty;
43 import javafx.css.StyleableProperty;
44 import javafx.scene.Node;
45 import javafx.scene.control.Control;
46 import javafx.scene.control.ProgressBar;
47 import javafx.scene.control.ProgressIndicator;
48 import javafx.scene.control.SkinBase;
281
282 /** {@inheritDoc} */
283 @Override protected void layoutChildren(final double x, final double y,
284 final double w, final double h) {
285
286 final ProgressIndicator control = getSkinnable();
287 boolean isIndeterminate = control.isIndeterminate();
288
289 // resize clip
290 clipRegion.resizeRelocate(0, 0, w, h);
291
292 track.resizeRelocate(x, y, w, h);
293 bar.resizeRelocate(x, y, isIndeterminate ? getIndeterminateBarLength() : barWidth, h);
294
295 // things should be invisible only when well below minimum length
296 track.setVisible(true);
297
298 // width might have changed so recreate our animation if needed
299 if (isIndeterminate) {
300 createIndeterminateTimeline();
301 if (NodeHelper.isTreeVisible(getSkinnable())) {
302 indeterminateTransition.play();
303 }
304
305 // apply clip
306 bar.setClip(clipRegion);
307 } else if (indeterminateTransition != null) {
308 indeterminateTransition.stop();
309 indeterminateTransition = null;
310
311 // remove clip
312 bar.setClip(null);
313 bar.setScaleX(1);
314 bar.setTranslateX(0);
315 clipRegion.translateXProperty().unbind();
316 }
317 }
318
319
320
321 /***************************************************************************
|