X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tmf%2Forg.lttng.scope.tmf2.views.ui%2Fsrc%2Forg%2Flttng%2Fscope%2Ftmf2%2Fviews%2Fui%2Fjfx%2FCountingGridPane.java;fp=tmf%2Forg.lttng.scope.tmf2.views.ui%2Fsrc%2Forg%2Flttng%2Fscope%2Ftmf2%2Fviews%2Fui%2Fjfx%2FCountingGridPane.java;h=8ed93eabb8c7497693fcd1c4a9d5e2a70a9f603f;hb=735b1ca2b2e149bb22d85df231af4239b5e5522d;hp=0000000000000000000000000000000000000000;hpb=0b55ad30f1f5ee8ca3fd0ce5ff4c40022dff8661;p=deliverable%2Ftracecompass.git diff --git a/tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/jfx/CountingGridPane.java b/tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/jfx/CountingGridPane.java new file mode 100644 index 0000000000..8ed93eabb8 --- /dev/null +++ b/tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/jfx/CountingGridPane.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v1.0 which + * accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ + +package org.lttng.scope.tmf2.views.ui.jfx; + +import javafx.scene.Node; +import javafx.scene.layout.GridPane; + +/** + * Extension of a {@link GridPane} which tracks the number of inserted rows. + * + * Make sure you only add rows to the pane using {@link #appendRow(Node...)} or + * else it will give weird results! + * + * @author Alexandre Montplaisir + */ +public class CountingGridPane extends GridPane { + + private int fNbRows = 0; + + /** + * Add a row of nodes to this grid pane. Not thread-safe! + * + * @param children + * The contents of the row + */ + public void appendRow(Node... children) { + addRow(fNbRows++, children); + } +}