Ejemplo n.º 1
0
  ClauseOrder(QueryClauses clauses) {
    super(new GridLayout(1, 2));

    this.clauses = clauses;

    DefaultPanel pnl;
    JToolBar bar;
    JScrollPane scroll;

    DefaultTableModel model =
        new DefaultTableModel(0, 2) {
          public boolean isCellEditable(int row, int column) {
            return column == 0;
          }
        };

    this.add(pnl = new DefaultPanel());
    pnl.setCenterComponent(
        scroll = new JScrollPane(availableExpressions = new JList(new DefaultListModel())));
    pnl.setEastComponent(bar = new JToolBar(JToolBar.VERTICAL));
    bar.add(createButton("put >", PUT));
    bar.add(createButton("< push", PUSH));
    bar.setFloatable(false);

    this.add(pnl = new DefaultPanel());
    pnl.setCenterComponent(scroll = new JScrollPane(selectedExpressions = new JTable(model)));
    pnl.setEastComponent(bar = new JToolBar(JToolBar.VERTICAL));
    bar.add(createButton("up", UP));
    bar.add(createButton("down", DOWN));
    bar.setFloatable(false);
    scroll.getViewport().setBackground(selectedExpressions.getBackground());

    TableColumn tableColumn = selectedExpressions.getColumn(selectedExpressions.getColumnName(0));
    tableColumn.setCellEditor(new CheckBoxCellRenderer());
    tableColumn.setCellRenderer(new CheckBoxCellRenderer());
    tableColumn.setPreferredWidth(15);
    tableColumn.setMaxWidth(15);
    tableColumn.setResizable(false);

    selectedExpressions.setIntercellSpacing(new Dimension(0, 0));
    selectedExpressions.setShowGrid(false);
    selectedExpressions.setColumnSelectionAllowed(false);
    selectedExpressions.setDefaultRenderer(Boolean.class, new CheckBoxCellRenderer());
    selectedExpressions.getTableHeader().setPreferredSize(new Dimension(0, 0));
    selectedExpressions.getTableHeader().setVisible(false);
  }
  @Override
  public void draw(int i, int j) {
    TextRadarComponent.players.clear();
    inOrder.clear();
    super.draw(i, j);
    for (Object o : Resilience.getInstance().getInvoker().getEntityList()) {
      if ((Entity) o instanceof EntityOtherPlayerMP) {
        EntityOtherPlayerMP otherPlayer;
        otherPlayer = (EntityOtherPlayerMP) o;
        if (!Resilience.getInstance()
            .getInvoker()
            .getPlayerName(otherPlayer)
            .equalsIgnoreCase(Resilience.getInstance().getInvoker().getSessionUsername())) {
          inOrder.add(
              new TextRadarComponent(
                  Resilience.getInstance()
                      .getInvoker()
                      .stripControlCodes(
                          Resilience.getInstance().getInvoker().getPlayerName(otherPlayer)),
                  (int)
                      Resilience.getInstance()
                          .getInvoker()
                          .getDistanceToEntity(
                              otherPlayer, Resilience.getInstance().getWrapper().getPlayer()),
                  getX() + 3,
                  getY() + count,
                  FriendManager.isFriend(otherPlayer.func_145748_c_().getUnformattedText()),
                  this));
        }
      }
    }

    Collections.sort(inOrder);
    for (TextRadarComponent rad : inOrder) {
      TextRadarComponent.players.add(
          new TextRadarComponent(
              rad.getName(),
              (int) rad.getBlocksAway(),
              getX() + 3,
              count + getY() + 4,
              FriendManager.isFriend(rad.getName()),
              this));
      count += 15;
    }

    if (inOrder.size() != 0 && isExtended()) {
      Utils.drawRect(
          getX(), getY() + 17, getX1(), getY() + (15 * inOrder.size() + 20.5F), 0x99040404);
    }
    for (TextRadarComponent radar1 : TextRadarComponent.players) {
      if (isExtended()) {
        radar1.draw(i, j);
      }
    }
    count = 16;
  }