Package tangowidget.device

Examples of tangowidget.device.DeviceStateStatusPanel$Builder



  @Override
    public void widgetTestDescription() throws DevFailed {

    DeviceStateStatusPanel widgetBeforeStart;
    DeviceStateStatusPanel widgetAfterStart;

    // keep the same instance of JFrame for the test
    final JFrame jfBeforeStart = new JFrame();
    final JFrame jfAfterStart = new JFrame();
    final AssertErrorConf aecBeforeStart = new AssertErrorConf(jfBeforeStart);
    final AssertErrorConf aecAfterStart = new AssertErrorConf(jfAfterStart);

 

      componentInitialisationTest();
      componentNotWritableTest();

      // test invalid device Conf
      for (int i = 0; i < NB_INVALID_DEVICE_CONF_TEST; i++) {
        // reset device for test
                // initFirstDevice();

        // construct a widget with userEnable = true,alarmEnable =true,
        widgetBeforeStart = new DeviceStateStatusPanel.Builder(m_deviceName).jframe(jfBeforeStart).autoStart(false).build();
        widgetAfterStart = new DeviceStateStatusPanel.Builder(m_deviceName).jframe(jfAfterStart).build();

        // Before Start
        invalidDeviceConfigTest(widgetBeforeStart, i, aecBeforeStart, true);
        // After Start
        invalidDeviceConfigTest(widgetAfterStart, i, aecAfterStart, false);

        jfBeforeStart.remove(widgetBeforeStart);// clear jframe
        jfAfterStart.remove(widgetAfterStart);// clear jframe

        // clear
        widgetBeforeStart.stop();
        widgetAfterStart.stop();
      }

      jfBeforeStart.dispose();

      // //////////////////////////////////////////////////////////////////
      // check if we change device name, bean is updated (state, status
      // and tooltip)
      // ////////////////////////////////////////////////////////////////

      // init the 2 test device and change the state and status of device
      // 2
      initDevice();
      final DeviceData dd = new DeviceData();
      dd.insert(10);
      m_deviceProxy2.command_inout("switchState", dd);

      // create the bean and test is correctly display the sate, status
      // and tootlip device 1
      widgetAfterStart = new DeviceStateStatusPanel.Builder(m_deviceName).jframe(jfAfterStart).build();
      Sleeper.SECONDS.sleep(2);
      assertBeanShowSameDeviceValue(jfAfterStart, m_deviceProxy);
      toolTiptest(m_deviceName + "/status", getTextArea(jfAfterStart));

      // switch to device 2 and test bean is updated
      widgetAfterStart.setDeviceName(m_deviceName2);
      Sleeper.SECONDS.sleep(2);
      assertBeanShowSameDeviceValue(jfAfterStart, m_deviceProxy2);
      toolTiptest(m_deviceName2 + "/status", getTextArea(jfAfterStart));

      // clean
      widgetAfterStart.stop();
      jfAfterStart.dispose();

  }
View Full Code Here


  @Override
  protected void componentInitialisationTest() throws DevFailed {
    initFirstDevice();
    final JFrame jf = new JFrame();
    final DeviceStateStatusPanel widget = new DeviceStateStatusPanel.Builder(m_deviceName).jframe(jf).build();
    Sleeper.SECONDS.sleep(2);

    assertBeanShowSameDeviceValue(jf, m_deviceProxy);
  }
View Full Code Here

  @Override
  protected void componentNotWritableTest() throws DevFailed {
    // init
    initFirstDevice();
    final JFrame jf = new JFrame();
    final DeviceStateStatusPanel widget = new DeviceStateStatusPanel.Builder(m_deviceName).jframe(jf).build();
    Sleeper.SECONDS.sleep(2);

    // check is component not writable
    Assert.assertFalse("TexteArea shoudn't be editable", getTextArea(jf).isEditable());

    // clean
    widget.stop();
    jf.dispose();
  }
View Full Code Here

public class DeviceStateStatusPanelTest extends ABeansTest {

  @Override
  public void widgetTestDescription() throws DevFailed {

    DeviceStateStatusPanel widgetBeforeStart;
    DeviceStateStatusPanel widgetAfterStart;

    // keep the same instance of JFrame for the test
    final JFrame jfBeforeStart = new JFrame();
    final JFrame jfAfterStart = new JFrame();
    final AssertErrorConf aecBeforeStart = new AssertErrorConf(
        jfBeforeStart);
    final AssertErrorConf aecAfterStart = new AssertErrorConf(jfAfterStart);

    componentInitialisationTest();
    componentNotWritableTest();

    // test invalid device Conf
    for (int i = 0; i < NB_INVALID_DEVICE_CONF_TEST; i++) {
      // reset device for test
      // initFirstDevice();

      // construct a widget with userEnable = true,alarmEnable =true,
      widgetBeforeStart = new DeviceStateStatusPanel.Builder(m_deviceName)
          .jframe(jfBeforeStart).autoStart(false).build();
      widgetAfterStart = new DeviceStateStatusPanel.Builder(m_deviceName)
          .jframe(jfAfterStart).build();

      // Before Start
      invalidDeviceConfigTest(widgetBeforeStart, i, aecBeforeStart, true);
      // After Start
      invalidDeviceConfigTest(widgetAfterStart, i, aecAfterStart, false);

      jfBeforeStart.remove(widgetBeforeStart);// clear jframe
      jfAfterStart.remove(widgetAfterStart);// clear jframe

      // clear
      widgetBeforeStart.stop();
      widgetAfterStart.stop();
    }

    jfBeforeStart.dispose();

    // //////////////////////////////////////////////////////////////////
    // check if we change device name, bean is updated (state, status
    // and tooltip)
    // ////////////////////////////////////////////////////////////////

    // init the 2 test device and change the state and status of device
    // 2
    initDevice();
    final DeviceData dd = new DeviceData();
    dd.insert(10);
    m_deviceProxy2.command_inout("switchState", dd);

    // create the bean and test is correctly display the sate, status
    // and tootlip device 1
    widgetAfterStart = new DeviceStateStatusPanel.Builder(m_deviceName)
        .jframe(jfAfterStart).build();
    Sleeper.SECONDS.sleep(2);
    assertBeanShowSameDeviceValue(jfAfterStart, m_deviceProxy);
    toolTiptest(m_deviceName + "/status", getTextArea(jfAfterStart));

    // switch to device 2 and test bean is updated
    widgetAfterStart.setDeviceName(m_deviceName2);
    Sleeper.SECONDS.sleep(2);
    assertBeanShowSameDeviceValue(jfAfterStart, m_deviceProxy2);
    toolTiptest(m_deviceName2 + "/status", getTextArea(jfAfterStart));

    // clean
    widgetAfterStart.stop();
    jfAfterStart.dispose();

  }
View Full Code Here

  @Override
  protected void componentInitialisationTest() throws DevFailed {
    initFirstDevice();
    final JFrame jf = new JFrame();
    final DeviceStateStatusPanel widget = new DeviceStateStatusPanel.Builder(
        m_deviceName).jframe(jf).build();
    Sleeper.SECONDS.sleep(2);

    assertBeanShowSameDeviceValue(jf, m_deviceProxy);
  }
View Full Code Here

  @Override
  protected void componentNotWritableTest() throws DevFailed {
    // init
    initFirstDevice();
    final JFrame jf = new JFrame();
    final DeviceStateStatusPanel widget = new DeviceStateStatusPanel.Builder(
        m_deviceName).jframe(jf).build();
    Sleeper.SECONDS.sleep(2);

    // check is component not writable
    Assert.assertFalse("TexteArea shoudn't be editable", getTextArea(jf)
        .isEditable());

    // clean
    widget.stop();
    jf.dispose();
  }
View Full Code Here

TOP

Related Classes of tangowidget.device.DeviceStateStatusPanel$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.