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.sheets;
18  
19  import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseCashInfo;
21  import io.github.tonywasher.joceanus.moneywise.data.basic.MoneyWiseDataSet;
22  import io.github.tonywasher.joceanus.prometheus.data.PrometheusDataValues;
23  import io.github.tonywasher.joceanus.prometheus.sheets.PrometheusSheetDataInfo;
24  
25  /**
26   * SheetDataInfo extension for CashInfo.
27   *
28   * @author Tony Washer
29   */
30  public final class MoneyWiseSheetCashInfo
31          extends PrometheusSheetDataInfo<MoneyWiseCashInfo> {
32      /**
33       * NamedArea for CashInfo.
34       */
35      private static final String AREA_CASHINFO = MoneyWiseCashInfo.LIST_NAME;
36  
37      /**
38       * Constructor for loading a spreadsheet.
39       *
40       * @param pReader the spreadsheet reader
41       */
42      MoneyWiseSheetCashInfo(final MoneyWiseReader pReader) {
43          /* Call super-constructor */
44          super(pReader, AREA_CASHINFO);
45  
46          /* Access the InfoType list */
47          final MoneyWiseDataSet myData = (MoneyWiseDataSet) pReader.getData();
48          setDataList(myData.getCashInfo());
49      }
50  
51      /**
52       * Constructor for creating a spreadsheet.
53       *
54       * @param pWriter the spreadsheet writer
55       */
56      MoneyWiseSheetCashInfo(final MoneyWiseWriter pWriter) {
57          /* Call super-constructor */
58          super(pWriter, AREA_CASHINFO);
59  
60          /* Access the InfoType list */
61          final MoneyWiseDataSet myData = (MoneyWiseDataSet) pWriter.getData();
62          setDataList(myData.getCashInfo());
63      }
64  
65      @Override
66      public PrometheusDataValues loadSecureValues() throws OceanusException {
67          /* Build data values */
68          return getRowValues(MoneyWiseCashInfo.OBJECT_NAME);
69      }
70  }