Search in sources :

Example 91 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class PercentSpentIndicator method shouldBeVisible.

private boolean shouldBeVisible(String path) {
    if (path == null)
        return false;
    SaveableData enabledVal = dashCtx.getData().getInheritableValue(path, ENABLED_DATA_NAME);
    if (enabledVal == null)
        return Settings.getBool(ENABLED_SETTING_NAME, true);
    SimpleData enabled = enabledVal.getSimpleValue();
    return (enabled != null && enabled.test());
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) SaveableData(net.sourceforge.processdash.data.SaveableData)

Example 92 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class PercentSpentIndicator method dataValueChanged.

public void dataValueChanged(DataEvent e) throws RemoteException {
    forecastDateHTML = null;
    String name = e.getName();
    SimpleData value = e.getValue();
    if (name.equals(estTimeDataName)) {
        estTime = getDouble(value, Double.NaN);
        estTimeEditable = (value == null || value.isEditable()) && Settings.isReadWrite();
        recalc();
    } else if (name.equals(actTimeDataName)) {
        actTime = getDouble(value, 0.0);
        recalc();
    } else if (name.equals(actDateDateName)) {
        actDate = value;
        recalc();
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 93 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class Sumfor method call.

/** Perform a procedure call.
     *
     * This method <b>must</b> be thread-safe.
     */
public Object call(List arguments, ExpressionContext context) {
    double result = 0.0, val;
    String name = asString(getArg(arguments, 0));
    if (name == null)
        return null;
    Iterator i = collapseLists(arguments, 1).iterator();
    String path, dataName, alias;
    alias = NO_ALIAS_YET;
    SimpleData sVal = null;
    while (i.hasNext()) {
        path = asStringVal(i.next());
        if (path == null)
            continue;
        dataName = DataRepository.createDataName(path, name);
        if (alias == NO_ALIAS_YET)
            alias = dataName;
        else
            alias = null;
        sVal = context.get(dataName);
        val = asDouble(sVal);
        if (!Double.isNaN(val) && !Double.isInfinite(val))
            result += val;
    }
    if (alias != null && alias != NO_ALIAS_YET && sVal != null)
        return new DescribedValue(sVal, context.resolveName(alias));
    else if (result == 0)
        return ImmutableDoubleData.READ_ONLY_ZERO;
    else
        return new DoubleData(result);
}
Also used : Iterator(java.util.Iterator) SimpleData(net.sourceforge.processdash.data.SimpleData) DoubleData(net.sourceforge.processdash.data.DoubleData) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 94 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class DataMessageHandler method handle.

public void handle(MessageEvent message) {
    String prefix = getPrefix(message);
    if (prefix == null)
        return;
    Map<String, SimpleData> dataValues = parseData(message);
    if (dataValues == null || dataValues.isEmpty())
        return;
    Date editTimestamp = XMLUtils.getXMLDate(message.getMessageXml(), "editTimestamp");
    for (Entry<String, SimpleData> e : dataValues.entrySet()) {
        String dataName = DataRepository.createDataName(prefix, e.getKey());
        maybeSaveValue(message, dataName, e.getValue(), editTimestamp);
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) Date(java.util.Date)

Example 95 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class EVReportSettings method lookupPathFilter.

private void lookupPathFilter() {
    SaveableData sval = data.getInheritableValue(prefix, "Earned_Value//Path_Filter");
    if (sval == null)
        sval = data.getInheritableValue(prefix, "Earned_Value_Path_Filter");
    SimpleData val = (sval == null ? null : sval.getSimpleValue());
    parameters.put(PATH_FILTER_PARAM, val == null ? "" : val.format());
    sval = data.getInheritableValue(prefix, "Earned_Value//Merged_Path_Filter");
    if (sval == null)
        sval = data.getInheritableValue(prefix, "Earned_Value_Merged_Path_Filter");
    val = (sval == null ? null : sval.getSimpleValue());
    parameters.put(MERGED_PATH_FILTER_PARAM, val == null ? "" : val.format());
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) SaveableData(net.sourceforge.processdash.data.SaveableData)

Aggregations

SimpleData (net.sourceforge.processdash.data.SimpleData)164 ListData (net.sourceforge.processdash.data.ListData)20 DoubleData (net.sourceforge.processdash.data.DoubleData)15 SaveableData (net.sourceforge.processdash.data.SaveableData)14 StringData (net.sourceforge.processdash.data.StringData)13 IOException (java.io.IOException)11 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)11 DateData (net.sourceforge.processdash.data.DateData)10 Iterator (java.util.Iterator)9 List (java.util.List)7 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)6 NumberData (net.sourceforge.processdash.data.NumberData)6 Element (org.w3c.dom.Element)6 Map (java.util.Map)5 DataContext (net.sourceforge.processdash.data.DataContext)5 EscapeString (net.sourceforge.processdash.util.EscapeString)5 File (java.io.File)4