X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fjexer%2Fttree%2FTTreeViewWidget.java;h=13beac321bac9e46b0f81af48ac069efe3f5c890;hp=080a200497dfbe5389a8f62f3593688eb325fb72;hb=c4cefaa04ec122fc02efb6542451a31fdf722c32;hpb=c6815053bca27b1c2374548e06779a97651fe07d diff --git a/src/jexer/ttree/TTreeViewWidget.java b/src/jexer/ttree/TTreeViewWidget.java index 080a200..13beac3 100644 --- a/src/jexer/ttree/TTreeViewWidget.java +++ b/src/jexer/ttree/TTreeViewWidget.java @@ -268,11 +268,55 @@ public class TTreeViewWidget extends TScrollableWidget { // TScrollableWidget ------------------------------------------------------ // ------------------------------------------------------------------------ + /** + * Override TWidget's width: we need to set child widget widths. + * + * @param width new widget width + */ + @Override + public void setWidth(final int width) { + super.setWidth(width); + if (hScroller != null) { + hScroller.setWidth(getWidth() - 1); + } + if (vScroller != null) { + vScroller.setX(getWidth() - 1); + } + if (treeView != null) { + treeView.setWidth(getWidth() - 1); + } + reflowData(); + } + + /** + * Override TWidget's height: we need to set child widget heights. + * + * @param height new widget height + */ + @Override + public void setHeight(final int height) { + super.setHeight(height); + if (hScroller != null) { + hScroller.setY(getHeight() - 1); + } + if (vScroller != null) { + vScroller.setHeight(getHeight() - 1); + } + if (treeView != null) { + treeView.setHeight(getHeight() - 1); + } + reflowData(); + } + /** * Resize text and scrollbars for a new width/height. */ @Override public void reflowData() { + if (treeView == null) { + return; + } + int selectedRow = 0; boolean foundSelectedRow = false;