View Javadoc
1   /*
2    * MoneyWise: Finance Application
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.moneywise.ui.panel;
18  
19  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20  import io.github.tonywasher.joceanus.oceanus.event.OceanusEvent;
21  import io.github.tonywasher.joceanus.oceanus.event.OceanusEventManager;
22  import io.github.tonywasher.joceanus.oceanus.event.OceanusEventRegistrar;
23  import io.github.tonywasher.joceanus.oceanus.event.OceanusEventRegistrar.OceanusEventProvider;
24  import io.github.tonywasher.joceanus.oceanus.profile.OceanusProfile;
25  import io.github.tonywasher.joceanus.metis.ui.MetisErrorPanel;
26  import io.github.tonywasher.joceanus.metis.viewer.MetisViewerEntry;
27  import io.github.tonywasher.joceanus.metis.viewer.MetisViewerManager;
28  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseAssetBase;
29  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseBasicDataType;
30  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseCash;
31  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDeposit;
32  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseLoan;
33  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWisePayee;
34  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWisePortfolio;
35  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseSecurity;
36  import io.github.tonywasher.joceanus.moneywise.ui.MoneyWiseGoToId;
37  import io.github.tonywasher.joceanus.moneywise.ui.MoneyWiseUIResource;
38  import io.github.tonywasher.joceanus.moneywise.views.MoneyWiseView;
39  import io.github.tonywasher.joceanus.prometheus.ui.PrometheusActionButtons;
40  import io.github.tonywasher.joceanus.prometheus.ui.PrometheusGoToEvent;
41  import io.github.tonywasher.joceanus.prometheus.views.PrometheusDataEvent;
42  import io.github.tonywasher.joceanus.prometheus.views.PrometheusEditSet;
43  import io.github.tonywasher.joceanus.prometheus.views.PrometheusUIEvent;
44  import io.github.tonywasher.joceanus.prometheus.views.PrometheusViewerEntryId;
45  import io.github.tonywasher.joceanus.tethys.api.base.TethysUIComponent;
46  import io.github.tonywasher.joceanus.tethys.api.base.TethysUIEvent;
47  import io.github.tonywasher.joceanus.tethys.api.button.TethysUIButtonFactory;
48  import io.github.tonywasher.joceanus.tethys.api.button.TethysUIScrollButtonManager;
49  import io.github.tonywasher.joceanus.tethys.api.control.TethysUIControlFactory;
50  import io.github.tonywasher.joceanus.tethys.api.control.TethysUILabel;
51  import io.github.tonywasher.joceanus.tethys.api.factory.TethysUIFactory;
52  import io.github.tonywasher.joceanus.tethys.api.menu.TethysUIScrollMenu;
53  import io.github.tonywasher.joceanus.tethys.api.pane.TethysUIBorderPaneManager;
54  import io.github.tonywasher.joceanus.tethys.api.pane.TethysUIBoxPaneManager;
55  import io.github.tonywasher.joceanus.tethys.api.pane.TethysUICardPaneManager;
56  import io.github.tonywasher.joceanus.tethys.api.pane.TethysUIPaneFactory;
57  
58  /**
59   * Top-level panel for Accounts.
60   */
61  public class MoneyWiseAccountPanel
62          implements OceanusEventProvider<PrometheusDataEvent>, TethysUIComponent {
63      /**
64       * Strut width.
65       */
66      protected static final int STRUT_WIDTH = 5;
67  
68      /**
69       * Text for DataEntry Title.
70       */
71      private static final String NLS_DATAENTRY = MoneyWiseUIResource.ASSET_DATAENTRY.getValue();
72  
73      /**
74       * Text for Selection Title.
75       */
76      private static final String NLS_SELECT = MoneyWiseUIResource.ASSET_TITLE_SELECT.getValue();
77  
78      /**
79       * Text for Selection Prompt.
80       */
81      private static final String NLS_DATA = MoneyWiseUIResource.ASSET_PROMPT_SELECT.getValue();
82  
83      /**
84       * The Event Manager.
85       */
86      private final OceanusEventManager<PrometheusDataEvent> theEventManager;
87  
88      /**
89       * The Data View.
90       */
91      private final MoneyWiseView theView;
92  
93      /**
94       * The Panel.
95       */
96      private final TethysUIBorderPaneManager thePanel;
97  
98      /**
99       * The select button.
100      */
101     private final TethysUIScrollButtonManager<PanelName> theSelectButton;
102 
103     /**
104      * The card panel.
105      */
106     private final TethysUICardPaneManager<TethysUIComponent> theCardPanel;
107 
108     /**
109      * The select panel.
110      */
111     private final TethysUIBorderPaneManager theSelectPanel;
112 
113     /**
114      * The filter card panel.
115      */
116     private final TethysUICardPaneManager<TethysUIComponent> theFilterCardPanel;
117 
118     /**
119      * Deposit Table.
120      */
121     private final MoneyWiseDepositTable theDepositTable;
122 
123     /**
124      * Cash Table.
125      */
126     private final MoneyWiseCashTable theCashTable;
127 
128     /**
129      * Loan Table.
130      */
131     private final MoneyWiseLoanTable theLoanTable;
132 
133     /**
134      * Portfolio Table.
135      */
136     private final MoneyWisePortfolioTable thePortfolioTable;
137 
138     /**
139      * Security Table.
140      */
141     private final MoneyWiseSecurityTable theSecurityTable;
142 
143     /**
144      * Payee Table.
145      */
146     private final MoneyWisePayeeTable thePayeeTable;
147 
148     /**
149      * The UpdateSet.
150      */
151     private final PrometheusEditSet theEditSet;
152 
153     /**
154      * The data entry.
155      */
156     private final MetisViewerEntry theViewerEntry;
157 
158     /**
159      * The error panel.
160      */
161     private final MetisErrorPanel theError;
162 
163     /**
164      * The action buttons panel.
165      */
166     private final PrometheusActionButtons theActionButtons;
167 
168     /**
169      * Are we refreshing?
170      */
171     private boolean isRefreshing;
172 
173     /**
174      * The active panel.
175      */
176     private PanelName theActive;
177 
178     /**
179      * Constructor.
180      *
181      * @param pView the data view
182      */
183     MoneyWiseAccountPanel(final MoneyWiseView pView) {
184         /* Store details */
185         theView = pView;
186 
187         /* Access GUI Factory */
188         final TethysUIFactory<?> myFactory = pView.getGuiFactory();
189         final MetisViewerManager myViewer = pView.getViewerManager();
190 
191         /* Create the event manager */
192         theEventManager = new OceanusEventManager<>();
193 
194         /* Build the Update set */
195         theEditSet = new PrometheusEditSet(pView);
196 
197         /* Create the Panel */
198         final TethysUIPaneFactory myPanes = myFactory.paneFactory();
199         thePanel = myPanes.newBorderPane();
200 
201         /* Create the top level viewer entry for this view */
202         final MetisViewerEntry mySection = pView.getViewerEntry(PrometheusViewerEntryId.MAINTENANCE);
203         theViewerEntry = myViewer.newEntry(mySection, NLS_DATAENTRY);
204         theViewerEntry.setTreeObject(theEditSet);
205 
206         /* Create the error panel */
207         theError = pView.getToolkit().getToolkit().newErrorPanel(theViewerEntry);
208 
209         /* Create the action buttons panel */
210         theActionButtons = new PrometheusActionButtons(myFactory, theEditSet);
211 
212         /* Create the table panels */
213         thePayeeTable = new MoneyWisePayeeTable(pView, theEditSet, theError);
214         theSecurityTable = new MoneyWiseSecurityTable(pView, theEditSet, theError);
215         theDepositTable = new MoneyWiseDepositTable(pView, theEditSet, theError);
216         theCashTable = new MoneyWiseCashTable(pView, theEditSet, theError);
217         theLoanTable = new MoneyWiseLoanTable(pView, theEditSet, theError);
218         thePortfolioTable = new MoneyWisePortfolioTable(pView, theEditSet, theError);
219 
220         /* Create selection button and label */
221         final TethysUIControlFactory myControls = myFactory.controlFactory();
222         final TethysUIButtonFactory<?> myButtons = myFactory.buttonFactory();
223         final TethysUILabel myLabel = myControls.newLabel(NLS_DATA);
224         theSelectButton = myButtons.newScrollButton(PanelName.class);
225         buildSelectMenu();
226 
227         /* Create the card panel */
228         theCardPanel = myPanes.newCardPane();
229 
230         /* Add to the card panels */
231         theCardPanel.addCard(PanelName.DEPOSITS.toString(), theDepositTable);
232         theCardPanel.addCard(PanelName.CASH.toString(), theCashTable);
233         theCardPanel.addCard(PanelName.LOANS.toString(), theLoanTable);
234         theCardPanel.addCard(PanelName.PORTFOLIOS.toString(), thePortfolioTable);
235         theCardPanel.addCard(PanelName.SECURITIES.toString(), theSecurityTable);
236         theCardPanel.addCard(PanelName.PAYEES.toString(), thePayeeTable);
237         theActive = PanelName.DEPOSITS;
238         theSelectButton.setFixedText(theActive.toString());
239 
240         /* Create the new card panel */
241         theFilterCardPanel = myPanes.newCardPane();
242 
243         /* Build the new card panel */
244         theFilterCardPanel.addCard(PanelName.DEPOSITS.toString(), theDepositTable.getFilterPanel());
245         theFilterCardPanel.addCard(PanelName.CASH.toString(), theCashTable.getFilterPanel());
246         theFilterCardPanel.addCard(PanelName.LOANS.toString(), theLoanTable.getFilterPanel());
247         theFilterCardPanel.addCard(PanelName.PORTFOLIOS.toString(), thePortfolioTable.getFilterPanel());
248         theFilterCardPanel.addCard(PanelName.SECURITIES.toString(), theSecurityTable.getFilterPanel());
249         theFilterCardPanel.addCard(PanelName.PAYEES.toString(), thePayeeTable.getFilterPanel());
250 
251         /* Create the select prompt */
252         final TethysUIBoxPaneManager mySelect = myPanes.newHBoxPane();
253         mySelect.addNode(myLabel);
254         mySelect.addNode(theSelectButton);
255 
256         /* Create the selection panel */
257         theSelectPanel = myPanes.newBorderPane();
258         theSelectPanel.setBorderTitle(NLS_SELECT);
259         theSelectPanel.setWest(mySelect);
260         theSelectPanel.setCentre(theFilterCardPanel);
261 
262         /* Create the header panel */
263         final TethysUIBorderPaneManager myHeader = myPanes.newBorderPane();
264         myHeader.setCentre(theSelectPanel);
265         myHeader.setNorth(theError);
266         myHeader.setEast(theActionButtons);
267 
268         /* Now define the panel */
269         thePanel.setNorth(myHeader);
270         thePanel.setCentre(theCardPanel);
271 
272         /* Hide the action buttons initially */
273         theActionButtons.setVisible(false);
274 
275         /* Create the listeners */
276         theSelectButton.getEventRegistrar().addEventListener(TethysUIEvent.NEWVALUE, e -> handleSelection());
277         theError.getEventRegistrar().addEventListener(e -> handleErrorPane());
278         theActionButtons.getEventRegistrar().addEventListener(this::handleActionButtons);
279         setChildListeners(theDepositTable.getEventRegistrar());
280         setChildListeners(theCashTable.getEventRegistrar());
281         setChildListeners(theLoanTable.getEventRegistrar());
282         setChildListeners(thePayeeTable.getEventRegistrar());
283         setChildListeners(thePortfolioTable.getEventRegistrar());
284         setChildListeners(theSecurityTable.getEventRegistrar());
285     }
286 
287     @Override
288     public TethysUIComponent getUnderlying() {
289         return thePanel;
290     }
291 
292     @Override
293     public OceanusEventRegistrar<PrometheusDataEvent> getEventRegistrar() {
294         return theEventManager.getEventRegistrar();
295     }
296 
297     /**
298      * setChildListeners.
299      *
300      * @param pRegistrar the registrar
301      */
302     private void setChildListeners(final OceanusEventRegistrar<PrometheusDataEvent> pRegistrar) {
303         pRegistrar.addEventListener(PrometheusDataEvent.ADJUSTVISIBILITY, e -> {
304             if (!isRefreshing) {
305                 setVisibility();
306             }
307         });
308         pRegistrar.addEventListener(PrometheusDataEvent.GOTOWINDOW, this::handleGoToEvent);
309     }
310 
311     @Override
312     public void setEnabled(final boolean pEnabled) {
313         theSelectButton.setEnabled(pEnabled);
314         theCardPanel.setEnabled(pEnabled);
315         theFilterCardPanel.setEnabled(pEnabled);
316     }
317 
318     @Override
319     public void setVisible(final boolean pVisible) {
320         thePanel.setVisible(pVisible);
321     }
322 
323     /**
324      * Build select menu.
325      */
326     private void buildSelectMenu() {
327         /* Create builder */
328         final TethysUIScrollMenu<PanelName> myMenu = theSelectButton.getMenu();
329 
330         /* Loop through the panels */
331         for (PanelName myPanel : PanelName.values()) {
332             /* Create a new JMenuItem for the panel */
333             myMenu.addItem(myPanel);
334         }
335     }
336 
337     /**
338      * Show locked accounts.
339      *
340      * @param pShow true/false
341      */
342     public void showLocked(final boolean pShow) {
343         /* Adjust lock settings */
344         thePayeeTable.setShowAll(pShow);
345         theSecurityTable.setShowAll(pShow);
346         theDepositTable.setShowAll(pShow);
347         theCashTable.setShowAll(pShow);
348         theLoanTable.setShowAll(pShow);
349         thePortfolioTable.setShowAll(pShow);
350     }
351 
352     /**
353      * Cancel Editing of underlying tables.
354      */
355     private void cancelEditing() {
356         /* Cancel editing */
357         thePayeeTable.cancelEditing();
358         theSecurityTable.cancelEditing();
359         theDepositTable.cancelEditing();
360         theCashTable.cancelEditing();
361         theLoanTable.cancelEditing();
362         thePortfolioTable.cancelEditing();
363     }
364 
365     /**
366      * Refresh data.
367      *
368      * @throws OceanusException on error
369      */
370     public void refreshData() throws OceanusException {
371         /* Obtain the active profile */
372         OceanusProfile myTask = theView.getActiveTask();
373         myTask = myTask.startTask("Accounts");
374 
375         /* Note that we are refreshing */
376         isRefreshing = true;
377         theEditSet.setDataSet(theView.getData());
378 
379         /* Must be done in dataType order to ensure that links are resolved correctly */
380         thePayeeTable.refreshData();
381         theSecurityTable.refreshData();
382         theDepositTable.refreshData();
383         theCashTable.refreshData();
384         theLoanTable.refreshData();
385         thePortfolioTable.refreshData();
386 
387         /* Clear refreshing flag */
388         isRefreshing = false;
389         setVisibility();
390 
391         /* Touch the updateSet */
392         theViewerEntry.setTreeObject(theEditSet);
393 
394         /* Complete the task */
395         myTask.end();
396     }
397 
398     /**
399      * Determine Focus.
400      */
401     public void determineFocus() {
402         /* Switch on active component */
403         switch (theActive) {
404             case DEPOSITS:
405                 theDepositTable.determineFocus(theViewerEntry);
406                 break;
407             case CASH:
408                 theCashTable.determineFocus(theViewerEntry);
409                 break;
410             case LOANS:
411                 theLoanTable.determineFocus(theViewerEntry);
412                 break;
413             case PORTFOLIOS:
414                 thePortfolioTable.determineFocus(theViewerEntry);
415                 break;
416             case SECURITIES:
417                 theSecurityTable.determineFocus(theViewerEntry);
418                 break;
419             case PAYEES:
420                 thePayeeTable.determineFocus(theViewerEntry);
421                 break;
422             default:
423                 break;
424         }
425     }
426 
427     /**
428      * Does this panel have updates?
429      *
430      * @return true/false
431      */
432     public boolean hasUpdates() {
433         /* Determine whether we have updates */
434         boolean hasUpdates = theDepositTable.hasUpdates();
435         if (!hasUpdates) {
436             hasUpdates = theCashTable.hasUpdates();
437         }
438         if (!hasUpdates) {
439             hasUpdates = theLoanTable.hasUpdates();
440         }
441         if (!hasUpdates) {
442             hasUpdates = thePortfolioTable.hasUpdates();
443         }
444         if (!hasUpdates) {
445             hasUpdates = theSecurityTable.hasUpdates();
446         }
447         if (!hasUpdates) {
448             hasUpdates = thePayeeTable.hasUpdates();
449         }
450 
451         /* Return to caller */
452         return hasUpdates;
453     }
454 
455     /**
456      * Has this set of panels got the session focus?
457      *
458      * @return true/false
459      */
460     public boolean hasSession() {
461         /* Determine whether we have session focus */
462         boolean hasSession = theDepositTable.hasSession();
463         if (!hasSession) {
464             hasSession = theCashTable.hasSession();
465         }
466         if (!hasSession) {
467             hasSession = theLoanTable.hasSession();
468         }
469         if (!hasSession) {
470             hasSession = thePortfolioTable.hasSession();
471         }
472         if (!hasSession) {
473             hasSession = theSecurityTable.hasSession();
474         }
475         if (!hasSession) {
476             hasSession = thePayeeTable.hasSession();
477         }
478 
479         /* Return to caller */
480         return hasSession;
481     }
482 
483     /**
484      * Does this panel have errors?
485      *
486      * @return true/false
487      */
488     public boolean hasErrors() {
489         /* Determine whether we have errors */
490         boolean hasErrors = theDepositTable.hasErrors();
491         if (!hasErrors) {
492             hasErrors = theCashTable.hasErrors();
493         }
494         if (!hasErrors) {
495             hasErrors = theLoanTable.hasErrors();
496         }
497         if (!hasErrors) {
498             hasErrors = thePortfolioTable.hasErrors();
499         }
500         if (!hasErrors) {
501             hasErrors = theSecurityTable.hasErrors();
502         }
503         if (!hasErrors) {
504             hasErrors = thePayeeTable.hasErrors();
505         }
506 
507         /* Return to caller */
508         return hasErrors;
509     }
510 
511     /**
512      * Does this panel have item editing occurring?
513      *
514      * @return true/false
515      */
516     public boolean isItemEditing() {
517         /* Determine whether we have item editing */
518         boolean isEditing = theDepositTable.isItemEditing();
519         if (!isEditing) {
520             isEditing = theCashTable.isItemEditing();
521         }
522         if (!isEditing) {
523             isEditing = theLoanTable.isItemEditing();
524         }
525         if (!isEditing) {
526             isEditing = thePortfolioTable.isItemEditing();
527         }
528         if (!isEditing) {
529             isEditing = theSecurityTable.isItemEditing();
530         }
531         if (!isEditing) {
532             isEditing = thePayeeTable.isItemEditing();
533         }
534 
535         /* Return to caller */
536         return isEditing;
537     }
538 
539     /**
540      * Select account.
541      *
542      * @param pAccount the account to select
543      */
544     public void selectAccount(final MoneyWiseAssetBase pAccount) {
545         /* Determine which panel to show */
546         if (pAccount instanceof MoneyWiseDeposit myDeposit) {
547             theDepositTable.selectDeposit(myDeposit);
548             showPanel(PanelName.DEPOSITS);
549         } else if (pAccount instanceof MoneyWiseCash myCash) {
550             theCashTable.selectCash(myCash);
551             showPanel(PanelName.CASH);
552         } else if (pAccount instanceof MoneyWiseLoan myLoan) {
553             theLoanTable.selectLoan(myLoan);
554             showPanel(PanelName.LOANS);
555         } else if (pAccount instanceof MoneyWisePortfolio myPortfolio) {
556             thePortfolioTable.selectPortfolio(myPortfolio);
557             showPanel(PanelName.PORTFOLIOS);
558         } else if (pAccount instanceof MoneyWiseSecurity mySecurity) {
559             theSecurityTable.selectSecurity(mySecurity);
560             showPanel(PanelName.SECURITIES);
561         } else if (pAccount instanceof MoneyWisePayee myPayee) {
562             thePayeeTable.selectPayee(myPayee);
563             showPanel(PanelName.PAYEES);
564         }
565     }
566 
567     /**
568      * Show panel.
569      *
570      * @param pName the panel name
571      */
572     private void showPanel(final PanelName pName) {
573         /* Obtain name of panel */
574         final String myName = pName.toString();
575 
576         /* Move correct card to front */
577         theCardPanel.selectCard(myName);
578         theFilterCardPanel.selectCard(myName);
579 
580         /* Note the active panel */
581         theActive = pName;
582         theSelectButton.setFixedText(myName);
583 
584         /* Determine the focus */
585         determineFocus();
586     }
587 
588     /**
589      * Set Visibility.
590      */
591     protected void setVisibility() {
592         /* Determine whether we have updates */
593         final boolean hasUpdates = hasUpdates();
594         final boolean isItemEditing = isItemEditing();
595 
596         /* Update the action buttons */
597         theActionButtons.setEnabled(true);
598         theActionButtons.setVisible(hasUpdates && !isItemEditing);
599 
600         /* Update the selection */
601         theSelectButton.setEnabled(!isItemEditing);
602         theFilterCardPanel.setEnabled(!isItemEditing);
603 
604         /* Alert listeners that there has been a change */
605         theEventManager.fireEvent(PrometheusDataEvent.ADJUSTVISIBILITY);
606     }
607 
608     /**
609      * handleErrorPane.
610      */
611     private void handleErrorPane() {
612         /* Determine whether we have an error */
613         final boolean isError = theError.hasError();
614 
615         /* Hide selection panel on error */
616         theSelectPanel.setVisible(!isError);
617 
618         /* Lock card panel */
619         theCardPanel.setEnabled(!isError);
620 
621         /* Lock Action Buttons */
622         theActionButtons.setEnabled(!isError);
623     }
624 
625     /**
626      * handleSelection.
627      */
628     private void handleSelection() {
629         /* Cancel any editing */
630         cancelEditing();
631 
632         /* Show selected panel */
633         showPanel(theSelectButton.getValue());
634     }
635 
636     /**
637      * handle Action Buttons.
638      *
639      * @param pEvent the event
640      */
641     private void handleActionButtons(final OceanusEvent<PrometheusUIEvent> pEvent) {
642         /* Cancel editing */
643         cancelEditing();
644 
645         /* Perform the command */
646         theEditSet.processCommand(pEvent.getEventId(), theError);
647     }
648 
649     /**
650      * handle GoTo Event.
651      *
652      * @param pEvent the event
653      */
654     private void handleGoToEvent(final OceanusEvent<PrometheusDataEvent> pEvent) {
655         /* Access details */
656         @SuppressWarnings("unchecked") final PrometheusGoToEvent<MoneyWiseGoToId> myEvent = pEvent.getDetails(PrometheusGoToEvent.class);
657 
658         /* Access event and obtain details */
659         switch (myEvent.getId()) {
660             /* Pass through the event */
661             case STATEMENT:
662             case CATEGORY:
663             case REGION:
664             case TAG:
665             case STATIC:
666                 theEventManager.cascadeEvent(pEvent);
667                 break;
668 
669             /* Access subPanels */
670             case ACCOUNT:
671                 selectAccount(myEvent.getDetails(MoneyWiseAssetBase.class));
672                 break;
673             default:
674                 break;
675         }
676     }
677 
678     /**
679      * Panel names.
680      */
681     private enum PanelName {
682         /**
683          * Deposits.
684          */
685         DEPOSITS(MoneyWiseBasicDataType.DEPOSIT),
686 
687         /**
688          * Cash.
689          */
690         CASH(MoneyWiseBasicDataType.CASH),
691 
692         /**
693          * Loans.
694          */
695         LOANS(MoneyWiseBasicDataType.LOAN),
696 
697         /**
698          * Portfolios.
699          */
700         PORTFOLIOS(MoneyWiseBasicDataType.PORTFOLIO),
701 
702         /**
703          * Securities.
704          */
705         SECURITIES(MoneyWiseBasicDataType.SECURITY),
706 
707         /**
708          * Payees.
709          */
710         PAYEES(MoneyWiseBasicDataType.PAYEE);
711 
712         /**
713          * The String name.
714          */
715         private String theName;
716 
717         /**
718          * Constructor.
719          *
720          * @param pDataType the dataType
721          */
722         PanelName(final MoneyWiseBasicDataType pDataType) {
723             theName = pDataType.getListName();
724         }
725 
726         @Override
727         public String toString() {
728             /* return the name */
729             return theName;
730         }
731     }
732 }
733