FileDocCategorySizeDatePackage
StateItem.javaAPI DocAzureus 3.0.3.42537Sun Sep 23 04:54:52 BST 2007org.gudy.azureus2.ui.swt.views.tableitems.peers

StateItem

public class StateItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener

Fields Summary
Constructors Summary
public StateItem(String table_id)
Default Constructor

    super("state", POSITION_LAST, 65, table_id);
    setRefreshInterval(INTERVAL_LIVE);
  
Methods Summary
public voidrefresh(TableCell cell)

    PEPeerTransport peer = (PEPeerTransport)cell.getDataSource();  //TODO fix this "naughty" cast
    String state_text = "";
    if( peer != null ) {
      int state = peer.getConnectionState();
      
      if( !cell.setSortValue( state ) && cell.isValid() ) {
        return;
      }
      
      switch( state ) {
        case PEPeerTransport.CONNECTION_PENDING :
          state_text = MessageText.getString( "PeersView.state.pending" );
          break;
        case PEPeerTransport.CONNECTION_CONNECTING :
          state_text = MessageText.getString( "PeersView.state.connecting" );
          break;
        case PEPeerTransport.CONNECTION_WAITING_FOR_HANDSHAKE :
          state_text = MessageText.getString( "PeersView.state.handshake" );
          break;
        case PEPeerTransport.CONNECTION_FULLY_ESTABLISHED :
          state_text = MessageText.getString( "PeersView.state.established" );
          break;
      }
    }
    
    cell.setText( state_text );