| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
package org.homeunix.thecave.buddi.view.menu.items; |
| 5 | |
|
| 6 | |
import java.awt.event.ActionEvent; |
| 7 | |
|
| 8 | |
import org.homeunix.thecave.buddi.i18n.keys.MenuKeys; |
| 9 | |
import org.homeunix.thecave.buddi.model.BudgetCategory; |
| 10 | |
import org.homeunix.thecave.buddi.model.Document; |
| 11 | |
import org.homeunix.thecave.buddi.model.prefs.PrefsModel; |
| 12 | |
import org.homeunix.thecave.buddi.view.MainFrame; |
| 13 | |
|
| 14 | |
import ca.digitalcave.moss.swing.MossMenuItem; |
| 15 | |
|
| 16 | |
public class ViewUnrollAllBudgetCategories extends MossMenuItem{ |
| 17 | |
public static final long serialVersionUID = 0; |
| 18 | |
|
| 19 | |
public ViewUnrollAllBudgetCategories(MainFrame frame) { |
| 20 | 256 | super(frame, PrefsModel.getInstance().getTranslator().get(MenuKeys.MENU_EDIT_UNROLL_ALL_BUDGET_CATEGORIES)); |
| 21 | 256 | } |
| 22 | |
|
| 23 | |
@Override |
| 24 | |
public void actionPerformed(ActionEvent e) { |
| 25 | 0 | if (!(getFrame() instanceof MainFrame)) |
| 26 | 0 | throw new RuntimeException("Calling frame not instance of BudgetFrame"); |
| 27 | |
|
| 28 | 0 | for (BudgetCategory bc : ((Document) ((MainFrame) getFrame()).getDocument()).getBudgetCategories()) { |
| 29 | 0 | bc.setExpanded(true); |
| 30 | |
} |
| 31 | |
|
| 32 | 0 | ((MainFrame) getFrame()).updateContent(); |
| 33 | 0 | } |
| 34 | |
} |