| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
package org.homeunix.thecave.buddi.view.menu.menus; |
| 5 | |
|
| 6 | |
import org.homeunix.thecave.buddi.i18n.keys.MenuKeys; |
| 7 | |
import org.homeunix.thecave.buddi.model.prefs.PrefsModel; |
| 8 | |
import org.homeunix.thecave.buddi.view.MainFrame; |
| 9 | |
import org.homeunix.thecave.buddi.view.TransactionFrame; |
| 10 | |
import org.homeunix.thecave.buddi.view.menu.items.EditClearAndAdvanceTransaction; |
| 11 | |
import org.homeunix.thecave.buddi.view.menu.items.EditClearTransaction; |
| 12 | |
import org.homeunix.thecave.buddi.view.menu.items.EditCopyBudgetCategoryValuesToNext; |
| 13 | |
import org.homeunix.thecave.buddi.view.menu.items.EditCopyBudgetCategoryValuesToPrevious; |
| 14 | |
import org.homeunix.thecave.buddi.view.menu.items.EditDeleteAccount; |
| 15 | |
import org.homeunix.thecave.buddi.view.menu.items.EditDeleteBudgetCategory; |
| 16 | |
import org.homeunix.thecave.buddi.view.menu.items.EditDeleteTransaction; |
| 17 | |
import org.homeunix.thecave.buddi.view.menu.items.EditEditAccountTypes; |
| 18 | |
import org.homeunix.thecave.buddi.view.menu.items.EditEditAllTransactions; |
| 19 | |
import org.homeunix.thecave.buddi.view.menu.items.EditEditScheduledTransactions; |
| 20 | |
import org.homeunix.thecave.buddi.view.menu.items.EditEditTransactions; |
| 21 | |
import org.homeunix.thecave.buddi.view.menu.items.EditModifyAccount; |
| 22 | |
import org.homeunix.thecave.buddi.view.menu.items.EditModifyBudgetCategory; |
| 23 | |
import org.homeunix.thecave.buddi.view.menu.items.EditNewAccount; |
| 24 | |
import org.homeunix.thecave.buddi.view.menu.items.EditNewBudgetCategory; |
| 25 | |
import org.homeunix.thecave.buddi.view.menu.items.EditPreferences; |
| 26 | |
import org.homeunix.thecave.buddi.view.menu.items.EditReconcileAndAdvanceTransaction; |
| 27 | |
import org.homeunix.thecave.buddi.view.menu.items.EditRecordTransaction; |
| 28 | |
import org.homeunix.thecave.buddi.view.menu.items.EditUndeleteAccount; |
| 29 | |
import org.homeunix.thecave.buddi.view.menu.items.EditUndeleteBudgetCategory; |
| 30 | |
|
| 31 | |
import ca.digitalcave.moss.common.OperatingSystemUtil; |
| 32 | |
import ca.digitalcave.moss.swing.MossFrame; |
| 33 | |
import ca.digitalcave.moss.swing.MossMenu; |
| 34 | |
|
| 35 | |
public class EditMenu extends MossMenu { |
| 36 | |
public static final long serialVersionUID = 0; |
| 37 | |
|
| 38 | |
public EditMenu(MossFrame frame) { |
| 39 | 5975 | super(frame, PrefsModel.getInstance().getTranslator().get(MenuKeys.MENU_EDIT)); |
| 40 | |
|
| 41 | 5975 | } |
| 42 | |
|
| 43 | |
@Override |
| 44 | |
public void updateMenus() { |
| 45 | 42468 | this.removeAll(); |
| 46 | |
|
| 47 | 42468 | if (getFrame() instanceof MainFrame){ |
| 48 | 30480 | this.setEnabled(true); |
| 49 | 30480 | MainFrame frame = (MainFrame) getFrame(); |
| 50 | |
|
| 51 | 30480 | if (frame.isMyAccountsTabSelected()){ |
| 52 | 29974 | this.add(new EditNewAccount(frame)); |
| 53 | 29974 | this.add(new EditModifyAccount(frame)); |
| 54 | 29974 | this.add(new EditDeleteAccount(frame)); |
| 55 | 29974 | this.add(new EditUndeleteAccount(frame)); |
| 56 | 29974 | this.addSeparator(); |
| 57 | 29974 | this.add(new EditEditAccountTypes(frame)); |
| 58 | 29974 | this.addSeparator(); |
| 59 | 29974 | this.add(new EditEditTransactions(frame)); |
| 60 | 29974 | this.add(new EditEditAllTransactions(frame)); |
| 61 | |
} |
| 62 | 506 | else if (frame.isMyBudgetTabSelected()){ |
| 63 | 256 | this.add(new EditNewBudgetCategory(frame)); |
| 64 | 256 | this.add(new EditModifyBudgetCategory(frame)); |
| 65 | 256 | this.add(new EditDeleteBudgetCategory(frame)); |
| 66 | 256 | this.add(new EditUndeleteBudgetCategory(frame)); |
| 67 | 256 | this.addSeparator(); |
| 68 | 256 | this.add(new EditCopyBudgetCategoryValuesToPrevious(frame)); |
| 69 | 256 | this.add(new EditCopyBudgetCategoryValuesToNext(frame)); |
| 70 | 256 | this.addSeparator(); |
| 71 | 256 | this.add(new EditEditTransactions(frame)); |
| 72 | 256 | this.add(new EditEditAllTransactions(frame)); |
| 73 | |
} |
| 74 | |
|
| 75 | 30480 | this.add(new EditEditScheduledTransactions(frame)); |
| 76 | |
|
| 77 | 30480 | if (!OperatingSystemUtil.isMac()){ |
| 78 | 30480 | this.addSeparator(); |
| 79 | 30480 | this.add(new EditPreferences(frame)); |
| 80 | |
} |
| 81 | 30480 | } |
| 82 | 11988 | else if (getFrame() instanceof TransactionFrame){ |
| 83 | 0 | this.setEnabled(true); |
| 84 | 0 | TransactionFrame frame = (TransactionFrame) getFrame(); |
| 85 | 0 | this.add(new EditRecordTransaction(frame)); |
| 86 | 0 | this.add(new EditClearTransaction(frame)); |
| 87 | 0 | this.add(new EditDeleteTransaction(frame)); |
| 88 | 0 | if (PrefsModel.getInstance().isShowReconciled() || PrefsModel.getInstance().isShowCleared()) |
| 89 | 0 | this.addSeparator(); |
| 90 | 0 | if (PrefsModel.getInstance().isShowReconciled()) |
| 91 | 0 | this.add(new EditReconcileAndAdvanceTransaction(frame)); |
| 92 | 0 | if (PrefsModel.getInstance().isShowCleared()) |
| 93 | 0 | this.add(new EditClearAndAdvanceTransaction(frame)); |
| 94 | 0 | if (!OperatingSystemUtil.isMac()){ |
| 95 | 0 | this.addSeparator(); |
| 96 | 0 | this.add(new EditPreferences(frame)); |
| 97 | |
} |
| 98 | 0 | } |
| 99 | |
else { |
| 100 | 11988 | this.setVisible(false); |
| 101 | |
} |
| 102 | |
|
| 103 | 42468 | super.updateMenus(); |
| 104 | 42468 | } |
| 105 | |
} |