use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiRelay method createSidePanel.
private Panel createSidePanel(int side) {
String labelText = String.valueOf(RelayTileEntity.DUNSWE.charAt(side));
Label label = new Label(mc, this).setText(labelText);
label.setDesiredWidth(14).setDesiredHeight(14);
return new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(1)).addChild(label).addChild(createSubPanel(side, "Off").setDesiredWidth(115)).addChild(createSubPanel(side, "On").setDesiredWidth(115));
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class ScreenModuleGuiBuilder method nl.
@Override
public ScreenModuleGuiBuilder nl() {
if (row.size() == 1) {
panel.addChild(row.get(0).setDesiredHeight(16));
row.clear();
} else if (!row.isEmpty()) {
Panel rowPanel = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredHeight(16);
for (Widget<?> widget : row) {
rowPanel.addChild(widget);
}
panel.addChild(rowPanel);
row.clear();
}
return this;
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiDialingDevice method populateReceivers.
private void populateReceivers() {
List<TeleportDestinationClientInfo> newReceivers = fromServer_receivers;
if (newReceivers == null) {
return;
}
boolean newReceiversFiltered = favoriteButton.getCurrentChoiceIndex() == 1;
if (newReceivers.equals(receivers) && newReceiversFiltered == receiversFiltered) {
return;
}
receiversFiltered = newReceiversFiltered;
if (receiversFiltered) {
receivers = new ArrayList<>();
// We only show favorited receivers. Remove the rest.
for (TeleportDestinationClientInfo receiver : newReceivers) {
if (receiver.isFavorite()) {
receivers.add(receiver);
}
}
} else {
// Show all receivers.
receivers = new ArrayList<>(newReceivers);
}
receiverList.removeChildren();
for (TeleportDestinationClientInfo destination : receivers) {
BlockPos coordinate = destination.getCoordinate();
String dimName = destination.getDimensionName();
if (dimName == null || dimName.trim().isEmpty()) {
dimName = "Id " + destination.getDimension();
}
boolean favorite = destination.isFavorite();
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3));
panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(destination.getName()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(96).setTooltips("The name of the", "destination receiver:", destination.getName() + " (" + BlockPosTools.toString(coordinate) + ")"));
panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(dimName).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDynamic(true).setTooltips("The name of the", "destination dimension:", dimName).setDesiredWidth(110));
ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> changeFavorite()).setDesiredWidth(10);
choiceLabel.addChoice("No", "Not favorited", guielements, 131, 19);
choiceLabel.addChoice("Yes", "Favorited", guielements, 115, 19);
choiceLabel.setCurrentChoice(favorite ? 1 : 0);
panel.addChild(choiceLabel);
receiverList.addChild(panel);
}
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiDialingDevice method populateTransmitters.
private void populateTransmitters() {
List<TransmitterInfo> newTransmitters = fromServer_transmitters;
if (newTransmitters == null) {
return;
}
if (newTransmitters.equals(transmitters)) {
return;
}
transmitters = new ArrayList<>(newTransmitters);
transmitterList.removeChildren();
for (TransmitterInfo transmitterInfo : transmitters) {
BlockPos coordinate = transmitterInfo.getCoordinate();
TeleportDestination destination = transmitterInfo.getTeleportDestination();
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3));
panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setText(transmitterInfo.getName()).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(102));
panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setDynamic(true).setText(BlockPosTools.toString(coordinate)).setDesiredWidth(90));
panel.addChild(new ImageLabel(mc, this).setImage(guielements, destination.isValid() ? 80 : 96, 0).setDesiredWidth(16));
transmitterList.addChild(panel);
}
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiDialingDevice method setupReceiverPanel.
private Panel setupReceiverPanel() {
receiverList = new WidgetList(mc, this).setRowheight(14).setDesiredHeight(100).setPropagateEventsToChildren(true).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
clearSelectedStatus();
}
@Override
public void doubleClick(Widget parent, int index) {
hilightSelectedReceiver(index);
}
});
Slider receiverSlider = new Slider(mc, this).setDesiredWidth(11).setDesiredHeight(100).setVertical().setScrollable(receiverList);
return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(receiverList).addChild(receiverSlider).setDesiredHeight(106).setFilledBackground(0xff9e9e9e);
}
Aggregations