Allow table editing with single click + fix tab traversal in table

This commit is contained in:
SiboVG 2024-10-12 13:02:29 +02:00
parent 4cb542b4d9
commit f4b4e3ccc0
15 changed files with 52 additions and 48 deletions

View File

@ -1342,8 +1342,6 @@ FreeformFinSetCfg.lbl.Fincant = Fin cant:
FreeformFinSetCfg.lbl.ttip.Fincant = The angle that the fins are canted with respect to the rocket body. FreeformFinSetCfg.lbl.ttip.Fincant = The angle that the fins are canted with respect to the rocket body.
FreeformFinSetCfg.lbl.FincrossSection = Fin cross section: FreeformFinSetCfg.lbl.FincrossSection = Fin cross section:
FreeformFinSetCfg.lbl.Thickness = Thickness: FreeformFinSetCfg.lbl.Thickness = Thickness:
FreeformFinSetConfig.lbl.doubleClick1 = Double-click
FreeformFinSetConfig.lbl.doubleClick2 = to edit table entry
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+click: Delete point FreeformFinSetConfig.lbl.ctrlClick = Ctrl+click: Delete point
FreeformFinSetConfig.lbl.clickDrag = Click+drag: Add and move points FreeformFinSetConfig.lbl.clickDrag = Click+drag: Add and move points
FreeformFinSetConfig.lbl.shiftClickDrag = Shift+click+drag: Lock angle to previous point FreeformFinSetConfig.lbl.shiftClickDrag = Shift+click+drag: Lock angle to previous point

View File

@ -1033,9 +1033,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = :الموقع بالنسبة إلى
FreeformFinSetCfg.lbl.plus = plus FreeformFinSetCfg.lbl.plus = plus
FreeformFinSetCfg.lbl.FincrossSection = :المقطع العرضي للزعنفة FreeformFinSetCfg.lbl.FincrossSection = :المقطع العرضي للزعنفة
FreeformFinSetCfg.lbl.Thickness = :السماكة FreeformFinSetCfg.lbl.Thickness = :السماكة
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = نقرتين
FreeformFinSetConfig.lbl.doubleClick2 = للتعديل
FreeformFinSetConfig.lbl.clickDrag = أنقر وإسحب: لإضافة وتحريك نقاط FreeformFinSetConfig.lbl.clickDrag = أنقر وإسحب: لإضافة وتحريك نقاط
FreeformFinSetConfig.lbl.ctrlClick = مفتاح التحكم مع النقر: لحذف نقطة FreeformFinSetConfig.lbl.ctrlClick = مفتاح التحكم مع النقر: لحذف نقطة
FreeformFinSetConfig.lbl.scaleFin = حَجِّمْ الزعنفة FreeformFinSetConfig.lbl.scaleFin = حَجِّمْ الزعنفة

View File

@ -715,9 +715,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = Pozice vzhledem k:
FreeformFinSetCfg.lbl.plus = plus FreeformFinSetCfg.lbl.plus = plus
FreeformFinSetCfg.lbl.FincrossSection = Hrany stabilizátoru: FreeformFinSetCfg.lbl.FincrossSection = Hrany stabilizátoru:
FreeformFinSetCfg.lbl.Thickness = Tlou\u0161tka: FreeformFinSetCfg.lbl.Thickness = Tlou\u0161tka:
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = Dvoj klik
FreeformFinSetConfig.lbl.doubleClick2 = k editaci
FreeformFinSetConfig.lbl.clickDrag = Klik a táhnout: Pridej a presun body FreeformFinSetConfig.lbl.clickDrag = Klik a táhnout: Pridej a presun body
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+klik: Odstran bod FreeformFinSetConfig.lbl.ctrlClick = Ctrl+klik: Odstran bod
FreeformFinSetConfig.lbl.scaleFin = Merítko stabilizátoru FreeformFinSetConfig.lbl.scaleFin = Merítko stabilizátoru

View File

@ -772,9 +772,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = Position relativ zu:
FreeformFinSetCfg.lbl.plus = plus FreeformFinSetCfg.lbl.plus = plus
FreeformFinSetCfg.lbl.FincrossSection = Querschnitt: FreeformFinSetCfg.lbl.FincrossSection = Querschnitt:
FreeformFinSetCfg.lbl.Thickness = Wandstärke: FreeformFinSetCfg.lbl.Thickness = Wandstärke:
! doubleClick1 + 2 form the message "Doppelklick zum Bearbeiten", ungefähr in der Mitte teilen
FreeformFinSetConfig.lbl.doubleClick1 = Doppelklick
FreeformFinSetConfig.lbl.doubleClick2 = zum Bearbeiten
FreeformFinSetConfig.lbl.clickDrag = Klicken+Ziehen: Punkte bewegen und hinzufügen FreeformFinSetConfig.lbl.clickDrag = Klicken+Ziehen: Punkte bewegen und hinzufügen
FreeformFinSetConfig.lbl.ctrlClick = Strg+Klick: Punkt löschen FreeformFinSetConfig.lbl.ctrlClick = Strg+Klick: Punkt löschen
FreeformFinSetConfig.lbl.scaleFin = Leitwerk skalieren FreeformFinSetConfig.lbl.scaleFin = Leitwerk skalieren

View File

@ -374,9 +374,6 @@ FreeformFinSetCfg.tab.ttip.General = Propiedades generales
FreeformFinSetConfig.lbl.clickDrag = Click (sobre l\u00ednea)+arrastrar: Agregar punto FreeformFinSetConfig.lbl.clickDrag = Click (sobre l\u00ednea)+arrastrar: Agregar punto
FreeformFinSetConfig.lbl.ctrlClick = Control+Click (sobre punto): Eliminar punto FreeformFinSetConfig.lbl.ctrlClick = Control+Click (sobre punto): Eliminar punto
!DobleClic 1 + 2 en el mensaje "Doble-Click para editar", corta aproximadamente por la mitad
FreeformFinSetConfig.lbl.doubleClick1 = Doble Click en la lista
FreeformFinSetConfig.lbl.doubleClick2 = para editar
FreeformFinSetConfig.lbl.scaleFin = Dimensionar FreeformFinSetConfig.lbl.scaleFin = Dimensionar
GeneralOptimizationDialog.basicSimulationName = Simulaci\u00f3n b\u00e1sica GeneralOptimizationDialog.basicSimulationName = Simulaci\u00f3n b\u00e1sica

View File

@ -365,9 +365,6 @@ FreeformFinSetCfg.tab.ttip.General = Propri\u00E9t\u00E9s g\u00E9n\u00E9rales
FreeformFinSetConfig.lbl.clickDrag = Cliquer+d\u00E9placer: Ajouter et d\u00E9placer des points FreeformFinSetConfig.lbl.clickDrag = Cliquer+d\u00E9placer: Ajouter et d\u00E9placer des points
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+cliquer: Enlever un point FreeformFinSetConfig.lbl.ctrlClick = Ctrl+cliquer: Enlever un point
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = Double-cliquer
FreeformFinSetConfig.lbl.doubleClick2 = pour modifier
FreeformFinSetConfig.lbl.scaleFin = Redimensionner les ailerons FreeformFinSetConfig.lbl.scaleFin = Redimensionner les ailerons
GeneralOptimizationDialog.basicSimulationName = Simulation simple GeneralOptimizationDialog.basicSimulationName = Simulation simple

View File

@ -774,9 +774,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = Posizione relativa a :
FreeformFinSetCfg.lbl.plus = pi\u00f9 FreeformFinSetCfg.lbl.plus = pi\u00f9
FreeformFinSetCfg.lbl.FincrossSection = Sezione delle pinne FreeformFinSetCfg.lbl.FincrossSection = Sezione delle pinne
FreeformFinSetCfg.lbl.Thickness = Spessore: FreeformFinSetCfg.lbl.Thickness = Spessore:
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = Doppio-click
FreeformFinSetConfig.lbl.doubleClick2 = per modificare
FreeformFinSetConfig.lbl.clickDrag = Click+muovi: aggiunge e muove punti FreeformFinSetConfig.lbl.clickDrag = Click+muovi: aggiunge e muove punti
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+click: rimuove punti FreeformFinSetConfig.lbl.ctrlClick = Ctrl+click: rimuove punti
FreeformFinSetConfig.lbl.scaleFin = Scala pinna FreeformFinSetConfig.lbl.scaleFin = Scala pinna

View File

@ -804,9 +804,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = \u4F4D\u7F6E\uFF1A
FreeformFinSetCfg.lbl.plus = \u30D7\u30E9\u30B9 FreeformFinSetCfg.lbl.plus = \u30D7\u30E9\u30B9
FreeformFinSetCfg.lbl.FincrossSection = \u30D5\u30A3\u30F3\u65AD\u9762\u7A4D\uFF1A FreeformFinSetCfg.lbl.FincrossSection = \u30D5\u30A3\u30F3\u65AD\u9762\u7A4D\uFF1A
FreeformFinSetCfg.lbl.Thickness = \u539A\u3055\uFF1A FreeformFinSetCfg.lbl.Thickness = \u539A\u3055\uFF1A
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = \u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3067
FreeformFinSetConfig.lbl.doubleClick2 = \u7DE8\u96C6
FreeformFinSetConfig.lbl.clickDrag = Click+drag: \u30DD\u30A4\u30F3\u30C8\u306E\u8FFD\u52A0\u3068\u79FB\u52D5 FreeformFinSetConfig.lbl.clickDrag = Click+drag: \u30DD\u30A4\u30F3\u30C8\u306E\u8FFD\u52A0\u3068\u79FB\u52D5
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+click: \u30DD\u30A4\u30F3\u30C8\u306E\u524A\u9664 FreeformFinSetConfig.lbl.ctrlClick = Ctrl+click: \u30DD\u30A4\u30F3\u30C8\u306E\u524A\u9664
FreeformFinSetConfig.lbl.scaleFin = Scale Fin FreeformFinSetConfig.lbl.scaleFin = Scale Fin

View File

@ -984,9 +984,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = Positie relatief t.o.v.:
FreeformFinSetCfg.lbl.plus = plus FreeformFinSetCfg.lbl.plus = plus
FreeformFinSetCfg.lbl.FincrossSection = Vindoorsnede: FreeformFinSetCfg.lbl.FincrossSection = Vindoorsnede:
FreeformFinSetCfg.lbl.Thickness = Dikte: FreeformFinSetCfg.lbl.Thickness = Dikte:
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = Dubbelklik op
FreeformFinSetConfig.lbl.doubleClick2 = om te bewerken
FreeformFinSetConfig.lbl.clickDrag = Klik+sleep: Punten toevoegen en verplaatsen FreeformFinSetConfig.lbl.clickDrag = Klik+sleep: Punten toevoegen en verplaatsen
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+klik: Verwijder punt FreeformFinSetConfig.lbl.ctrlClick = Ctrl+klik: Verwijder punt
FreeformFinSetConfig.lbl.scaleFin = Schaal vin FreeformFinSetConfig.lbl.scaleFin = Schaal vin

View File

@ -719,9 +719,6 @@ ComponentInfo.EngineBlock = <b>Blokada silnika</b> unieruchamia silnik wewn\u01
FreeformFinSetCfg.lbl.plus = plus FreeformFinSetCfg.lbl.plus = plus
FreeformFinSetCfg.lbl.FincrossSection = Przekrój statecznika: FreeformFinSetCfg.lbl.FincrossSection = Przekrój statecznika:
FreeformFinSetCfg.lbl.Thickness = Grubo\u015B\u0107: FreeformFinSetCfg.lbl.Thickness = Grubo\u015B\u0107:
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = Kliknij dwukrotnie
FreeformFinSetConfig.lbl.doubleClick2 = aby edytowa\u0107
FreeformFinSetConfig.lbl.clickDrag = Kliknij i przeci\u0105gnij: Dodaj i przesuwaj punkty FreeformFinSetConfig.lbl.clickDrag = Kliknij i przeci\u0105gnij: Dodaj i przesuwaj punkty
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+klik: Usu\u0144 punkt FreeformFinSetConfig.lbl.ctrlClick = Ctrl+klik: Usu\u0144 punkt
FreeformFinSetConfig.lbl.scaleFin = Skaluj statecznik FreeformFinSetConfig.lbl.scaleFin = Skaluj statecznik

View File

@ -354,9 +354,6 @@ FreeformFinSetCfg.tab.ttip.General = Propriedades gerais
FreeformFinSetConfig.lbl.clickDrag = Clique+arraste: Adicionar e mover pontos FreeformFinSetConfig.lbl.clickDrag = Clique+arraste: Adicionar e mover pontos
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+clique em: Remover ponto FreeformFinSetConfig.lbl.ctrlClick = Ctrl+clique em: Remover ponto
# doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = Duplo clique
FreeformFinSetConfig.lbl.doubleClick2 = editar
FreeformFinSetConfig.lbl.scaleFin = Escala da aleta FreeformFinSetConfig.lbl.scaleFin = Escala da aleta
GeneralOptimizationDialog.basicSimulationName = Simula\u00e7\u00e3o b\u00e1sica GeneralOptimizationDialog.basicSimulationName = Simula\u00e7\u00e3o b\u00e1sica

View File

@ -1013,9 +1013,6 @@ FreeformFinSetCfg.lbl.Posrelativeto = \u041F\u043E\u043B\u043E\u0436\u0435\u043D
FreeformFinSetCfg.lbl.plus = \u043F\u043B\u044E\u0441 FreeformFinSetCfg.lbl.plus = \u043F\u043B\u044E\u0441
FreeformFinSetCfg.lbl.FincrossSection = \u041F\u0440\u043E\u0444\u0438\u043B\u044C \u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0430\u0442\u043E\u0440\u0430: FreeformFinSetCfg.lbl.FincrossSection = \u041F\u0440\u043E\u0444\u0438\u043B\u044C \u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0430\u0442\u043E\u0440\u0430:
FreeformFinSetCfg.lbl.Thickness = \u0422\u043E\u043B\u0449\u0438\u043D\u0430: FreeformFinSetCfg.lbl.Thickness = \u0422\u043E\u043B\u0449\u0438\u043D\u0430:
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = \u0414\u0432\u043E\u0439\u043D\u043E\u0439 \u043A\u043B\u0438\u043A
FreeformFinSetConfig.lbl.doubleClick2 = \u0434\u043B\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F
FreeformFinSetConfig.lbl.clickDrag = \u041A\u043B\u0438\u043A+\u0442\u0430\u0449\u0438\u0442\u044C: \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u044C \u0442\u043E\u0447\u043A\u0438 FreeformFinSetConfig.lbl.clickDrag = \u041A\u043B\u0438\u043A+\u0442\u0430\u0449\u0438\u0442\u044C: \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u044C \u0442\u043E\u0447\u043A\u0438
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+\u043A\u043B\u0438\u043A: \u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0442\u043E\u0447\u043A\u0443 FreeformFinSetConfig.lbl.ctrlClick = Ctrl+\u043A\u043B\u0438\u043A: \u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0442\u043E\u0447\u043A\u0443
FreeformFinSetConfig.lbl.scaleFin = \u041C\u0430\u0441\u0448\u0442\u0430\u0431 \u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0430\u0442\u043E\u0440\u0430 FreeformFinSetConfig.lbl.scaleFin = \u041C\u0430\u0441\u0448\u0442\u0430\u0431 \u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0430\u0442\u043E\u0440\u0430

View File

@ -1225,8 +1225,6 @@ FreeformFinSetCfg.lbl.Fincant = \u041d\u0430\u0445\u0438\u043b \u043a\u0456\u043
FreeformFinSetCfg.lbl.ttip.Fincant = \u041a\u0443\u0442, \u043f\u0456\u0434 \u044f\u043a\u0438\u043c \u043a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044c \u043d\u0430\u0445\u0438\u043b\u0435\u043d\u043e \u0432\u0456\u0434\u043d\u043e\u0441\u043d\u043e \u043a\u043e\u0440\u043f\u0443\u0441\u0443 \u0440\u0430\u043a\u0435\u0442\u0438. FreeformFinSetCfg.lbl.ttip.Fincant = \u041a\u0443\u0442, \u043f\u0456\u0434 \u044f\u043a\u0438\u043c \u043a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044c \u043d\u0430\u0445\u0438\u043b\u0435\u043d\u043e \u0432\u0456\u0434\u043d\u043e\u0441\u043d\u043e \u043a\u043e\u0440\u043f\u0443\u0441\u0443 \u0440\u0430\u043a\u0435\u0442\u0438.
FreeformFinSetCfg.lbl.FincrossSection = \u041f\u0435\u0440\u0435\u0440\u0456\u0437 \u043a\u0456\u043b\u044c\u043a\u043e\u0441\u0442\u0456: FreeformFinSetCfg.lbl.FincrossSection = \u041f\u0435\u0440\u0435\u0440\u0456\u0437 \u043a\u0456\u043b\u044c\u043a\u043e\u0441\u0442\u0456:
FreeformFinSetCfg.lbl.Thickness = \u0422\u043e\u0432\u0449\u0438\u043d\u0430: FreeformFinSetCfg.lbl.Thickness = \u0422\u043e\u0432\u0449\u0438\u043d\u0430:
FreeformFinSetConfig.lbl.doubleClick1 = \u0414\u0432\u0456\u0447\u0456 \u043a\u043b\u0456\u043a\u043d\u0456\u0442\u044c
FreeformFinSetConfig.lbl.doubleClick2 = \u0449\u043e\u0431 \u0440\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438
FreeformFinSetConfig.lbl.clickDrag = \u041a\u043b\u0456\u043a+\u043f\u0435\u0440\u0435\u0442\u044f\u0433\u0443\u0432\u0430\u043d\u043d\u044f: \u0414\u043e\u0434\u0430\u0442\u0438 \u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0456\u0441\u0442\u0438\u0442\u0438 \u0442\u043e\u0447\u043a\u0438 FreeformFinSetConfig.lbl.clickDrag = \u041a\u043b\u0456\u043a+\u043f\u0435\u0440\u0435\u0442\u044f\u0433\u0443\u0432\u0430\u043d\u043d\u044f: \u0414\u043e\u0434\u0430\u0442\u0438 \u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0456\u0441\u0442\u0438\u0442\u0438 \u0442\u043e\u0447\u043a\u0438
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+\u043a\u043b\u0456\u043a: \u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0442\u043e\u0447\u043a\u0443 FreeformFinSetConfig.lbl.ctrlClick = Ctrl+\u043a\u043b\u0456\u043a: \u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0442\u043e\u0447\u043a\u0443
FreeformFinSetConfig.lbl.scaleFin = \u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0443\u0432\u0430\u0442\u0438 \u043a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044c FreeformFinSetConfig.lbl.scaleFin = \u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0443\u0432\u0430\u0442\u0438 \u043a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044c

View File

@ -391,9 +391,6 @@ FreeformFinSetCfg.tab.ttip.General = \u5E38\u89C4\u5C5E\u6027
FreeformFinSetConfig.lbl.clickDrag = \u5355\u51FB+\u62D6\u62FD: \u6DFB\u52A0,\u79FB\u52A8\u70B9 FreeformFinSetConfig.lbl.clickDrag = \u5355\u51FB+\u62D6\u62FD: \u6DFB\u52A0,\u79FB\u52A8\u70B9
FreeformFinSetConfig.lbl.ctrlClick = Ctrl+\u5355\u51FB: \u5220\u9664\u70B9 FreeformFinSetConfig.lbl.ctrlClick = Ctrl+\u5355\u51FB: \u5220\u9664\u70B9
! doubleClick1 + 2 form the message "Double-click to edit", split approximately at the middle
FreeformFinSetConfig.lbl.doubleClick1 = \u53CC\u51FB
FreeformFinSetConfig.lbl.doubleClick2 = \u7F16\u8F91
FreeformFinSetConfig.lbl.scaleFin = \u7F29\u653E\u7A33\u5B9A\u7FFC FreeformFinSetConfig.lbl.scaleFin = \u7F29\u653E\u7A33\u5B9A\u7FFC
GeneralOptimizationDialog.basicSimulationName = \u57FA\u672C\u4EFF\u771F GeneralOptimizationDialog.basicSimulationName = \u57FA\u672C\u4EFF\u771F

View File

@ -1,10 +1,13 @@
package info.openrocket.swing.gui.configdialog; package info.openrocket.swing.gui.configdialog;
import java.awt.Component;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
@ -19,6 +22,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.DefaultCellEditor;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JDialog; import javax.swing.JDialog;
@ -31,6 +35,7 @@ import javax.swing.JScrollPane;
import javax.swing.JSpinner; import javax.swing.JSpinner;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
@ -230,11 +235,40 @@ public class FreeformFinSetConfig extends FinSetConfig {
// Create the table // Create the table
tableModel = new FinPointTableModel(); tableModel = new FinPointTableModel();
table = new JTable(tableModel); table = new JTable(tableModel) {
@Override
public void changeSelection(int row, int column, boolean toggle, boolean extend) {
super.changeSelection(row, column, toggle, extend);
if (isCellEditable(row, column)) {
editCellAt(row, column);
Component editor = getEditorComponent();
if (editor != null) {
editor.requestFocus();
}
}
}
};
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
for (int i = 0; i < Columns.values().length; i++) { for (int i = 0; i < Columns.values().length; i++) {
table.getColumnModel().getColumn(i).setPreferredWidth(Columns.values()[i].getWidth()); table.getColumnModel().getColumn(i).setPreferredWidth(Columns.values()[i].getWidth());
} }
// Set custom editor for highlighting all text
DefaultCellEditor editor = new DefaultCellEditor(new JTextField()) {
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
JTextField textField = (JTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
SwingUtilities.invokeLater(textField::selectAll);
return textField;
}
};
// Apply the editor to all columns
for (int i = 0; i < table.getColumnCount(); i++) {
table.getColumnModel().getColumn(i).setCellEditor(editor);
}
table.addMouseListener(new MouseAdapter() { table.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -264,6 +298,17 @@ public class FreeformFinSetConfig extends FinSetConfig {
} }
}); });
JScrollPane tablePane = new JScrollPane(table); JScrollPane tablePane = new JScrollPane(table);
// Remove focus from table when interacting on the figure
figurePane.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (table.isEditing()) {
table.getCellEditor().stopCellEditing();
}
table.clearSelection();
}
});
JButton scaleButton = new JButton(trans.get("FreeformFinSetConfig.lbl.scaleFin")); JButton scaleButton = new JButton(trans.get("FreeformFinSetConfig.lbl.scaleFin"));
scaleButton.addActionListener(new ActionListener() { scaleButton.addActionListener(new ActionListener() {
@ -337,9 +382,8 @@ public class FreeformFinSetConfig extends FinSetConfig {
order.add(table); order.add(table);
// row of text directly below figure // row of text directly below figure
panel.add(new StyledLabel(trans.get("lbl.doubleClick1")+" "+trans.get("FreeformFinSetConfig.lbl.doubleClick2"), -2), "spanx 2"); panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.ctrlClick"), -2), "spanx 2");
panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.ctrlClick"), -2), "spanx 2, wrap"); panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.clickDrag"), -2), "spanx 2, wrap");
panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.clickDrag"), -2), "spanx 2");
panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.shiftClickDrag"), -2), "spanx 2"); panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.shiftClickDrag"), -2), "spanx 2");
panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.ctrlShiftClickDrag"), -2), "spanx 2, wrap"); panel.add(new StyledLabel(trans.get("FreeformFinSetConfig.lbl.ctrlShiftClickDrag"), -2), "spanx 2, wrap");
@ -503,6 +547,7 @@ public class FreeformFinSetConfig extends FinSetConfig {
@Override @Override
public void mousePressed(MouseEvent event) { public void mousePressed(MouseEvent event) {
requestFocusInWindow();
final FreeformFinSet finset = (FreeformFinSet) component; final FreeformFinSet finset = (FreeformFinSet) component;
final int pressIndex = getPoint(event); final int pressIndex = getPoint(event);
@ -681,8 +726,8 @@ public class FreeformFinSetConfig extends FinSetConfig {
@Override @Override
public void mouseClicked(MouseEvent event) { public void mouseClicked(MouseEvent event) {
int mods = event.getModifiersEx(); int mods = event.getModifiersEx();
if(( event.getButton() == MouseEvent.BUTTON1) && (0 < (MouseEvent.CTRL_DOWN_MASK & mods))) { if ((event.getButton() == MouseEvent.BUTTON1) && (0 < (MouseEvent.CTRL_DOWN_MASK & mods))) {
int clickIndex = getPoint(event); int clickIndex = getPoint(event);
if ( 0 < clickIndex) { if ( 0 < clickIndex) {
// if ctrl+click, delete point // if ctrl+click, delete point
@ -695,8 +740,7 @@ public class FreeformFinSetConfig extends FinSetConfig {
return; return;
} }
} }
super.mouseClicked(event);
super.mouseClicked(event);
} }
private int getPoint(MouseEvent event) { private int getPoint(MouseEvent event) {