Exemplo n.º 1
0
  public void updateViewFromState() {
    customSqlBox.setText(savedSqlCondition);
    showInvalid.setChecked(savedShowInvalid);

    filterList.clear();
    for (FilterData filterData : savedFilters) {
      filterList.addWidget(filterFactory.getFilterWidgetFromData(filterData));
    }
  }
Exemplo n.º 2
0
  public void handleHistoryArguments(Map<String, String> arguments) {
    setSqlCondition(arguments.get("condition"));
    savedShowInvalid = Boolean.valueOf(arguments.get("show_invalid"));
    showInvalid.setChecked(savedShowInvalid);

    filterList.clear();
    for (int index = 0; ; index++) {
      FilterData filterData = FilterData.dataFromHistory(arguments, getListKey("filter", index));
      if (filterData == null) {
        break;
      }
      filterList.addWidget(filterFactory.getFilterWidgetFromData(filterData));
    }
  }
Exemplo n.º 3
0
  public void updateStateFromView() {
    savedSqlCondition = customSqlBox.getText().trim();
    savedShowInvalid = showInvalid.isChecked();

    savedFilters.clear();
    for (TestFilterWidget filter : filterList.getWidgets()) {
      savedFilters.add(filter.getFilterData());
    }
  }
Exemplo n.º 4
0
  private void initRadarPanel() {
    final WidgetList<RadarCFG.MarkerCheck> markers =
        new WidgetList<RadarCFG.MarkerCheck>(new Coord(200, 16), 20) {
          @Override
          protected void itemclick(RadarCFG.MarkerCheck item, int button) {
            if (button == 1) {
              item.set(!item.a);
            }
          }
        };
    markers.canselect = false;
    radar.add(markers, 225, 0);

    WidgetList<RadarCFG.GroupCheck> groups =
        radar.add(
            new WidgetList<RadarCFG.GroupCheck>(new Coord(200, 16), 20) {
              @Override
              public void selected(RadarCFG.GroupCheck item) {
                markers.clear(true);
                for (RadarCFG.MarkerCFG marker : item.group.markerCFGs) {
                  markers.additem(new RadarCFG.MarkerCheck(marker));
                }
              }
            });
    for (RadarCFG.Group group : RadarCFG.groups) {
      groups.additem(new RadarCFG.GroupCheck(group)).hitbox = true;
    }

    radar.add(
        new Button(60, "Save") {
          @Override
          public void click() {
            RadarCFG.save();
          }
        },
        183,
        groups.sz.y + 10);

    radar.pack();
    radar.add(new PButton(200, "Back", 27, main), radar.sz.x / 2 - 100, radar.sz.y + 35);
    radar.pack();
  }
Exemplo n.º 5
0
  private void updateContentsList() {
    List<ItemStack> items = tileEntity.getShowingItems();
    if (itemList.getMaximum() == 0) {
      // We need to refresh.
      for (ItemStack stack : items) {
        if (stack != null) {
          String displayName = BlockInfo.getReadableName(stack, 0);

          Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
          panel.addChild(new BlockRender(mc, this).setRenderItem(stack));
          panel.addChild(
              new Label(mc, this)
                  .setDynamic(true)
                  .setText(displayName)
                  .setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT));
          itemList.addChild(panel);
        }
      }
    }
  }
Exemplo n.º 6
0
 private InvBlockInfo getSelectedContainer() {
   int selected = storageList.getSelected();
   if (selected != -1) {
     SyncedValueList<InvBlockInfo> inventories = tileEntity.getInventories();
     if (selected < inventories.size()) {
       InvBlockInfo invBlockInfo = inventories.get(selected);
       return invBlockInfo;
     }
   }
   return null;
 }
Exemplo n.º 7
0
  private void initShortcutsPanel() {
    WidgetList<KeyBinder.ShortcutWidget> list =
        shortcuts.add(
            new WidgetList<KeyBinder.ShortcutWidget>(new Coord(300, 24), 16) {
              @Override
              public boolean mousedown(Coord c0, int button) {
                boolean result = super.mousedown(c0, button);
                KeyBinder.ShortcutWidget item = itemat(c0);
                if (item != null) {
                  c0 = c0.add(0, sb.val * itemsz.y);
                  item.mousedown(c0.sub(item.parentpos(this)), button);
                }
                return result;
              }

              @Override
              public Object tooltip(Coord c0, Widget prev) {
                KeyBinder.ShortcutWidget item = itemat(c0);
                if (item != null) {
                  c0 = c0.add(0, sb.val * itemsz.y);
                  return item.tooltip(c0, prev);
                }
                return super.tooltip(c, prev);
              }
            });
    list.canselect = false;
    KeyBinder.makeWidgets(
            () -> {
              for (int i = 0; i < list.listitems(); i++) {
                list.listitem(i).update();
              }
              return null;
            })
        .forEach(list::additem);
    shortcuts.pack();
    shortcuts.add(
        new PButton(200, "Back", 27, main), shortcuts.sz.x / 2 - 100, shortcuts.sz.y + 35);
    shortcuts.pack();
  }
Exemplo n.º 8
0
  private void updateStorageList() {
    SyncedValueList<InvBlockInfo> inventories = tileEntity.getInventories();
    if (inventories.getClientVersion() != clientVersion) {
      clientVersion = inventories.getClientVersion();
      storageList.removeChildren();
      for (InvBlockInfo blockInfo : inventories) {
        Coordinate c = blockInfo.getCoordinate();
        Block block = mc.theWorld.getBlock(c.getX(), c.getY(), c.getZ());
        int meta = mc.theWorld.getBlockMetadata(c.getX(), c.getY(), c.getZ());
        String displayName;
        if (block == null || block.isAir(mc.theWorld, c.getX(), c.getY(), c.getZ())) {
          displayName = "[REMOVED]";
          block = null;
        } else {
          displayName = BlockInfo.getReadableName(block, meta);
        }

        Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
        panel.addChild(new BlockRender(mc, this).setRenderItem(block));
        panel.addChild(
            new Label(mc, this)
                .setText(displayName)
                .setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT)
                .setDesiredWidth(90));
        panel.addChild(new Label(mc, this).setDynamic(true).setText(c.toString()));
        storageList.addChild(panel);
      }
    }
    storageList.clearHilightedRows();
    Set<Coordinate> coordinates = fromServer_coordinates;
    int i = 0;
    for (InvBlockInfo blockInfo : inventories) {
      Coordinate c = blockInfo.getCoordinate();
      if (coordinates.contains(c)) {
        storageList.addHilightedRow(i);
      }
      i++;
    }
  }