Search in sources :

Example 1 with IServoyDataConverterContext

use of com.servoy.j2db.server.ngclient.IServoyDataConverterContext in project servoy-client by Servoy.

the class MediaPropertyType method wrap.

@Override
public MediaWrapper wrap(Object value, MediaWrapper previousValue, PropertyDescription propertyDescription, IWrappingContext dataConverterContext) {
    if (previousValue != null && Utils.equalObjects(value, previousValue.mediaUrl)) {
        return previousValue;
    }
    IServoyDataConverterContext servoyDataConverterContext = ((IContextProvider) dataConverterContext.getWebObject()).getDataConverterContext();
    FlattenedSolution flattenedSolution = servoyDataConverterContext.getSolution();
    INGApplication application = servoyDataConverterContext.getApplication();
    String url = getMediaUrl(value, flattenedSolution, application);
    if (url != null)
        return new MediaWrapper(value, url);
    if (value != null && !Utils.equalObjects(value, Integer.valueOf(0)))
        Debug.log("cannot convert media " + value + " using converter context " + servoyDataConverterContext);
    return null;
}
Also used : MediaWrapper(com.servoy.j2db.server.ngclient.property.types.MediaPropertyType.MediaWrapper) INGApplication(com.servoy.j2db.server.ngclient.INGApplication) IContextProvider(com.servoy.j2db.server.ngclient.IContextProvider) FlattenedSolution(com.servoy.j2db.FlattenedSolution) IServoyDataConverterContext(com.servoy.j2db.server.ngclient.IServoyDataConverterContext)

Aggregations

FlattenedSolution (com.servoy.j2db.FlattenedSolution)1 IContextProvider (com.servoy.j2db.server.ngclient.IContextProvider)1 INGApplication (com.servoy.j2db.server.ngclient.INGApplication)1 IServoyDataConverterContext (com.servoy.j2db.server.ngclient.IServoyDataConverterContext)1 MediaWrapper (com.servoy.j2db.server.ngclient.property.types.MediaPropertyType.MediaWrapper)1