Search in sources :

Example 61 with ObservableList

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);
}
Also used : ObservableList(javafx.collections.ObservableList) Signature(php.runtime.annotation.Reflection.Signature)

Example 62 with ObservableList

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;
}
Also used : ObservableList(javafx.collections.ObservableList)

Example 63 with ObservableList

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);
    }
}
Also used : Insets(javafx.geometry.Insets) KaixiaoInfo(com.kendy.entity.KaixiaoInfo) ArrayList(java.util.ArrayList) GudongRateInfo(com.kendy.entity.GudongRateInfo) TableColumn(javafx.scene.control.TableColumn) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList)

Example 64 with ObservableList

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();
}
Also used : Button(javafx.scene.control.Button) Initializable(javafx.fxml.Initializable) NumUtil(com.kendy.util.NumUtil) URL(java.net.URL) Random(java.util.Random) Logger(org.apache.log4j.Logger) AlertType(javafx.scene.control.Alert.AlertType) StringUtil(com.kendy.util.StringUtil) MoneyService(com.kendy.service.MoneyService) Map(java.util.Map) KaixiaoInfo(com.kendy.entity.KaixiaoInfo) MyController(application.MyController) TableView(javafx.scene.control.TableView) Alert(javafx.scene.control.Alert) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) GudongRateInfo(com.kendy.entity.GudongRateInfo) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) Set(java.util.Set) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) List(java.util.List) TypeReference(com.alibaba.fastjson.TypeReference) CollectUtil(com.kendy.util.CollectUtil) ShowUtil(com.kendy.util.ShowUtil) GDDetailInfo(com.kendy.entity.GDDetailInfo) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ButtonType(javafx.scene.control.ButtonType) Record(com.kendy.entity.Record) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) MapUtil(com.kendy.util.MapUtil) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) Insets(javafx.geometry.Insets) ResourceBundle(java.util.ResourceBundle) TableUtil(com.kendy.util.TableUtil) DataConstans(application.DataConstans) DBUtil(com.kendy.db.DBUtil) Player(com.kendy.entity.Player) Label(javafx.scene.control.Label) ClubZhuofei(com.kendy.entity.ClubZhuofei) TeamProxyService(com.kendy.service.TeamProxyService) ProfitInfo(com.kendy.entity.ProfitInfo) Main(application.Main) GDInputInfo(com.kendy.entity.GDInputInfo) ActionEvent(javafx.event.ActionEvent) JSON(com.alibaba.fastjson.JSON) Collections(java.util.Collections) GDDetailInfo(com.kendy.entity.GDDetailInfo) GDInputInfo(com.kendy.entity.GDInputInfo) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList)

Example 65 with ObservableList

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);
}
Also used : List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) Record(com.kendy.entity.Record) LMDetailInfo(com.kendy.entity.LMDetailInfo)

Aggregations

ObservableList (javafx.collections.ObservableList)77 List (java.util.List)46 ArrayList (java.util.ArrayList)31 Collectors (java.util.stream.Collectors)29 Map (java.util.Map)28 FXCollections (javafx.collections.FXCollections)28 HashMap (java.util.HashMap)21 Node (javafx.scene.Node)20 TableColumn (javafx.scene.control.TableColumn)20 Label (javafx.scene.control.Label)18 Optional (java.util.Optional)17 ActionEvent (javafx.event.ActionEvent)16 FXML (javafx.fxml.FXML)16 TableView (javafx.scene.control.TableView)16 MouseEvent (javafx.scene.input.MouseEvent)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 Button (javafx.scene.control.Button)15 BorderPane (javafx.scene.layout.BorderPane)15 File (java.io.File)14