Skip to content

Commit

Permalink
#156 - HACK. Move columns most likely to be hidden to left
Browse files Browse the repository at this point in the history
  • Loading branch information
hohonuuli committed Feb 17, 2023
1 parent d944a24 commit 2031f38
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,8 @@ private void init(ResourceBundle i18n) {
90,
safelyCompare(Annotation::getRecordedTimestamp)));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.timecode"),
1,
safely(Annotation::getTimecode),
90,
safelyCompare(a -> a.getTimecode().toString())));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.elapsedtime"),
2,
1,
(a) -> {
var et = a.getElapsedTime();
if (et != null) {
Expand All @@ -47,11 +41,11 @@ private void init(ResourceBundle i18n) {
safelyCompare(Annotation::getElapsedTime)));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.concept"),
3,
2,
Annotation::getConcept,
140));

var associationCol = new TableColumnExt(4, 140, new AssociationListTableCellRenderer(), null);
var associationCol = new TableColumnExt(3, 140, new AssociationListTableCellRenderer(), null);
var associationId = i18n.getString("annotable.col.association");
associationCol.setEditable(false);
associationCol.setIdentifier(associationId);
Expand All @@ -60,7 +54,7 @@ private void init(ResourceBundle i18n) {
associationCol.addHighlighter(new ColorHighlighter(Colors.DEFAULT.getColor(), Colors.DEFAULT_TABLE_TEXT.getColor()));
addColumn(associationCol);

var fgsCol = new TableColumnExt(5, 45, new FGSCellRenderer(), null);
var fgsCol = new TableColumnExt(4, 45, new FGSCellRenderer(), null);
var fgsId = i18n.getString("annotable.col.framegrab");
fgsCol.setEditable(false);
fgsCol.setIdentifier(fgsId);
Expand All @@ -69,12 +63,28 @@ private void init(ResourceBundle i18n) {
addColumn(fgsCol);

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.observer"),
6,
5,
Annotation::getObserver,
50));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.duration"),
addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.activity"),
6,
Annotation::getActivity,
50));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.group"),
7,
Annotation::getGroup,
50));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.timecode"),
8,
safely(Annotation::getTimecode),
90,
safelyCompare(a -> a.getTimecode().toString())));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.duration"),
9,
(a) -> {
var d = a.getDuration();
if (d != null) {
Expand All @@ -87,16 +97,6 @@ private void init(ResourceBundle i18n) {
45,
safelyCompare(Annotation::getDuration)));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.activity"),
8,
Annotation::getActivity,
50));

addColumn(new AnnotationTableColumn(i18n.getString("annotable.col.group"),
9,
Annotation::getGroup,
50));

}

private Function<Annotation, String> safely(Function<Annotation, ?> fn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.HighlighterFactory;
import org.jdesktop.swingx.sort.TableSortController;
import org.mbari.vars.core.util.ListUtils;
import org.mbari.vars.services.model.Annotation;
import org.mbari.vars.services.model.Media;
Expand All @@ -23,6 +24,7 @@
import org.slf4j.LoggerFactory;

import javax.swing.*;
import javax.swing.table.TableRowSorter;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -104,6 +106,7 @@ public JXTable getTable() {
if (table == null) {
var tableColumnModel = tableModel.getTableColumnModel();
table = new JXTable(tableModel, tableColumnModel);
// table.setRowSorter(new TableSortController<>());

var tableHeader = new JXTableHeader(tableColumnModel);
tableHeader.setReorderingAllowed(true);
Expand Down

0 comments on commit 2031f38

Please sign in to comment.