Package simtools.data

Examples of simtools.data.DataSource


                color = dialog.getColor();
                bColor.setBackground(color);


                DataSource colorTempDataSource = dialog.getSource();
                colorMapper = dialog.getMapper();

                        if  (colorTempDataSource!=null){
                           
                            if (colorMapperSource!=null)
View Full Code Here


        // Same time reference for all created synchronous time stamped data
        TimeSource timeReference = null;
        AsynchronousMergeDataSource mds = null;
        for (int i = 0; i < dsc.size(); i++) {
            try {
                DataSource data = (DataSource) dsc.get(i);
                String id = DataInfo.getId(data);
                if (!(id.equals(DataInfo.getId(timeRef)))) {    // Do not add the time reference to merge collection
                    if (get(id) != null) {
                        id += "_" + DataInfo.getLabel(dsc); // if data source name already exists then add collection name as a suffix
View Full Code Here

            Hashtable newRepositories = new Hashtable();
            ArrayList dataList = new ArrayList(repertory.getChildren());
            for (Iterator iter = repertory.getChildren().iterator(); iter.hasNext();) {
                o = iter.next();
                if (o instanceof DataSource) {
                    DataSource d = (DataSource) o;
                    String dsName = ((d.getInformation().id));
                    String repName = dsName.substring(dsName.indexOf(".") + 1);
                    for (int i = 0; i < proof - 1; i++) {
                        repName = repName.substring(repName.indexOf(".") + 1);
                    }
                    repName = repName.substring(0, 1);
View Full Code Here

       
        return getBooleanValue(rowIndex);
      case 2:
        return Boolean.valueOf(dataCopy.getDataSource(rowIndex)!=null);
      case 3:
        DataSource ds=dataCopy.getDataSource(rowIndex);
        if(ds==null){
          return "";
        }
        return DataInfo.getLabel(ds);
      default:
View Full Code Here

        Object[][] ret = new Object[numberOfAddedData][4];
        for(int i=0;i<numberOfAddedData;i++){
            Object o =  settings.get(DATA_TO_MERGE + "_" + i);
           
            DataSource refTime = null;
           
            if (o instanceof TimeStampedDataSource){
                refTime = ((TimeStampedDataSource)o).getTime();
         
            } else if (o instanceof TimeStampedDataSourceCollection){
View Full Code Here

            if (mergedTimeRefIndex != null){
                refTimeIndex = mergedTimeRefIndex.intValue();
            }

            Object o =  settings.get(DATA_TO_MERGE + "_" + refTimeIndex);
            DataSource mergedTimeReferenceDs = null;

            if (o instanceof TimeStampedDataSource){
                mergedTimeReferenceDs = ((TimeStampedDataSource)o).getTime();

            } else if (o instanceof TimeStampedDataSourceCollection){
                // we take the fisrt TimeSource
                mergedTimeReferenceDs = ((TimeStampedDataSource)((TimeStampedDataSourceCollection)o).get(0)).getTime();

            } else {
                mergedTimeReferenceDs = (DataSource)settings.get(TIME_REFERENCE + "_" + refTimeIndex);
            }

            double offset =  ((Double)settings.get(TIME_REFERENCE_OFFSET + "_" + refTimeIndex)).doubleValue();

            boolean refTimeIsRelative = false;
            if ( settings.get(TIME_REFERENCE_IS_RELATIVE + "_" + refTimeIndex)!=null){
                refTimeIsRelative = ((Boolean)settings.get(TIME_REFERENCE_IS_RELATIVE + "_" + refTimeIndex)).booleanValue();
            }
            long initialDate = 0;
            if ( settings.get(TIME_REFERENCE_INITIAL_DATE + "_" + refTimeIndex)!=null) {
                initialDate = ((Long)settings.get(TIME_REFERENCE_INITIAL_DATE + "_" + refTimeIndex)).longValue();
            }

            try {
                ret= new JSSynchronousMergeDSCollection(
                        collectionName,
                        interpolationOrder,
                        collectionTimeReferenceIsRelative,
                        mergedTimeReferenceDs,
                        refTimeIsRelative,
                        offset,
                        initialDate);
            } catch (MergeDataException e) {
                ret = null;
            }
        }

        if (ret != null) {
            // Add data to merge collection
            for(int i=0;i<numberOfAddedData;i++) {
                try{
                    Object o =  settings.get(DATA_TO_MERGE + "_" + i);
                    double offset =  ((Double)settings.get(TIME_REFERENCE_OFFSET + "_" + i)).doubleValue();

                    boolean refTimeIsRelative = false;
                    if ( settings.get(TIME_REFERENCE_IS_RELATIVE + "_" + i)!=null)
                        refTimeIsRelative = ((Boolean)settings.get(TIME_REFERENCE_IS_RELATIVE + "_" + i)).booleanValue();

                    long initialDate = 0;
                    if ( settings.get(TIME_REFERENCE_INITIAL_DATE + "_" + i)!=null)
                        initialDate = ((Long)settings.get(TIME_REFERENCE_INITIAL_DATE + "_" + i)).longValue();

                    if (o instanceof DataSourceCollection){
                        if (o instanceof TimeStampedDataSourceCollection){
                            ret.add((TimeStampedDataSourceCollection)o, offset,initialDate);
                        }else{
                            // get synchronous parameters
                            DataSource refTime = (DataSource)settings.get(TIME_REFERENCE + "_" + i);
                            ret.add((DataSourceCollection)o, refTime, refTimeIsRelative,offset, initialDate);
                        }

                    } else{
                        if (o instanceof TimeStampedDataSource){
                            ret.add((TimeStampedDataSource)o, offset, initialDate);
                        }else{
                            // get synchronous parameters
                            DataSource refTime = (DataSource)settings.get(TIME_REFERENCE + "_" + i);
                            ret.add((DataSource)o, refTime, refTimeIsRelative, offset, initialDate);
                        }
                    }
                } catch(MergeDataException e) {
                }
View Full Code Here

        CategoryPlot plot = chart.getCategoryPlot();
        SourceCategoryDataset dst = (SourceCategoryDataset)plot.getDataset();
        dst.setDataSourceCollection((DataSourceCollection)o);
        chart.setTitle(dst.getName());
        for (int i=0; i<mappers.size(); ++i) {
          DataSource ds = (DataSource)mapperSources.get(i);
          if (ds!=null) ds.removeListener(this);
          ColorMapper cm = (ColorMapper)mappers.get(i);
          if (cm!=null) cm.removeListener(this);
        }
        for (int i=0; i<((DataSourceCollection)o).size(); ++i) {
          mappers.add(null); mapperSources.add(null); // no mapper by default
View Full Code Here

            });
           
        }
       
        public DataSource createSource(String name) {
            DataSource ds;
           
            if (rbDynamic.isSelected()) {
                Number i = NumberStringComparator.stringToNumber(tfInit.getText());
                if (i==null) i = new Long(0);
                Number s = NumberStringComparator.stringToNumber(tfDynaStep.getText());
View Full Code Here

      pcurvecolor.setFocusPainted(false);

      CategoryItemRenderer renderer = plot.getRenderer();
      int n = dst.getRowCount();
      for (int i=0; i<n; ++i) {
        DataSource ds = (DataSource)mapperSources.get(i);
        if (ds==null) ds = dst.getSource(i); // take the datasource associated with this series by default
        pcbxcurves.addItem(new CbxEntry(i,dst.getName(i),(Color)renderer.getSeriesPaint(i),ds,(ColorMapper)mappers.get(i)));
      }
      pcbxeditortf = (JTextField)pcbxcurves.getEditor().getEditorComponent();
      pupdateForEntry(pcbxcurves.getSelectedItem());
View Full Code Here

        // Start from the end, to remove the entries and keep the index OK
        for (int i=n-1; i>=0; i--) {
          if (!toKeep[i]) {
            GenericMapper mapper = (GenericMapper)mappers.remove(i);
            if (mapper!=null) mapper.removeListener(BarChartShape.this);
            DataSource source = (DataSource)mapperSources.remove(i);
            if (source!=null) source.removeListener(BarChartShape.this);
            dst.removeSource(i);
          }
        }
      }
     
      // Now we match the data set and the list
      int len = pcbxcurves.getItemCount();
      for (int i=0; i<len; ++i) {
        CbxEntry e = (CbxEntry)pcbxcurves.getItemAt(i);
        dst.setName(i,e.name);
        CategoryItemRenderer renderer = plot.getRenderer();
        DataSource ds = (DataSource)mapperSources.get(i);
        if ((e.source==null) && (ds!=null)) ds.removeListener(BarChartShape.this);
        mapperSources.set(i,e.source);
        if (e.source!=null) e.source.addListener(BarChartShape.this);
        ColorMapper cm = (ColorMapper)mappers.get(i);
        if ((e.mapper==null) && (cm!=null)) cm.removeListener(BarChartShape.this);
        mappers.set(i,e.mapper);
View Full Code Here

TOP

Related Classes of simtools.data.DataSource

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.