Skip to content
Snippets Groups Projects
Commit 028a86bf authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

fix: iss1134

parent 6b39bfd7
No related branches found
No related tags found
No related merge requests found
...@@ -44,14 +44,17 @@ import javafx.scene.paint.Color; ...@@ -44,14 +44,17 @@ import javafx.scene.paint.Color;
public class SPIMPipelineProgressViewController extends BorderPane implements CloseableControl, InitiableControl { public class SPIMPipelineProgressViewController extends BorderPane implements CloseableControl, InitiableControl {
public final static Logger log = LoggerFactory public final static Logger log = LoggerFactory
.getLogger(cz.it4i.fiji.haas_spim_benchmark.ui.SPIMPipelineProgressViewController.class); .getLogger(cz.it4i.fiji.haas_spim_benchmark.ui.SPIMPipelineProgressViewController.class);
private static final String EMPTY_VALUE = "\u2007\u2007\u2007"; private static final String EMPTY_VALUE = "";
private static final int PREFERRED_WIDTH = 900; private static final int PREFERRED_WIDTH = 900;
private static final Map<JobState, Color> taskExecutionState2Color = new HashMap<>(); private static final Map<JobState, Color> taskExecutionState2Color = new HashMap<>();
private static final double TIMEPOINT_TABLE_COLUMN_WIDTH_RATIO = 6;
static { static {
taskExecutionState2Color.put(JobState.Running, Color.rgb(0xF2, 0xD5, 0x39)); taskExecutionState2Color.put(JobState.Running, Color.rgb(0xF2, 0xD5, 0x39));
taskExecutionState2Color.put(JobState.Finished, Color.rgb(0x41, 0xB2, 0x80)); taskExecutionState2Color.put(JobState.Finished, Color.rgb(0x41, 0xB2, 0x80));
...@@ -180,12 +183,18 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl ...@@ -180,12 +183,18 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
JavaFXRoutines.setCellValueFactory(this.tasks, i++, JavaFXRoutines.setCellValueFactory(this.tasks, i++,
(Function<Task, String>) v -> Constants.BENCHMARK_TASK_NAME_MAP.get(v (Function<Task, String>) v -> Constants.BENCHMARK_TASK_NAME_MAP.get(v
.getDescription())); .getDescription()));
double tableColumnWidth = computeTableColumnWidth(computations);
log.info("table column width " + tableColumnWidth);
for (TaskComputation tc : computations) { for (TaskComputation tc : computations) {
this.tasks.getColumns().add(new TableColumn<>(tc.getTimepoint() + "")); TableColumn<ObservableValue<Task>, String> tableCol;
this.tasks.getColumns().add(tableCol = new TableColumn<>(columnHeader(
tc)));
int index = i++; int index = i++;
tableCol.setPrefWidth(tableColumnWidth);
constructCellFactory(index); constructCellFactory(index);
} }
fixNotVisibleColumn();
this.tasks.getItems().addAll(taskList); this.tasks.getItems().addAll(taskList);
}); });
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
...@@ -197,6 +206,23 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl ...@@ -197,6 +206,23 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
}, Constants.HAAS_UPDATE_TIMEOUT, Constants.HAAS_UPDATE_TIMEOUT); }, Constants.HAAS_UPDATE_TIMEOUT, Constants.HAAS_UPDATE_TIMEOUT);
} }
private long computeTableColumnWidth(List<TaskComputation> computations) {
return Math.round(this.tasks.getColumns().get(0)
.getWidth() / TIMEPOINT_TABLE_COLUMN_WIDTH_RATIO * (1 + Math.max(0,
computeMaxColumnHeaderTextLenght(computations) - 1) / 2));
}
private int computeMaxColumnHeaderTextLenght(
List<TaskComputation> computations)
{
return columnHeader(
computations.get(computations.size() - 1)).length();
}
private String columnHeader(TaskComputation taskComputation) {
return taskComputation.getTimepoint() + "";
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void constructCellFactory(int index) { private void constructCellFactory(int index) {
JavaFXRoutines.setCellValueFactory(this.tasks, index, (Function<Task, TaskComputation>) v -> { JavaFXRoutines.setCellValueFactory(this.tasks, index, (Function<Task, TaskComputation>) v -> {
...@@ -221,8 +247,4 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl ...@@ -221,8 +247,4 @@ public class SPIMPipelineProgressViewController extends BorderPane implements Cl
private void updateTable() { private void updateTable() {
registry.update(); registry.update();
} }
private void fixNotVisibleColumn() {
// this.tasks.getColumns().add(new TableColumn<>(" "));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment