Package net.sourceforge.processdash.data

Examples of net.sourceforge.processdash.data.ListData


            new DeferredDataLookup(context));
       
        if (results == null || results.isEmpty())
            return ListData.EMPTY_LIST;
       
        ListData result = new ListData();
        for (Iterator i = results.iterator(); i.hasNext();)
            result.add(i.next());
       
        try {
            result.sortContents(String.CASE_INSENSITIVE_ORDER);
        } catch (Exception e) {}
       
        return result;
    }
View Full Code Here


        protected DeferredDataLookup(ExpressionContext context) {
            this.context = context;
        }

        public List getTaggedData(String dataName) {
            ListData result = ListData.asListData(context.get(dataName));
            return (result == null ? null : result.asList());
        }
View Full Code Here

        this.start = start;
        storeTag(tag);
        this.script = expression;
        this.data = data;
        this.prefix = prefix;
        this.value = new ListData();
        this.externalValue = null;
        chopTagLength = (this.tag.startsWith("/") ? this.tag.length() : 0);

        this.value.setEditable(false);
View Full Code Here

    public String saveString() { return ""; }

    public SimpleData getSimpleValue() {
        valueQueried = true;
        if (externalValue == null && value != null)
            externalValue = new ListData(value);
        return externalValue;
    }
View Full Code Here

        return (sd == null ? null : sd.format());
    }

    public List<String> getList(String dataName) {
        SimpleData sd = getSimpleValue(dataName);
        ListData ld = ListData.asListData(sd);
        if (ld == null)
            return null;

        List result = new ArrayList(ld.asList());
        for (int i = result.size(); i-- > 0;) {
            Object item = result.get(i);
            if (item instanceof SimpleData)
                result.set(i, convert((SimpleData) item));
        }
View Full Code Here

        }
        return null;
    }

    public synchronized ListData getSaveList() {
        ListData result = new ListData();
        result.add(saveDate(get(0).endDate));
        Period p;
        for (int i = 1;   i < periods.size();  i++) {
            p = get(i);
            if (p.automatic)
                break;
            result.add(Double.toString(p.planTotalTime));
            result.add(saveDate(p.endDate));
        }
        result.setImmutable();
        return result;
    }
View Full Code Here

    }
   
    public String getPeriodNoteData() {
        if (periodNotes == null || periodNotes.isEmpty())
            return null;
        ListData result = new ListData();
        for (Map.Entry<Date, String> e : periodNotes.entrySet()) {
            result.add(saveDate(e.getKey()));
            result.add(e.getValue());
        }
        return result.format();
    }
View Full Code Here

    }
   
    public void setPeriodNoteData(String noteData) {
        periodNotes = new TreeMap<Date, String>();
        if (noteData != null && noteData.length() > 0) {
            ListData data = new ListData(noteData);
            for (int i = 1;  i < data.size(); i += 2) {
                try {
                    Date date = parseDate((String) data.get(i-1));
                    String note = (String) data.get(i);
                    periodNotes.put(date, note);
                } catch (Exception e) {
                    // bad data - try to continue with the next element.
                }
            }
View Full Code Here

                listNames.put(rsse, listName);
            }
        }

        // fetch the value of the named list.
        ListData result = lookupList(data, listName);

        // if the named list has no value yet, create the value and
        // save it in the repository.
        if (result == null) synchronized (listName) {
            result = lookupList(data, listName);
            if (result == null) {
                String expression = rsse.buildExpression();

                try {
                    data.putExpression(listName, "", expression);
                } catch (MalformedValueException mve) {
                    System.err.println("malformed value!");
                    data.putValue(listName, new ListData());
                }
                data.addDataListener(listName, NULL_LISTENER);
                result = lookupList(data, listName);
            }
        }
View Full Code Here

    private static ListData getFilteredList(DataRepository data,
                                            String forParam,
                                            String[] conditions,
                                            String orderBy,
                                            String basePrefix) {
        ListData result;
            // if the "for" parameter is missing or is simply ".", then
            // return a list containing only one element - the base prefix.
        if (forParam == null ||
            forParam.length() == 0 ||
            forParam.equals(".")) {
            result = new ListData();
            result.add(basePrefix);

            // if the for parameter specifies a data list rather than
            // a tag name, or if the base prefix is empty, return all the
            // items in the list in question.
        } else if (basePrefix == null || basePrefix.length() == 0 ||
                   !forParamIsTagName(forParam)) {
            result =
                getList(data, forParam, conditions, orderBy, basePrefix);

            // otherwise, get the appropriate prefix list, and create
            // a filtered copy containing only those prefixes that
            // start with the base prefix.
        } else {
            ListData fullPrefixList =
                getList(data, forParam, conditions, orderBy, basePrefix);
            result = new ListData();
            String item;
            for (int i = 0;   i < fullPrefixList.size();   i++) {
                item = (String) fullPrefixList.get(i);
                if (item.equals(basePrefix) ||
                    item.startsWith(basePrefix + "/"))
                    result.add(item);
            }
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.data.ListData

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.