protected void configureFont() { FontConfigurationDialog dialog = new FontConfigurationDialog( getDialogParent(), getHeatmapFont() ) { private static final long serialVersionUID = 1L; @Override protected String getDescription() { return DESCRIPTION_FONT_DIALOG; } }; dialog.setVisible(true); if(!dialog.isCanceled()) { this.setHeatmapFont(dialog.getSelectedFont()); } }
/** * Returns the heat map font. * * @return the heat map font */ public Font getHeatmapFont() { return this.heatmapFont.orElse(this.getFont()); }
/** * Constructs a new {@code JHeatMapPanel} wrapping {@code heatmap}. * * @param heatmap * a {@code JHeatMap}. */ public JHeatMapPanel(JHeatMap heatmap) { super(new BorderLayout()); this.heatmap = heatmap; this.initComponent(); }
protected void editColors() { ColorsSelectionDialog dialog = new ColorsSelectionDialog( getDialogParent(), 2, Integer.MAX_VALUE, asList(this.colors) ); dialog.setVisible(true); if (!dialog.isCanceled()) { this.setColors(dialog.getSelectedColors()); } }
toolbar.setLayout(layout); toolbar.add(getMenu()); this.checkInitialColors(); fixComboSize(lowColorCB); lowColorCB.setSelectedItem(this.heatmap.getLowColor()); lowColorCB.addItemListener(e -> { fixComboSize(highColorCB); highColorCB.setRenderer(new ColorListCellRenderer()); highColorCB.setSelectedItem(this.heatmap.getHighColor()); this.add(toolbar, NORTH); this.add(heatmap, CENTER);
private void transformDataMatrix() { JHeatMapDataOperationsDialog dialog = new JHeatMapDataOperationsDialog(getDialogParent()); dialog.setVisible(true); if(!dialog.isCanceled()) { applyTransformations(dialog.getTransform(), dialog.getCentering()); } }
protected void editVisibleColumns() { List<String> visible = this.heatmap.getVisibleColumnNames(); List<String> notVisible = this.heatmap.getColumnNames(); notVisible.removeAll(visible); ListSelectionDialog<String> dialog; try { dialog = new ListSelectionDialog<String>( getDialogParent(), visible, notVisible, "Visible columns", "Not visible columns" ){ private static final long serialVersionUID = 1L; public String getDescription() { return DESCRIPTION_VISIBLE_COLUMNS; } }; dialog.setVisible(true); if (!dialog.isCanceled()) { this.heatmap.setVisibleColumnNames(dialog.getSelectedItems()); } } catch (InvalidClassException e) { throw new RuntimeException(e); } }
private void setHeatmapFont(Font font) { this.heatmapFont = ofNullable(font); this.heatmap.setHeatmapFont(getHeatmapFont()); }
showComponent(new JHeatMapPanel(heatmap), "JHeatMapPanel demo");
protected void editVisibleRows() { List<String> visible = this.heatmap.getVisibleRowNames(); List<String> notVisible = this.heatmap.getRowNames(); notVisible.removeAll(visible); ListSelectionDialog<String> dialog; try { dialog = new ListSelectionDialog<String>( getDialogParent(), visible, notVisible, "Visible rows", "Not visible rows" ) { private static final long serialVersionUID = 1L; public String getDescription() { return DESCRIPTION_VISIBLE_ROWS; } }; dialog.setVisible(true); if (!dialog.isCanceled()) { this.heatmap.setVisibleRowNames(dialog.getSelectedItems()); } } catch (InvalidClassException e) { throw new RuntimeException(e); } }
protected void setHeatmapRange() { DoubleRangeInputDialog dialog = new DoubleRangeInputDialog( getDialogParent(), new DoubleRange(heatmap.getLowValue(), heatmap.getHighValue()) ) { private static final long serialVersionUID = 1L; @Override protected String getDescription() { return DESCRIPTION_RANGE_DIALOG; } }; dialog.setVisible(true); if(!dialog.isCanceled()) { heatmap.setValuesRange(dialog.getSelectedRange()); } }