package com.sandu.ximon.admin.dto.nova;
|
|
import com.sandu.ximon.admin.config.VnnoxConstant;
|
import com.sandu.ximon.dao.domain.LEDProgramFile;
|
import lombok.Data;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Data
|
public class PlayerWidget {
|
// 组件名称,用于日志查询使用,若不填写,日志查询时很难区分
|
private String name;
|
// 组件类型
|
//PICTURE - 图片
|
//VIDEO-视频
|
//ARCH_TEXT- 文本
|
//SIMPLE_RSS - rss媒体
|
//HTML - 网页媒体
|
//STREAM_MEDIA - 流媒体
|
//BOX - 窗口
|
//WEATHER - 简易天气组件
|
private PlayerWidgetType type;
|
// 图片和视频为必填项,内容为图片或视频的md5值
|
private String md5;
|
// 图片或视频的大小byte
|
private PlayerWidgetDisplayType displayType;
|
// 文字整体背景颜色,#00000000代表透明色
|
private String backgroundColor;
|
// 当播放方式为“滚动”时必填
|
private PlayerWidgetScrollAttribute scrollAttribute;
|
// 多行文字显示集合
|
private List<PlayerWidgetLine> lines;
|
// 图片或视频的大小byte
|
private Long size;
|
// 组件的播放时长,精确到毫秒
|
private Long duration;
|
// 图片\视频\rss\网页媒体\流媒体的访问地址, 需要自行验证地址的有效性
|
private String url;
|
// 组件的上下覆盖顺序,数字越大图层越往上,默认0
|
private Integer zIndex;
|
// 组件在页面的位置
|
private PlayerLayout layout;
|
// 组件的入场特效,默认无特效
|
private PlayerAnimation inAnimation;
|
// 窗口的内容,类型为窗口时必填,参考Widget的属性,也可以参考下面的示例
|
private List<PlayerMedia> mediaList;
|
// html组件离线播放媒体(定制功能)
|
private PlayerOffline offline;
|
|
|
private String address;
|
|
private Double latitude;
|
|
private Double longitude;
|
|
private Integer width;
|
|
private Integer height;
|
|
private Integer refreshPeriod;
|
|
private Integer fontSize;
|
|
private Boolean bold;
|
|
private Boolean italic;
|
|
private Boolean underline;
|
|
private String color;
|
|
private Integer tempUnit;
|
|
private Integer unitSymbol;
|
|
private Boolean weatherEnable;
|
|
private Boolean tempEnable;
|
|
private Boolean windEnable;
|
|
private Boolean humidEnable;
|
|
private Boolean currentTempEnable;
|
|
private Boolean isShowInOneLine;
|
|
|
public PlayerWidget generateMediaWidget(String widgetName,
|
Integer zIndex,
|
PlayerWidgetType playerWidgetType,
|
LEDProgramFile file,
|
PlayerLayout playerLayout,
|
PlayerAnimation animation) {
|
this.setName(widgetName);
|
this.setZIndex(zIndex);
|
this.setType(playerWidgetType);
|
this.setSize(Long.getLong(file.getSize()));
|
this.setMd5(file.getMd5());
|
this.setDuration(VnnoxConstant.REDIS_MAX_SAVE_TIME);
|
this.setUrl(file.getFileUrl());
|
this.setLayout(playerLayout);
|
this.setInAnimation(animation);
|
return this;
|
}
|
|
public PlayerWidget generateScrollUpTextWidget(String widgetName,
|
Integer zIndex,
|
Long duration,
|
List<String> content,
|
String contentColor,
|
Integer fontSize,
|
PlayerLayout playerLayout) {
|
this.setName(widgetName);
|
this.setZIndex(zIndex);
|
this.setType(PlayerWidgetType.ARCH_TEXT);
|
this.setDisplayType(PlayerWidgetDisplayType.SCROLL);
|
this.setBackgroundColor("#00000000");
|
this.setScrollAttribute(
|
new PlayerWidgetScrollAttribute(
|
PlayerWidgetScrollAttributeAnimation.MARQUEE_UP, 1
|
)
|
);
|
this.setDuration(duration);
|
|
|
List<PlayerWidgetLine> playerWidgetLineList = new ArrayList<>();
|
|
for (String str : content) {
|
PlayerWidgetLine playerWidgetLine = new PlayerWidgetLine();
|
List<PlayerWidgetLineTextAttributes> playerWidgetLineTextAttributesList =
|
new ArrayList<>();
|
PlayerWidgetLineTextAttributes playerWidgetLineTextAttributes =
|
new PlayerWidgetLineTextAttributes();
|
playerWidgetLineTextAttributes.setContent(str);
|
playerWidgetLineTextAttributes.setTextColor(contentColor); // "#337FE5"
|
playerWidgetLineTextAttributes.setFontSize(fontSize);
|
playerWidgetLineTextAttributes.setBold(true);
|
playerWidgetLineTextAttributes.setUnderline(false);
|
playerWidgetLineTextAttributesList.add(playerWidgetLineTextAttributes);
|
playerWidgetLine.setTextAttributes(playerWidgetLineTextAttributesList);
|
playerWidgetLineList.add(playerWidgetLine);
|
}
|
|
this.setLines(playerWidgetLineList);
|
this.setLayout(playerLayout);
|
return this;
|
}
|
|
public PlayerWidget generateLeftScrollTextWidget(
|
String widgetName,
|
Integer zIndex,
|
Long duration,
|
String content,
|
String contentColor,
|
Integer fontSize,
|
PlayerLayout playerLayout
|
) {
|
this.setName(widgetName);
|
this.setZIndex(zIndex);
|
this.setType(PlayerWidgetType.ARCH_TEXT);
|
this.setDisplayType(PlayerWidgetDisplayType.SCROLL);
|
this.setBackgroundColor("#00000000");
|
this.setScrollAttribute(
|
new PlayerWidgetScrollAttribute(
|
PlayerWidgetScrollAttributeAnimation.MARQUEE_LEFT, 2
|
)
|
);
|
this.setDuration(duration);
|
List<PlayerWidgetLine> playerWidgetLineList = new ArrayList<>();
|
|
List<PlayerWidgetLineTextAttributes> playerWidgetLineTextAttributesList =
|
new ArrayList<>();
|
PlayerWidgetLine playerWidgetLine = new PlayerWidgetLine();
|
|
PlayerWidgetLineTextAttributes playerWidgetLineTextAttributes =
|
new PlayerWidgetLineTextAttributes();
|
playerWidgetLineTextAttributes.setContent(content);
|
playerWidgetLineTextAttributes.setTextColor(contentColor); // "#337FE5"
|
playerWidgetLineTextAttributes.setFontSize(fontSize);
|
playerWidgetLineTextAttributes.setBold(true);
|
|
playerWidgetLineTextAttributesList.add(playerWidgetLineTextAttributes);
|
playerWidgetLine.setTextAttributes(playerWidgetLineTextAttributesList);
|
|
playerWidgetLineList.add(playerWidgetLine);
|
this.setLines(playerWidgetLineList);
|
this.setLayout(playerLayout);
|
return this;
|
}
|
|
|
|
|
}
|