From 7d852cca24e6028e2996f17b8f416e033e469bbc Mon Sep 17 00:00:00 2001 From: Martin Davis Date: Sat, 2 Dec 2023 12:46:36 -0800 Subject: [PATCH] Add constants for geometry labels --- .../locationtech/jtstest/testbuilder/AppStrings.java | 1 + .../jtstest/testbuilder/GeometryInputDialog.java | 4 ++-- .../jtstest/testbuilder/RelatePanel.java | 12 ++++++------ .../jtstest/testbuilder/TestCaseTextDialog.java | 6 +++--- .../locationtech/jtstest/testbuilder/ValidPanel.java | 6 +++--- .../locationtech/jtstest/testbuilder/WKTPanel.java | 4 ++-- .../jtstest/testbuilder/model/LayerList.java | 7 ++++--- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/AppStrings.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/AppStrings.java index 9c8ff00154..13b62e0473 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/AppStrings.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/AppStrings.java @@ -18,6 +18,7 @@ public class AppStrings { public static final String GEOM_LABEL_A = "A"; public static final String GEOM_LABEL_B = "B"; + public static final String GEOM_LABEL_RESULT = "Result"; public static final String TAB_LABEL_LOG = "Log"; public static final String TAB_LABEL_VALUE = "Value"; diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/GeometryInputDialog.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/GeometryInputDialog.java index dcab3c4412..bc8ba79800 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/GeometryInputDialog.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/GeometryInputDialog.java @@ -82,7 +82,7 @@ void jbInit() throws Exception { jLabel1.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel1.setForeground(AppColors.A); jLabel1.setToolTipText(""); - jLabel1.setText("A"); + jLabel1.setText(AppStrings.GEOM_LABEL_A); jPanel1.setLayout(gridBagLayout2); btnLoad.setToolTipText(""); btnLoad.setText("Load"); @@ -101,7 +101,7 @@ public void actionPerformed(ActionEvent e) { }); jLabel2.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel2.setForeground(AppColors.B); - jLabel2.setText("B"); + jLabel2.setText(AppStrings.GEOM_LABEL_B); lblError.setToolTipText(""); txtError.setLineWrap(true); txtError.setBorder(BorderFactory.createEtchedBorder()); diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/RelatePanel.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/RelatePanel.java index 5314f0ef46..4db24c3500 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/RelatePanel.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/RelatePanel.java @@ -264,7 +264,7 @@ void jbInit() throws Exception { jPanel1.setLayout(gridBagLayout2); jLabel14.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel14.setForeground(AppColors.A); - jLabel14.setText("A"); + jLabel14.setText(AppStrings.GEOM_LABEL_A); jLabel13.setFont(new java.awt.Font("Dialog", 2, 12)); jLabel13.setForeground(AppColors.A); jLabel13.setText("Ext"); @@ -289,24 +289,24 @@ void jbInit() throws Exception { txtAB.setHorizontalAlignment(SwingConstants.LEFT); jLabel23.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel23.setForeground(AppColors.B); - jLabel23.setText("B"); + jLabel23.setText(AppStrings.GEOM_LABEL_B); relateBI.setFont(new java.awt.Font("Dialog", 1, 12)); relateBI.setText("F"); jLabel22.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel22.setForeground(AppColors.A); jLabel22.setToolTipText(""); - jLabel22.setText("A"); + jLabel22.setText(AppStrings.GEOM_LABEL_A); relateEI.setFont(new java.awt.Font("Dialog", 1, 12)); relateEI.setText("F"); jLabel21.setToolTipText(""); jLabel21.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel21.setForeground(AppColors.A); jLabel21.setToolTipText(""); - jLabel21.setText("A"); + jLabel21.setText(AppStrings.GEOM_LABEL_A); jLabel20.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel20.setForeground(AppColors.B); jLabel20.setToolTipText(""); - jLabel20.setText("B"); + jLabel20.setText(AppStrings.GEOM_LABEL_B); relateBE.setFont(new java.awt.Font("Dialog", 1, 12)); relateBE.setText("F"); relateEE.setFont(new java.awt.Font("Dialog", 1, 12)); @@ -332,7 +332,7 @@ void jbInit() throws Exception { jLabel8.setText("Int"); jLabel7.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel7.setForeground(AppColors.B); - jLabel7.setText("B"); + jLabel7.setText(AppStrings.GEOM_LABEL_B); relateII.setBackground(Color.white); relateII.setFont(new java.awt.Font("Dialog", 1, 12)); relateII.setText("F"); diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/TestCaseTextDialog.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/TestCaseTextDialog.java index a0f3737231..fa6355db13 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/TestCaseTextDialog.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/TestCaseTextDialog.java @@ -263,9 +263,9 @@ void rbGML_actionPerformed(ActionEvent e) { private void writeView(String a, String b, String result) { txtGeomView.setText(""); - writeViewGeometry("A", a); - writeViewGeometry("B", b); - writeViewGeometry("Result", result); + writeViewGeometry(AppStrings.GEOM_LABEL_A, a); + writeViewGeometry(AppStrings.GEOM_LABEL_B, b); + writeViewGeometry(AppStrings.GEOM_LABEL_RESULT, result); } private void writeViewGeometry(String tag, String str) diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/ValidPanel.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/ValidPanel.java index c8ed635e24..6f4968c038 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/ValidPanel.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/ValidPanel.java @@ -110,11 +110,11 @@ public void actionPerformed(ActionEvent e) { }); rbA.setSelected(true); - rbA.setText("A"); + rbA.setText(AppStrings.GEOM_LABEL_A); rbA.setForeground(AppColors.A); - rbB.setText("B"); + rbB.setText(AppStrings.GEOM_LABEL_B); rbB.setForeground(AppColors.B); - rbResult.setText("Result"); + rbResult.setText(AppStrings.GEOM_LABEL_RESULT); rbA.addItemListener(new ItemListener() { @Override diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/WKTPanel.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/WKTPanel.java index 6e9bd43304..76e63960bd 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/WKTPanel.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/WKTPanel.java @@ -151,13 +151,13 @@ public void actionPerformed(ActionEvent e) { aLabel.setFont(new java.awt.Font("Dialog", 1, 16)); aLabel.setForeground(AppColors.A); - aLabel.setText("A"); + aLabel.setText(AppStrings.GEOM_LABEL_A); aLabel.setPreferredSize(new Dimension(20, 20)); aLabel.setHorizontalTextPosition(SwingConstants.LEFT); bLabel.setFont(new java.awt.Font("Dialog", 1, 16)); bLabel.setForeground(AppColors.B); - bLabel.setText("B"); + bLabel.setText(AppStrings.GEOM_LABEL_B); bLabel.setPreferredSize(new Dimension(20, 20)); aScrollPane.setBorder(BorderFactory.createLoweredBevelBorder()); diff --git a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/model/LayerList.java b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/model/LayerList.java index ecf525e61e..5de2ccf584 100644 --- a/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/model/LayerList.java +++ b/modules/app/src/main/java/org/locationtech/jtstest/testbuilder/model/LayerList.java @@ -19,6 +19,7 @@ import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jtstest.testbuilder.AppStrings; import org.locationtech.jtstest.testbuilder.geom.ComponentLocater; import org.locationtech.jtstest.testbuilder.geom.GeometryLocation; import org.locationtech.jtstest.testbuilder.geom.SegmentExtracter; @@ -51,9 +52,9 @@ public LayerList() } void initFixed() { - layers.add(new Layer("A")); - layers.add(new Layer("B")); - layers.add(new Layer("Result")); + layers.add(new Layer(AppStrings.GEOM_LABEL_A)); + layers.add(new Layer(AppStrings.GEOM_LABEL_B)); + layers.add(new Layer(AppStrings.GEOM_LABEL_RESULT)); } public int size() { return layers.size(); }