use of com.cas.sim.tis.util.HTTPUtils in project TeachingInSimulation by ScOrPiOzzy.
the class ClientConfig method buildHttpUtil.
@Bean
public HTTPUtils buildHttpUtil() {
HTTPUtils util = new HTTPUtils();
util.setHost(httpdAddress);
util.setPort(httpdPort);
try {
SocketTest.test(httpdAddress, httpdPort);
} catch (RuntimeException e) {
throw e;
}
return util;
}
use of com.cas.sim.tis.util.HTTPUtils in project TeachingInSimulation by ScOrPiOzzy.
the class ResourceViewer method createImageViewer.
/**
* 创建图片浏览
*/
public void createImageViewer() {
HTTPUtils utils = SpringUtil.getBean(HTTPUtils.class);
// Image image = new Image("http://192.168.1.19:8082/Test/1516772514400.png");
String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
if (url == null) {
return;
}
Image image = new Image(url);
ImageView imageView = new ImageView(image);
HBox box = new HBox(imageView);
box.setAlignment(Pos.CENTER);
ScrollPane scrollPane = new ScrollPane(box);
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
scrollPane.setPannable(true);
double width = image.getWidth();
double height = image.getHeight();
DoubleProperty zoomProperty = new SimpleDoubleProperty(1);
zoomProperty.addListener(observable -> {
if (height * zoomProperty.get() > viewer.getHeight()) {
return;
}
imageView.setFitWidth(width * zoomProperty.get());
imageView.setFitHeight(height * zoomProperty.get());
});
scrollPane.addEventFilter(ScrollEvent.ANY, new EventHandler<ScrollEvent>() {
@Override
public void handle(ScrollEvent event) {
double delta = event.getDeltaY() / 100;
double zoom = zoomProperty.get();
double zoomDelta = zoom + delta;
if (zoomDelta < 0.5) {
zoomProperty.set(0.5);
} else if (zoomDelta > 2) {
zoomProperty.set(2);
} else {
zoomProperty.set(zoomDelta);
}
}
});
viewer.getChildren().add(scrollPane);
}
use of com.cas.sim.tis.util.HTTPUtils in project TeachingInSimulation by ScOrPiOzzy.
the class ResourceViewer method createVLCViewer.
/**
* 创建视频查看器
*/
private void createVLCViewer() {
HTTPUtils utils = SpringUtil.getBean(HTTPUtils.class);
String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
if (url == null) {
return;
}
VLCPlayer player = new VLCPlayer();
player.loadVideo(url);
viewer.getChildren().add(player);
// player.loadVideo("http://192.168.1.19:8082/Test/Mux140928003405.avi");
// player.loadVideo("http://192.168.1.19:8082/resources/4dae3b67-1d55-4125-a577-4086585464c1.mp4");
}
use of com.cas.sim.tis.util.HTTPUtils in project TeachingInSimulation by ScOrPiOzzy.
the class ResourceViewer method createPDFViewer.
/**
* 创建PDF查看器
*/
private void createPDFViewer() {
HTTPUtils utils = SpringUtil.getBean(HTTPUtils.class);
String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
if (url == null) {
return;
}
Browser browser = new Browser(BrowserType.LIGHTWEIGHT);
browser.loadURL(url);
BrowserView view = new BrowserView(browser);
viewer.getChildren().add(view);
}
use of com.cas.sim.tis.util.HTTPUtils in project TeachingInSimulation by ScOrPiOzzy.
the class ResourceViewer method createSWFViewer.
/**
* 创建FLASH查看器
*/
private void createSWFViewer() {
HTTPUtils utils = SpringUtil.getBean(HTTPUtils.class);
String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
if (url == null) {
return;
}
SWFBrowser browser = new SWFBrowser(BrowserType.LIGHTWEIGHT);
browser.loadHTML(url);
BrowserView view = new BrowserView(browser);
viewer.getChildren().add(view);
}
Aggregations