Java 类edu.wpi.first.wpilibj.tables.ITableListener 实例源码

项目:snobot-2017    文件:Relay.java   
@Override
public void startLiveWindowMode() {
  m_tableListener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      String val = ((String) value);
      if (val.equals("Off")) {
        set(Value.kOff);
      } else if (val.equals("On")) {
        set(Value.kOn);
      } else if (val.equals("Forward")) {
        set(Value.kForward);
      } else if (val.equals("Reverse")) {
        set(Value.kReverse);
      }
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
项目:Frc2016FirstStronghold    文件:DoubleSolenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  set(Value.kOff); // Stop for safety
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      // TODO: this is bad also
      if (value.toString().equals("Reverse"))
        set(Value.kReverse);
      else if (value.toString().equals("Forward"))
        set(Value.kForward);
      else
        set(Value.kOff);
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:Frc2016FirstStronghold    文件:CANSpeedController.java   
/**
 * Creates an ITableListener for the LiveWindow table for this CAN speed
 * controller.
 */
public default ITableListener createTableListener() {
    return (table, key, value, isNew) -> {
        switch(key) {
            case "Enabled":
                if ((Boolean) value) {
                    enable();
                } else {
                    disable();
                }
                break;
            case "Value": set((Double) value); break;
            case "Mode": setControlMode(((Double) value).intValue()); break;
        }
        if(getControlMode().isPID()) {
          switch(key) {
              case "p": setP((Double) value); break;
              case "i": setI((Double) value); break;
              case "d": setD((Double) value); break;
              case "f": setF((Double) value); break;
          }
        }
    };
}
项目:Frc2016FirstStronghold    文件:Relay.java   
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
  m_table_listener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      String val = ((String) value);
      if (val.equals("Off")) {
        set(Value.kOff);
      } else if (val.equals("On")) {
        set(Value.kOn);
      } else if (val.equals("Forward")) {
        set(Value.kForward);
      } else if (val.equals("Reverse")) {
        set(Value.kReverse);
      }
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:FakeWPILib    文件:Relay.java   
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        @Override
        public void valueChanged(ITable itable, String key, Object value,
                                 boolean bln) {
            String val = ((String) value);
            if (val.equals("Off")) {
                set(Value.kOff);
            } else if (val.equals("On")) {
                set(Value.kOn);
            } else if (val.equals("Forward")) {
                set(Value.kForward);
            } else if (val.equals("Reverse")) {
                set(Value.kReverse);
            }
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilibj    文件:DoubleSolenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(Value.kOff); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
//TODO: this is bad also
            if (value.toString().equals("Reverse"))
    set(Value.kReverse);
else if (value.toString().equals("Forward"))
    set(Value.kForward);
else
    set(Value.kOff);
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilibj    文件:Relay.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            String val = ((String) value);
            if (val.equals("Off")) {
                set(Value.kOff);
            }
            else if (val.equals("Forward")) {
                set(Value.kForward);
            }
            else if (val.equals("Reverse")) {
                set(Value.kReverse);
            }
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:Robot-Java-2014    文件:SS_BallCatcher.java   
private static void initCatcherTable(){

    m_table.putBoolean(NETTABLE_CATCHER_CATCHER_STATE, m_solenoidCatcher.get());
    m_table.putBoolean(NETTABLE_CATCHER_FLIPPER_STATE, m_solenoidFlipper.get());
    m_table.putNumber(NETTABLE_CATCHER_SPINDLE_SCALE, m_spindleScale);
    m_tableListener = new ITableListener(){
        public void valueChanged(ITable table, String key, Object value, boolean isNew){
            if(key.equals(NETTABLE_CATCHER_CATCHER_STATE)){
                m_solenoidCatcher.set(((Boolean)value).booleanValue());
            }else if(key.equals(NETTABLE_CATCHER_FLIPPER_STATE)){
                m_solenoidFlipper.set(((Boolean)value).booleanValue());
            }else if(key.equals(NETTABLE_CATCHER_SPINDLE_SCALE)){
                setSpindleScale(((Double)value).doubleValue());
            }
        }
    };

    m_table.addTableListener(m_tableListener, true);
}
项目:Robot-Java-2014    文件:SS_Drivetrain.java   
private static void initDriveTable(){
    m_table.putNumber(NETTABLE_DRIVETRAIN_DRIVEMODE, DriveMode.ARCADE.getMode());
    m_table.putString(NETTABLE_DRIVETRAIN_DRIVEMODE_STRING, DriveMode.ARCADE.toString());
    m_table.putBoolean(NETTABLE_DRIVETRAIN_SOLENOID, DriveMode.ARCADE.getSolenoid());
    m_table.putString(NETTABLE_DRIVETRAIN_DEFAULT_COMMAND, DriveMode.ARCADE.getCommand().getName());
    m_table.putNumber(NETTABLE_DRIVETRAIN_SCALE, m_scale);
    m_tableListener = new ITableListener(){
        public void valueChanged(ITable table, String key, Object value, boolean isNew){
            if(key.equalsIgnoreCase(NETTABLE_DRIVETRAIN_DRIVEMODE)){
                new C_ChangeDrivemode(table.getNumber(NETTABLE_DRIVETRAIN_DRIVEMODE)).start();
            }else if(key.equals(NETTABLE_DRIVETRAIN_SCALE)){
                m_scale = table.getNumber(NETTABLE_DRIVETRAIN_SCALE);
            }
        }
    };

    m_table.addTableListener(m_tableListener, true);
}
项目:wpilib-java    文件:DoubleSolenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(Value.kOff); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
//TODO: this is bad also
            if (value.toString().equals("Reverse"))
    set(Value.kReverse);
else if (value.toString().equals("Forward"))
    set(Value.kForward);
else
    set(Value.kOff);
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilib-java    文件:Relay.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
            String val = ((String) value);
            if (val.equals("Off")) {
                set(Value.kOff);
            }
            else if (val.equals("Forward")) {
                set(Value.kForward);
            }
            else if (val.equals("Reverse")) {
                set(Value.kReverse);
            }
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:frc-2016    文件:MultiSpeedController.java   
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
    stopMotor(); // Stop for safety
    m_table_listener = new ITableListener() {
        @Override
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            set(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:snobot-2017    文件:CoordinateWidet2017.java   
private void initializeTrajectoryListener()
{

    ITable mTable = NetworkTable.getTable(SmartDashBoardNames.sSPLINE_NAMESPACE);
    ITableListener idealSplineListener = new ITableListener()
    {

        @Override
        public void valueChanged(ITable arg0, String arg1, Object arg2, boolean arg3)
        {
            mCoordinateGui.setPath(IdealSplineSerializer.deserializePath(arg2.toString()));
        }
    };
    mTable.addTableListener(SmartDashBoardNames.sSPLINE_IDEAL_POINTS, idealSplineListener, true);
}
项目:snobot-2017    文件:DigitalOutput.java   
@Override
public void startLiveWindowMode() {
  m_tableListener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set((Boolean) value);
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
项目:snobot-2017    文件:PWM.java   
@Override
public void startLiveWindowMode() {
  setSpeed(0); // Stop for safety
  m_tableListener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      setSpeed((Double) value);
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
项目:snobot-2017    文件:CANSpeedController.java   
/**
 * Creates an ITableListener for the LiveWindow table for this CAN speed controller.
 */
default ITableListener createTableListener() {
  return (table, key, value, isNew) -> {
    switch (key) {
      case "Enabled":
        if ((Boolean) value) {
          enable();
        } else {
          disable();
        }
        break;
      case "Value":
        set((Double) value);
        break;
      case "Mode":
        setControlMode(((Double) value).intValue());
        break;
      default:
        break;
    }
    if (getControlMode().isPID()) {
      switch (key) {
        case "p":
          setP((Double) value);
          break;
        case "i":
          setI((Double) value);
          break;
        case "d":
          setD((Double) value);
          break;
        case "f":
          setF((Double) value);
          break;
        default:
          break;
      }
    }
  };
}
项目:snobot-2017    文件:Servo.java   
@Override
public void startLiveWindowMode() {
  m_tableListener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set(((Double) value).doubleValue());
    }
  };
  m_table.addTableListener("Value", m_tableListener, true);
}
项目:Frc2016FirstStronghold    文件:DigitalOutput.java   
/**
 * {@inheritDoc}
 */
@Override
public void startLiveWindowMode() {
  m_table_listener = new ITableListener() {
    @Override
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set(((Boolean) value).booleanValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:Frc2016FirstStronghold    文件:PWM.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  setSpeed(0); // Stop for safety
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      setSpeed(((Double) value).doubleValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:Frc2016FirstStronghold    文件:Solenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  set(false); // Stop for safety
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set(((Boolean) value).booleanValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:Frc2016FirstStronghold    文件:Servo.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
  m_table_listener = new ITableListener() {
    public void valueChanged(ITable itable, String key, Object value, boolean bln) {
      set(((Double) value).doubleValue());
    }
  };
  m_table.addTableListener("Value", m_table_listener, true);
}
项目:FakeWPILib    文件:PWM.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    setSpeed(0); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            setSpeed(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:FakeWPILib    文件:Solenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(false); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            set(((Boolean) value).booleanValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:GRIP    文件:MockNetworkTable.java   
@Override
public void addTableListener(ITableListener listener, boolean immediateNotify) {
  if (immediateNotify) {
    for (String key : getKeys()) {
      listener.valueChanged(this, key, getValue(key), false);
    }
  }
  addTableListener(listener);
}
项目:GRIP    文件:MockNetworkTable.java   
@Override
public void addTableListener(String key, ITableListener listener, boolean immediateNotify) {
  if (immediateNotify) {
    listener.valueChanged(this, key, getValue(key), false);
  }
  listeners.computeIfAbsent(key, k -> new ArrayList<>()).add(listener);
}
项目:wpilibj    文件:DigitalOutput.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            set(((Boolean) value).booleanValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilibj    文件:PWM.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    setSpeed(0); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            setSpeed(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilibj    文件:Solenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(false); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            set(((Boolean) value).booleanValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilibj    文件:CANJaguar.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(0); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            set(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilibj    文件:Servo.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            set(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:Robot-Java-2014    文件:SS_Launcher.java   
private static void initLauncherTable(){
    m_table.putBoolean(NETTABLE_LAUNCHER_READY, isPreped());
    m_tableListener = new ITableListener(){
        public void valueChanged(ITable table, String key, Object value, boolean isNew){

        }
    };

    m_table.addTableListener(m_tableListener, true);
}
项目:wpilib-java    文件:DigitalOutput.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
            set(((Boolean) value).booleanValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilib-java    文件:PWM.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    setSpeed(0); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            setSpeed(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilib-java    文件:Solenoid.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(false); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
            set(((Boolean) value).booleanValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilib-java    文件:CANJaguar.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    set(0); // Stop for safety
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
            set(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:wpilib-java    文件:Servo.java   
/**
 * {@inheritDoc}
 */
public void startLiveWindowMode() {
    m_table_listener = new ITableListener() {
        public void valueChanged(ITable itable, String key, Object value, boolean bln) {
            System.out.println(key+": "+value);
            set(((Double) value).doubleValue());
        }
    };
    m_table.addTableListener("Value", m_table_listener, true);
}
项目:snobot-2017    文件:SelectAutonomous.java   
public void addChangeListener(ITableListener aListener)
{
    mSendableChooser.getTable().addTableListener(aListener);
}
项目:snobot-2017    文件:SelectStartPosition.java   
public void addChangeListener(ITableListener aListener)
{
    mPickPoint.getTable().addTableListener(aListener);
}
项目:snobot-2017    文件:DefenseInFront.java   
public void addChangeListener(ITableListener aListener)
{
    mDefenseInFront.getTable().addTableListener(aListener);
}
项目:GRIP    文件:MockNetworkTable.java   
@Override
public void addTableListener(ITableListener listener) {
  listeners.computeIfAbsent("", k -> new ArrayList<>()).add(listener);
}