Search in sources :

Example 41 with HorizontalLayout

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));
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 42 with HorizontalLayout

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;
}
Also used : HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 43 with HorizontalLayout

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);
    }
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Keyboard(org.lwjgl.input.Keyboard) Label(mcjty.lib.gui.widgets.Label) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) BlockPosTools(mcjty.lib.varia.BlockPosTools) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Panel(mcjty.lib.gui.widgets.Panel) Vec3d(net.minecraft.util.math.Vec3d) PacketRequestIntegerFromServer(mcjty.lib.network.PacketRequestIntegerFromServer) Logging(mcjty.lib.varia.Logging) RFTools(mcjty.rftools.RFTools) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) BlockPos(net.minecraft.util.math.BlockPos) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) EmptyContainer(mcjty.lib.container.EmptyContainer) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) BlockPos(net.minecraft.util.math.BlockPos) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 44 with HorizontalLayout

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);
    }
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) BlockPos(net.minecraft.util.math.BlockPos) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 45 with HorizontalLayout

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);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Aggregations

HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)75 Panel (mcjty.lib.gui.widgets.Panel)55 Window (mcjty.lib.gui.Window)38 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)32 TextField (mcjty.lib.gui.widgets.TextField)25 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)24 java.awt (java.awt)21 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)21 List (java.util.List)20 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)20 Button (mcjty.lib.gui.widgets.Button)20 Argument (mcjty.lib.network.Argument)19 RFTools (mcjty.rftools.RFTools)19 BlockPos (net.minecraft.util.math.BlockPos)19 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 StyleConfig (mcjty.lib.base.StyleConfig)16 ResourceLocation (net.minecraft.util.ResourceLocation)15 Minecraft (net.minecraft.client.Minecraft)14 EmptyContainer (mcjty.lib.container.EmptyContainer)13