001package conexp.fx.gui.cellpane;
002
003/*
004 * #%L
005 * Concept Explorer FX
006 * %%
007 * Copyright (C) 2010 - 2023 Francesco Kriegel
008 * %%
009 * This program is free software: you can redistribute it and/or modify
010 * it under the terms of the GNU General Public License as
011 * published by the Free Software Foundation, either version 3 of the
012 * License, or (at your option) any later version.
013 * 
014 * This program is distributed in the hope that it will be useful,
015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017 * GNU General Public License for more details.
018 * 
019 * You should have received a copy of the GNU General Public
020 * License along with this program.  If not, see
021 * <http://www.gnu.org/licenses/gpl-3.0.html>.
022 * #L%
023 */
024
025import javafx.application.Application;
026import javafx.event.EventHandler;
027import javafx.geometry.Pos;
028import javafx.scene.Scene;
029import javafx.scene.text.TextAlignment;
030import javafx.stage.Stage;
031import javafx.stage.WindowEvent;
032
033public final class CellPaneTest extends Application {
034
035  public static final void main(String[] args) {
036    launch(args);
037  }
038
039  @Override
040  public final void start(Stage stage) throws Exception {
041    stage.setScene(new Scene(THE_CELL_PANE, 1200, 800));
042    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
043
044      @Override
045      public void handle(WindowEvent event) {
046        System.exit(0);
047      }
048    });
049    stage.show();
050  }
051
052  private static final TestCellPane THE_CELL_PANE = new TestCellPane();
053
054  private static final class TestCellPane extends CellPane<TestCellPane, TestCell> {
055
056    protected TestCellPane() {
057      super("TheCellPane", InteractionMode.ROWS_AND_COLUMNS);
058      rowHeightDefault.set(20);
059      columnWidthDefault.set(20);
060      textSizeDefault.set(16);
061      animate.set(true);
062      maxRows.set(1000);
063      maxColumns.set(1000);
064    }
065
066    @Override
067    protected final TestCell createCell(final int gridRow, final int gridColumn) {
068      return new TestCell(gridRow, gridColumn);
069    }
070
071  }
072
073  private static final class TestCell extends Cell<TestCell, TestCellPane> {
074
075    public TestCell(final int gridRow, final int gridColumn) {
076      super(THE_CELL_PANE, gridRow, gridColumn, Pos.CENTER, TextAlignment.CENTER, false, null, true);
077    }
078
079    @Override
080    protected final void updateContent() {
081//      final String text = TestCell.this.contentCoordinates.get().toString();
082      textContent.set("X");
083    }
084
085  }
086
087}