Package pspdash.data

Examples of pspdash.data.ListData


    }


    /** Construct an empty list. */
    protected static ListData newEmptyList() {
        ListData result = new ListData();
        result.setEditable(false);
        return result;
    }
View Full Code Here


        // get the list of values that we should iterate over. This can be
        // specified either as a list literal using the "values" attribute,
        // or via a list variable using the "list" attribute.
        String values = foreach.getAttribute("values");
        ListData list;
        if (isNull(values)) {
            String listName = foreach.getAttribute("list");
            list = getList(listName);
        } else {
            list = new ListData(values);
        }

        // iterate over the list and calculate the resulting contents.
        String loopIndex = foreach.getAttribute("name");
        String loopContents = text.substring(foreach.end, endfor.begin);
        StringBuffer replacement = new StringBuffer();
        String iterResults;
        for (int i = 0;   i < list.size();   i++) {
            iterResults = StringUtils.findAndReplace
                (loopContents, loopIndex, (String)list.get(i));
            /*
            iterResults = StringUtils.findAndReplace
                (iterResults,
                 DIRECTIVE_START + "0",
                 DIRECTIVE_START + "0" + i + "-");
View Full Code Here

            listName = trimDelim(listName);
            SimpleData d = getSimpleValue(listName);
            if (d instanceof ListData)   return (ListData) d;
            if (d instanceof StringData) return ((StringData) d).asList();
            if (d instanceof SimpleData) {
                ListData result = new ListData();
                result.add(d.format());
            }
            return EMPTY_LIST;
        } else {
            // listName names an environment variable or parameter
            ListData result = new ListData();

                                // try for an environment variable first.
            Object envVal = env.get(listName);
            if (envVal instanceof String) {
                result.add((String) envVal);
                return result;
            }
                                // look for a parameter value.
            String[] param = (String[]) params.get(listName + "_ALL");
            if (param != null)
                for (int i = 0;   i < param.length;   i++)
                    result.add(param[i]);
            else if (params.get(listName) instanceof String) {
                String paramVal = (String) params.get(listName);
                if (paramVal.startsWith("LIST="))
                    return new ListData(paramVal.substring(5));
                else
                    result.add(paramVal);
            }

            return result;
        }
    }
View Full Code Here

        // get the [Use_Rollup] data element for the current
        // project. If it is null, return immediately.
        String prefix = getPrefix();   if (prefix == null) return;
        String useRollupName = data.createDataName(prefix, "Use_Rollup");
        ListData rollupIDs = getList(data, useRollupName);
        if (rollupIDs == null) return;

        String tableStart = TABLE_START, tableEnd = "", tableRow;
        for (int i = 0;   i < rollupIDs.size();   i++) {
            tableRow = getFragment(data, rollupIDs.get(i).toString());
            if (tableRow != null && tableRow.length() > 0) {
                out.print(tableStart);
                out.print(tableRow);
                tableStart = ""; tableEnd = TABLE_END;
            }
View Full Code Here

        // lookup the data element [/ROLLUP_ID/Rollup Instance
        // List]. If it is missing or if it contains less than two
        // items, return an empty fragment (and save the empty
        // fragment to the cache).
        String instanceListName = rollupInstanceList(rollupID);
        ListData instanceList = getList(data, instanceListName);
        if (instanceList == null || instanceList.size() < 2)
            return CACHE.put(rollupID, "");

        // Construct an HTML fragment
        StringBuffer result = new StringBuffer();
        result.append("<tr><td>Base &quot;To Date&quot; ").append(rollupID)
            .append(" data on:&nbsp;</td>\n    <td colspan=10><select name='[")
            .append(rollupPrefix(rollupID)).append("]s'>");
        for (int i = 0;   i < instanceList.size();   i++)
            result.append("\n<option>").append(instanceList.get(i));
        result.append("\n</select></td></tr>\n");
        return CACHE.put(rollupID, result.toString());
    }
View Full Code Here

        List args =  collapseLists(arguments, 2);

        if (start < 0) start = 0;
        if (end < 0 || end > args.size()) end = args.size();

        ListData result = new ListData();
        if (start < end) {
            Iterator i = args.subList(start, end).iterator();
            while (i.hasNext())
                result.add(i.next());
        }

        return result;
    }
View Full Code Here

     *
     * This method <b>must</b> be thread-safe.
     */
    public Object call(List arguments, ExpressionContext context)
    {
        ListData result = new ListData();

        String name = asString(getArg(arguments, 0));
        if (name == null) return null;

        Iterator i = collapseLists(arguments, 1).iterator();
        String path, dataName;
        while (i.hasNext()) {
            path = asStringVal(i.next());
            if (path == null) continue;

            dataName = DataRepository.createDataName(path, name);
            result.addAll(asList(context.get(dataName)));
        }
        return result;
    }
View Full Code Here

        // data repository.
        DataRepository data = getDataRepository();
        String pfx = getPrefix();
        if (pfx == null) pfx = "/";
        StringBuffer prefix = new StringBuffer(pfx);
        ListData list;
        Element result = null;
        SaveableData val;
        for (val = data.getInheritableValue(prefix, FILE_XML_DATANAME);
             val != null;
             val = data.getInheritableValue(chop(prefix), FILE_XML_DATANAME)) {

            if (val != null && !(val instanceof SimpleData))
                val = val.getSimpleValue();

            if (val instanceof StringData)
                list = ((StringData) val).asList();
            else if (val instanceof ListData)
                list = (ListData) val;
            else
                list = null;

            if (list != null)
                for (int i=0;   i < list.size();  i++) {
                    String url = (String) list.get(i);
                    Document docList = getDocumentTree(url);
                    if (docList != null) {
                        result = (new FileFinder(name, docList)).file;
                        if (result != null)
                            return result;
View Full Code Here

                                      String taskListName) {
        String globalPrefix = MAIN_DATA_PREFIX + taskListName;
        String dataName =
            data.createDataName(globalPrefix, TASK_LISTS_DATA_NAME);
        SimpleData listVal = data.getSimpleValue(dataName);
        ListData list = null;
        if (listVal instanceof ListData)
            list = (ListData) listVal;
        else if (listVal instanceof StringData)
            list = ((StringData) listVal).asList();

        if (list == null) return;
        for (int i = 0;   i < list.size();   i++) {
            taskListName = (String) list.get(i);
            EVTaskList taskList = EVTaskList.openExisting
                (taskListName, data, hierarchy, cache, false);
            if (taskList == null) {
                if (EVTaskListXML.validName(taskListName))
                    taskList = new EVTaskListXML(taskListName, data);
View Full Code Here

        // Now, save the rollup to the repository with the new name.
        if (newName != null) {
            dataName = data.createDataName(MAIN_DATA_PREFIX + newName,
                                           TASK_LISTS_DATA_NAME);
            ListData list = new ListData();
            Iterator i = evTaskLists.iterator();
            while (i.hasNext())
                list.add(((EVTaskList) i.next()).taskListName);

            data.putValue(dataName, list);
            taskListName = newName;
        }
    }
View Full Code Here

TOP

Related Classes of pspdash.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.