Search in sources :

Example 46 with TableColumn

use of javafx.scene.control.TableColumn 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)

Example 47 with TableColumn

use of javafx.scene.control.TableColumn in project blue by kunstmusik.

the class BlueJFXControlsApplication method setTablesTest.

private void setTablesTest(TabPane root) {
    TableView<Person> jfxTable = new TableView<>();
    ObservableList<Person> people = FXCollections.observableArrayList();
    for (int i = 0; i < 20; i++) {
        Person p = new Person();
        p.setFirstName("test");
        p.setLastName(Integer.toString(i));
        people.add(p);
    }
    TableColumn<Person, String> firstNameCol = new TableColumn<Person, String>("First Name");
    firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
    TableColumn<Person, String> lastNameCol = new TableColumn<Person, String>("Last Name");
    lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
    jfxTable.getColumns().addAll(firstNameCol, lastNameCol);
    jfxTable.setItems(people);
    SwingNode swingNode = new SwingNode();
    Vector v = new Vector();
    for (int i = 0; i < 20; i++) {
        Vector t = new Vector();
        t.add("test");
        t.add(Integer.toString(i));
        v.add(t);
    }
    Vector labels = new Vector();
    labels.add("First Name");
    labels.add("Last Name");
    SwingUtilities.invokeLater(() -> {
        DefaultTableModel tm = new DefaultTableModel(v, labels);
        JTable table = new JTable(tm);
        table.updateUI();
        JScrollPane scrollPane = new JScrollPane(table);
        scrollPane.setBorder(BorderFactory.createEmptyBorder());
        swingNode.setContent(scrollPane);
    });
    root.getTabs().add(new Tab("Tables", new SplitPane(jfxTable, swingNode)));
}
Also used : JScrollPane(javax.swing.JScrollPane) DefaultTableModel(javax.swing.table.DefaultTableModel) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) SplitPane(javafx.scene.control.SplitPane) TableColumn(javafx.scene.control.TableColumn) SwingNode(javafx.embed.swing.SwingNode) Tab(javafx.scene.control.Tab) JTable(javax.swing.JTable) Vector(java.util.Vector) TableView(javafx.scene.control.TableView)

Example 48 with TableColumn

use of javafx.scene.control.TableColumn 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);
}
Also used : DoubleStringConverter(javafx.util.converter.DoubleStringConverter) NumberUtilities(blue.utility.NumberUtilities) ButtonType(javafx.scene.control.ButtonType) LineList(blue.components.lines.LineList) Glow(javafx.scene.effect.Glow) MouseEvent(javafx.scene.input.MouseEvent) DoubleProperty(javafx.beans.property.DoubleProperty) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) TableModelListener(javax.swing.event.TableModelListener) LinePoint(blue.components.lines.LinePoint) TableColumn(javafx.scene.control.TableColumn) DragDirection(blue.components.DragDirection) Utils(org.controlsfx.tools.Utils) BlueFX(blue.jfx.BlueFX) ScrollPane(javafx.scene.control.ScrollPane) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) ContextMenu(javafx.scene.control.ContextMenu) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) Color(javafx.scene.paint.Color) ObjectProperty(javafx.beans.property.ObjectProperty) Modality(javafx.stage.Modality) Dialog(javafx.scene.control.Dialog) MenuItem(javafx.scene.control.MenuItem) PropertyValueFactory(javafx.scene.control.cell.PropertyValueFactory) GraphicsContext(javafx.scene.canvas.GraphicsContext) Canvas(javafx.scene.canvas.Canvas) Line(blue.components.lines.Line) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Optional(java.util.Optional) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) ObservableValue(javafx.beans.value.ObservableValue) ObservableList(javafx.collections.ObservableList) DoubleStringConverter(javafx.util.converter.DoubleStringConverter) ObservableValue(javafx.beans.value.ObservableValue) TableColumn(javafx.scene.control.TableColumn) LinePoint(blue.components.lines.LinePoint) LinePoint(blue.components.lines.LinePoint) Dialog(javafx.scene.control.Dialog) ScrollPane(javafx.scene.control.ScrollPane) TableModelListener(javax.swing.event.TableModelListener) ButtonType(javafx.scene.control.ButtonType) TableView(javafx.scene.control.TableView)

Example 49 with TableColumn

use of javafx.scene.control.TableColumn 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));
}
Also used : ObservableList(javafx.collections.ObservableList) ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper) TableColumn(javafx.scene.control.TableColumn)

Example 50 with TableColumn

use of javafx.scene.control.TableColumn in project jvarkit by lindenb.

the class IgvReview method start.

@Override
public void start(final Stage stage) throws Exception {
    stage.setTitle(getClass().getSimpleName());
    Predicate<VariantContext> ctxFilter;
    Map<String, String> params = super.getParameters().getNamed();
    if (params.containsKey("--filter")) {
        ctxFilter = JexlVariantPredicate.create(params.get("--filter"));
    } else {
        ctxFilter = V -> true;
    }
    final List<String> args = super.getParameters().getUnnamed();
    final File configFile;
    if (args.isEmpty()) {
        final FileChooser fc = new FileChooser();
        final String lastDirStr = preferences.get(LAST_USED_DIR_KEY, null);
        if (lastDirStr != null && !lastDirStr.isEmpty()) {
            fc.setInitialDirectory(new File(lastDirStr));
        }
        fc.getExtensionFilters().addAll(Collections.singletonList(new FileChooser.ExtensionFilter("Config file", "*.config", "*.cfg", "*.list")));
        configFile = fc.showOpenDialog(stage);
    } else if (args.size() == 1) {
        configFile = new File(args.get(0));
    } else {
        configFile = null;
    }
    if (configFile == null || !configFile.exists()) {
        JfxUtils.dialog().cause("Illegal number of arguments or file doesn't exists.").show(stage);
        Platform.exit();
        return;
    }
    if (configFile.isFile() && configFile.getParentFile() != null) {
        this.preferences.put(LAST_USED_DIR_KEY, configFile.getParentFile().getPath());
    }
    final List<String> configLines = Files.readAllLines(configFile.toPath());
    final Predicate<String> ignoreComment = (S) -> !S.startsWith("#");
    final Predicate<String> predVcf = S -> S.endsWith(".vcf") || S.endsWith(".vcf.gz");
    if (configLines.stream().filter(ignoreComment).filter(predVcf).count() != 1) {
        JfxUtils.dialog().cause("Found more than one vcf file in " + configFile).show(stage);
        Platform.exit();
        return;
    }
    final File vcfFile = configLines.stream().filter(ignoreComment).filter(predVcf).map(S -> new File(S)).findFirst().get();
    LOG.info("Opening vcf file and loading in memory");
    VCFFileReader vfr = null;
    CloseableIterator<VariantContext> iter = null;
    final Set<String> sampleNames;
    try {
        this.variants.clear();
        vfr = new VCFFileReader(vcfFile, false);
        this.vcfHeader = vfr.getFileHeader();
        sampleNames = new HashSet<>(this.vcfHeader.getSampleNamesInOrder());
        if (sampleNames.isEmpty()) {
            JfxUtils.dialog().cause("No Genotypes in " + vcfFile).show(stage);
            Platform.exit();
            return;
        }
        iter = vfr.iterator();
        this.variants.addAll(iter.stream().filter(ctxFilter).filter(CTX -> CTX.isVariant()).collect(Collectors.toList()));
    } catch (final Exception err) {
        JfxUtils.dialog().cause(err).show(stage);
        Platform.exit();
        return;
    } finally {
        CloserUtil.close(iter);
        CloserUtil.close(vfr);
    }
    if (this.variants.isEmpty()) {
        JfxUtils.dialog().cause("No Variants").show(stage);
        Platform.exit();
        return;
    }
    final SAMSequenceDictionary dict = this.vcfHeader.getSequenceDictionary();
    if (dict == null || dict.isEmpty()) {
        JfxUtils.dialog().cause(JvarkitException.VcfDictionaryMissing.getMessage(vcfFile.getPath())).show(stage);
        Platform.exit();
        return;
    }
    final SamReaderFactory srf = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.LENIENT);
    configLines.stream().filter(ignoreComment).filter(S -> S.endsWith(".bam")).map(S -> new File(S)).forEach(F -> {
        final SamReader samIn = srf.open(F);
        final SAMFileHeader header = samIn.getFileHeader();
        CloserUtil.close(samIn);
        String sample = null;
        for (final SAMReadGroupRecord rg : header.getReadGroups()) {
            String s = rg.getSample();
            if (s == null)
                continue;
            if (sample == null) {
                sample = s;
            } else if (!sample.equals(s)) {
                JfxUtils.dialog().cause("Two samples in " + F).show(stage);
                Platform.exit();
                return;
            }
        }
        if (sample == null) {
            JfxUtils.dialog().cause("No sample in " + F + ". Ignoring").show(stage);
            return;
        }
        if (!sampleNames.contains(sample)) {
            JfxUtils.dialog().cause("Not in VCF header " + sample + " / " + F + ". Ignoring").show(stage);
            return;
        }
        this.sample2bamFile.put(sample, F);
    });
    if (this.sample2bamFile.isEmpty()) {
        JfxUtils.dialog().cause("No valid bam file in " + configFile).show(stage);
        return;
    }
    sampleNames.retainAll(this.sample2bamFile.keySet());
    if (sampleNames.isEmpty()) {
        JfxUtils.dialog().cause("No Sample associated to bam").show(stage);
        return;
    }
    ObservableList<VariantAndGenotype> genotypes = FXCollections.observableArrayList(this.variants.stream().flatMap(CTX -> CTX.getGenotypes().stream().filter(G -> sampleNames.contains(G.getSampleName())).map(G -> new VariantAndGenotype(CTX, G))).collect(Collectors.toList()));
    if (genotypes.isEmpty()) {
        JfxUtils.dialog().cause("No Genotype to show").show(stage);
        return;
    }
    Menu menu = new Menu("File");
    MenuItem menuItem = new MenuItem("Save as...");
    menuItem.setOnAction(AE -> {
        saveVariantsAs(stage);
    });
    menu.getItems().add(menuItem);
    menuItem = new MenuItem("Save");
    menuItem.setOnAction(AE -> {
        if (this.saveAsFile != null) {
            saveVariants(stage, this.saveAsFile);
        } else {
            saveVariantsAs(stage);
        }
    });
    menu.getItems().add(menuItem);
    menu.getItems().add(new SeparatorMenuItem());
    menuItem = new MenuItem("Quit");
    menuItem.setOnAction(AE -> {
        Platform.exit();
    });
    menu.getItems().add(menuItem);
    MenuBar bar = new MenuBar(menu);
    this.genotypeTable = new TableView<>(genotypes);
    this.genotypeTable.getColumns().add(makeColumn("CHROM", G -> G.ctx.getContig()));
    this.genotypeTable.getColumns().add(makeColumn("POS", G -> G.ctx.getStart()));
    this.genotypeTable.getColumns().add(makeColumn("ID", G -> G.ctx.getID()));
    this.genotypeTable.getColumns().add(makeColumn("REF", G -> G.ctx.getReference().getDisplayString()));
    this.genotypeTable.getColumns().add(makeColumn("ALT", G -> G.ctx.getAlternateAlleles().stream().map(A -> A.getDisplayString()).collect(Collectors.joining(","))));
    this.genotypeTable.getColumns().add(makeColumn("Sample", G -> G.g.getSampleName()));
    this.genotypeTable.getColumns().add(makeColumn("Type", G -> G.g.getType().name()));
    this.genotypeTable.getColumns().add(makeColumn("Alleles", G -> G.g.getAlleles().stream().map(A -> A.getDisplayString()).collect(Collectors.joining(","))));
    TableColumn<VariantAndGenotype, String> reviewCol = new TableColumn<>("Review");
    reviewCol.setCellValueFactory(C -> C.getValue().getReviewProperty());
    reviewCol.setCellFactory(TextFieldTableCell.forTableColumn());
    reviewCol.setOnEditCommit((E) -> {
        int y = E.getTablePosition().getRow();
        this.genotypeTable.getItems().get(y).setReview(E.getNewValue());
    });
    reviewCol.setEditable(true);
    this.genotypeTable.getColumns().add(reviewCol);
    this.genotypeTable.getSelectionModel().cellSelectionEnabledProperty().set(true);
    this.genotypeTable.setEditable(true);
    final ContextMenu cm = new ContextMenu();
    MenuItem mi1 = new MenuItem("Menu 1");
    cm.getItems().add(mi1);
    MenuItem mi2 = new MenuItem("Menu 2");
    cm.getItems().add(mi2);
    this.genotypeTable.setOnMousePressed(event -> {
        if (event.isPrimaryButtonDown() && (event.getClickCount() == 3 || event.isShiftDown())) {
            moveIgvTo(stage, genotypeTable.getSelectionModel().getSelectedItem());
        } else if (event.isSecondaryButtonDown()) {
            cm.show(genotypeTable, event.getScreenX(), event.getScreenY());
        }
    });
    final BorderPane pane2 = new BorderPane(this.genotypeTable);
    pane2.setPadding(new Insets(10, 10, 10, 10));
    VBox vbox1 = new VBox(bar, pane2);
    final Scene scene = new Scene(vbox1, 500, 300);
    stage.setScene(scene);
    stage.show();
}
Also used : JexlVariantPredicate(com.github.lindenb.jvarkit.util.vcf.JexlVariantPredicate) VCFFileReader(htsjdk.variant.vcf.VCFFileReader) VCFHeader(htsjdk.variant.vcf.VCFHeader) VariantContextWriterBuilder(htsjdk.variant.variantcontext.writer.VariantContextWriterBuilder) VBox(javafx.scene.layout.VBox) SAMFileHeader(htsjdk.samtools.SAMFileHeader) Application(javafx.application.Application) Vector(java.util.Vector) ContextMenu(javafx.scene.control.ContextMenu) IgvConstants(com.github.lindenb.jvarkit.util.igv.IgvConstants) Map(java.util.Map) TableView(javafx.scene.control.TableView) CloserUtil(htsjdk.samtools.util.CloserUtil) PrintWriter(java.io.PrintWriter) MenuItem(javafx.scene.control.MenuItem) GenotypeBuilder(htsjdk.variant.variantcontext.GenotypeBuilder) Predicate(java.util.function.Predicate) Logger(com.github.lindenb.jvarkit.util.log.Logger) Set(java.util.Set) Collectors(java.util.stream.Collectors) JvarkitException(com.github.lindenb.jvarkit.lang.JvarkitException) Platform(javafx.application.Platform) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) List(java.util.List) SAMReadGroupRecord(htsjdk.samtools.SAMReadGroupRecord) VariantContextWriter(htsjdk.variant.variantcontext.writer.VariantContextWriter) VariantContext(htsjdk.variant.variantcontext.VariantContext) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) SamReaderFactory(htsjdk.samtools.SamReaderFactory) VariantContextBuilder(htsjdk.variant.variantcontext.VariantContextBuilder) Genotype(htsjdk.variant.variantcontext.Genotype) CloseableIterator(htsjdk.samtools.util.CloseableIterator) Scene(javafx.scene.Scene) Socket(java.net.Socket) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) BackingStoreException(java.util.prefs.BackingStoreException) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) Function(java.util.function.Function) ValidationStringency(htsjdk.samtools.ValidationStringency) ArrayList(java.util.ArrayList) TableColumn(javafx.scene.control.TableColumn) HashSet(java.util.HashSet) Insets(javafx.geometry.Insets) Launcher(com.github.lindenb.jvarkit.util.jcommander.Launcher) VCFHeaderLineType(htsjdk.variant.vcf.VCFHeaderLineType) MenuBar(javafx.scene.control.MenuBar) Files(java.nio.file.Files) SAMSequenceDictionary(htsjdk.samtools.SAMSequenceDictionary) IOException(java.io.IOException) SamReader(htsjdk.samtools.SamReader) InputStreamReader(java.io.InputStreamReader) File(java.io.File) Preferences(java.util.prefs.Preferences) Menu(javafx.scene.control.Menu) FileChooser(javafx.stage.FileChooser) Stage(javafx.stage.Stage) Closeable(java.io.Closeable) JfxUtils(com.github.lindenb.jvarkit.jfx.components.JfxUtils) VCFFormatHeaderLine(htsjdk.variant.vcf.VCFFormatHeaderLine) Window(javafx.stage.Window) BufferedReader(java.io.BufferedReader) Collections(java.util.Collections) BorderPane(javafx.scene.layout.BorderPane) Insets(javafx.geometry.Insets) SAMReadGroupRecord(htsjdk.samtools.SAMReadGroupRecord) VCFFileReader(htsjdk.variant.vcf.VCFFileReader) VariantContext(htsjdk.variant.variantcontext.VariantContext) MenuBar(javafx.scene.control.MenuBar) ContextMenu(javafx.scene.control.ContextMenu) SAMSequenceDictionary(htsjdk.samtools.SAMSequenceDictionary) SamReader(htsjdk.samtools.SamReader) FileChooser(javafx.stage.FileChooser) ContextMenu(javafx.scene.control.ContextMenu) Menu(javafx.scene.control.Menu) SamReaderFactory(htsjdk.samtools.SamReaderFactory) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) Scene(javafx.scene.Scene) TableColumn(javafx.scene.control.TableColumn) JvarkitException(com.github.lindenb.jvarkit.lang.JvarkitException) BackingStoreException(java.util.prefs.BackingStoreException) IOException(java.io.IOException) SAMFileHeader(htsjdk.samtools.SAMFileHeader) File(java.io.File) VBox(javafx.scene.layout.VBox)

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