@@ -89,6 +89,8 @@ public class DimensionalityReductionView extends JFrame
8989
9090 private final JRadioButton tsneRadioButton ;
9191
92+ private final JRadioButton pcaRadioButton ;
93+
9294 private final JCheckBox standardizeFeaturesCheckBox ;
9395
9496 private final JSpinner numberOfDimensionsInput ;
@@ -133,6 +135,7 @@ public DimensionalityReductionView( final Model model, final Context context )
133135
134136 umapRadioButton = new JRadioButton ( "UMAP" );
135137 tsneRadioButton = new JRadioButton ( "t-SNE" );
138+ pcaRadioButton = new JRadioButton ( "PCA" );
136139
137140 // Common settings
138141 standardizeFeaturesCheckBox = new JCheckBox ( "Standardize features" );
@@ -166,6 +169,7 @@ private void initSettings()
166169 DimensionalityReductionAlgorithm algorithm = controller .getAlgorithm ();
167170 umapRadioButton .setSelected ( algorithm == DimensionalityReductionAlgorithm .UMAP );
168171 tsneRadioButton .setSelected ( algorithm == DimensionalityReductionAlgorithm .TSNE );
172+ pcaRadioButton .setSelected ( algorithm == DimensionalityReductionAlgorithm .PCA );
169173 CommonSettings settings = controller .getCommonSettings ();
170174 UmapSettings umapSettings = controller .getUmapSettings ();
171175 TSneSettings tSneSettings = controller .getTSneSettings ();
@@ -192,10 +196,12 @@ private void initBehavior()
192196
193197 umapRadioButton .addActionListener ( e -> updateAlgorithmSettings () );
194198 tsneRadioButton .addActionListener ( e -> updateAlgorithmSettings () );
199+ pcaRadioButton .addActionListener ( e -> updateAlgorithmSettings () );
195200
196201 ButtonGroup algorithmGroup = new ButtonGroup ();
197202 algorithmGroup .add ( umapRadioButton );
198203 algorithmGroup .add ( tsneRadioButton );
204+ algorithmGroup .add ( pcaRadioButton );
199205
200206 CommonSettings commonSettings = controller .getCommonSettings ();
201207 UmapSettings umapSettings = controller .getUmapSettings ();
@@ -224,12 +230,13 @@ private void initLayout()
224230 {
225231 add ( canvas , BorderLayout .CENTER );
226232
227- canvas .add ( new JLabel ( "Graph type:" ), "split 3 " );
233+ canvas .add ( new JLabel ( "Graph type:" ), "split 4 " );
228234 canvas .add ( modelGraphRadioButton );
229235 canvas .add ( branchGraphRadioButton , "wrap" );
230- canvas .add ( new JLabel ( "Algorithm:" ), "split 3 " );
236+ canvas .add ( new JLabel ( "Algorithm:" ), "split 4 " );
231237 canvas .add ( umapRadioButton );
232- canvas .add ( tsneRadioButton , "wrap" );
238+ canvas .add ( tsneRadioButton );
239+ canvas .add ( pcaRadioButton , "wrap" );
233240 canvas .add ( standardizeFeaturesCheckBox , "wrap" );
234241 canvas .add ( new JLabel ( "Number of dimensions:" ), SPLIT_2 );
235242 canvas .add ( numberOfDimensionsInput , WMIN_35_WRAP );
@@ -280,8 +287,10 @@ private void updateAlgorithmSettings()
280287 DimensionalityReductionAlgorithm algorithm ;
281288 if ( umapRadioButton .isSelected () )
282289 algorithm = DimensionalityReductionAlgorithm .UMAP ;
283- else
290+ else if ( tsneRadioButton . isSelected () )
284291 algorithm = DimensionalityReductionAlgorithm .TSNE ;
292+ else
293+ algorithm = DimensionalityReductionAlgorithm .PCA ;
285294 controller .setAlgorithm ( algorithm );
286295 addAlgorithmSpecificSettings ( algorithm );
287296 revalidate ();
@@ -305,6 +314,10 @@ private void addAlgorithmSpecificSettings( final DimensionalityReductionAlgorith
305314 algorithmSpecificSettingsPanel .add ( new JLabel ( "Maximum number of iterations:" ), SPLIT_2 );
306315 algorithmSpecificSettingsPanel .add ( maxIterationsInput , WMIN_35_WRAP );
307316 break ;
317+ case PCA :
318+ algorithmSpecificSettingsPanel .add ( new JLabel ( "" ), "wrap" );
319+ algorithmSpecificSettingsPanel .add ( new JLabel ( "" ), "wrap" );
320+ break ;
308321 default :
309322 break ;
310323 }
0 commit comments