Permalink
Browse files

Merge pull request #68 from mkaring/1.4

Improved ListBox slightly
  • Loading branch information...
2 parents fb2b1e8 + 904f7a7 commit 3a9ecb3d21915bbd6e7a44e9bdbbc36ea0177320 @void256 void256 committed Nov 24, 2012
@@ -126,7 +126,6 @@ public void bind(
ensureVerticalScrollbar();
createLabels();
initializeScrollPanel(screen);
- setElementHeight();
initializeScrollElementHeight();
listBoxImpl.updateView(0);
initializeHorizontalScrollbar();
@@ -297,20 +296,19 @@ public void updateTotalWidth(final int newWidth) {
nifty.executeEndOfFrameElementActions();
screen.layoutLayers();
- setElementHeight();
subscribeHorizontalScrollbar();
}
} else if (newWidth <= listBoxPanelElement.getWidth()) {
if (horizontal != null) {
unsubscribeHorizontalScrollbar();
nifty.removeElement(screen, horizontal);
nifty.executeEndOfFrameElementActions();
- setElementHeight();
}
}
}
initializeHorizontalScrollbar();
ensureWidthConstraints();
+ getElement().getParent().layoutElements();
}
public void ensureWidthConstraints() {
@@ -541,7 +539,7 @@ private void initializeScrollPanel(final Screen screen) {
updateBottomRightElement();
nifty.executeEndOfFrameElementActions();
- screen.layoutLayers();
+ getElement().getParent().layoutElements();
}
private void updateBottomRightElement() {
@@ -634,11 +632,6 @@ private void ensureVerticalScrollbar() {
}
}
- private void setElementHeight() {
- getElement().setConstraintHeight(new SizeValue(displayItems * labelTemplateHeight + findHorizontalScrollbarHeight() + "px"));
- screen.layoutLayers();
- }
-
private int findHorizontalScrollbarHeight() {
int horizontalScrollbarElementHeight = 0;
Element horizontalScrollbarElement = getElement().findElementByName("#horizontal-scrollbar");
@@ -4,7 +4,7 @@
<panel childLayout="vertical">
<panel id="#scrollpanel" childLayout="horizontal">
<panel id="#panel" childLayout="absolute" childClip="true" style="#scrollpanel" controller="de.lessvoid.nifty.controls.listbox.ListBoxPanel" inputMapping="de.lessvoid.nifty.input.mapping.MenuInputMapping">
- <panel id="#child-root" width="100%" childLayout="vertical" visibleToMouse="true">
+ <panel id="#child-root" childLayout="vertical" visibleToMouse="true">
<interact onMouseWheel="mouseWheel()" />
<!-- this is the template element used for the listbox items -->
<text text="Template" style="nifty-listbox-item" controller="de.lessvoid.nifty.controls.listbox.ListBoxItemController" inputMapping="de.lessvoid.nifty.input.mapping.MenuInputMapping"/>

0 comments on commit 3a9ecb3

Please sign in to comment.