Search in sources :

Example 56 with TableColumn

use of javafx.scene.control.TableColumn in project financial by greatkendy123.

the class LMController method viewAllClubAction.

/**
 * 查看所有俱乐部总帐单
 *
 * @time 2017年11月22日
 * @param event
 */
public void viewAllClubAction(ActionEvent event) {
    // 无数据就返回
    int size = allClubMap.size();
    if (allClubMap == null || allClubMap.size() == 0) {
        ShowUtil.show("无数据可以导出");
        return;
    }
    Map<String, List<Record>> current_LM_Map = LMTotalList.get(getCurrentLMType() - 1);
    if (MapUtil.isNullOrEmpty(current_LM_Map)) {
        ShowUtil.show("该联盟无数据可以导出");
        return;
    }
    // 组装当前要展示的联盟的相应俱乐部
    Map<String, Club> lmClubMap = getLMClub(current_LM_Map);
    // 设置合计桌费(这个没多大影响)
    setNewSumOfZF();
    // 隐藏单个所有信息
    showAllView();
    // 点击所有俱乐部总帐按钮后的单个聪明数据统计 {俱乐部ID  : 表内容}
    Map<String, List<LMSumInfo>> allClubSumMap = getAllClubSumMap(current_LM_Map);
    FlowPane flow = new FlowPane();
    flow.setId(FLOW_PANE_ID);
    flow.setMinWidth(668);
    flow.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, new BorderWidths(3))));
    flow.setVgap(20);
    flow.setHgap(20);
    flow.setPadding(new Insets(10, 10, 10, 30));
    // int size = allClubMap.size();
    // if(allClubMap == null || allClubMap.size() ==0) {
    // ShowUtil.show("无数据可以导出");
    // return;
    // }
    // 表示第一列的宽度
    final int talbeWidth = 300;
    // 表示第一列的宽度
    final int With1 = 80;
    // 表示第二列的宽度
    final int With2 = 70;
    final int With3 = 70;
    final int With4 = 60;
    final int height = 115;
    final String style = "-fx-alignment: CENTER;";
    final String clubNameStyle = "-fx-background-color: #FFFFE0;";
    // for(Map.Entry<String, Club> entry : allClubMap.entrySet()) {
    for (Map.Entry<String, Club> entry : lmClubMap.entrySet()) {
        Club club = entry.getValue();
        String clubId = entry.getKey();
        TableView table = new TableView();
        table.setPrefHeight(height);
        table.setPrefWidth(talbeWidth);
        // 设置列
        TableColumn col1 = new TableColumn(club.getName());
        col1.setPrefWidth(With1);
        col1.setStyle(style);
        col1.setSortable(false);
        col1.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumName"));
        TableColumn col2 = new TableColumn("总战绩");
        col2.setSortable(false);
        col2.setStyle(style);
        col2.setPrefWidth(With2);
        col2.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumZJ"));
        // 红色注释
        col2.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
        TableColumn col3 = new TableColumn("总保险");
        col3.setSortable(false);
        col3.setStyle(style);
        col3.setPrefWidth(With3);
        col3.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumInsure"));
        // 红色注释
        col3.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
        TableColumn col4 = new TableColumn("总人数");
        col4.setSortable(false);
        col4.setStyle(style);
        col4.setPrefWidth(With4);
        col4.setCellValueFactory(new PropertyValueFactory<LMSumInfo, String>("lmSumPersonCount"));
        table.getColumns().addAll(col1, col2, col3, col4);
        // 设置数据
        setDynamicTableData(table, clubId, allClubSumMap);
        flow.getChildren().add(table);
    }
    ;
    bigAnchorPane.getChildren().add(0, flow);
}
Also used : LMSumInfo(com.kendy.entity.LMSumInfo) Insets(javafx.geometry.Insets) TableColumn(javafx.scene.control.TableColumn) Club(com.kendy.entity.Club) BorderWidths(javafx.scene.layout.BorderWidths) FlowPane(javafx.scene.layout.FlowPane) BorderStroke(javafx.scene.layout.BorderStroke) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) Border(javafx.scene.layout.Border) Map(java.util.Map) HashMap(java.util.HashMap) TableView(javafx.scene.control.TableView)

Example 57 with TableColumn

use of javafx.scene.control.TableColumn in project financial by greatkendy123.

the class MyController method payedAllAction.

/**
 * 支付全部(有空再去实现吧)
 *
 * @time 2017年11月11日
 * @param event
 */
public void payedAllAction(ActionEvent event) {
    if (tablePaiju != null && tablePaiju.getItems() != null) {
        TableColumn<WanjiaInfo, ?> col = tablePaiju.getColumns().get(tablePaiju.getColumns().size() - 1);
        ObservableList<TableColumn<WanjiaInfo, ?>> columns = tablePaiju.getColumns();
        for (WanjiaInfo info : tablePaiju.getItems()) {
            System.out.println(info.toString());
        }
    } else {
        ShowUtil.show("全支付失败:因为牌局表为空!");
    }
}
Also used : WanjiaInfo(com.kendy.entity.WanjiaInfo) TableColumn(javafx.scene.control.TableColumn)

Example 58 with TableColumn

use of javafx.scene.control.TableColumn in project financial by greatkendy123.

the class MyController method bindCellValue.

/**
 * kendy:绑定数据域
 * @param colums TableColumn 可变参数
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void bindCellValue(TableColumn<? extends Entity, String>... colums) {
    try {
        for (TableColumn column : colums) {
            String fxId = column.getId();
            column.setCellValueFactory(new PropertyValueFactory<Entity, String>(fxId));
            column.setStyle("-fx-alignment: CENTER;");
            // 禁止排序
            column.setSortable(false);
        }
    } catch (Exception e) {
        throw new RuntimeException("小林:绑定列值失败");
    }
}
Also used : Entity(com.kendy.interfaces.Entity) TableColumn(javafx.scene.control.TableColumn) IOException(java.io.IOException)

Example 59 with TableColumn

use of javafx.scene.control.TableColumn in project jgnash by ccavanaugh.

the class BudgetTableController method buildAccountPeriodResultsColumn.

private TableColumn<Account, BigDecimal> buildAccountPeriodResultsColumn(final int index) {
    final BudgetPeriodDescriptor descriptor = budgetResultsModel.getDescriptorList().get(index);
    // determine if the column is to be highlighted if the period is not yearly
    final Boolean highlight = (descriptor.isBetween(LocalDate.now()) ? Boolean.TRUE : Boolean.FALSE) && budget.get().getBudgetPeriod() != Period.YEARLY;
    final TableColumn<Account, BigDecimal> headerColumn = new TableColumn<>(descriptor.getPeriodDescription());
    final TableColumn<Account, BigDecimal> budgetedColumn = new TableColumn<>(resources.getString("Column.Budgeted"));
    budgetedColumn.getProperties().put(NOW, highlight);
    budgetedColumn.setCellValueFactory(param -> {
        if (param.getValue() != null) {
            return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getBudgeted());
        }
        return new SimpleObjectProperty<>(BigDecimal.ZERO);
    });
    budgetedColumn.setCellFactory(param -> new AccountCommodityFormatTableCell());
    lockColumnBehavior(budgetedColumn, columnWidth);
    headerColumn.getColumns().add(budgetedColumn);
    final TableColumn<Account, BigDecimal> actualColumn = new TableColumn<>(resources.getString("Column.Actual"));
    actualColumn.getProperties().put(NOW, highlight);
    actualColumn.setCellValueFactory(param -> {
        if (param.getValue() != null) {
            return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getChange());
        }
        return new SimpleObjectProperty<>(BigDecimal.ZERO);
    });
    actualColumn.setCellFactory(param -> new AccountCommodityFormatTableCell());
    lockColumnBehavior(actualColumn, columnWidth);
    headerColumn.getColumns().add(actualColumn);
    final TableColumn<Account, BigDecimal> remainingColumn = new TableColumn<>(resources.getString("Column.Remaining"));
    remainingColumn.getProperties().put(NOW, highlight);
    remainingColumn.setCellValueFactory(param -> {
        if (param.getValue() != null) {
            return new SimpleObjectProperty<>(budgetResultsModel.getResults(descriptor, param.getValue()).getRemaining());
        }
        return new SimpleObjectProperty<>(BigDecimal.ZERO);
    });
    remainingColumn.setCellFactory(param -> new AccountCommodityFormatTableCell());
    lockColumnBehavior(remainingColumn, remainingColumnWidth);
    headerColumn.getColumns().add(remainingColumn);
    headerColumn.resizableProperty().set(false);
    return headerColumn;
}
Also used : Account(jgnash.engine.Account) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) BudgetPeriodDescriptor(jgnash.engine.budget.BudgetPeriodDescriptor) TableColumn(javafx.scene.control.TableColumn) TreeTableColumn(javafx.scene.control.TreeTableColumn) BigDecimal(java.math.BigDecimal)

Example 60 with TableColumn

use of javafx.scene.control.TableColumn in project jgnash by ccavanaugh.

the class BudgetTableController method buildAccountTypeTable.

private void buildAccountTypeTable() {
    final TableColumn<AccountGroup, String> nameColumn = new TableColumn<>(resources.getString("Column.Type"));
    nameColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().toString()));
    accountTypeTable.getColumns().add(nameColumn);
}
Also used : AccountGroup(jgnash.engine.AccountGroup) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) TableColumn(javafx.scene.control.TableColumn) TreeTableColumn(javafx.scene.control.TreeTableColumn)

Aggregations

TableColumn (javafx.scene.control.TableColumn)132 TableView (javafx.scene.control.TableView)68 TableCell (javafx.scene.control.TableCell)66 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)46 Button (javafx.scene.control.Button)44 VBox (javafx.scene.layout.VBox)41 Tooltip (javafx.scene.control.Tooltip)40 Callback (javafx.util.Callback)40 ObservableList (javafx.collections.ObservableList)39 Insets (javafx.geometry.Insets)37 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)36 Label (javafx.scene.control.Label)35 ArrayList (java.util.ArrayList)33 List (java.util.List)33 Scene (javafx.scene.Scene)32 Res (bisq.core.locale.Res)31 FxmlView (bisq.desktop.common.view.FxmlView)31 Inject (javax.inject.Inject)31 HyperlinkWithIcon (bisq.desktop.components.HyperlinkWithIcon)30 SortedList (javafx.collections.transformation.SortedList)27