Package fr.soleil.globalscreen.tangowidget.attribute

Examples of fr.soleil.globalscreen.tangowidget.attribute.AttributeImagePanel


        // Initialiser le device et le composant
        initFirstDevice();
        int data[] = readImageAttribute(m_deviceProxy, attributeName);

        final AttributeImagePanel widget = new AttributeImagePanel.Builder(m_deviceName,
                attributeName).jframe(jf1).build();
        Sleeper.SECONDS.sleep(2);

        final NumberMatrix numberMatrix = widget.getData();
        Assert.assertTrue("Widget doesn't reflect image attribute", equality(numberMatrix, data));

        // modifier la valeur de l'attribut
        for (int i = 0; i < data.length; i++) {
            data[i] += i;
        }

        m_deviceProxy.write_attribute(new DeviceAttribute(attributeName, data, numberMatrix
                .getWidth(), numberMatrix.getHeight()));

        // attendre la mise � jour du composant
        Sleeper.SECONDS.sleep(1);
        Assert.assertTrue("Widget doesn't reflect image attribute",
                equality(widget.getData(), data));

        // SteUserEnabled en cours de vie du composant
        widget.setUserEnabled(false);
        notEditableBehaviour(jf1);

        // Faire varier le nom de l'attribut
        attributeName = "int_image_ro";
        data = readImageAttribute(m_deviceProxy2, attributeName);

        widget.setAttributeName(attributeName);
        // attendre la mise � jour du composant
        Sleeper.SECONDS.sleep(1);
        Assert.assertTrue("Widget does'nt reflect image attribute",
                equality(widget.getData(), data));

        /*    // Faire varier le nom du device
         *     TODO : � v�rifier en V2
            initSecondDevice();
           
            data = readImageAttribute(m_deviceProxy2,attributeName);
            widget.setDeviceName(m_deviceName2);
            // attendre la mise � jour du composant
            Sleeper.SECONDS.sleep(1);

            // TODO
            // le changement de device ne fonctionne pas
            // Assert.assertTrue("Widget does'nt reflect image attribute",equality(widget.getData(),data));
        */

        // test du SetVisible fait avec le fen�tre Roi car il n'est pas possible de retrouver
        // l'objet image

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


        jf1 = new JFrame();

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

        final AttributeImagePanel widget = new AttributeImagePanel.Builder(m_deviceName,
                attributeName).setShowRoiInformationTable(true).jframe(jf1).build();
        Sleeper.SECONDS.sleep(2);

        // enable ROI table display
        final JTable roiTable = (JTable) tth.findFirstComponent(ARoiInfoTable.class, jf1);
        Assert.assertTrue("ROI table should be visible", roiTable != null);

        final TableModel roiData = roiTable.getModel();

        Assert.assertTrue("ROI Table should be empty", roiData.getRowCount() == 0);
        Assert.assertTrue("ROI should contain 10 columns", roiData.getColumnCount() == 10);

        widget.addRoi("MyRoi1,Rectangle, 2, 60, 60, 80, 50,BLACK");

        Assert.assertTrue("ROI Table should contain 1 ROI", roiData.getRowCount() == 1);

        // verify row 0 according to MyRoi1
        int row = 0;
        int col = 0;
        Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi1'",
                roiData.getValueAt(col, row).equals("MyRoi1"));
        col = 1;
        Assert.assertTrue("[" + row + "," + col + "] should contain 'Rectangle'", roiData
                .getValueAt(row, col).equals("Rectangle"));
        col = 4;
        Assert.assertTrue("[" + row + "," + col + "] should contain 50",
                roiData.getValueAt(row, col).equals(new Double(50)));
        col = 5;
        Assert.assertTrue("[" + row + "," + col + "] should contain 80",
                roiData.getValueAt(row, col).equals(new Double(80)));

        widget.addRoi("MyRoi3,Cross, 2, 72, 72, 90, 60,GREEN");
        widget.addRoi("MyRoi2,Rectangle, 2, 70, 70, 90, 60,GREEN");
        Assert.assertTrue("ROI Table should contain 3 ROIs in 4 lines", roiTable.getModel()
                .getRowCount() == 4);

        // verify rows 0 & 1 according to MyRoi3
        row = 1;
        col = 0;
        Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi3'",
                roiData.getValueAt(row, col).equals("MyRoi3"));
        col = 1;
        Assert.assertTrue("[" + row + "," + col + "] should contain 'Straight Line'", roiData
                .getValueAt(row, col).equals("Straight Line"));
        col = 4;
        Assert.assertTrue("[" + row + "," + col + "] should contain 60",
                roiData.getValueAt(row, col).equals(new Double(60)));
        col = 5;
        Assert.assertTrue("[" + row + "," + col + "] should contain 0", roiData
                .getValueAt(row, col).equals(new Double(0)));

        row = 2;
        col = 0;
        Assert.assertTrue("[" + row + "," + col + "] should be empty", roiData.getValueAt(row, col)
                .equals(""));
        col = 1;
        Assert.assertTrue("[" + row + "," + col + "] should contain 'Straight Line'", roiData
                .getValueAt(row, col).equals("Straight Line"));
        col = 4;
        Assert.assertTrue("[" + row + "," + col + "] should contain 0", roiData
                .getValueAt(row, col).equals(new Double(0)));
        col = 5;
        Assert.assertTrue("[" + row + "," + col + "] should contain 90",
                roiData.getValueAt(row, col).equals(new Double(90)));

        // try to remove MyRoi3
        widget.addRoi("MyRoi3,None, 2, 72, 72, 90, 60,GREEN");
        col = 0;
        row = 0;
        Assert.assertTrue("Cannot remove ROI", roiTable.getModel().getRowCount() == 2);
        Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi1'",
                roiData.getValueAt(row, col).equals("MyRoi1"));
        row = 1;
        Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi2'",
                roiData.getValueAt(row, col).equals("MyRoi2"));

        // test du SetVisible
        widget.setVisible(false);
        Assert.assertTrue("widget should not be visible", !roiTable.isShowing());

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

        jf1 = new JFrame();

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

        final AttributeImagePanel widget = new AttributeImagePanel.Builder(m_deviceName,
                attributeName).jframe(jf1).build();
        Sleeper.SECONDS.sleep(2);

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

        // TODO http://controle/mantis/view.php?id=21242
        // attendre la disponibilit� d'une m�thode getImageZoneLocationOnScreen()
        // dans la classe ImageViewer permettant d'obtenir la localisation sur
        // l'�cran de la zone image.
        // Cette m�thode fournira les coordoon�es de la zone image sur laquelle
        // on peut cliquer pour notifier le tableListener d�fini plus haut

        // Le code devrait ressembler � :
        // fr.soleil.comete.swing.ImageViewer viewer =
        // (fr.soleil.comete.swing.ImageViewer)widget.getComponent();
        // Rectangle zoneImage = viewer.getImageZoneLocationOnScreen()

        widget.removeTableListener(listenerTest);

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

    protected void componentBehaviourWithROAttTest() throws DevFailed {
        jf1 = new JFrame();

        // Initialiser le device et le composant
        initFirstDevice();
        final AttributeImagePanel widget = new AttributeImagePanel.Builder(m_deviceName,
                "int_image_ro").jframe(jf1).build();
        Sleeper.SECONDS.sleep(2);

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

        jf1 = new JFrame();

        // Initialiser le device et le composant
        initFirstDevice();
        final AttributeImagePanel widget = new AttributeImagePanel.Builder(m_deviceName,
                "int_image_rw").userEnable(false).jframe(jf1).build();
        Sleeper.SECONDS.sleep(2);

        notEditableBehaviour(jf1);

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

    private void monochromeTest() throws DevFailed {
        jf1 = new JFrame();

        // Initialiser le device et le composant
        initFirstDevice();
        final AttributeImagePanel widget = new AttributeImagePanel.Builder(m_deviceName,
                "int_image_rw").setMonochrome(true).jframe(jf1).build();

        Sleeper.SECONDS.sleep(2);

        final ImageViewer imageViewer = (ImageViewer) tth
                .findFirstComponent(ImageViewer.class, jf1);
        Assert.assertTrue("Image viewer not found", imageViewer != null);

        final BufferedImage image = imageViewer.getImage();

        for (int x = 0; x < image.getWidth(); x++) {
            for (int y = 0; y < image.getHeight(); y++) {
                Assert.assertTrue("Image is not BW", isBWColor(new Color(image.getRGB(0, 0))));
            }
        }

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

    // Initialiser le device et le composant
    initFirstDevice();
    int data[] = readImageAttribute(m_deviceProxy, attributeName);

    final AttributeImagePanel widget = new AttributeImagePanel.Builder(
        m_deviceName, attributeName).jframe(jf1).build();
    Sleeper.SECONDS.sleep(2);

    final NumberMatrix numberMatrix = widget.getData();
    Assert.assertTrue("Widget doesn't reflect image attribute",
        equality(numberMatrix, data));

    // modifier la valeur de l'attribut
    for (int i = 0; i < data.length; i++) {
      data[i] += i;
    }

    m_deviceProxy.write_attribute(new DeviceAttribute(attributeName, data,
        numberMatrix.getWidth(), numberMatrix.getHeight()));

    // attendre la mise � jour du composant
    Sleeper.SECONDS.sleep(1);
    Assert.assertTrue("Widget doesn't reflect image attribute",
        equality(widget.getData(), data));

    // SteUserEnabled en cours de vie du composant
    widget.setUserEnabled(false);
    notEditableBehaviour(jf1);

    // Faire varier le nom de l'attribut
    attributeName = "int_image_ro";
    data = readImageAttribute(m_deviceProxy2, attributeName);

    widget.setAttributeName(attributeName);
    // attendre la mise � jour du composant
    Sleeper.SECONDS.sleep(1);
    Assert.assertTrue("Widget does'nt reflect image attribute",
        equality(widget.getData(), data));

    /*
     * // Faire varier le nom du device TODO : � v�rifier en V2
     * initSecondDevice();
     *
     * data = readImageAttribute(m_deviceProxy2,attributeName);
     * widget.setDeviceName(m_deviceName2); // attendre la mise � jour du
     * composant Sleeper.SECONDS.sleep(1);
     *
     * // TODO // le changement de device ne fonctionne pas //
     * Assert.assertTrue
     * ("Widget does'nt reflect image attribute",equality(widget
     * .getData(),data));
     */

    // test du SetVisible fait avec le fen�tre Roi car il n'est pas possible
    // de retrouver
    // l'objet image

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

    jf1 = new JFrame();

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

    final AttributeImagePanel widget = new AttributeImagePanel.Builder(
        m_deviceName, attributeName).setShowRoiInformationTable(true)
        .jframe(jf1).build();
    Sleeper.SECONDS.sleep(2);

    // enable ROI table display
    final JTable roiTable = (JTable) tth.findFirstComponent(
        ARoiInfoTable.class, jf1);
    Assert.assertTrue("ROI table should be visible", roiTable != null);

    final TableModel roiData = roiTable.getModel();

    Assert.assertTrue("ROI Table should be empty",
        roiData.getRowCount() == 0);
    Assert.assertTrue("ROI should contain 10 columns",
        roiData.getColumnCount() == 10);

    widget.addRoi("MyRoi1,Rectangle, 2, 60, 60, 80, 50,BLACK");

    Assert.assertTrue("ROI Table should contain 1 ROI",
        roiData.getRowCount() == 1);

    // verify row 0 according to MyRoi1
    int row = 0;
    int col = 0;
    Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi1'",
        roiData.getValueAt(col, row).equals("MyRoi1"));
    col = 1;
    Assert.assertTrue("[" + row + "," + col
        + "] should contain 'Rectangle'", roiData.getValueAt(row, col)
        .equals("Rectangle"));
    col = 4;
    Assert.assertTrue("[" + row + "," + col + "] should contain 50",
        roiData.getValueAt(row, col).equals(new Double(50)));
    col = 5;
    Assert.assertTrue("[" + row + "," + col + "] should contain 80",
        roiData.getValueAt(row, col).equals(new Double(80)));

    widget.addRoi("MyRoi3,Cross, 2, 72, 72, 90, 60,GREEN");
    widget.addRoi("MyRoi2,Rectangle, 2, 70, 70, 90, 60,GREEN");
    Assert.assertTrue("ROI Table should contain 3 ROIs in 4 lines",
        roiTable.getModel().getRowCount() == 4);

    // verify rows 0 & 1 according to MyRoi3
    row = 1;
    col = 0;
    Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi3'",
        roiData.getValueAt(row, col).equals("MyRoi3"));
    col = 1;
    Assert.assertTrue("[" + row + "," + col
        + "] should contain 'Straight Line'",
        roiData.getValueAt(row, col).equals("Straight Line"));
    col = 4;
    Assert.assertTrue("[" + row + "," + col + "] should contain 60",
        roiData.getValueAt(row, col).equals(new Double(60)));
    col = 5;
    Assert.assertTrue("[" + row + "," + col + "] should contain 0", roiData
        .getValueAt(row, col).equals(new Double(0)));

    row = 2;
    col = 0;
    Assert.assertTrue("[" + row + "," + col + "] should be empty", roiData
        .getValueAt(row, col).equals(""));
    col = 1;
    Assert.assertTrue("[" + row + "," + col
        + "] should contain 'Straight Line'",
        roiData.getValueAt(row, col).equals("Straight Line"));
    col = 4;
    Assert.assertTrue("[" + row + "," + col + "] should contain 0", roiData
        .getValueAt(row, col).equals(new Double(0)));
    col = 5;
    Assert.assertTrue("[" + row + "," + col + "] should contain 90",
        roiData.getValueAt(row, col).equals(new Double(90)));

    // try to remove MyRoi3
    widget.addRoi("MyRoi3,None, 2, 72, 72, 90, 60,GREEN");
    col = 0;
    row = 0;
    Assert.assertTrue("Cannot remove ROI", roiTable.getModel()
        .getRowCount() == 2);
    Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi1'",
        roiData.getValueAt(row, col).equals("MyRoi1"));
    row = 1;
    Assert.assertTrue("[" + row + "," + col + "] should contain 'MyRoi2'",
        roiData.getValueAt(row, col).equals("MyRoi2"));

    // test du SetVisible
    widget.setVisible(false);
    Assert.assertTrue("widget should not be visible", !roiTable.isShowing());

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

    jf1 = new JFrame();

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

    final AttributeImagePanel widget = new AttributeImagePanel.Builder(
        m_deviceName, attributeName).jframe(jf1).build();
    Sleeper.SECONDS.sleep(2);

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

    // TODO http://controle/mantis/view.php?id=21242
    // attendre la disponibilit� d'une m�thode
    // getImageZoneLocationOnScreen()
    // dans la classe ImageViewer permettant d'obtenir la localisation sur
    // l'�cran de la zone image.
    // Cette m�thode fournira les coordoon�es de la zone image sur laquelle
    // on peut cliquer pour notifier le tableListener d�fini plus haut

    // Le code devrait ressembler � :
    // fr.soleil.comete.swing.ImageViewer viewer =
    // (fr.soleil.comete.swing.ImageViewer)widget.getComponent();
    // Rectangle zoneImage = viewer.getImageZoneLocationOnScreen()

    widget.removeTableListener(listenerTest);

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

  protected void componentBehaviourWithROAttTest() throws DevFailed {
    jf1 = new JFrame();

    // Initialiser le device et le composant
    initFirstDevice();
    final AttributeImagePanel widget = new AttributeImagePanel.Builder(
        m_deviceName, "int_image_ro").jframe(jf1).build();
    Sleeper.SECONDS.sleep(2);

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

TOP

Related Classes of fr.soleil.globalscreen.tangowidget.attribute.AttributeImagePanel

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.