Package fr.soleil.globalscreen.tangowidget.attribute

Examples of fr.soleil.globalscreen.tangowidget.attribute.MultiAttributeDualSpectrumChart$Builder


    // Initialiser le device et le composant
    initFirstDevice();
    initSecondDevice();

    final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
        xAttributeNameList, yAttributeNameList)
        .displayAttributeLabel(false).jframe(jf1).build();

    Sleeper.SECONDS.sleep(2);

    final JButton hideBtn = tth.findButtonByText(jf1, "Hide");
    Assert.assertTrue("Hide button should be visible", hideBtn != null);

    final JButton displayBtn = tth.findButtonByText(jf1, "Display");
    Assert.assertTrue("Display button should be visible",
        displayBtn != null);

    final JButton freezeValuesBtn = tth.findButtonByText(jf1,
        "Freeze Values");
    Assert.assertTrue("Hide button should be visible",
        freezeValuesBtn != null);

    final JButton clearFreezesBtn = tth.findButtonByText(jf1,
        "Clear Freezes");
    Assert.assertTrue("Hide button should be visible",
        clearFreezesBtn != null);

    final Component[] cbxArray = new ComponentFinderSorter(JComboBox.class)
        .findAndSort(jf1);
    Assert.assertTrue("combos should be visible", cbxArray != null);
    Assert.assertTrue("2 combos should be visible", cbxArray.length == 2);

    final JComboBox visibleDataCbx = (JComboBox) cbxArray[0];
    final JComboBox hideDataCbx = (JComboBox) cbxArray[1];

    Sleeper.SECONDS.sleep(5);
    Assert.assertTrue("visible data combo should contain "
        + yAttributeNameList.length + " elements",
        visibleDataCbx.getItemCount() == yAttributeNameList.length);

    Assert.assertTrue("hide data combo should be empty",
        hideDataCbx.getItemCount() == 0);

    for (int i = 0; i < yAttributeNameList.length; i++) {
      Assert.assertTrue(
          "visible data combo should contain attribute names",
          visibleDataCbx.getItemAt(i).equals(yAttributeNameList[i]));
    }

    // tth.enterIndexForCombo(visibleDataCbx, 1);
    tth.enterText(visibleDataCbx, yAttributeNameList[1]);
    tth.click(hideBtn);

    Sleeper.SECONDS.sleep(1);

    Assert.assertTrue(
        "visible data combo should contain "
            + (yAttributeNameList.length - 1) + " elements",
        visibleDataCbx.getItemCount() == (yAttributeNameList.length - 1));
    Assert.assertTrue("hide data combo should contain 1 element",
        hideDataCbx.getItemCount() == 1);

    Assert.assertTrue("hide data combo should contain "
        + yAttributeNameList[1],
        hideDataCbx.getItemAt(0).equals(yAttributeNameList[1]));

    tth.enterText(visibleDataCbx, yAttributeNameList[2]);
    tth.click(hideBtn);

    Assert.assertTrue(
        "visible data combo should contain "
            + (yAttributeNameList.length - 2) + " elements",
        visibleDataCbx.getItemCount() == (yAttributeNameList.length - 2));
    Assert.assertTrue("hide data combo should contain 2 elements",
        hideDataCbx.getItemCount() == 2);

    Assert.assertTrue("hide data combo should contain "
        + yAttributeNameList[2],
        hideDataCbx.getItemAt(1).equals(yAttributeNameList[2]));

    tth.enterText(hideDataCbx, yAttributeNameList[1]);
    tth.click(displayBtn);

    Assert.assertTrue("hide data combo should contain 1 element",
        hideDataCbx.getItemCount() == 1);
    Assert.assertTrue(
        "visible data combo should contain "
            + (yAttributeNameList.length - 1) + " elements",
        visibleDataCbx.getItemCount() == (yAttributeNameList.length - 1));

    Assert.assertTrue("hide data combo should contain "
        + yAttributeNameList[2],
        hideDataCbx.getItemAt(0).equals(yAttributeNameList[2]));

    widget.setVisible(false);
    Assert.assertTrue("widget should not be visible", !hideBtn.isShowing());

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


    jf1 = new JFrame();

    // Initialiser le device et le composant
    initFirstDevice();

    final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
        xAttributeNameList, yAttributeNameList).jframe(jf1).build();

    Sleeper.SECONDS.sleep(2);

    final Component[] cbxArray = new ComponentFinderSorter(JComboBox.class)
        .findAndSort(jf1);
    Assert.assertTrue("combos should be visible", cbxArray != null);
    Assert.assertTrue("2 combos should be visible", cbxArray.length == 2);

    final JComboBox visibleDataCbx = (JComboBox) cbxArray[0];

    Assert.assertTrue("visible data combo should contain 1 element",
        visibleDataCbx.getItemCount() == 1);

    Object o = visibleDataCbx.getItemAt(0);

    final int index = visibleDataCbx.getSelectedIndex();
    final String[] displayed = ((IComboBox) visibleDataCbx)
        .getDisplayedList();
    if ((displayed != null) && (index > -1) && (index < displayed.length)) {
      o = displayed[index];
    }

    Assert.assertTrue("visible data combo should contain label name",
        String.valueOf(o).compareTo(displayName) == 0);

    // V�rifier l'existance de la l�gende
    final JLChartLegend legend = (JLChartLegend) tth.findFirstComponent(
        JLChartLegend.class, jf1);
    Assert.assertTrue("Legend section is not visible", legend != null);
    // V�rifier la pr�sence de la l�gende
    final JLChart chart = (JLChart) tth.findFirstComponent(JLChart.class,
        jf1);
    final JLDataView view = chart.getDataView(m_deviceName + "/"
        + yAttributeName);
    if (view != null) {
      Assert.assertTrue("Legend section is not visible", view
          .getDisplayName().compareTo(displayName) == 0);
    }

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

    final double[] xData = da.extractDoubleArray();

    da = m_deviceProxy.read_attribute(yAttributeName);
    final double[] yData = da.extractDoubleArray();

    final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
        xAttributeNameList, yAttributeNameList).jframe(jf1).build();

    Sleeper.SECONDS.sleep(2);

    final JLChart chart = (JLChart) tth.findFirstComponent(JLChart.class,
        jf1);
    Assert.assertTrue("JLChart component not found", chart != null);

    final ITableListenerImpl listenerTest = new ITableListenerImpl();
    widget.addTableListener(listenerTest);

    tth.mouseClickOnComponent(chart);
    Sleeper.SECONDS.sleep(5);

    final int notifCount = listenerTest.getNotifyCount();
    Assert.assertTrue("listener has been notified " + notifCount
        + " instead of 6 times ", notifCount == 6);
    Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)") != null);
    Assert.assertTrue(listenerTest
        .getNotification("selectedXChanged(double)") != null);
    Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)") != null);
    Assert.assertTrue(listenerTest
        .getNotification("selectedYChanged(double)") != null);
    Assert.assertTrue(listenerTest.getNotification("selectedPointChanged") != null);

    // le clic est effectu� au milieu du composant
    final double xClick = xData[xData.length / 2]; // le spectre en x est
                            // lin�aire
    final double yClick = yData[yData.length / 2];

    // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)").equals((int)xClick));
    // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(double)").equals(xClick));
    // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)").equals((int)yClick));
    // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(double)").equals(yClick));

    widget.removeTableListener(listenerTest);
    listenerTest.reset();

    tth.mouseClickOnComponent(chart);
    Sleeper.SECONDS.sleep(1);

    Assert.assertTrue("listener should not be notified",
        listenerTest.getNotifyCount() == 0);

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

        // Initialiser le device et le composant
        initFirstDevice();
        initSecondDevice();

        final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
                xAttributeNameList, yAttributeNameList).displayAttributeLabel(false).jframe(jf1)
                .build();

        Sleeper.SECONDS.sleep(2);

        final JButton hideBtn = tth.findButtonByText(jf1, "Hide");
        Assert.assertTrue("Hide button should be visible", hideBtn != null);

        final JButton displayBtn = tth.findButtonByText(jf1, "Display");
        Assert.assertTrue("Display button should be visible", displayBtn != null);

        final JButton freezeValuesBtn = tth.findButtonByText(jf1, "Freeze Values");
        Assert.assertTrue("Hide button should be visible", freezeValuesBtn != null);

        final JButton clearFreezesBtn = tth.findButtonByText(jf1, "Clear Freezes");
        Assert.assertTrue("Hide button should be visible", clearFreezesBtn != null);

        final Component[] cbxArray = new ComponentFinderSorter(JComboBox.class).findAndSort(jf1);
        Assert.assertTrue("combos should be visible", cbxArray != null);
        Assert.assertTrue("2 combos should be visible", cbxArray.length == 2);

        final JComboBox visibleDataCbx = (JComboBox) cbxArray[0];
        final JComboBox hideDataCbx = (JComboBox) cbxArray[1];

        Sleeper.SECONDS.sleep(5);
        Assert.assertTrue("visible data combo should contain " + yAttributeNameList.length
                + " elements", visibleDataCbx.getItemCount() == yAttributeNameList.length);

        Assert.assertTrue("hide data combo should be empty", hideDataCbx.getItemCount() == 0);

        for (int i = 0; i < yAttributeNameList.length; i++) {
            Assert.assertTrue("visible data combo should contain attribute names", visibleDataCbx
                    .getItemAt(i).equals(yAttributeNameList[i]));
        }

        // tth.enterIndexForCombo(visibleDataCbx, 1);
        tth.enterText(visibleDataCbx, yAttributeNameList[1]);
        tth.click(hideBtn);

        Sleeper.SECONDS.sleep(1);

        Assert.assertTrue("visible data combo should contain " + (yAttributeNameList.length - 1)
                + " elements", visibleDataCbx.getItemCount() == (yAttributeNameList.length - 1));
        Assert.assertTrue("hide data combo should contain 1 element",
                hideDataCbx.getItemCount() == 1);

        Assert.assertTrue("hide data combo should contain " + yAttributeNameList[1], hideDataCbx
                .getItemAt(0).equals(yAttributeNameList[1]));

        tth.enterText(visibleDataCbx, yAttributeNameList[2]);
        tth.click(hideBtn);

        Assert.assertTrue("visible data combo should contain " + (yAttributeNameList.length - 2)
                + " elements", visibleDataCbx.getItemCount() == (yAttributeNameList.length - 2));
        Assert.assertTrue("hide data combo should contain 2 elements",
                hideDataCbx.getItemCount() == 2);

        Assert.assertTrue("hide data combo should contain " + yAttributeNameList[2], hideDataCbx
                .getItemAt(1).equals(yAttributeNameList[2]));

        tth.enterText(hideDataCbx, yAttributeNameList[1]);
        tth.click(displayBtn);

        Assert.assertTrue("hide data combo should contain 1 element",
                hideDataCbx.getItemCount() == 1);
        Assert.assertTrue("visible data combo should contain " + (yAttributeNameList.length - 1)
                + " elements", visibleDataCbx.getItemCount() == (yAttributeNameList.length - 1));

        Assert.assertTrue("hide data combo should contain " + yAttributeNameList[2], hideDataCbx
                .getItemAt(0).equals(yAttributeNameList[2]));

        widget.setVisible(false);
        Assert.assertTrue("widget should not be visible", !hideBtn.isShowing());

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

        jf1 = new JFrame();

        // Initialiser le device et le composant
        initFirstDevice();

        final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
                xAttributeNameList, yAttributeNameList).jframe(jf1).build();

        Sleeper.SECONDS.sleep(2);

        final Component[] cbxArray = new ComponentFinderSorter(JComboBox.class).findAndSort(jf1);
        Assert.assertTrue("combos should be visible", cbxArray != null);
        Assert.assertTrue("2 combos should be visible", cbxArray.length == 2);

        final JComboBox visibleDataCbx = (JComboBox) cbxArray[0];

        Assert.assertTrue("visible data combo should contain 1 element",
                visibleDataCbx.getItemCount() == 1);

        Object o = visibleDataCbx.getItemAt(0);

        final int index = visibleDataCbx.getSelectedIndex();
        final String[] displayed = ((IComboBox) visibleDataCbx).getDisplayedList();
        if ((displayed != null) && (index > -1) && (index < displayed.length)) {
            o = displayed[index];
        }

        Assert.assertTrue("visible data combo should contain label name", String.valueOf(o)
                .compareTo(displayName) == 0);

        // V�rifier l'existance de la l�gende
        final JLChartLegend legend = (JLChartLegend) tth.findFirstComponent(JLChartLegend.class,
                jf1);
        Assert.assertTrue("Legend section is not visible", legend != null);
        // V�rifier la pr�sence de la l�gende
        final JLChart chart = (JLChart) tth.findFirstComponent(JLChart.class, jf1);
        final JLDataView view = chart.getDataView(m_deviceName + "/" + yAttributeName);
        if (view != null) {
            Assert.assertTrue("Legend section is not visible",
                    view.getDisplayName().compareTo(displayName) == 0);
        }

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

        final double[] xData = da.extractDoubleArray();

        da = m_deviceProxy.read_attribute(yAttributeName);
        final double[] yData = da.extractDoubleArray();

        final MultiAttributeDualSpectrumChart widget = new MultiAttributeDualSpectrumChart.Builder(
                xAttributeNameList, yAttributeNameList).jframe(jf1).build();

        Sleeper.SECONDS.sleep(2);

        final JLChart chart = (JLChart) tth.findFirstComponent(JLChart.class, jf1);
        Assert.assertTrue("JLChart component not found", chart != null);

        final ITableListenerImpl listenerTest = new ITableListenerImpl();
        widget.addTableListener(listenerTest);

        tth.mouseClickOnComponent(chart);
        Sleeper.SECONDS.sleep(5);

        final int notifCount = listenerTest.getNotifyCount();
        Assert.assertTrue("listener has been notified " + notifCount + " instead of 6 times ",
                notifCount == 6);
        Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedXChanged(double)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedYChanged(double)") != null);
        Assert.assertTrue(listenerTest.getNotification("selectedPointChanged") != null);

        // le clic est effectu� au milieu du composant
        final double xClick = xData[xData.length / 2]; // le spectre en x est lin�aire
        final double yClick = yData[yData.length / 2];

        // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(int)").equals((int)xClick));
        // Assert.assertTrue(listenerTest.getNotification("selectedXChanged(double)").equals(xClick));
        // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(int)").equals((int)yClick));
        // Assert.assertTrue(listenerTest.getNotification("selectedYChanged(double)").equals(yClick));

        widget.removeTableListener(listenerTest);
        listenerTest.reset();

        tth.mouseClickOnComponent(chart);
        Sleeper.SECONDS.sleep(1);

        Assert.assertTrue("listener should not be notified", listenerTest.getNotifyCount() == 0);

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

TOP

Related Classes of fr.soleil.globalscreen.tangowidget.attribute.MultiAttributeDualSpectrumChart$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.