Search in sources :

Example 16 with ObservableList

use of javafx.collections.ObservableList in project loinc2hpo by monarch-initiative.

the class SetupTabController method initTextFlow.

private void initTextFlow() {
    Text text1 = new Text("\n\tLOINC2HPO: An app for biocuration LOINC to HPO mappings");
    text1.setFont(new Font(15));
    text1.setFill(Color.DARKSLATEBLUE);
    Text text2 = new Text("\n\n\t\t1. Use the edit menu to download hp.obo");
    Text text3 = new Text("\n\t\t2. Use the edit menu to tell the app where the LOINC file is located");
    Text text4 = new Text("\n\t\t3. Use the edit menu to indicate your biocurator id");
    Text text5 = new Text("\n\t\t4. Indicate location of loinc2hpo.tab curation file (usually the file from GitHub)");
    ObservableList list = textflow.getChildren();
    list.addAll(text1, text2, text3, text4, text5);
}
Also used : ObservableList(javafx.collections.ObservableList) Text(javafx.scene.text.Text) Font(javafx.scene.text.Font)

Example 17 with ObservableList

use of javafx.collections.ObservableList in project org.csstudio.display.builder by kasemir.

the class WidgetTree method bindSelections.

/**
 * Link selections in tree view and model
 */
private void bindSelections() {
    // Update selected widgets in model from selection in tree_view
    final ObservableList<TreeItem<WidgetOrTab>> tree_selection = tree_view.getSelectionModel().getSelectedItems();
    InvalidationListener listener = (Observable observable) -> {
        if (!active.compareAndSet(false, true))
            return;
        try {
            final List<Widget> widgets = new ArrayList<>(tree_selection.size());
            for (TreeItem<WidgetOrTab> item : tree_selection) {
                final WidgetOrTab wot = item.getValue();
                final Widget widget = wot.isWidget() ? wot.getWidget() : wot.getTab().getWidget();
                if (!widgets.contains(widget))
                    widgets.add(widget);
            }
            ;
            logger.log(Level.FINE, "Selected in tree: {0}", widgets);
            editor.getWidgetSelectionHandler().setSelection(widgets);
        } finally {
            active.set(false);
        }
    };
    tree_selection.addListener(listener);
    // Update selection in tree_view from selected widgets in model
    editor.getWidgetSelectionHandler().addListener(this::setSelectedWidgets);
}
Also used : TreeItem(javafx.scene.control.TreeItem) TabsWidget(org.csstudio.display.builder.model.widgets.TabsWidget) Widget(org.csstudio.display.builder.model.Widget) InvalidationListener(javafx.beans.InvalidationListener) ArrayList(java.util.ArrayList) List(java.util.List) ObservableList(javafx.collections.ObservableList) Observable(javafx.beans.Observable)

Example 18 with ObservableList

use of javafx.collections.ObservableList in project financial by greatkendy123.

the class MoneyService method updatetTableProfitFirst.

private static void updatetTableProfitFirst(TableView<ProfitInfo> tableProfit) {
    /**
     ********************************************** 利润表  *************
     */
    // 1清空 表数据
    tableProfit.setItems(null);
    // 2获取InfoList
    ObservableList<ProfitInfo> observableList3 = FXCollections.observableArrayList();
    Map<String, String> profitMap = null;
    if (DataConstans.Index_Table_Id_Map.size() == 0) {
        log.info("=========================刷新(从昨天加载数据)");
        if (DBUtil.isPreData2017VeryFirst()) {
            profitMap = JSON.parseObject(DataConstans.preDataMap.get("昨日利润"), new TypeReference<Map<String, String>>() {
            });
            if (profitMap != null) {
                profitMap.forEach((type, account) -> {
                    observableList3.add(new ProfitInfo(type, digit0(account)));
                });
            }
        } else {
            List<ProfitInfo> list = JSON.parseObject(DataConstans.preDataMap.get("利润"), new TypeReference<List<ProfitInfo>>() {
            });
            if (list != null) {
                list.forEach(info -> {
                    observableList3.add(new ProfitInfo(info.getProfitType(), digit0(info.getProfitAccount())));
                });
            }
        }
    } else {
        log.info("=========================刷新(从上一场加载数据)");
        Map<String, String> map = DataConstans.All_Locked_Data_Map.get(DataConstans.Index_Table_Id_Map.size() + "");
        List<ProfitInfo> ProfitInfoList = JSON.parseObject(MoneyService.getJsonString(map, "利润"), new TypeReference<List<ProfitInfo>>() {
        });
        for (ProfitInfo infos : ProfitInfoList) {
            observableList3.add(infos);
        }
        // sumMap相关设值
        MyController mc = Main.myController;
        int size = DataConstans.Index_Table_Id_Map.size();
        if (size >= 1) {
            // 此情况下要从上一场加载==团队回水总和
            // DataConstans.SumMap = new HashMap<String,Double>();
            String shangchangKaixiao = MoneyService.getLockedInfo(size + "", "实时开销总和");
            // add 9-1
            DataConstans.SumMap.put("上场开销", Double.valueOf(shangchangKaixiao));
        }
    }
    tableProfit.setItems(observableList3);
    tableProfit.refresh();
}
Also used : List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) TypeReference(com.alibaba.fastjson.TypeReference) ProfitInfo(com.kendy.entity.ProfitInfo) MyController(application.MyController)

Example 19 with ObservableList

use of javafx.collections.ObservableList in project financial by greatkendy123.

the class MoneyService method fillTableCurrentMoneyInfo2.

/**
 * 将前一次的实时金额数据备份到第01表=== 非2017-01-01
 * @param table
 * @param userInfoList
 */
public static void fillTableCurrentMoneyInfo2(TableView<TeamInfo> tableTeam, TableView<CurrentMoneyInfo> table, TableView<ZijinInfo> tableZijin, TableView<ProfitInfo> tableProfit, TableView<KaixiaoInfo> tableKaixiao, Label LMLabel) {
    Map<String, String> map = DataConstans.preDataMap;
    /**
     ********************************************** 团队回水表  *************
     */
    tableTeam.setItems(null);
    ObservableList<TeamInfo> obList = FXCollections.observableArrayList();
    List<TeamInfo> teamList = JSON.parseObject(DataConstans.preDataMap.get("团队回水"), new TypeReference<List<TeamInfo>>() {
    });
    for (TeamInfo info : teamList) {
        obList.add(info);
    }
    tableTeam.setItems(obList);
    /**
     ********************************************** 实时金额表  *************
     */
    // 1清空 表数据
    table.setItems(null);
    // 2获取InfoList
    ObservableList<CurrentMoneyInfo> obListCurrentMoney = FXCollections.observableArrayList();
    List<CurrentMoneyInfo> cmList = JSON.parseObject(DataConstans.preDataMap.get("实时金额"), new TypeReference<List<CurrentMoneyInfo>>() {
    });
    for (CurrentMoneyInfo info : cmList) {
        obListCurrentMoney.add(info);
    }
    table.setItems(obListCurrentMoney);
    table.refresh();
    // 合并ID操作
    flush_SSJE_table();
    /**
     ********************************************** 资金表  *************
     */
    // 1清空 表数据
    tableZijin.setItems(null);
    // 2获取InfoList
    ObservableList<ZijinInfo> obListZijin = FXCollections.observableArrayList();
    List<ZijinInfo> zijinList = JSON.parseObject(DataConstans.preDataMap.get("资金"), new TypeReference<List<ZijinInfo>>() {
    });
    for (ZijinInfo info : zijinList) {
        obListZijin.add(info);
    }
    tableZijin.setItems(obListZijin);
    /**
     ********************************************** 利润表  *************
     */
    // 1清空 表数据
    tableProfit.setItems(null);
    // 2获取InfoList
    ObservableList<ProfitInfo> obListProfit = FXCollections.observableArrayList();
    List<ProfitInfo> profitList = JSON.parseObject(DataConstans.preDataMap.get("利润"), new TypeReference<List<ProfitInfo>>() {
    });
    for (ProfitInfo info : profitList) {
        obListProfit.add(info);
    }
    tableProfit.setItems(obListProfit);
    /**
     ********************************************** 实时开销表  *************
     */
    tableKaixiao.setItems(null);
    // 2获取InfoList
    ObservableList<KaixiaoInfo> obListKaixiao = FXCollections.observableArrayList();
    List<KaixiaoInfo> kaixiaoList = JSON.parseObject(DataConstans.preDataMap.get("实时开销"), new TypeReference<List<KaixiaoInfo>>() {
    });
    for (KaixiaoInfo info : kaixiaoList) {
        obListKaixiao.add(info);
    }
    // add 注释掉:新一天的统计中实时开销为空
    tableKaixiao.setItems(obListKaixiao);
    // 缓存一一场的实时开销总和
    DataConstans.SumMap.put("上场开销", getSumOfTableKaixiao(tableKaixiao));
    /**
     ********************************************** 联盟对帐  *************
     */
    String lm = DataConstans.preDataMap.get("联盟对帐");
    // LMLabel.setText(LMLabel.getText());//注意这里是{联盟对帐={联盟对帐=3000}}
    // 注意这里是{联盟对帐={联盟对帐=3000}}
    LMLabel.setText(lm);
}
Also used : KaixiaoInfo(com.kendy.entity.KaixiaoInfo) TeamInfo(com.kendy.entity.TeamInfo) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) ProfitInfo(com.kendy.entity.ProfitInfo) ZijinInfo(com.kendy.entity.ZijinInfo) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList)

Example 20 with ObservableList

use of javafx.collections.ObservableList in project financial by greatkendy123.

the class WaizhaiService method generateWaizhaiTables.

/**
 * 自动生成外债信息表
 * @param tableWaizhai
 * @param hbox
 * @param tableCurrentMoneyInfo
 * @param tableTeam
 */
@SuppressWarnings("unchecked")
public static void generateWaizhaiTables(TableView<WaizhaiInfo> tableWaizhai, HBox hbox, TableView<CurrentMoneyInfo> tableCurrentMoneyInfo, TableView<TeamInfo> tableTeam) {
    // 清空数据
    ObservableList<Node> allTables = hbox.getChildren();
    if (allTables != null && allTables.size() > 0)
        hbox.getChildren().remove(0, allTables.size());
    if (DataConstans.Index_Table_Id_Map.size() == 0) {
        ShowUtil.show("你当前还未锁定任意一局,查询没有数据!", 2);
        return;
    }
    ObservableList<CurrentMoneyInfo> CurrentMoneyInfo_OB_List = FXCollections.observableArrayList();
    Map<String, List<CurrentMoneyInfo>> gudongMap = get_SSJE_Gudong_Map(tableCurrentMoneyInfo, tableTeam);
    Map<String, String> sumMap = getSum(gudongMap);
    int gudongMapSize = gudongMap.size();
    if (gudongMapSize == 0) {
        ShowUtil.show("股东列表为空或实时金额为空!");
        return;
    }
    TableView<CurrentMoneyInfo> table;
    for (Map.Entry<String, List<CurrentMoneyInfo>> entry : gudongMap.entrySet()) {
        String gudongName = entry.getKey();
        List<CurrentMoneyInfo> list = entry.getValue();
        table = new TableView<CurrentMoneyInfo>();
        // 设置列
        TableColumn firstNameCol = new TableColumn("股东" + gudongName);
        firstNameCol.setPrefWidth(110);
        firstNameCol.setCellValueFactory(new PropertyValueFactory<CurrentMoneyInfo, String>("mingzi"));
        TableColumn lastNameCol = new TableColumn(sumMap.get(gudongName));
        lastNameCol.setStyle("-fx-alignment: CENTER;");
        lastNameCol.setPrefWidth(95);
        lastNameCol.setCellValueFactory(new PropertyValueFactory<CurrentMoneyInfo, String>("shishiJine"));
        lastNameCol.setCellFactory(MyController.getColorCellFactory(new CurrentMoneyInfo()));
        table.setPrefWidth(210);
        table.getColumns().addAll(firstNameCol, lastNameCol);
        // 设置数据
        CurrentMoneyInfo_OB_List = FXCollections.observableArrayList();
        for (CurrentMoneyInfo info : list) {
            CurrentMoneyInfo_OB_List.add(info);
        }
        table.setItems(CurrentMoneyInfo_OB_List);
        hbox.setSpacing(5);
        hbox.setPadding(new Insets(0, 0, 0, 0));
        hbox.getChildren().addAll(table);
    }
    // 设置债务表
    ObservableList<WaizhaiInfo> obList = FXCollections.observableArrayList();
    for (Map.Entry<String, String> entry : sumMap.entrySet()) {
        obList.add(new WaizhaiInfo(entry.getKey(), entry.getValue()));
    }
    tableWaizhai.setItems(obList);
    setWaizhaiSum(tableWaizhai);
}
Also used : Insets(javafx.geometry.Insets) WaizhaiInfo(com.kendy.entity.WaizhaiInfo) Node(javafx.scene.Node) CurrentMoneyInfo(com.kendy.entity.CurrentMoneyInfo) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ObservableList(javafx.collections.ObservableList) HashMap(java.util.HashMap) Map(java.util.Map)

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