001     
002    /*****************************************************************************
003    
004        jBudget.
005        Copyright (C) 2006  Dmitri Petrov
006    
007        This program is free software: you can redistribute it and/or modify
008        it under the terms of the GNU General Public License as published by
009        the Free Software Foundation, either version 3 of the License, or
010        (at your option) any later version.
011    
012        This program is distributed in the hope that it will be useful,
013        but WITHOUT ANY WARRANTY; without even the implied warranty of
014        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015        GNU General Public License for more details.
016    
017        You should have received a copy of the GNU General Public License
018        along with this program.  If not, see <http://www.gnu.org/licenses/>.
019     
020    /*****************************************************************************
021    
022    /*
023     * TransactionListPanel.java
024     *
025     * Created on July 11, 2006, 9:49 AM
026     */
027    
028    package org.jbudget.gui.trans;
029    
030    import org.jbudget.Core.Transaction;
031    import org.jbudget.io.DataManager;
032    
033    /**
034     *
035     * @author petrov
036     */
037    public class AllocationListPanel extends TransactionListPanelBase
038    {
039    
040        /** Creates a new instance of TransactionListPanel */
041        public AllocationListPanel()
042        {
043            super();
044            itemName = "Allocation";
045        }
046    
047        protected TransactionListModelBase createTableModel()
048        {
049            return new AllocationsListModel();
050        }
051    
052        protected TransactionCellEditor createCellEditor()
053        {
054            return new TransactionCellEditor(TransactionEditor.AllocationMode);
055        }
056    
057        protected TransactionRenderer createCellRenderer()
058        {
059            return new TransactionRenderer();
060        }
061    
062        /** Removes allocation or allocation from a corresponding object
063         */
064        public void removeTransaction(Transaction allocation)
065        {
066            DataManager.getInstance().removeAllocation(allocation);
067        }
068    
069        /** Adds allocation to the corresponding date structures.
070         */
071        public void addTransaction(Transaction allocation)
072        {
073            DataManager.getInstance().addAllocation(allocation);
074        }
075    
076        /** Sets the title for the transaction/allocation dialog */
077        public String getDialogTitle()
078        {
079            return "New Allocation";
080        }
081    }