use of com.cas.sim.tis.svg.SVGGlyph in project TeachingInSimulation by ScOrPiOzzy.
the class TestSvg method start.
@Override
public void start(Stage primaryStage) throws Exception {
SVGHelper.loadGlyphsFont(TestSvg.class.getResource("/svg/iconfont.svg"));
SVGHelper.getAllGlyphsIDs().forEach(System.out::println);
//
SVGGlyph svgGlyph = null;
svgGlyph = new SVGGlyph("iconfont.svg.excel", Color.RED, 64);
svgGlyph.setSizeForWidth(64);
Button btn1 = new Button("文字1", svgGlyph);
//
svgGlyph = new SVGGlyph("iconfont.svg.excelwenjian", Color.AQUA, 32);
svgGlyph.setSizeForWidth(32);
svgGlyph.setRotate(45);
Button btn2 = new Button("文字2", svgGlyph);
//
svgGlyph = new SVGGlyph("iconfont.svg.wui-f-excel", Color.BLANCHEDALMOND, 16);
svgGlyph.setSizeForWidth(16);
Button btn3 = new Button("文字3", svgGlyph);
VBox vb = new VBox(btn1, btn2, btn3);
primaryStage.setScene(new Scene(vb));
primaryStage.show();
}
use of com.cas.sim.tis.svg.SVGGlyph in project TeachingInSimulation by ScOrPiOzzy.
the class TypicalCaseMenu method getLeftContent.
@Override
public Region getLeftContent() {
VBox vb = new VBox(10);
Button create = createMenu(MsgUtil.getMessage("menu.button.new"), new SVGGlyph("iconfont.svg.new", Color.WHITE, 32));
create.setOnMouseClicked(e -> newCase());
Button open = createMenu(MsgUtil.getMessage("menu.button.open"), new SVGGlyph("iconfont.svg.open", Color.WHITE, 32));
open.setOnMouseClicked(e -> showCaseDialog());
Button save = createMenu(MsgUtil.getMessage("menu.button.save"), new SVGGlyph("iconfont.svg.save", Color.WHITE, 32));
save.setOnMouseClicked(e -> saveCase());
HBox menu = new HBox(22, create, open, save);
menu.setAlignment(Pos.CENTER);
// 菜单
vb.getChildren().add(menu);
vb.getChildren().add(new ElecCompTree(elecComp -> typicalCase3D.selectedElecComp(elecComp)));
return vb;
}
use of com.cas.sim.tis.svg.SVGGlyph in project TeachingInSimulation by ScOrPiOzzy.
the class PreparationDetail method createQuizTable.
private void createQuizTable() {
// 数据库唯一表示
Column<Integer> id = new Column<>();
id.setPrimary(true);
id.setVisible(false);
id.setKey("id");
// 资源图标
Column<Integer> icon = new Column<>();
icon.setAlignment(Pos.CENTER_RIGHT);
icon.setKey("icon");
icon.setText("");
icon.setMaxWidth(25);
Function<Integer, SVGGlyph> converter = new Function<Integer, SVGGlyph>() {
@Override
public SVGGlyph apply(Integer type) {
if (type == null) {
return null;
}
ResourceType resourceType = ResourceType.getResourceType(type);
return new SVGGlyph(resourceType.getIcon(), resourceType.getColor(), 22);
}
};
icon.setCellFactory(SVGIconCell.forTableColumn(converter));
// 资源名称
Column<String> name = new Column<>();
name.setAlignment(Pos.CENTER_LEFT);
name.setKey("name");
name.setText(MsgUtil.getMessage("resource.name"));
name.setMaxWidth(250);
quizs.getColumns().addAll(id, icon, name);
// 查看按钮
Column<String> view = new Column<String>();
view.setCellFactory(BtnCell.forTableColumn(MsgUtil.getMessage("button.view"), Priority.ALWAYS, "blue-btn", rid -> {
PreparationQuiz preparationQuiz = SpringUtil.getBean(PreparationQuizAction.class).findQuizById((Integer) rid);
int type = preparationQuiz.getType();
if (PreparationQuizType.LIBRARY.getType() == type) {
openLibrary(preparationQuiz.getRelationId());
} else if (PreparationQuizType.BROKEN_CASE.getType() == type) {
openBrokenCase(preparationQuiz.getRelationId());
} else if (PreparationQuizType.FREE.getType() == type) {
openFreeMode();
}
}));
view.setAlignment(Pos.CENTER_RIGHT);
quizs.getColumns().add(view);
if (RoleConst.TEACHER == Session.get(Session.KEY_LOGIN_ROLE, -1)) {
// 删除按钮
Column<String> delete = new Column<String>();
delete.setCellFactory(BtnCell.forTableColumn(MsgUtil.getMessage("button.delete"), "blue-btn", rid -> {
AlertUtil.showConfirm(MsgUtil.getMessage("alert.confirmation.data.delete"), response -> {
if (response == ButtonType.YES) {
SpringUtil.getBean(PreparationResourceAction.class).detele((Integer) rid);
loadResources();
}
});
}));
delete.setAlignment(Pos.CENTER_RIGHT);
delete.setMaxWidth(58);
quizs.getColumns().add(delete);
}
}
use of com.cas.sim.tis.svg.SVGGlyph in project TeachingInSimulation by ScOrPiOzzy.
the class ResourceList method createTable.
private void createTable() {
// 数据库唯一表示
Column<Integer> id = new Column<>();
id.setPrimary(true);
id.setVisible(false);
id.setKey("id");
// 资源图标
Column<Integer> icon = new Column<>();
icon.setAlignment(Pos.CENTER_RIGHT);
icon.setKey("type");
icon.setText("");
icon.setMaxWidth(25);
Function<Integer, SVGGlyph> converter = new Function<Integer, SVGGlyph>() {
@Override
public SVGGlyph apply(Integer type) {
if (type == null) {
return null;
}
ResourceType resourceType = ResourceType.getResourceType(type);
return new SVGGlyph(resourceType.getIcon(), resourceType.getColor(), 22);
}
};
icon.setCellFactory(SVGIconCell.forTableColumn(converter));
// 资源名称
Column<String> name = new Column<>();
name.setAlignment(Pos.CENTER_LEFT);
name.setKey("name");
name.setText(MsgUtil.getMessage("resource.name"));
name.setMaxWidth(250);
// 日期
Column<Date> date = new Column<>();
date.setAlignment(Pos.CENTER);
date.setKey("createDate");
date.setText(type.getDateLabel());
date.setMaxWidth(160);
date.setCellFactory(Cell.forTableColumn(new StringConverter<Date>() {
@Override
public String toString(Date date) {
return DateUtil.date2Str(date, DateUtil.DATE_TIME_PAT_SHOW_);
}
@Override
public Date fromString(String string) {
return null;
}
}));
table.getColumns().addAll(id, icon, name, date);
// 查看按钮
Column<String> view = new Column<String>();
view.setCellFactory(BtnCell.forTableColumn(MsgUtil.getMessage("button.view"), Priority.ALWAYS, "blue-btn", rid -> {
SpringUtil.getBean(ResourceAction.class).browsed((Integer) rid);
ResourceAction action = SpringUtil.getBean(ResourceAction.class);
Resource resource = action.findResourceByID((Integer) rid);
// 跳转到查看页面
PageController controller = SpringUtil.getBean(PageController.class);
controller.loadContent(new ResourceViewer(resource), PageLevel.Level2);
}));
view.setAlignment(Pos.CENTER_RIGHT);
table.getColumns().add(view);
if (type.isEditable()) {
// 删除按钮
Column<String> delete = new Column<String>();
delete.setCellFactory(BtnCell.forTableColumn(MsgUtil.getMessage("button.delete"), "blue-btn", rid -> {
AlertUtil.showConfirm(MsgUtil.getMessage("alert.confirmation.data.delete"), response -> {
if (response == ButtonType.YES) {
SpringUtil.getBean(ResourceAction.class).detele((Integer) rid);
pagination.reload();
}
});
}));
delete.setAlignment(Pos.CENTER_RIGHT);
delete.setMaxWidth(58);
table.getColumns().add(delete);
}
}
use of com.cas.sim.tis.svg.SVGGlyph in project TeachingInSimulation by ScOrPiOzzy.
the class DrawingController method maximize.
public void maximize() {
if (this.stage.isMaximized()) {
max.setGraphic(new SVGGlyph("iconfont.svg.revert", Color.web("#A2CBF3"), 10));
maxTip.setText(MsgUtil.getMessage("button.revert"));
} else {
max.setGraphic(new SVGGlyph("iconfont.svg.max", Color.web("#A2CBF3"), 10));
maxTip.setText(MsgUtil.getMessage("button.maximize"));
}
}
Aggregations