use of javafx.collections.ObservableList in project financial by greatkendy123.
the class ZonghuiService method initTableKaixiaoAndGetSum.
/**
* 总汇Tab中的开销表赋值
*/
public static String initTableKaixiaoAndGetSum(TableView<ZonghuiKaixiaoInfo> tableZonghuiKaixiao) {
ObservableList<ZonghuiKaixiaoInfo> obList = FXCollections.observableArrayList();
Map<String, Map<String, String>> lockedMap = DataConstans.All_Locked_Data_Map;
String sumOfKaixiao = "0";
if (lockedMap.size() > 0) {
Map<String, String> map = lockedMap.get(DataConstans.Index_Table_Id_Map.size() + "");
List<KaixiaoInfo> KaixiaoInfoList = JSON.parseObject(MoneyService.getJsonString(map, "实时开销"), new TypeReference<List<KaixiaoInfo>>() {
});
for (KaixiaoInfo infos : KaixiaoInfoList) {
obList.add(new ZonghuiKaixiaoInfo(infos.getKaixiaoType(), infos.getKaixiaoMoney()));
}
sumOfKaixiao = MoneyService.getJsonString(map, "实时开销总和");
tableZonghuiKaixiao.getColumns().get(1).setText(sumOfKaixiao);
}
tableZonghuiKaixiao.setItems(obList);
tableZonghuiKaixiao.refresh();
return sumOfKaixiao;
}
use of javafx.collections.ObservableList in project financial by greatkendy123.
the class TGController method refreshTableTGTeamSum.
/**
* 刷新托管团队总和数据(合计)
*/
public void refreshTableTGTeamSum() {
ObservableList<TGTeamInfo> items = tableTGZhanji.getItems();
// 1 战绩2.5%:
double zjRate25Sum = items.stream().mapToDouble(info -> NumUtil.getNum(info.getTgZJ25())).sum();
// 2 战绩未知
String columnName = tableTGZhanji.getColumns().get(5).getText();
double zjRateUnknowSum = tableTGZhanji.getItems().stream().mapToDouble(info -> NumUtil.getNum(info.getTgZJUnknow())).sum();
// 3 保险
double zjBaoxianSum = items.stream().mapToDouble(info -> NumUtil.getNum(info.getTgBaoxian())).sum() * (-0.975);
// 4 回保
double zjHuibaoSum = items.stream().mapToDouble(info -> NumUtil.getNum(info.getTgHuiBao())).sum();
// 5 总和
double zjProfitSum = zjRate25Sum - zjRateUnknowSum + zjBaoxianSum - zjHuibaoSum;
// 6 总人次
int size = 0;
if (items != null) {
size = items.size();
}
List<TypeValueInfo> list = new ArrayList<TypeValueInfo>();
list.add(new TypeValueInfo("战绩2.5%合计", NumUtil.digit2(zjRate25Sum + "")));
list.add(new TypeValueInfo(columnName + "合计", NumUtil.digit2(zjRateUnknowSum + "")));
list.add(new TypeValueInfo("保险合计", NumUtil.digit2(zjBaoxianSum + "")));
list.add(new TypeValueInfo("回保合计", NumUtil.digit2(zjHuibaoSum + "")));
list.add(new TypeValueInfo("总利润合计", NumUtil.digit2(zjProfitSum + "")));
list.add(new TypeValueInfo("总人次", size + ""));
ObservableList<TypeValueInfo> obList = FXCollections.observableArrayList(list);
tableZJSum.setItems(obList);
}
use of javafx.collections.ObservableList in project blue by kunstmusik.
the class ParameterLineView method editPoints.
private void editPoints() {
TableView<LinePoint> table = new TableView<>();
TableColumn<LinePoint, Double> xCol = new TableColumn<>("x");
TableColumn<LinePoint, Double> yCol = new TableColumn<>("y");
table.getColumns().setAll(xCol, yCol);
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
table.setItems(getSelectedLine().getObservableList());
table.setEditable(true);
xCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<LinePoint, Double>, ObservableValue<Double>>() {
@Override
public ObservableValue<Double> call(TableColumn.CellDataFeatures<LinePoint, Double> param) {
return new ReadOnlyObjectWrapper<>(param.getValue().getX() * getDuration() + getStartTime());
}
});
xCol.setCellFactory(TextFieldTableCell.forTableColumn(new DoubleStringConverter()));
xCol.setOnEditCommit(te -> {
LinePoint lp = te.getRowValue();
ObservableList<LinePoint> lpList = getSelectedLine().getObservableList();
if (getSelectedLine().getLinePoint(0) == lp || getSelectedLine().getLinePoint(getSelectedLine().size() - 1) == lp) {
return;
}
int index = lpList.indexOf(lp);
double v = (te.getNewValue() - getStartTime()) / getDuration();
lp.setX(Utils.clamp(lpList.get(index - 1).getX(), v, lpList.get(index + 1).getX()));
});
xCol.setEditable(true);
yCol.setCellValueFactory(new PropertyValueFactory<>("y"));
yCol.setCellFactory(TextFieldTableCell.forTableColumn(new DoubleStringConverter()));
yCol.setOnEditCommit(te -> {
te.getRowValue().setY(Utils.clamp(getSelectedLine().getMin(), te.getNewValue(), getSelectedLine().getMax()));
});
yCol.setEditable(true);
Dialog<ButtonType> d = new Dialog<>();
d.initOwner(getScene().getWindow());
d.initModality(Modality.APPLICATION_MODAL);
d.getDialogPane().setContent(new ScrollPane(table));
d.getDialogPane().getStylesheets().add(BlueFX.getBlueFxCss());
d.getDialogPane().getButtonTypes().setAll(ButtonType.OK);
d.setTitle("Edit Points");
TableModelListener tml = tme -> {
repaint();
};
getSelectedLine().addTableModelListener(tml);
Optional<ButtonType> res = d.showAndWait();
getSelectedLine().removeTableModelListener(tml);
}
use of javafx.collections.ObservableList in project latexdraw by arnobl.
the class Canvas method updateSelectionBorders.
private void updateSelectionBorders() {
if (selectionBorder.isDisable())
return;
Platform.runLater(() -> {
final ObservableList<IShape> selection = drawing.getSelection().getShapes();
if (selection.isEmpty()) {
selectionBorder.setVisible(false);
} else {
final Rectangle2D rec = selection.stream().map(sh -> shapesToViewMap.get(sh)).filter(vi -> vi != null).map(vi -> {
final Bounds b = vi.getBoundsInParent();
return (Rectangle2D) new Rectangle2D.Double(b.getMinX(), b.getMinY(), b.getWidth(), b.getHeight());
}).reduce(Rectangle2D::createUnion).orElse(new Rectangle2D.Double());
selectionBorder.setLayoutX(rec.getMinX());
selectionBorder.setLayoutY(rec.getMinY());
selectionBorder.setWidth(rec.getWidth());
selectionBorder.setHeight(rec.getHeight());
selectionBorder.setVisible(true);
}
});
}
use of javafx.collections.ObservableList in project latexdraw by arnobl.
the class ShortcutsController method initialize.
@SuppressWarnings("unchecked")
@Override
public void initialize(final URL location, final ResourceBundle resources) {
final String ctrl = KeyEvent.getKeyModifiersText(InputEvent.CTRL_MASK);
final String shift = KeyEvent.getKeyModifiersText(InputEvent.SHIFT_MASK);
// $NON-NLS-1$
final String leftClick = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.8");
// $NON-NLS-1$
final String catEdit = LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.89");
// $NON-NLS-1$
final String catNav = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.4");
// $NON-NLS-1$
final String catTran = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.5");
// $NON-NLS-1$
final String catDraw = LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.6");
// $NON-NLS-1$
final String catFile = LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.88");
for (int i = 0, size = table.getColumns().size(); i < size; i++) {
final int colIndex = i;
final TableColumn<ObservableList<String>, String> col = (TableColumn<ObservableList<String>, String>) table.getColumns().get(i);
col.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().get(colIndex)));
}
table.getColumns().forEach(col -> col.prefWidthProperty().bind(table.widthProperty().divide(3)));
// $NON-NLS-1$
table.getItems().addAll(// $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+C", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.40"), catEdit), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+V", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.43"), catEdit), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+X", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.44"), catEdit), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+Z", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.23"), catEdit), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+Y", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.22"), catEdit), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+N", LangTool.INSTANCE.getBundle().getString("Res.2"), catFile), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+O", LangTool.INSTANCE.getBundle().getString("FileLoaderSaver.3"), catFile), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + "+S", LangTool.INSTANCE.getBundle().getString("FileLoaderSaver.1"), catFile), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+W", LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.18"), catFile), // $NON-NLS-1$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_ADD), LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.57"), catNav), // $NON-NLS-1$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_SUBTRACT), LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.58"), catNav), // $NON-NLS-1$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_DELETE), LangTool.INSTANCE.getBundle().getString("LaTeXDrawFrame.17"), catDraw), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_RIGHT), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.9"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_LEFT), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.10"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_UP), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.11"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(KeyEvent.getKeyText(KeyEvent.VK_DOWN), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.12"), catNav), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+U", LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.23"), catTran), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + "+A", LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.25"), catDraw), // $NON-NLS-1$
FXCollections.observableArrayList(ctrl + '+' + leftClick, LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.26"), catDraw), // $NON-NLS-1$
FXCollections.observableArrayList(shift + '+' + leftClick, LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.27"), catDraw), // $NON-NLS-1$ //$NON-NLS-2$
FXCollections.observableArrayList(ctrl + '+' + LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.29"), LangTool.INSTANCE.getBundle().getString("ShortcutsFrame.30"), catDraw));
}
Aggregations