Search in sources :

Example 1 with ValueEvent

use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.

the class GuiStorageScanner method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored(ForgeDirection.DOWN);
    energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setVertical().setDesiredWidth(10).setDesiredHeight(84).setMaxValue(maxEnergyStored).setShowText(false);
    energyBar.setValue(tileEntity.getCurrentRF());
    storageList = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            itemList.removeChildren();
            tileEntity.clearShowingItems();
            getInventoryOnServer();
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            hilightSelectedContainer(index);
        }
    });
    Slider storageListSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(storageList);
    Panel topPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(1)).setDesiredHeight(90).addChild(energyBar).addChild(storageList).addChild(storageListSlider);
    itemList = new WidgetList(mc, this);
    Slider itemListSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(itemList);
    Panel midPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(1)).addChild(itemList).addChild(itemListSlider);
    scanButton = new Button(mc, this).setText("Scan").setDesiredWidth(50).setDesiredHeight(14).addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            startStopScan();
        }
    }).setTooltips("Start/stop a scan of", "all storage units", "in radius");
    progressBar = new EnergyBar(mc, this).setShowText(false).setEnergyOnColor(0xff0022ee).setEnergyOffColor(0xff111163).setSpacerColor(0xff000043).setHorizontal().setMaxValue(100).setDesiredWidth(30).setValue(0);
    radiusLabel = new ScrollableLabel(mc, this).addValueEvent(new ValueEvent() {

        @Override
        public void valueChanged(Widget parent, int newValue) {
            changeRadius(newValue);
        }
    }).setRealMinimum(1).setRealMaximum(20).setDesiredWidth(30);
    radiusLabel.setRealValue(tileEntity.getRadius());
    TextField textField = new TextField(mc, this).addTextEvent(new TextEvent() {

        @Override
        public void textChanged(Widget parent, String newText) {
            storageList.clearHilightedRows();
            fromServer_coordinates.clear();
            startSearch(newText);
        }
    });
    Panel searchPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(18).addChild(new Label(mc, this).setText("Search:")).addChild(textField);
    Slider radiusSlider = new Slider(mc, this).setHorizontal().setTooltips("Radius of scan").setMinimumKnobSize(12).setScrollable(radiusLabel);
    Panel scanPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(18).addChild(scanButton).addChild(progressBar).addChild(radiusSlider).addChild(radiusLabel);
    Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setSpacing(1).setVerticalMargin(3)).addChild(topPanel).addChild(midPanel).addChild(searchPanel).addChild(scanPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    tileEntity.requestRfFromServer(RFToolsMessages.INSTANCE);
}
Also used : Window(mcjty.lib.gui.Window) TextEvent(mcjty.lib.gui.events.TextEvent) ValueEvent(mcjty.lib.gui.events.ValueEvent) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ButtonEvent(mcjty.lib.gui.events.ButtonEvent) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 2 with ValueEvent

use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.

the class GuiDimensionMonitor method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    alarmLevel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent(new ValueEvent() {

        @Override
        public void valueChanged(Widget parent, int newValue) {
            changeAlarmValue(newValue);
        }
    });
    Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setHorizontal().setTooltips("Alarm level").setScrollable(alarmLevel);
    Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmLevel).addChild(alarmSlider);
    toplevel.addChild(bottomPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, MONITOR_WIDTH, MONITOR_HEIGHT));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Slider(mcjty.lib.gui.widgets.Slider) ValueEvent(mcjty.lib.gui.events.ValueEvent) Widget(mcjty.lib.gui.widgets.Widget) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) ScrollableLabel(mcjty.lib.gui.widgets.ScrollableLabel) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 3 with ValueEvent

use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.

the class GuiEnvironmentalController method initGui.

@Override
public void initGui() {
    super.initGui();
    toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int r = tileEntity.getRadius();
    if (r < 5) {
        r = 5;
    } else if (r > 100) {
        r = 100;
    }
    int miny = tileEntity.getMiny();
    int maxy = tileEntity.getMaxy();
    Panel radiusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(25, 6, ENV_WIDTH - 30, 16));
    ScrollableLabel radius = new ScrollableLabel(mc, this).setRealMinimum(5).setRealMaximum(100).setRealValue(r).setDesiredWidth(24).addValueEvent(new ValueEvent() {

        @Override
        public void valueChanged(Widget parent, int newValue) {
            sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETRADIUS, new Argument("radius", newValue));
        }
    });
    Slider slider = new Slider(mc, this).setHorizontal().setScrollable(radius).setMinimumKnobSize(12);
    radiusPanel.addChild(new Label(mc, this).setText("Radius:")).addChild(slider).addChild(radius);
    Panel minPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(25, 24, ENV_WIDTH - 30, 16));
    minyTextField = new TextField(mc, this).setText(Integer.toString(miny)).addTextEvent(new TextEvent() {

        @Override
        public void textChanged(Widget parent, String newText) {
            sendBounds(true);
        }
    });
    maxyTextField = new TextField(mc, this).setText(Integer.toString(maxy)).addTextEvent(new TextEvent() {

        @Override
        public void textChanged(Widget parent, String newText) {
            sendBounds(false);
        }
    });
    minPanel.addChild(new Label(mc, this).setText("Height:")).addChild(minyTextField).addChild(maxyTextField);
    playersList = new WidgetList(mc, this);
    Slider playerSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(playersList);
    Panel playersPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 42, ENV_WIDTH - 30, 72)).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(playersList).addChild(playerSlider);
    Panel controlPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 118, ENV_WIDTH - 30, 16)).setLayout(new HorizontalLayout().setHorizontalMargin(1).setVerticalMargin(0).setSpacing(1));
    ChoiceLabel blacklist = new ChoiceLabel(mc, this).addChoices(MODE_BLACKLIST, MODE_WHITELIST).setDesiredWidth(30).setDesiredHeight(15).setChoiceTooltip(MODE_BLACKLIST, "Players in the list above will not get the effects").setChoiceTooltip(MODE_WHITELIST, "Players in the list above will get the effects").addChoiceEvent(new ChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, String newChoice) {
            changeBlacklistMode(newChoice);
        }
    });
    if (tileEntity.isWhitelistMode()) {
        blacklist.setChoice(MODE_WHITELIST);
    } else {
        blacklist.setChoice(MODE_BLACKLIST);
    }
    addButton = new Button(mc, this).setText("+").setDesiredHeight(15).setTooltips("Add a player to the list").addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            addPlayer();
        }
    });
    delButton = new Button(mc, this).setText("-").setDesiredHeight(15).setTooltips("Remove selected player from the list").addButtonEvent(new ButtonEvent() {

        @Override
        public void buttonClicked(Widget parent) {
            delPlayer();
        }
    });
    nameField = new TextField(mc, this);
    initRedstoneMode();
    controlPanel.addChild(blacklist).addChild(addButton).addChild(delButton).addChild(nameField).addChild(redstoneMode);
    toplevel.addChild(radiusPanel).addChild(minPanel).addChild(playersPanel).addChild(controlPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    listDirty = 0;
    requestPlayers();
}
Also used : Window(mcjty.lib.gui.Window) TextEvent(mcjty.lib.gui.events.TextEvent) Argument(mcjty.lib.network.Argument) ValueEvent(mcjty.lib.gui.events.ValueEvent) ChoiceEvent(mcjty.lib.gui.events.ChoiceEvent) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) ButtonEvent(mcjty.lib.gui.events.ButtonEvent) TextField(mcjty.lib.gui.widgets.TextField)

Example 4 with ValueEvent

use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.

the class GuiRFMonitor method initGui.

@Override
public void initGui() {
    super.initGui();
    list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            setSelectedBlock(index);
        }
    });
    listDirty = 0;
    Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(list);
    Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(list).addChild(listSlider);
    alarmModeChoiceLabel = new ChoiceLabel(mc, this).addChoices(RFMonitorMode.MODE_OFF.getDescription(), RFMonitorMode.MODE_LESS.getDescription(), RFMonitorMode.MODE_MORE.getDescription()).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Control when a redstone", "signal should be sent").addChoiceEvent(new ChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, String newChoice) {
            changeAlarmMode(RFMonitorMode.getModeFromDescription(newChoice));
        }
    });
    alarmModeChoiceLabel.setChoice(tileEntity.getAlarmMode().getDescription());
    alarmLabel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent(new ValueEvent() {

        @Override
        public void valueChanged(Widget parent, int newValue) {
            changeAlarmValue(newValue);
        }
    });
    Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setHorizontal().setMinimumKnobSize(15).setTooltips("Alarm level").setScrollable(alarmLabel);
    Panel alarmPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmModeChoiceLabel).addChild(alarmSlider).addChild(alarmLabel).setDesiredHeight(20);
    Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(listPanel).addChild(alarmPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    fromServer_clientAdjacentBlocks = new ArrayList<Coordinate>();
    RFToolsMessages.INSTANCE.sendToServer(new PacketGetAdjacentBlocks(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
}
Also used : Window(mcjty.lib.gui.Window) ValueEvent(mcjty.lib.gui.events.ValueEvent) ChoiceEvent(mcjty.lib.gui.events.ChoiceEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Coordinate(mcjty.lib.varia.Coordinate) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 5 with ValueEvent

use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.

the class GuiLiquidMonitor method initGui.

@Override
public void initGui() {
    super.initGui();
    list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            setSelectedBlock(index);
        }
    });
    listDirty = 0;
    Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(list);
    Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(list).addChild(listSlider);
    alarmModeChoiceLabel = new ChoiceLabel(mc, this).addChoices(RFMonitorMode.MODE_OFF.getDescription(), RFMonitorMode.MODE_LESS.getDescription(), RFMonitorMode.MODE_MORE.getDescription()).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Control when a redstone", "signal should be sent").addChoiceEvent(new ChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, String newChoice) {
            changeAlarmMode(RFMonitorMode.getModeFromDescription(newChoice));
        }
    });
    alarmModeChoiceLabel.setChoice(tileEntity.getAlarmMode().getDescription());
    alarmLabel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent(new ValueEvent() {

        @Override
        public void valueChanged(Widget parent, int newValue) {
            changeAlarmValue(newValue);
        }
    });
    Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setMinimumKnobSize(15).setHorizontal().setTooltips("Alarm level").setScrollable(alarmLabel);
    Panel alarmPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmModeChoiceLabel).addChild(alarmSlider).addChild(alarmLabel).setDesiredHeight(20);
    Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(listPanel).addChild(alarmPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    fromServer_clientAdjacentBlocks = new ArrayList<Coordinate>();
    RFToolsMessages.INSTANCE.sendToServer(new PacketGetAdjacentTankBlocks(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
}
Also used : Window(mcjty.lib.gui.Window) ValueEvent(mcjty.lib.gui.events.ValueEvent) ChoiceEvent(mcjty.lib.gui.events.ChoiceEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Coordinate(mcjty.lib.varia.Coordinate) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Aggregations

Window (mcjty.lib.gui.Window)5 ValueEvent (mcjty.lib.gui.events.ValueEvent)5 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)5 Panel (mcjty.lib.gui.widgets.Panel)5 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)4 ChoiceEvent (mcjty.lib.gui.events.ChoiceEvent)3 DefaultSelectionEvent (mcjty.lib.gui.events.DefaultSelectionEvent)3 ButtonEvent (mcjty.lib.gui.events.ButtonEvent)2 TextEvent (mcjty.lib.gui.events.TextEvent)2 Button (mcjty.lib.gui.widgets.Button)2 Label (mcjty.lib.gui.widgets.Label)2 TextField (mcjty.lib.gui.widgets.TextField)2 Coordinate (mcjty.lib.varia.Coordinate)2 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)1 ScrollableLabel (mcjty.lib.gui.widgets.ScrollableLabel)1 Slider (mcjty.lib.gui.widgets.Slider)1 Widget (mcjty.lib.gui.widgets.Widget)1 Argument (mcjty.lib.network.Argument)1