use of com.ldtteam.blockout.Pane in project Structurize by ldtteam.
the class ScrollingGroup method adjustChild.
@Override
public void adjustChild(final Pane child) {
int childY = 0;
if (children.size() >= 2) {
final Pane lastChild = children.get(children.size() - 2);
childY = lastChild.getY() + lastChild.getHeight();
}
child.setPosition(0, childY);
child.setSize(getInteriorWidth(), child.getHeight());
}
use of com.ldtteam.blockout.Pane in project Structurize by ldtteam.
the class ScrollingListContainer method refreshElementPanes.
/**
* Creates, deletes, and updates existing Panes for elements in the list based on the DataProvider.
*
* @param dataProvider data provider object, shouldn't be null.
* @param listNodeParams the xml parameters for this pane.
*/
public void refreshElementPanes(final ScrollingList.DataProvider dataProvider, final PaneParams listNodeParams, final int height) {
final int numElements = (dataProvider != null) ? dataProvider.getElementCount() : 0;
if (dataProvider != null) {
for (int i = 0; i < numElements; ++i) {
final Pane child;
if (listElementHeight * i + listElementHeight >= scrollY && listElementHeight * i <= scrollY + height) {
if (i < children.size()) {
child = children.get(i);
} else {
child = Loader.createFromPaneParams(listNodeParams, this);
if (child == null) {
continue;
}
if (i == 0) {
listElementHeight = child.getHeight();
}
}
child.setPosition(0, i * listElementHeight);
dataProvider.updateElement(i, child);
}
}
}
while (children.size() > numElements) {
removeChild(children.get(numElements));
}
setContentHeight(numElements * listElementHeight);
}
use of com.ldtteam.blockout.Pane in project Structurize by ldtteam.
the class Group method removeChild.
@Override
public void removeChild(@NotNull final Pane child) {
super.removeChild(child);
final int formerChildY = child.getY();
final int formerChildHeight = child.getHeight();
for (@NotNull final Pane c : children) {
if (c.getY() > formerChildY) {
c.moveBy(0, -formerChildHeight);
}
}
}
use of com.ldtteam.blockout.Pane in project Structurize by ldtteam.
the class Group method adjustChild.
@Override
public void adjustChild(@NotNull final Pane child) {
int childX = child.getX();
int childY = spacing;
int childWidth = child.getWidth();
final int childHeight = child.getHeight();
// Adjust for horizontal size and alignment
if (childWidth < 0) {
childWidth = getInteriorWidth();
} else if (child.getAlignment().isRightAligned()) {
childX = (getInteriorWidth() - childWidth) - childX;
} else if (child.getAlignment().isHorizontalCentered()) {
childX = ((getInteriorWidth() - childWidth) / 2) + childX;
}
for (@NotNull final Pane c : children) {
if (c == child) {
break;
}
childY = c.getY() + c.getHeight() + spacing;
}
child.setSize(childWidth, childHeight);
child.setPosition(childX, childY);
}
use of com.ldtteam.blockout.Pane in project minecolonies by ldtteam.
the class WindowPostBox method requestClicked.
/**
* Action executed when request is clicked.
*
* @param button the clicked button.
*/
private void requestClicked(final Button button) {
final int row = stackList.getListElementIndexByPane(button);
final ItemStack stack = allItems.get(row);
int qty = stack.getMaxStackSize();
for (final Pane child : button.getParent().getChildren()) {
if (child.getID().equals(INPUT_QTY)) {
try {
qty = Integer.parseInt(((TextField) child).getText());
} catch (final NumberFormatException ex) {
// Be quiet about it.
}
}
}
Network.getNetwork().sendToServer(new PostBoxRequestMessage(buildingView, stack.copy(), qty, deliverAvailable));
}
Aggregations