Package simtools.data

Examples of simtools.data.DataSource


    }

    protected void initWithLastDataSourceValues() {
        // Set cell text
        HookedTextShape ts0 = (HookedTextShape) cells.get(0);
        DataSource source = ts0.source;
        if (source != null) {
            try {
                long dsIndex = source.getLastIndex();
                for (int i = 0; i < cells.size(); i++) {
                    // Get text value from fisrt cell properties
                    String text = "";
                    if (ts0.displayDsName.booleanValue()) {
                        String name = DataInfo.getLabel(source);
                        if ((name != null) && !name.equals("")) {
                            text += name;
                            if (ts0.displayDsValue.booleanValue()) {
                                text += "=";
                            }
                        }
                    }
                    try {
                        if (ts0.displayDsValue.booleanValue()) {
                            text += ts0.formatSourceValue(source.getValue(dsIndex));
                        }
                    } catch (DataException e) {
                        text += TextShape.resources.getString("NoValue");
                    }
                    if (ts0.displayDsUnit.booleanValue()) {
View Full Code Here


      case 1:
        return getValue(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 o = it.next();
            if (!(o instanceof VariableAssociation)) {
                it.remove();
                continue;
            }
            DataSource ds = ((VariableAssociation)o).ds;
            try {
                minIndex = Math.max(minIndex, ds.getStartIndex());
                maxIndex = Math.min(maxIndex, ds.getLastIndex());
            } catch (UnsupportedOperation e) {
            }
            ds.addListener(this);
        }
        if (maxIndex == Long.MAX_VALUE) maxIndex = 0;
        minmaxOk=false;
    }
View Full Code Here

            Object o = it.next();
            if (!(o instanceof VariableAssociation)) {
                it.remove();
                continue;
            }
            DataSource ds = ((VariableAssociation)o).ds;
            try {
                minIndex = Math.max(minIndex, ds.getStartIndex());
                maxIndex = Math.min(maxIndex, ds.getLastIndex());
            } catch (UnsupportedOperation e) {
            }
            ds.addListener(this);
            if (minIndex == Long.MIN_VALUE) minIndex = 0;
        }
       
        computeSortedOrder();
        minmaxOk=false;
View Full Code Here

    }
   
    /** Remove the listeners */
    public synchronized void cleanup() {
        for (Iterator it = variables.iterator(); it.hasNext();) {
            DataSource ds = ((VariableAssociation)it.next()).ds;
            ds.removeListener(this);
        }
    }
View Full Code Here

    public void DataSourceIndexRangeChanged(DataSource ds, long startIndex, long lastIndex) {
        // One of the sources changed its definition interval => recompute the intersection
        long min = startIndex;
        long max = lastIndex;
        for (Iterator it = variables.iterator(); it.hasNext();) {
            DataSource dsv = ((VariableAssociation)it.next()).ds;
            if (dsv==ds) continue; // Same source, and do not need to use equals() here
            try {
                min = Math.max(min, dsv.getStartIndex());
                max = Math.min(max, dsv.getLastIndex());
            } catch (UnsupportedOperation e) {
            }
        }
        // Update our range
        minIndex = min; maxIndex = max;
View Full Code Here

            Object o = it.next();
            if (!(o instanceof VariableAssociation)) {
                it.remove();
                continue;
            }
            DataSource ds = ((VariableAssociation)o).ds;
            if(ds==newData){
              ((VariableAssociation)o).ds=newData;
                try {
                    minIndex = Math.max(minIndex, newData.getStartIndex());
                    maxIndex = Math.min(maxIndex, newData.getLastIndex());
View Full Code Here

     */
    public long computeLastIndex() throws UnsupportedOperation {
        // If no data source is used, the index range is irrelevant
        long max = Long.MAX_VALUE;
        for (Iterator it = variables.iterator(); it.hasNext();) {
            DataSource ds = ((VariableAssociation)it.next()).ds;
            max = Math.min(max, ds.computeLastIndex());
        }
        maxIndex = max;
        if (maxIndex == Long.MAX_VALUE) maxIndex = 0;
        return maxIndex;
    }
View Full Code Here

     */
    public long computeStartIndex() throws UnsupportedOperation {
        // If no data source is used, the index range is irrelevant
        long min = Long.MIN_VALUE;
        for (Iterator it = variables.iterator(); it.hasNext();) {
            DataSource ds = ((VariableAssociation)it.next()).ds;
            min = Math.max(min, ds.computeStartIndex());
        }
        minIndex = min;
        if (minIndex == Long.MIN_VALUE) minIndex = 0;
        return minIndex;
    }
View Full Code Here

        // Disable invalid operations
        if( (tsdsc instanceof MergeDSCollection) ){
            throw new IllegalArgumentException(DataInfo.getId(tsdsc) + " is already a merge of collection");
        }
        DataSource addedDs = null;

        for(int i=0;i<tsdsc.size();i++) {
            try {
                if ( ! (tsdsc.get(i) instanceof TimeStampedDataSource)){
                    continue;
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.