use of javafx.collections.ObservableList in project jphp by jphp-compiler.
the class UXChoiceBox method update.
@Signature
@SuppressWarnings("unchecked")
public void update() {
ObservableList items = getWrappedObject().getItems();
getWrappedObject().setItems(null);
getWrappedObject().setItems(items);
}
use of javafx.collections.ObservableList in project jphp by jphp-compiler.
the class UXList method offsetExists.
@Override
public Memory offsetExists(Environment environment, Memory... memories) {
ObservableList list = getWrappedObject();
int index = memories[0].toInteger();
return index >= 0 && index < list.size() ? Memory.TRUE : Memory.FALSE;
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class GDController method dynamicGenerateGDTable.
/**
* 生成动态股东表
*
* @time 2018年1月20日
*/
private void dynamicGenerateGDTable() {
// 股东列表
Set<String> gudongSet = gudongTeamMap.keySet();
List<String> _gudongList = new ArrayList<>(gudongSet);
Collections.sort(_gudongList);
TableView<GudongRateInfo> table;
ObservableList<GudongRateInfo> obList = FXCollections.observableArrayList();
for (String gudongName : _gudongList) {
table = new TableView<GudongRateInfo>();
// 设置列
TableColumn firstNameCol = new TableColumn("股东" + gudongName);
firstNameCol.setStyle("-fx-alignment: CENTER;");
firstNameCol.setPrefWidth(100);
firstNameCol.setCellValueFactory(new PropertyValueFactory<GudongRateInfo, String>("gudongName"));
TableColumn lastNameCol = new TableColumn("0%");
lastNameCol.setStyle("-fx-alignment: CENTER;");
lastNameCol.setPrefWidth(92);
lastNameCol.setCellValueFactory(new PropertyValueFactory<GudongRateInfo, String>("gudongProfit"));
lastNameCol.setCellFactory(MyController.getColorCellFactory(new GudongRateInfo()));
table.setPrefWidth(210);
TableColumn tempValCol = new TableColumn("0");
tempValCol.setStyle("-fx-alignment: CENTER;");
tempValCol.setPrefWidth(60);
tempValCol.setCellValueFactory(new PropertyValueFactory<GudongRateInfo, String>("description"));
tempValCol.setCellFactory(MyController.getColorCellFactory(new GudongRateInfo()));
table.setPrefWidth(210 + 60);
table.getColumns().addAll(firstNameCol, lastNameCol, tempValCol);
// 设置数据
// {团队ID:List<Record}
Map<String, List<Record>> teamMap = gudongTeamMap.get(gudongName);
List<KaixiaoInfo> kaixiaoList = gudongKaixiaoMap.get(gudongName);
setDynamicTableData(table, teamMap, kaixiaoList, gudongName);
// 往左边的股东表中添加记录
setDataToSumTable(table);
contributionHBox.setSpacing(5);
contributionHBox.setPadding(new Insets(0, 0, 0, 0));
contributionHBox.getChildren().addAll(table);
}
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class GDController method setTable_JLGu_data.
/**
* 设置股东奖励股数据
*/
private void setTable_JLGu_data() {
// 股东及股东的记录数,一个记录数就是一个人次
Map<String, List<Record>> gudongSizeMap = dataList.stream().collect(// 按股东分
Collectors.groupingBy(record -> getGudongByPlayerId((Record) record)));
ObservableList<String> gudongList = MyController.getGudongList();
for (String gudong : gudongList) {
if (!gudongSizeMap.keySet().contains(gudong)) {
gudongSizeMap.put(gudong, new ArrayList<>());
}
}
// 获取非银河的股东的所有人次利润
Double renciProfit = getRenciTotalProfit_not_yinhe();
ObservableList<GDInputInfo> obList = FXCollections.observableArrayList();
// 股东列表总和:除了银河股东,用于获取各股东的比例(比拼值),加上了总人次利润(除去银河股东)
Double sum = tableGDSum.getItems().stream().filter(info -> !info.getGudongName().contains("银河")).map(info -> NumUtil.getNum(info.getGudongProfit())).reduce(Double::sum).orElseGet(() -> 0d) + renciProfit;
// 获取可分配的奖励池
Double curragePool = getJLPoolAvailable();
// 计算各股东的奖励金额
tableGDSum.getItems().stream().filter(info -> !info.getGudongName().contains("银河")).map(info -> {
/**
******************************************************添加相应股东的人次总利润*********
*/
String gudongId = info.getGudongName().replace("股东", "");
Integer size = gudongSizeMap.get(gudongId).size();
Double gudongTotalRenciProfit = NumUtil.getNumTimes(size.toString(), getRenci());
/**
***************************************************************
*/
Double rate = divide((NumUtil.getNum(info.getGudongProfit()) + gudongTotalRenciProfit), sum);
Double currageMoney = curragePool * rate;
// 明细缓存
GDDetailInfo gdDetailInfo = detailMap.get(info.getGudongName());
gdDetailInfo.setJl7(NumUtil.digit0(currageMoney));
// 返回
return new GDInputInfo(info.getGudongName(), NumUtil.getPercentStr(rate), NumUtil.digit0(currageMoney));
}).forEach(info -> obList.add(info));
// 设置数据并刷新表
tableEncourageGu.setItems(obList);
tableEncourageGu.refresh();
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class LMController method setDataTableLMDetail.
/**
* 根据ID更新详情表
*
* @time 2017年11月25日
* @param clubId
* @param isNeedSum 是否需要进行求和
*/
public void setDataTableLMDetail(String clubId, boolean isNeedSum) {
tableLMDetail.setItems(null);
// List<Record> list = eachClubList.get(clubId);
int LMTypeIndex = this.getCurrentLMType() - 1;
Map<String, List<Record>> LMMap = LMTotalList.get(LMTypeIndex);
List<Record> list = LMMap.get(clubId);
ObservableList<LMDetailInfo> obList = FXCollections.observableArrayList();
if (list == null) {
tableLMDetail.setItems(obList);
// 如果有回查功能就有可能出现这个问题
log.warn("根据详情表找不到俱乐部信息:" + clubId);
return;
}
if (isNeedSum)
// 求和统计
list = computSumList(list, true);
list.forEach(record -> {
// * @param lmDetailTableId
// * @param lmDetailZJ
// * @param lmDetailInsure
// * @param lmDetailPersonCount
String tableId = record.getTableId();
String zj = record.getScore();
String insure = record.getInsurance();
String personNumbers = record.getPersonCount();
obList.add(new LMDetailInfo(tableId, zj, insure, personNumbers));
});
tableLMDetail.setItems(obList);
}
Aggregations