Package fr.esrf.tangoatk.core

Examples of fr.esrf.tangoatk.core.AttributePolledList


        }
    }

    public void attributeListIsConnected(Vector<IAttribute>  aattributeList) {
        //System.out.println("attributeListIsConnected="+aattributeList.size());
        AttributePolledList tmpAttributePolledList = new AttributePolledList();      
        tmpAttributePolledList.setRefreshInterval(refreshingPeriod);
        tmpAttributePolledList.setFilter(new IEntityFilter(){
            private static final long serialVersionUID = 1L;

            public boolean keep(IEntity ientity)
            {
                if(ientity instanceof INumberScalar)
                    return true;
                if(ientity instanceof IStringScalar)
                    return true;
                if(ientity instanceof IBooleanScalar)
                    return true;
                else
                    return false;
            }
        });
       
        IAttribute tmpIAttribute = null;
        int tmpInvalidAttribute = 0;
        Enumeration<IAttribute> tmpEnumeration = aattributeList.elements();
        while (tmpEnumeration.hasMoreElements())
        {
            tmpIAttribute = (IAttribute) tmpEnumeration.nextElement();
            for (int i = 0; i < attributeNameList.length; i++)
            {
                if(tmpIAttribute.getName().equalsIgnoreCase(attributeNameList[i].trim()))
                {
                    tmpAttributePolledList.add(tmpIAttribute);  
                    if(!(tmpIAttribute instanceof INumberScalar)
                      && !(tmpIAttribute instanceof IStringScalar)
                      && !(tmpIAttribute instanceof IBooleanScalar))
                    {
                        tmpInvalidAttribute++;
                        if(displayErrorOnFormat)
                            ConnectionErrorDialog.showMessageDialog(this, null, "\n" + tmpIAttribute.getName() + "is not a scalar");
                    }                  
                    break;
                }
            }
        }
       
        if(tmpAttributePolledList.size() + tmpInvalidAttribute + m_attributeKOList.size() == attributeNameList.length)       
        {
            BindingTango.removeConnectionListener(this);
            boolean isPossValue = attributePossibleValueList.length == attributeNameList.length;
            Enumeration<IAttribute> enumeration = aattributeList.elements();
            while(enumeration.hasMoreElements() && isPossValue)
            {
                IAttribute attribute = (IAttribute)enumeration.nextElement();
                int tmpIndex = getIndex(attribute.getName());
                if(tmpIndex != -1)
                {
                    if(attribute instanceof INumberScalar || attribute instanceof IStringScalar)
                    {
                            if(isPossValue)
                            {
                                String possValues = attributePossibleValueList[tmpIndex];
                                StringTokenizer possValueList = new StringTokenizer(possValues, ",");
                                if(possValueList.countTokens() > 0)
                                {
                                    String[] stringValues = null;
                                    double[] doubleValues = null;
                                    if(attribute instanceof INumberScalar)
                                        doubleValues = new double[possValueList.countTokens()];
                                    if(attribute instanceof IStringScalar)
                                        stringValues = new String[possValueList.countTokens()];
                                    int count = 0;
                                    while (possValueList.hasMoreTokens())
                                    {
                                        if(attribute instanceof INumberScalar)
                                            doubleValues[count++] = Double.parseDouble(possValueList.nextToken().trim());
                                        if(attribute instanceof IStringScalar)
                                            stringValues[count++] = possValueList.nextToken().trim();
                                    }
                                    if(attribute instanceof INumberScalar)
                                        ((INumberScalar)attribute).setPossibleValues(doubleValues);
                                    if(attribute instanceof IStringScalar)
                                        ((IStringScalar)attribute).setPossibleValues(stringValues);
                                }// End if
                            }//End if
                    }//End if
                }//End If index
            }//End while
            try
            {
                scalarListViewer.setModel(tmpAttributePolledList);
            }
            catch (Exception e) {
                //Null Pointer exception in SimpleScalarViewer.java:411
            }
            setSetterEnabled(setterEnabled) ;
            setSetterVisible(setterVisible) ;
        }//End if
         
        if(!tmpAttributePolledList.isEmpty())
            tmpAttributePolledList.startRefresher();
    }
View Full Code Here


            if (!m_AttributeList.containsKey(tmpAttributeName)) {
                m_AttributeList.put(tmpAttributeName, anAttribute);
            }
        }
        try {
            AttributePolledList tmpAttributePolledList = null;
            if (!m_attributeListRef.containsKey(tmpAttributeName)) {
                String tmpHashCode = "";
                if (m_attributeListTable.isEmpty()) {
                    tmpAttributePolledList = addAttributeInNewAttributePolledList(tmpAttributeName);
                }
                else {
                    Enumeration<AttributePolledList> tmpEnumeration = m_attributeListTable
                            .elements();
                    while (tmpEnumeration.hasMoreElements()) {
                        tmpAttributePolledList = tmpEnumeration.nextElement();
                        if (tmpAttributePolledList.size() < BindingTango.NB_ATTR_MAX) {
                            break;
                        }
                    }

                    if (tmpAttributePolledList.size() == BindingTango.NB_ATTR_MAX) {
                        tmpAttributePolledList = addAttributeInNewAttributePolledList(tmpAttributeName);
                    }
                    else {
                        tmpHashCode = String.valueOf(tmpAttributePolledList.hashCode());
                        m_attributeListRef.put(tmpAttributeName, tmpHashCode);
                    }
                }
                if (tmpAttributePolledList != null) {
                    tmpAttributePolledList.add(anAttribute);
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here

        }

    }

    private static AttributePolledList addAttributeInNewAttributePolledList(String tmpAttributeName) {
        AttributePolledList tmpAttributePolledList;
        String tmpHashCode;
        tmpAttributePolledList = new AttributePolledList();
        tmpHashCode = String.valueOf(tmpAttributePolledList.hashCode());
        m_attributeListRef.put(tmpAttributeName, tmpHashCode);
        m_attributeListTable.put(tmpHashCode, tmpAttributePolledList);
        return tmpAttributePolledList;
    }
View Full Code Here

            //System.out.println("SPJZ ============> removeAttribute : " + anAttributeName);
            if (m_attributeListRef.containsKey(tmpAttributeName)) {
                String tmpPolledList = m_attributeListRef.get(tmpAttributeName);
                m_attributeListRef.remove(tmpAttributeName);
                if (m_attributeListTable.containsKey(tmpPolledList)) {
                    AttributePolledList tmpAttributePolledList = m_attributeListTable
                            .get(tmpPolledList);
                    if (tmpAttributePolledList != null) {
                        tmpAttributePolledList.remove(anAttributeName);
                        if (tmpAttributePolledList.isEmpty()) {
                            tmpAttributePolledList.stopRefresher();
                            m_attributeListTable.remove(tmpPolledList);
                            tmpAttributePolledList = null;
                        }
                    }
                }
View Full Code Here

        return false;
    }

    public static void startRefresher() {
        Enumeration<AttributePolledList> tmpAttElement = m_attributeListTable.elements();
        AttributePolledList tmpAttributePolledList = null;
        while (tmpAttElement.hasMoreElements()) {
            tmpAttributePolledList = tmpAttElement.nextElement();
            if (tmpAttributePolledList != null && !tmpAttributePolledList.isRefresherStarted()
                    && !tmpAttributePolledList.isEmpty()) {
                tmpAttributePolledList.setRefreshInterval(resfreshingPeriod);
                tmpAttributePolledList.startRefresher();
            }

        }

        Enumeration<DevicePolledList> tmpDevElement = m_deviceListTable.elements();
View Full Code Here

        DeviceFactory.getInstance().stopRefresher();
    }

    public static void stopRefresher() {
        Enumeration<AttributePolledList> tmpAttElement = m_attributeListTable.elements();
        AttributePolledList tmpAttributePolledList = null;
        while (tmpAttElement.hasMoreElements()) {
            tmpAttributePolledList = tmpAttElement.nextElement();
            if (tmpAttributePolledList != null && tmpAttributePolledList.isRefresherStarted()
                    && tmpAttributePolledList.isEmpty()) {
                tmpAttributePolledList.stopRefresher();
            }
        }

        Enumeration<DevicePolledList> tmpDevElement = m_deviceListTable.elements();
        DevicePolledList tmpPolledList = null;
View Full Code Here

  public void attributeListIsConnected(Vector<IAttribute> aattributeList) {
    //System.out.println("attributeListIsConnected=" + aattributeList.size());
    //Check if it s the good attribute list
    Enumeration<IAttribute> tmpEnumeration = aattributeList.elements();
    IAttribute tmpIAttribute = null;
    AttributePolledList tmpAttributePolledList = new AttributePolledList();
    tmpAttributePolledList.setRefreshInterval(refreshingPeriod);
    tmpAttributePolledList.setFilter(new IEntityFilter(){
      private static final long serialVersionUID = 1L;
      public boolean keep(IEntity ientity)
      {
        if(ientity instanceof INumberSpectrum) {
          return true;
        }
        return false;
      }
    });
    while (tmpEnumeration.hasMoreElements())
    {
      tmpIAttribute = tmpEnumeration.nextElement();
      for (String element : attributeNameList) {
        if(tmpIAttribute.getName().equalsIgnoreCase(element.trim()))
        {
          if(tmpIAttribute instanceof INumberSpectrum) {
            tmpAttributePolledList.add(tmpIAttribute);
          }
          else {
            ConnectionErrorDialog.showMessageDialog(this, null, "\n" + tmpIAttribute.getName() + "is not a numerical spectrum");
          }
        }
      }
    }
    if(!tmpAttributePolledList.isEmpty())
    {
      BindingTango.removeConnectionListener(this);
      setModel(tmpAttributePolledList);
      tmpAttributePolledList.startRefresher();
    }
  }
View Full Code Here

    }

    public void attributeListIsConnected(Vector<IAttribute> aattributeList) {
      //Check if it s the good attribute list
        Enumeration<IAttribute> tmpEnumeration = aattributeList.elements();
        AttributePolledList tmpAttributePolledList = new AttributePolledList();
        tmpAttributePolledList.setRefreshInterval(refreshingPeriod);
        tmpAttributePolledList.setFilter(new IEntityFilter(){
            private static final long serialVersionUID = 1L;
            public boolean keep(IEntity ientity)
            {
                if(ientity instanceof INumberScalar)
                    return true;
                 return false;
            }
        });
        IAttribute tmpIAttribute = null;
        int tmpInvalidAttribute = 0;
        while (tmpEnumeration.hasMoreElements())
        {
            tmpIAttribute = (IAttribute) tmpEnumeration.nextElement();
            for (int i = 0; i < attributeNameList.length; i++)
            {
                if(tmpIAttribute.getName().equalsIgnoreCase(attributeNameList[i].trim()))
                {
                    tmpAttributePolledList.add(tmpIAttribute);   
                    if(!(tmpIAttribute instanceof INumberScalar))
                    {
                        tmpInvalidAttribute++;
                        ConnectionErrorDialog.showMessageDialog(this, null, "\n" + tmpIAttribute.getName() + "is not a numerical scalar");
                    }
                    break;
                }
            }
        }
        if(tmpAttributePolledList.size() + tmpInvalidAttribute + m_attributeKOList.size() == attributeNameList.length)       
        {
            BindingTango.removeConnectionListener(this);
            setModel(tmpAttributePolledList);           
            setXAxisOnBottom(isXAxisOnBottom());
            setAlarmLevel(getAlarmLevel());
            setFaultLevel(getFaultLevel());
            setXaxisName(getXaxisName());
            setChartHeader(getChartHeader());
            setChartColor(chartColor);
            setChartStyle(getChartStyle());
            setMarkerStyle(getMarkerStyle());
            setConfigFile(configFile);
            setAutoScale(autoScale);
            setMinimum(minimum);
            setMaximum(maximum);
        }
       
        if(!tmpAttributePolledList.isEmpty())
            tmpAttributePolledList.startRefresher();
    }
View Full Code Here

   }

   @Override
   public String loadSetting(String filename) {
     String tmpResult = super.loadSetting(filename);
     AttributePolledList tmpAttributePolledList = super.getModel();
     if(tmpAttributePolledList != null) {
       tmpAttributePolledList.startRefresher();
     }

     if(tmpResult.length() > 0) {
       JOptionPane.showMessageDialog(this.getParent(),tmpResult , "Errors reading " + configFile, 0);
     }
View Full Code Here

   }

   public void attributeListIsConnected(Vector<IAttribute> aattributeList) {
     //Check if it s the good attribute list
     Enumeration<IAttribute> tmpEnumeration = aattributeList.elements();
     AttributePolledList tmpAttributePolledList = new AttributePolledList();
     tmpAttributePolledList.setRefreshInterval(refreshingPeriod);
     tmpAttributePolledList.setFilter(new IEntityFilter(){
       private static final long serialVersionUID = 1L;
       public boolean keep(IEntity ientity)
       {
         if(ientity instanceof INumberScalar) {
           return true;
         }
         return false;
       }
     });
     IAttribute tmpIAttribute = null;
     int tmpInvalidAttribute = 0;
     while (tmpEnumeration.hasMoreElements())
     {
       tmpIAttribute = tmpEnumeration.nextElement();
       for (String element : attributeNameList) {
         if(tmpIAttribute.getName().equalsIgnoreCase(element.trim()))
         {
           tmpAttributePolledList.add(tmpIAttribute);
           if(!(tmpIAttribute instanceof INumberScalar))
           {
             tmpInvalidAttribute++;
             ConnectionErrorDialog.showMessageDialog(this, null, "\n" + tmpIAttribute.getName() + "is not a numerical scalar");
           }
           break;
         }
       }
     }
     if(tmpAttributePolledList.size() + tmpInvalidAttribute + m_attributeKOList.size() == attributeNameList.length)
     {
       BindingTango.removeConnectionListener(this);
       setModel(tmpAttributePolledList);
       String tmpAttributeName = null;
       Enumeration<?> tmpEnumerationEntity = tmpAttributePolledList.elements();
       tmpIAttribute = null;
       while (tmpEnumerationEntity.hasMoreElements()) {
         tmpIAttribute = (IAttribute) tmpEnumerationEntity.nextElement();
         tmpAttributeName = tmpIAttribute.getName();
         super.addToAxis(tmpAttributeName, Trend.SEL_Y1, true);
       }
       setSelectionTreeVisible(isSelectionTreeVisible());
       setToolbarVisible(toolbarVisible);
       setAutoScale(autoScale);
       setMinimum(minimum);
       setMaximum(maximum);
     }

     if(!tmpAttributePolledList.isEmpty()) {
       tmpAttributePolledList.startRefresher();
     }

   }
View Full Code Here

TOP

Related Classes of fr.esrf.tangoatk.core.AttributePolledList

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.